MakeDetCfgCSV.C
Go to the documentation of this file.
1 
2 
3 void MakeDetCfgCSV(){
4 
5  TFile file("MetricsTree_All.root","read");
6  TTree *tree = (TTree*)file.Get("mytree");
7 
8  int run, subrun;
10 
11  tree->SetBranchAddress("run",&run);
12  tree->SetBranchAddress("subrun",&subrun);
13  tree->SetBranchAddress("dbencoded",&dbencoded);
14  tree->SetBranchAddress("preliminary",&preliminary);
15  tree->SetBranchAddress("pass_all",&pass_all);
16  tree->SetBranchAddress("pass_time",&pass_time);
17  tree->SetBranchAddress("pass_empty",&pass_empty);
18  tree->SetBranchAddress("pass_runlen",&pass_runlen);
19  tree->SetBranchAddress("pass_hits",&pass_hits);
20 
21 
22  ofstream procfile;
23  procfile.open("DetCfgTable.csv");
24 
25  int nentries = tree->GetEntries();
26 
27  TString rowstr;
28 
29  for(int i = 0; i < nentries; i++){
30 
31  if(i%(nentries/10)==0) cout << int(100.0*i/nentries+0.5) << "% done" << endl;
32 
33  tree->GetEntry(i);
34 
35  if(preliminary || !pass_all) continue;
36 
37  rowstr = TString::Format("%d\t%02d\t%d", run, subrun, dbencoded);
38 
39  procfile << rowstr.Data() << endl;
40 
41  }
42 
43  procfile.close();
44 
45 }
Int_t pass_all
Definition: SimpleIterate.C:42
Int_t dbencoded
Definition: SimpleIterate.C:54
void MakeDetCfgCSV()
Definition: MakeDetCfgCSV.C:3
Int_t pass_empty
Definition: SimpleIterate.C:38
Long64_t nentries
TString rowstr
Int_t preliminary
Definition: SimpleIterate.C:63
OStream cout
Definition: OStream.cxx:6
ofstream procfile
TFile * file
Definition: cellShifts.C:17
void Format(TGraph *gr, int lcol, int lsty, int lwid, int mcol, int msty, double msiz)
Definition: Style.cxx:154
Int_t pass_runlen
Definition: SimpleIterate.C:37
Int_t pass_time
Definition: SimpleIterate.C:41
Int_t pass_hits
Definition: SimpleIterate.C:39