Logo coherent WaveBurst  
Library Reference Guide
Logo
ReadLiveTimeFromROOT.C
Go to the documentation of this file.
1 //
2 // Read livetime tree from input root file
3 // Author : Gabriele Vedovato
4 //
5 // Example: root -l -b 'ReadLiveTimeFromROOT.C("merge/live_O2_K02_C02c_LH_BBH_BKG_run1.M1.root",2)'
6 //
7 
8 void ReadLiveTimeFromROOT(TString liveFileName, int nIFO) {
9 //
10 // liveFileName: input livetime root file
11 // nIFO : number of detectors
12 //
13 
14  TFile *_file0 = TFile::Open(liveFileName);
15 
16  TTree* tree = (TTree *) gROOT->FindObject("liveTime");
17  if(tree==NULL) {cout << "ScanLIVE : liveTime tree not found !!!" << endl;exit(1);}
18 
19  char selection[1024];
20  sprintf(selection,"lag[%d]==0 && slag[%d]==0",nIFO,nIFO);
21 
22  tree->Draw("start[0]:stop[0]:live",selection,"goff"); // select zero lag segments
23 
24  int size = (Int_t)tree->GetSelectedRows(); // get the selected entries
25  double* start = tree->GetV1();
26  double* stop = tree->GetV2();
27  double* live = tree->GetV3();
28 
29  double live_dq2=0;
30  double live_dq1=0;
31  cout.precision(14);
32  for(int i=0;i<size;i++) {
33  cout << i << "\tstart: " << start[i] << "\tstop: " << stop[i] << endl;
34  live_dq1+=stop[i]-start[i];
35  live_dq2+=live[i];
36  }
37 
38  cout << "livetime zero lag after DQ CAT1 : " << live_dq1 << " sec\t" << live_dq1/(24*3600.) << " days" << endl;
39  cout << "livetime zero lag after DQ CAT2 & GATING: " << live_dq2 << " sec\t" << live_dq2/(24*3600.) << " days" << endl;
40 
41  exit(0);
42 }
TTree * tree
Definition: TimeSortTree.C:20
TString live
TString("c")
Long_t size
i drho i
#define nIFO
sprintf(tfres,"(1/%g)x(%g) (sec)x(Hz)", 2 *df, df)
void ReadLiveTimeFromROOT(TString liveFileName, int nIFO)
exit(0)