26 TB.
checkFile(gSystem->Getenv(
"CWB_ROOTLOGON_FILE"));
27 TB.
checkFile(gSystem->Getenv(
"CWB_PARAMETERS_FILE"));
28 TB.
checkFile(gSystem->Getenv(
"CWB_UPARAMETERS_FILE"));
31 if(gSystem->Getenv(
"CWB_MERGE_LABEL")==NULL) {
32 cout <<
"Error : environment CWB_MERGE_LABEL is not defined!!!" << endl;
exit(1);
34 cwb_merge_label=
TString(gSystem->Getenv(
"CWB_MERGE_LABEL"));
41 cout <<
"Error : cwb_fix_slag_missed.C must be applied only to production files !!!" << endl;
exit(1);
45 cout << net_file_name << endl;
46 cout << liv_file_name << endl;
54 TFile *fwave = TFile::Open(net_file_name);
55 if(fwave==NULL) {cout <<
"Error opening file " << net_file_name << endl;
exit(1);}
56 TTree* twave = (TTree *) gROOT->FindObject(
"waveburst");
57 if(twave==NULL) {cout <<
"Error opening tree wave" << endl;
exit(1);}
62 TIter
next(twave->GetListOfBranches());
63 while ((branch=(TBranch*)
next())) {
64 if (
TString(
"slag").CompareTo(branch->GetName())==0) net_slag=
true;
69 TFile *
flive = TFile::Open(liv_file_name);
70 if(flive==NULL) {cout <<
"Error opening file " << liv_file_name << endl;
exit(1);}
71 TTree*
tlive = (TTree *) gROOT->FindObject(
"liveTime");
72 if(tlive==NULL) {cout <<
"Error opening tree livetime" << endl;
exit(1);}
77 TIter
next(tlive->GetListOfBranches());
78 while ((branch=(TBranch*)
next())) {
79 if (
TString(
"slag").CompareTo(branch->GetName())==0) liv_slag=
true;
82 if(liv_slag&&net_slag) {
83 cout <<
"Files " << endl;
84 cout << liv_file_name << endl;
85 cout << net_file_name << endl;
86 cout <<
"already contains slag leaf, exit" << endl;
90 if(!liv_slag&&net_slag) {
91 cout <<
"File " << net_file_name <<
" aleady contains slag leaf" << endl;
92 cout <<
"only " << liv_file_name <<
" needs to be fixed" << endl;
93 cout <<
"apply cwb_fix_live_slag_missed.C " << endl;
97 if(liv_slag&&!net_slag) {
98 cout <<
"File " << liv_file_name <<
" aleady contains slag leaf" << endl;
99 cout <<
"only " << net_file_name <<
" needs to be fixed" << endl;
100 cout <<
"something wrong during production, please check" << endl;
111 cout <<
"File " << net_file_name <<
" do not contains slag leaf" << endl;
112 cout <<
"File " << liv_file_name <<
" do not contains slag leaf" << endl;
113 cout <<
"Do you want to fix them ? (y/n) ";
115 cout << endl << endl;
116 }
while ((strcmp(answer,
"y")!=0)&&(strcmp(answer,
"n")!=0));
117 if (strcmp(answer,
"y")==0) fixit=
true;
126 fix_liv_file_name.ReplaceAll(
".root",
".FIX.root");
127 cout <<
"Fixed live file : " << fix_liv_file_name.Data() << endl;
129 TFile* flive_fix =
new TFile(fix_liv_file_name,
"RECREATE");
130 if (flive_fix->IsZombie()) {
131 cout <<
"CWB::Toolbox::setVeto - Error opening file " << fix_liv_file_name.Data() << endl;
134 TTree *tlive_fix = (TTree*)tlive->CloneTree(0);
135 tlive_fix->SetMaxTreeSize(5000000000);
138 tlive_fix->Branch(
"slag",xslag,
"slag[6]/F");
142 tlive->SetBranchAddress(
"run",&xrun);
145 if(
i%100000==0) cout <<
i <<
"/" << ntrg_live << endl;
147 for (
int n=0;
n<
nIFO;
n++) xslag[
n] = 0.;
149 for (
int n=nIFO+1;
n<6;
n++) xslag[
n] = -1;
162 fix_net_file_name.ReplaceAll(
".root",
".FIX.root");
163 cout <<
"Fixed wave file : " << fix_net_file_name.Data() << endl;
165 TFile* fwave_fix =
new TFile(fix_net_file_name,
"RECREATE");
166 if (fwave_fix->IsZombie()) {
167 cout <<
"CWB::Toolbox::setVeto - Error opening file " << fix_net_file_name.Data() << endl;
170 TTree *twave_fix = (TTree*)twave->CloneTree(0);
171 twave_fix->SetMaxTreeSize(5000000000);
174 twave_fix->Branch(
"slag",xslag,
"slag[6]/F");
179 if(
i%100000==0) cout <<
i <<
"/" << ntrg_wave << endl;
181 for (
int n=0;
n<
nIFO;
n++) xslag[
n] = 0.;
183 for (
int n=nIFO+1;
n<6;
n++) xslag[
n] = -1;
197 olstfname.ReplaceAll(
"wave_",
"merge_");
198 olstfname.ReplaceAll(
".root",
".lst");
199 olstfname.Remove(0,olstfname.Last(
'/')+1);
200 cout << olstfname << endl;
203 estat = gSystem->GetPathInfo(
TString(
merge_dir)+
"/"+ilstfname,&
id,&size,&flags,&mt);
sprintf(liv_file_name,"%s/live_%s.%s.root", merge_dir, data_label, cwb_merge_label.Data())
TString fix_liv_file_name(liv_file_name)
TIter next(twave->GetListOfBranches())
TString fix_net_file_name(net_file_name)
strcpy(RunLabel, RUN_LABEL)