35 namespace __LoadWatchers__ {
53 using namespace __LoadWatchers__ ;
84 if(!gSystem->IsFileInIncludePath(cpp_path))
86 cout<<cpp_path<<
" not found, class not loaded."<<
endl;
91 TString CompileLine =
".L " + cpp_path + Form(
"+%s",
CompOpt.Data());
92 gROOT->ProcessLine(CompileLine.Data());
99 if(!what_directory.BeginsWith(
"/"))
101 TString CurrentDir = gSystem->pwd();
103 what_directory.Prepend(CurrentDir);
105 tmp = what_directory;
printf(
"{Conf} Add %s to the include path \n",
tmp.Data());
106 tmp.Prepend(
" .include ");
107 gROOT->ProcessLine(
tmp.Data());
113 sprintf(
DefaultW,
" \033[1;34m [*] "); sprintf(
MyW,
" \033[1;32m [+] "); sprintf(
WarningW,
" \033[1;31m [!] "); sprintf(
AncW,
" \033[1;35m [+] "); sprintf(
EndColor,
"\033[0m");
135 printf(
"******************************************************************** \n") ;
136 printf(
" Configure/Compile/Load Watcher for the GANIL phase \n") ;
137 printf(
"******************************************************************** \n") ;
143 if ( macroPATH.Contains(tmp.Data()) ==
false ) {
144 printf(
"{Conf} Add %s to the macros path \n",tmp.Data());
146 macroPATH.Prepend(tmp.Data()); gROOT->SetMacroPath(macroPATH.Data());
153 gSystem->Load(
"libGWCORE.so");
154 gSystem->Load(
"libGWADF.so");
155 gSystem->Load(
"libGWADFE.so");
156 gSystem->Load(
"libGWTOOLS.so");
158 if (
AGAPRO.Contains(
"/") ) {
160 AGAPRO.Append(
"/include");
printf(
"{Conf} Add path to AGAPRO includes [%s] to the include path \n",
AGAPRO.Data());
161 AGAPRO.Prepend(
" .include ");
162 gROOT->ProcessLine(
AGAPRO.Data());
164 gSystem->Load(
"libAgaProCommon.so");
165 gSystem->Load(
"libCrystalProducer.so");
166 gSystem->Load(
"libPreprocessingFilter.so");
167 gSystem->Load(
"libTrackingFilter.so");
171 gSystem->MakeDirectory(
"./Out");
177 MFMDIR = gSystem->Getenv(
"MFMLIB");
VAMOSDIR = gSystem->Getenv(
"VAMOSLIB");
GRUDIR = gSystem->Getenv(
"GRULIB");
179 std::ofstream fdefs(
"WatchersConfigNew.h",ios::out | ios::trunc);
180 if ( fdefs.is_open() ) {
183 if (
AGAPRO.Contains(
"/") ) {
184 fdefs <<
"#define HAS_AGAPROCONFIG " <<
std::endl;
188 fdefs <<
"// enable / disable GANIL " <<
std::endl;
189 if (
MFMDIR !=
"" && !gSystem->AccessPathName(Form(
"%s/lib/libMFM.so",
MFMDIR.Data())) ) {
192 tmp =
MFMDIR; tmp+=
"/include";
printf(
"{Conf} Add %s to the include path \n",tmp.Data());
193 tmp.Prepend(
" .include ");
194 gROOT->ProcessLine(tmp.Data());
198 && !gSystem->AccessPathName(Form(
"%s/lib/libVamos.so",
VAMOSDIR.Data()))
199 && !gSystem->AccessPathName(Form(
"%s/lib/libGWVamos.so",
VAMOSDIR.Data()))
202 fdefs <<
"#define HAS_VAMOS " <<
std::endl;
204 tmp =
VAMOSDIR; tmp+=
"/include";
printf(
"{Conf} Add %s to the include path \n",tmp.Data());
205 tmp.Prepend(
" .include ");
211 fdefs <<
"#define HAS_GRU " <<
std::endl;
219 std::ifstream fich2(
"WatchersConfig.h");
220 if(!fich2) system(
"mv WatchersConfigNew.h WatchersConfig.h");
221 else if(system(
"diff WatchersConfigNew.h WatchersConfig.h")) system(
"mv WatchersConfigNew.h WatchersConfig.h");
222 else system(
"rm WatchersConfigNew.h");
253 std::cout <<
AncW <<
" NO Watchers for ancillaries, install first MFM [MANDATORY] VAMOS / GRU ... to get some " <<
EndColor <<
std::endl;
257 cout <<
"[Load] libMFM from " <<
MFMDIR <<
endl;
258 gSystem->Load(
"libMFM.so" );
265 cout <<
"[Load] libVamos.so and libGWVamos.so from " <<
VAMOSDIR <<
endl;
266 gSystem->Load(
"libVamos.so" );
267 gSystem->Load(
"libGWVamos.so" );
273 tmp = gSystem->Getenv(
"ANALYSIS_AGATA");
274 if ( !(
tmp ==
"") ) {
275 printf(
"{Conf} ANALYSIS_AGATA found to be %s \n",
tmp.Data());
278 printf(
"{Conf} Set ANALYSIS_AGATA to ./ConfVAMOS \n"); gSystem->Setenv(
"ANALYSIS_AGATA",
"./ConfVAMOS");
282 cout <<
"- Load libGRU.so from " <<
GRUDIR.Data() <<
endl;
283 gSystem->Load( Form(
"%s/lib/libGRU.so",
GRUDIR.Data()) );
285 tmp.Prepend(
" .include ");
286 gROOT->ProcessLine(
tmp.Data());
296 if ( what_conf ==
"ADF.conf" ) {
298 TString adf_path = gSystem->Getenv(
"ADF_CONF_PATH");
300 if ( adf_path ==
"" ) {
303 if ( !gSystem->AccessPathName(
"./ADF.conf") ) {
308 TString tmp_dir = gSystem->TempDirectory();
309 std::cout <<
WarningW <<
"Cannot find ADF.conf ... try and install a default one from internet, make sure it fullfils your needs " <<
EndColor <<
std::endl;
310 gSystem->Exec(Form(
"svn --quiet checkout svn+ssh://anonsvn@anonsvn.in2p3.fr/agata/conf/watchers/ %s",tmp_dir.Data()));
311 if ( gSystem->CopyFile(Form(
"%s/ADF.conf",tmp_dir.Data()),
"./ADF.conf") == 0 )
315 adf_path = gSystem->Getenv(
"PWD");
319 if ( adf_path ==
"" ) {
323 gSystem->Setenv(
"ADF_CONF_PATH",adf_path.Data());
324 printf(
"\n\t{Conf}\tADF_CONF_PATH has been set to %s \n\n",adf_path.Data());
327 if ( what_conf ==
"CrystalPositionLookUpTable.dat" ) {
330 if ( !gSystem->AccessPathName(
"./CrystalPositionLookUpTable.dat") ) {
335 TString tmp_dir = gSystem->TempDirectory();
336 gSystem->Exec(Form(
"svn --quiet checkout svn+ssh://anonsvn@anonsvn.in2p3.fr/agata/conf/watchers/ %s",tmp_dir.Data()));
337 if ( gSystem->CopyFile(Form(
"%s/CrystalPositionsLookUpTableGANIL.dat",tmp_dir.Data()),
"./CrystalPositionLookUpTable.dat") == 0 ) {
338 std::cout <<
WarningW <<
"CrystalPositionLookUpTable.dat was not there ... a default one from internet has been installed, make sure it fullfils your needs! " <<
EndColor <<
std::endl;;
343 std::cout <<
WarningW <<
"Mapping of AGATA Ge Crystal, CrystalPositionLookUpTable.dat, not found !" <<
EndColor <<
std::endl;
351 cout <<
endl <<
"|INFO| ... informations ... messages ... help ... for Online/Quasi Online Analysis |" <<
endl;
352 cout <<
"|INFO|" <<
endl;
353 cout <<
"|INFO|\tTo start stogs Watchers : " <<
endl;
354 cout <<
"|INFO|\t\t1 - Configure StogsWatcher.C" <<
endl;
355 cout <<
"|INFO|\t\t2 - Compile/Run the Watchers with : " <<
endl;
356 cout <<
"|INFO|\t\t.L StogsWatchers.C+" <<
endl;
357 cout <<
"|INFO|StogsWatchers() or StogsWatcher(new TFile(\"MySpectra.root\",\"UPDATE\"))" <<
endl;
358 cout <<
"|INFO|" <<
endl;
362 CheckConf(
"CrystalPositionLookUpTable.dat");
365 TFolder *TaskFolder =
366 (TFolder*)gROOT->GetRootFolder()->FindObject(
"Tasks");
367 TBrowser *browser =
new TBrowser(
"Browser",TaskFolder,
"Welcome in the wonderful world of Gammaware watchers, have fun !!!");
369 TFolder *SpectraViewerFolder = (TFolder*)gROOT->GetRootFolder()->FindObject(
"SpectraViewer");
370 if (SpectraViewerFolder)
371 browser->BrowseObject(SpectraViewerFolder);
372 TFolder *GwWatchersFolder = (TFolder*)gROOT->GetRootFolder()->FindObject(
"GwWatchers");
374 browser->BrowseObject(GwWatchersFolder);
393 gSystem->Exec(Form(
"rm -rf %s/*_C.so %s/*_C.d %s/*.o %s/*_cpp.so %s/*_cpp.d %s/*.pcm",
394 Dir.Data(),Dir.Data(),Dir.Data(),Dir.Data(),Dir.Data(),Dir.Data() ));
void CleanDir(TString Dir)
clean up all created watchers
printf("******************************************************************** \n")
void CleanWatchers()
clean up all created watchers
void LoadWatchers_AGATA()
void CheckConf(TString what_conf)
void AddInclude(TString what_directory)
void LoadWatchers_ANCILLARIES()
ADF::LogMessage & endl(ADF::LogMessage &log)
void LoadClass(TString cpp_path)
functions defined in this macro
void BeginLoadWatchers()
Set Env and Load Gw libraries.
static const char * GetPath(const char *)
to get a particular GW environment variable
void LoadStogsWatchers(const Char_t *comp_opt="g", const Char_t *path_to_agapro="")