GetPartList_4DB.C
Go to the documentation of this file.
1 
2 
4 
5  TFile file("MetricsTree_All.root","read");
6  TTree *tree = (TTree*)file.Get("mytree");
7 
8  int run, subrun, par, pass_all;
10  int ngoodcdb, preliminary;
11 
12  tree->SetBranchAddress("run",&run);
13  tree->SetBranchAddress("subrun",&subrun);
14  tree->SetBranchAddress("par",&par);
15  tree->SetBranchAddress("pass_all",&pass_all);
16  tree->SetBranchAddress("pass_hits",&pass_hits);
17  tree->SetBranchAddress("pass_empty",&pass_empty);
18  tree->SetBranchAddress("pass_time",&pass_time);
19  tree->SetBranchAddress("pass_runlen",&pass_runlen);
20  tree->SetBranchAddress("ngoodcdb",&ngoodcdb);
21  tree->SetBranchAddress("preliminary",&preliminary);
22 
23  ofstream procfile[2];
24 
25  for(int p = 1; p < 3; p++){
26  procfile[p-1].open(TString::Format("ListOfGoodSubruns_P%d.txt",p).Data());
27  }
28 
29  ofstream procbad;
30  procbad.open("ListOfBadSubruns_ForSAM.txt");
31 
32  int nentries = tree->GetEntries();
33 
34  vector<TString> omFileName;
35  vector<int> passvec;
36 
37  int mincdb = 14;
38 
39  int lastrun = 0;
40  int lastpar = 0;
41 
42  for(int i = 0; i < nentries; i++){
43 
44  if(i%(nentries/10)==0) cout << int(100.0*i/nentries+0.5) << "% done" << endl;
45 
46  tree->GetEntry(i);
47 
48  if(preliminary) continue;
49 
50  if((run != lastrun && lastrun>0)){
51 
52  for(int j=0; j<int(omFileName.size()); j++){
53 
54  if(lastpar!=1 || !passvec[j] || mincdb<4) procbad << omFileName[j].Data() << endl;
55 
56  if(passvec[j] && ((lastpar==1 && mincdb>=4) || lastpar==2)){
57 
58  procfile[lastpar-1] << omFileName[j].Data() << endl;
59 
60  }
61 
62  }
63 
64  mincdb = 14;
65  omFileName.clear();
66  passvec.clear();
67 
68  }
69 
70  omFileName.push_back(TString::Format("%08d\t%03d", run, subrun));
71  passvec.push_back(pass_all);
72 
73  if(ngoodcdb < mincdb) mincdb = ngoodcdb;
74 
75  lastrun = run;
76  lastpar = par;
77 
78  }
79 
80  for(int j=0; j<int(omFileName.size()); j++){
81 
82  if(lastpar!=1 || !passvec[j] || mincdb<4) procbad << omFileName[j].Data() << endl;
83 
84  if(passvec[j] && ((lastpar==1 && mincdb>=4) || lastpar==2)){
85 
86  procfile[lastpar-1] << omFileName[j].Data() << endl;
87 
88  }
89 
90  }
91 
92  for(int p = 1; p < 3; p++){
93  procfile[p-1].close();
94  }
95 
96  procbad.close();
97 
98 }
Int_t pass_all
Definition: SimpleIterate.C:42
void GetPartList_4DB()
const char * p
Definition: xmltok.h:285
Int_t par
Definition: SimpleIterate.C:24
Int_t pass_empty
Definition: SimpleIterate.C:38
Long64_t nentries
Int_t preliminary
Definition: SimpleIterate.C:63
const double j
Definition: BetheBloch.cxx:29
Int_t ngoodcdb
Definition: SimpleIterate.C:33
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