GetProcessed.C
Go to the documentation of this file.
1 #include <iostream>
2 #include <fstream>
3 #include <iomanip>
4 #include <sstream>
5 #include <string>
6 #include <streambuf>
7 #include <cstring>
8 #include <algorithm>
9 
10 #include <TStyle.h>
11 #include <TSystem.h>
12 #include <TFile.h>
13 #include <TString.h>
14 #include <TTree.h>
15 #include <TH2F.h>
16 #include <TH1F.h>
17 #include <TMath.h>
18 
19 #include <TSQLServer.h>
20 #include <TSQLResult.h>
21 #include <TSQLStatement.h>
22 
23 void GetProcessed(){
24 
25  TFile file("MetricsTree_All.root","read");
26  TTree *tree = (TTree*)file.Get("mytree");
27 
28  int run, subrun, preliminary;
29 
30  tree->SetBranchAddress("run",&run);
31  tree->SetBranchAddress("subrun",&subrun);
32  tree->SetBranchAddress("preliminary",&preliminary);
33 
34  ofstream procfile;
35  procfile.open("listProcessed.txt");
36 
37  int nentries = tree->GetEntries();
38 
39  int runtemp = 0;
40 
41  for(int i = 0; i < nentries; i++){
42 
43  if(i%(nentries/10)==0) cout << int(100.0*i/nentries+0.5) << "% done" << endl;
44 
45  tree->GetEntry(i);
46 
47 // procfile << TString::Format("%08d\t%03d",run, subrun) << endl;
48  if(runtemp!=run && !preliminary){
49  procfile << TString::Format("%08d",run) << endl;
50  runtemp = run;
51  }
52 
53  }
54 
55  procfile.close();
56 
57 }
void GetProcessed()
Definition: GetProcessed.C:23
Long64_t nentries
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