GammaWare  Head Version for release 0.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
adf/Macros/Deprecated/Load.C
Go to the documentation of this file.
1 {
2 /*
3  This ROOT script configures a ROOT session so that the GammaWare facilities can be used to work with Watchers.
4  Depending on the analysis, ancillaries could be added (see ANCILLARY_PART).
5  For this the path to includes and the additional libraries should be given
6 
7  Usage:
8  root Load.C
9 
10  O. Stézowski
11 */
12 
13  // to modify to Aclic compilation's options
14  // .L toto.C+[CompOpt] with CompOpt = "" or "+" or "+g"
15  const Char_t *CompOpt = "g";
16 
17 // ---> GammaWare PART /////////////////////////
18  printf("******************************************************************** \n") ;
19  printf(" Messages from Load.C \n") ;
20  printf("******************************************************************** \n") ;
21 
22  // to add to ROOT the Gw path to look for macros
23  TString tmp, macroPATH;
24 
25  macroPATH = gROOT->GetMacroPath(); tmp = Gw::Env::GetPath("MacrosPath");
26  if ( macroPATH.Contains(tmp.Data()) == false ) {
27  printf("- Add %s to the macros path \n",tmp.Data());
28  tmp += ":";
29  macroPATH.Prepend(tmp.Data()); gROOT->SetMacroPath(macroPATH.Data());
30  }
31 
32  // add GammaWare include path to ROOT for compilation
33  tmp = Gw::Env::GetPath("IncludePath"); printf("- Add %s to the include path \n",tmp.Data());
34  tmp.Prepend(" .include ");
35  gROOT->ProcessLine(tmp.Data());
36 
37  // load the different Gw libraries needed
38  gSystem->Load("libGWCORE");
39  gSystem->Load("libGWADF");
40  gSystem->Load("libGWADFE");
41  gSystem->Load("libEve");
42  gSystem->Load("libGWTOOLS");
43 
44  // compile and load the different watchers
45  tmp = "./MyWatchers" ; printf("- Add %s to the include path \n",tmp.Data());
46  tmp.Prepend(" .include ");
47  gROOT->ProcessLine(tmp.Data());
48  tmp = "./DefaultWatchers" ; printf("- Add %s to the include path \n",tmp.Data());
49  tmp.Prepend(" .include ");
50  gROOT->ProcessLine(tmp.Data());
51 
52  // setup not defined, take the default
53  if ( gSystem->AccessPathName("./SetupWatchers.C") ) { // does not exist
54  cout << "- Standard configuration (Default setup, SetupWatchers.C) installed " << endl;
55  gSystem->CopyFile("Macros/SetupWatchers.C","./SetupWatchers.C");
56  }
57  // Add personnal watchers in MyWatchers
58  if ( gSystem->AccessPathName("MyWatchers") ) { // does not exist
59  cout << "- Add personnal customisable watchers " << endl;
60  gSystem->mkdir("./MyWatchers");
61  gSystem->CopyFile("Macros/MyTree.h","MyWatchers/MyTree.h");
62  gSystem->CopyFile("Macros/MyTree.C","MyWatchers/MyTree.C");
63  }
64 
65  gSystem->Load("DefaultWatchers/libWATCHERS");
66 
67  // ---> ANCILLARY_PART /////////////////////////
68  // ---> Additional libraries if required
69  // PRISMA lib ... setup properly if PRISMA_PREPROC is set
70  TString tmp = gSystem->Getenv("PRISMA_PREPROC");
71  if ( tmp != "" ) {
72  // Directory where are the includes of the ancillary part for compilation
73  tmp = "$PRISMA_PREPROC/src/lib_prisma/include/"; printf("- Add %s to the include path \n",tmp.Data());
74  tmp.Prepend(" .include ");
75  gROOT->ProcessLine(tmp.Data());
76 
77  // ---> the prisma library
78  gSystem->Load("$PRISMA_PREPROC/lib/libPRISMA.so");
79 
80  // ---> Compile and load the watchers for PRISMA
81  if ( gSystem->AccessPathName("MyWatchers/PrismaWatchers.h") )
82  gSystem->CopyFile("Macros/PrismaWatchers.h","MyWatchers/PrismaWatchers.h");
83  if ( gSystem->AccessPathName("MyWatchers/PrismaWatchers.C") )
84  gSystem->CopyFile("Macros/PrismaWatchers.C","MyWatchers/PrismaWatchers.C");
85 
86  tmp = Form(".L MyWatchers/PrismaWatchers.C+%s",CompOpt);
87  gROOT->ProcessLine(tmp.Data());
88  }
89  // ---> END ANCILLARY_PART /////////////////////////
90 
91  // do it after in case an ancillary part is added in the tree
92  tmp = Form(".L MyWatchers/MyTree.C+%s",CompOpt);
93  gROOT->ProcessLine(tmp.Data());
94 
95  // Gives some command that can be run
96  cout << endl;
97  cout << " To start online (Local Level) Watchers : " << endl;
98  cout << " - to watch one selected actor " << endl;
99  cout << " .x OnlineWatchersLLP.C+ or .x OnlineWatchersLLP.C+(new TFile(\"MySpectra.root\",\"UPDATE\"))" << endl;
100  cout << " - to watch simultaneously all the actors " << endl;
101  cout << " .x OnlineWatchersLLP.C+(0x0,true) or .x OnlineWatchersLLP.C+(new TFile(\"MySpectra.root\",\"UPDATE\"),true)" << endl;
102  cout << " To start online (Global Level) Watchers : " << endl;
103  cout << " .x OnlineWatchersGLP.C+ or .x OnlineWatchersGLP.C+(new TFile(\"MySpectra.root\",\"UPDATE\"))" << endl;
104  cout << " Then start the watching from the ROOT Browser " << endl << endl;
105  cout << " To start offline Watchers : " << endl;
106  cout << " 1 - Configure OfflineWatcher.C (it could be a copy of of the one in DefaultWatchers)" << endl;
107  cout << " 2 - Run the Watchers with : " << endl;
108  cout << " .x OfflineWatchers.C+ or .x OfflineWatchers.C+(new TFile(\"MySpectra.root\",\"UPDATE\"))" << endl;
109  cout << endl;
110 
111  // check whether or not ADF_CONF_PATH has been set !
112  TString adf_path = gSystem->Getenv("ADF_CONF_PATH");
113  if ( adf_path == "" ) {
114  if ( ! gSystem->AccessPathName("./ADF.conf") ) { // does exist
115  // get the current directory
116  TString pwd_path = gSystem->Getenv("PWD");
117  // set ADF_CONF_PATH to the current directory
118  gSystem->Setenv("ADF_CONF_PATH",pwd_path.Data());
119 
120  printf("\n [Info] ADF_CONF_PATH has been set to %s \n\n ",pwd_path.Data());
121  }
122  else
123  cout << "\n ** [WARNING] ** , ADF_CONF_PATH not set ! " << endl << endl;
124  }
125  else printf("\n [Info] ADF_CONF_PATH is %s \n\n ",adf_path.Data());
126 
127  // start a ROOT TBrowser
128  TBrowser *b = new TBrowser();
129 
130 
131  //--------
132  /*
133  // Set include path and Load the precompiled librarie WATCHERS (see DefaultWatchers/Makefile)
134  tmp = "./DefaultWatchers" ; printf("- Add %s to the include path \n",tmp.Data());
135  tmp.Prepend(" .include ");
136  gROOT->ProcessLine(tmp.Data());
137 
138  gSystem->Load("DefaultWatchers/libWATCHERS");
139 
140 
141 // ---> ANCILLARY_PART /////////////////////////
142 // ---> Additional libraries if required (ANCILLARY_PART)
143  // Directory where are the includes of the ancillary part
144  tmp = "/path/to/where/are/prisma/includes"; printf("- Add %s to the include path \n",tmp.Data());
145  tmp.Prepend(" .include ");
146  gROOT->ProcessLine(tmp.Data());
147 
148  // ---> Additional libraries if required (ANCILLARY PART)
149  //gSystem->Load("libPrisma");
150 
151  // ---> Compile and load the watchers for ancillaries
152  // gROOT->ProcessLine(".L MyAnc.C+");
153 
154 // ---> END ANCILLARY_PART /////////////////////////
155 
156  // Gives some command that can be run
157  cout << endl;
158  cout << " To start online (Local Level) Watchers : " << endl;
159  cout << " - to watch one selected actor " << endl;
160  cout << " .x OnlineWatchersLLP.C+ or .x OnlineWatchersLLP.C+(new TFile(\"MySpectra.root\",\"UPDATE\"))" << endl;
161  cout << " - to watch simultaneously all the actors " << endl;
162  cout << " .x OnlineWatchersLLP.C+(OxO,true) or .x OnlineWatchersLLP.C+(new TFile(\"MySpectra.root\",\"UPDATE\"),true)" << endl;
163  cout << " To start online (Global Level) Watchers : " << endl;
164  cout << " .x OnlineWatchersGLP.C+ or .x OnlineWatchersGLP.C+(new TFile(\"MySpectra.root\",\"UPDATE\"))" << endl;
165  cout << " Then start the watching from the ROOT Browser " << endl << endl;
166  cout << " To start offline Watchers : " << endl;
167  cout << " 1 - Configure OfflineWatcher.C (it could be a copy of of the one in DefaultWatchers)" << endl;
168  cout << " 2 - Run the Watchers with : " << endl;
169  cout << " .x OfflineWatchers.C+ or .x OfflineWatchers.C+(new TFile(\"MySpectra.root\",\"UPDATE\"))" << endl;
170  cout << endl;
171 
172  // check whether or not ADF_CONF_PATH has been set !
173  TString adf_path = gSystem->Getenv("ADF_CONF_PATH");
174  if ( adf_path == "" ) {
175  if ( ! gSystem->AccessPathName("./ADF.conf") ) { // does exist
176  // get the current directory
177  TString pwd_path = gSystem->Getenv("PWD");
178  // set ADF_CONF_PATH to the current directory
179  gSystem->Setenv("ADF_CONF_PATH",pwd_path.Data());
180 
181  printf("\n [Info] ADF_CONF_PATH has been set to %s \n\n ",pwd_path.Data());
182  }
183  else
184  cout << "\n ** [WARNING] ** , ADF_CONF_PATH not set ! " << endl << endl;
185  }
186  else
187  printf("\n [Info] ADF_CONF_PATH is %s \n\n ",adf_path.Data());
188 
189  // start a ROOT TBrowser
190  TBrowser b;
191  */
192 }
TBrowser * b
printf("******************************************************************** \n")
TString macroPATH
const Char_t * CompOpt
ADF::LogMessage & endl(ADF::LogMessage &log)
TString tmp
static const char * GetPath(const char *)
to get a particular GW environment variable
Definition: Env.cpp:47