25 TB.
checkFile(gSystem->Getenv(
"CWB_ROOTLOGON_FILE"));
26 TB.
checkFile(gSystem->Getenv(
"CWB_PARAMETERS_FILE"));
27 TB.
checkFile(gSystem->Getenv(
"CWB_UPARAMETERS_FILE"));
30 if(gSystem->Getenv(
"CWB_MERGE_LABEL")==NULL) {
31 cout <<
"Error : environment CWB_MERGE_LABEL is not defined!!!" << endl;
exit(1);
33 cwb_merge_label=
TString(gSystem->Getenv(
"CWB_MERGE_LABEL"));
37 if(cwb_merge_label[0]!=
'M') {
38 cout <<
"Error : label " << cwb_merge_label.Data() <<
" has bad format (M#)" << endl;
exit(1);
42 if(!lcheck.IsDigit()) {
43 cout <<
"Error : label " << cwb_merge_label.Data() <<
" has bad format (M#)" << endl;
exit(1);
45 cwb_merge_number=lcheck.Atoi();
57 if(cwb_merge_opts!=
"") {
62 cwb_bpsm = (option==
"TRUE") ?
true :
false;
66 cwb_brms = (option==
"TRUE") ?
true :
false;
70 cwb_bvar = (option==
"TRUE") ?
true :
false;
74 if(!option.IsDigit()) {
75 cout << endl <<
"cwb_merge.C : Error - --nthread argument '" 76 << option <<
"' is not a number" << endl << endl;
79 cwb_nthreads = option.Atoi();
87 if(option!=
"") cwb_utag = option;
96 if(cwb_utag!=
"") mtag = TString::Format(
".%s.U_%s.root",cwb_merge_label.Data(),cwb_utag.Data());
97 else mtag = TString::Format(
".%s.root",cwb_merge_label.Data());
98 if(cwb_merge_label.CompareTo(
"M0")!=0) {
100 for(
int i=0;
i<fileList.size();
i++) {
101 if(fileList[
i].Contains(mtag)) {
102 cout <<
"Ecwb_merge.C : Error - merge label " << cwb_merge_label <<
" already exist" << endl << endl;
109 int ipos = (cwb_utag==
"") ? 2 : 3;
110 for(
int i=0;
i<fileList.size();
i++) {
111 cout <<
i <<
" " << fileList[
i].Data() << endl;
112 if(cwb_utag!=
"")
if(!fileList[
i].Contains(TString::Format(
".U_%s",cwb_utag.Data())))
continue;
113 if(fileList[
i].Contains(
".root")) {
115 TString srescueID = ((TObjString*)token->At(token->GetEntries()-
ipos))->GetString();
117 srescueID.ReplaceAll(
"M",
"");
118 if(srescueID.IsDigit()) {
120 int rescueID = srescueID.Atoi();
121 if(iversion<rescueID) iversion=rescueID;
127 if(cwb_merge_number==0 || cwb_merge_number>=iversion) {
130 cout << endl <<
"cwb_merge.C : Error - the input merge version (M" << cwb_merge_number
131 <<
") must be greater of the most recent merge version (M" << iversion-1 <<
")" << endl << endl;
137 char cmd[128];
sprintf(cmd,
"iversion = %d",iversion);
140 gROOT->Macro(gSystem->ExpandPathName(
"$CWB_MACROS/cwb_merge_log.C"));
145 cout <<
"Start merging to file : " << new_data_label << endl << endl;
146 vector<TString> mergeList;
147 if(cwb_nthreads<=1) {
166 int estat = gSystem->GetPathInfo(condor_dag_file,&
id,&size,&
flags,&mt);
171 cout << endl <<
"Merged files : " << mergeList.size() <<
"/" <<
nfactor*ncondor_jobs << endl << endl;
179 if(cwb_utag!=
"") gSystem->Exit(0);
181 char wave_name[1024];
sprintf(wave_name,
"%s/wave_%s.root",
merge_dir,new_data_label);
182 TFile *
ifile = TFile::Open(wave_name);
183 if(ifile==NULL) {cout <<
"Failed to open " << wave_name << endl;
exit(1);}
187 cout <<
"Error : history is not present!!!" << endl;
exit(1);
195 for(
int i=0;
i<stageList->GetSize();
i++) {
196 TObjString* stageObjString = (TObjString*)stageList->At(
i);
197 TString stageName = stageObjString->GetString();
199 bool isProcessingStage=
false;
203 if(!isProcessingStage)
continue;
204 char* stage =
const_cast<char*
>(stageName.Data());
208 git_version = ihistory->
GetHistory(stage,const_cast<char*>(
"GITVERSION"));
216 if (!out.good()) {cout <<
"Error Opening File : " << configFile << endl;
exit(1);}
217 out << config.Data();
char condor_dag_file[1024]
char full_condor_dir[1024]
static TString GetStageString(CWB_STAGE jstage)
static int GetStageSize()
sprintf(tag,"wave_%s", data_label)
#define EXPORT(TYPE, VAR, CMD)
strcpy(RunLabel, RUN_LABEL)
vector< TString > fileList
char merge_list_file[1024]
char * GetHistory(char *StageName, char *Type)