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;
67 if(!net_slag) {cout <<
"File " << net_file_name <<
" not contains slag leaf, apply cwb_fix_slag_missed.C " << endl;
exit(1);}
70 TFile *
flive = TFile::Open(liv_file_name);
71 if(flive==NULL) {cout <<
"Error opening file " << liv_file_name << endl;
exit(1);}
72 TTree*
tlive = (TTree *) gROOT->FindObject(
"liveTime");
73 if(tlive==NULL) {cout <<
"Error opening tree livetime" << endl;
exit(1);}
78 TIter
next(tlive->GetListOfBranches());
79 while ((branch=(TBranch*)
next())) {
80 if (
TString(
"slag").CompareTo(branch->GetName())==0) liv_slag=
true;
89 cout <<
"File " << liv_file_name <<
" do not contains slag leaf" << endl;
90 cout <<
"Do you want to fix it ? (y/n) ";
92 cout <<
"File " << liv_file_name <<
" already contains slag leaf" << endl;
93 cout <<
"Do you want to fix it anyway ? (y/n) ";
97 }
while ((strcmp(answer,
"y")!=0)&&(strcmp(answer,
"n")!=0));
98 if (strcmp(answer,
"y")==0) fixit=
true;
105 int nIFO = slagList[0].segId.size();
107 int*
ind =
new int[slagList.size()+1];
108 for(
int j=0;
j<slagList.size();
j++) {
112 ind[slagList[
j].jobId] =
j;
121 fix_liv_file_name.ReplaceAll(
".root",
".FIX.root");
122 cout <<
"Fixed live file : " << fix_liv_file_name.Data() << endl;
124 TFile* flive_fix =
new TFile(fix_liv_file_name,
"RECREATE");
125 if (flive_fix->IsZombie()) {
126 cout <<
"CWB::Toolbox::setVeto - Error opening file " << fix_liv_file_name.Data() << endl;
129 TTree *tlive_fix = (TTree*)tlive->CloneTree(0);
130 tlive_fix->SetMaxTreeSize(5000000000);
134 tlive_fix->Branch(
"slag",xslag,
"slag[6]/F");
137 tlive_fix->SetBranchAddress(
"slag",xslag);
141 tlive->SetBranchAddress(
"run",&xrun);
142 int ntrg = tlive->GetEntries();
144 if(
i%100000==0) cout <<
i <<
"/" << ntrg << endl;
147 for (
int n=0;
n<
nIFO;
n++) xslag[
n] =
segLen*(slagList[j].segId[
n]-slagList[j].segId[0]);
148 xslag[
nIFO] = slagList[
j].slagId[0];
149 for (
int n=nIFO+1;
n<6;
n++) xslag[
n] = -1;
TString fix_net_file_name(net_file_name)
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())
cout<< endl<< endl;} while((strcmp(answer,"y")!=0)&&(strcmp(answer,"n")!=0));if(strcmp(answer,"y")==0) fixit=true;if(!fixit) exit(0);vector< waveSegment > cat1List