GetPartList.C
Go to the documentation of this file.
1 
2 
3 void GetPartList(){
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  TString omFileName;
35 
36  for(int i = 0; i < nentries; i++){
37 
38  if(i%(nentries/10)==0) cout << int(100.0*i/nentries+0.5) << "% done" << endl;
39 
40  tree->GetEntry(i);
41 
42  if(preliminary) continue;
43 
44  omFileName = TString::Format("%08d\t%03d", run, subrun);
45 
46  if(par!=1 || !pass_all || ngoodcdb < 4) procbad << omFileName.Data() << endl;
47 
48  if(!pass_all || (par!=1 && par!=2) || ngoodcdb < 4) continue;
49 
50  procfile[par-1] << omFileName.Data() << endl;
51 
52  }
53 
54  for(int p = 1; p < 3; p++){
55  procfile[p-1].close();
56  }
57 
58  procbad.close();
59 
60 }
Int_t pass_all
Definition: SimpleIterate.C:42
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
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
void GetPartList()
Definition: GetPartList.C:3
Int_t pass_runlen
Definition: SimpleIterate.C:37
Int_t pass_time
Definition: SimpleIterate.C:41
Int_t pass_hits
Definition: SimpleIterate.C:39