Logo Coherent WaveBurst  
Reference Guide
Logo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GetCmdLineHistory.C
Go to the documentation of this file.
1 //
2 // Get Command Line infos from the OUTPUT CWB ROOT FILES contained in the 'idir' directory
3 // Author : Gabriele Vedovato
4 //
5 // Example : root 'GetCmdLineHistory.C("output")'
6 // Output : /home/waveburst/soft/root/root-v5-32-04.patched/bin/root.exe -splash -n -l -b ...
7 //
8 
10 
12 
13  vector<TString> fileList = CWB::Toolbox::getFileListFromDir(idir,".root","",data_label,true);
14  for(int n=0;n<fileList.size();n++) {
15 
16  // Get STOP JOB info from history
17  TFile *ifile = TFile::Open(fileList[n]);
18  if(ifile==NULL) {cout << "Failed to open " << fileList[n].Data() << endl;exit(-1);}
19  CWB::History* ihistory = (CWB::History*)ifile->Get("history");
20  if(ihistory==NULL) { cout << "Error : history is not present!!!" << endl;exit(1); }
21 
23  int nStages = cwb::GetStageSize();
24  if(ihistory) {
25  TList* stageList = ihistory->GetStageNames(); // get stage list
26  for(int i=0;i<stageList->GetSize();i++) { // loop over the stage list
27  TObjString* stageObjString = (TObjString*)stageList->At(i);
28  TString stageName = stageObjString->GetString();
29  char* stage = const_cast<char*>(stageName.Data());
30  TString info = ihistory->GetHistory(stage,const_cast<char*>("CMDLINE"));
31  if(info!="") cmd_line=info;
32  }
33  }
34  cout << cmd_line << endl;
35  ifile->Close();
36  }
37 
38  exit(0);
39 }
40 
static vector< TString > getFileListFromDir(TString dir_name, TString endString="", TString beginString="", TString containString="", bool fast=false)
Definition: Toolbox.cc:4333
int n
Definition: cwb_net.C:10
cout<< "skymap size : "<< L<< endl;for(int l=0;l< L;l++) sm.set(l, l);sm > const_cast< char * >("skymap.dat")
TString("c")
i drho i
char data_label[512]
Definition: test_config1.C:160
TList * GetStageNames()
Definition: History.cc:409
int nStages
static int GetStageSize()
Definition: cwb.hh:150
TFile * ifile
char cmd_line[512]
Definition: cwb_net.C:136
cout<< "Starting reading output directory ..."<< endl;vector< TString > fileList
void GetCmdLineHistory(TString idir)
char * GetHistory(char *StageName, char *Type)
Definition: History.cc:255
CWB::History * ihistory
exit(0)