coherent WaveBurst
Library Reference Guide
home
cWB_docker
git
cWB
library
tools
history
tutorials
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
9
void
GetCmdLineHistory
(
TString
idir) {
10
11
TString
data_label
=
""
;
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
22
TString
cmd_line
;
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
CWB::Toolbox::getFileListFromDir
static vector< TString > getFileListFromDir(TString dir_name, TString endString="", TString beginString="", TString containString="", bool fast=false)
Definition:
Toolbox.cc:5108
n
int n
Definition:
cwb_net.C:28
TString
TString("c")
Definition:
cwb_report_skymap.C:129
i
i drho i
Definition:
cwb_epparameters.C:88
CWB::History
Definition:
History.hh:56
data_label
char data_label[512]
Definition:
test_config1.C:160
CWB::History::GetStageNames
TList * GetStageNames()
Definition:
History.cc:427
nStages
int nStages
Definition:
cwb_dump_config.C:51
cwb::GetStageSize
static int GetStageSize()
Definition:
cwb.hh:162
ifile
TFile * ifile
Definition:
cwb_dump_config.C:41
cmd_line
char cmd_line[512]
Definition:
cwb_net.C:154
fileList
cout<< "Starting reading output directory ..."<< endl;vector< TString > fileList
Definition:
cwb_condor_check.C:82
GetCmdLineHistory
void GetCmdLineHistory(TString idir)
Definition:
GetCmdLineHistory.C:9
CWB::History::GetHistory
char * GetHistory(char *StageName, char *Type)
Definition:
History.cc:273
ihistory
CWB::History * ihistory
Definition:
cwb_dump_config.C:44
exit
exit(0)