CondenseDetCfg.C
Go to the documentation of this file.
1 #include <vector>
2 #include <iostream>
3 #include <fstream>
4 
5 #include <TFile.h>
6 #include <TString.h>
7 #include <TMath.h>
8 #include <TDatime.h>
9 
10 using namespace std;
11 
12 struct RunInfo{
13 
14  int run;
15  int dbmask;
16 
17 };
18 
20 
21  ofstream runfile;
22  runfile.open("DetCfgTable_cond.csv");
23 
24  ifstream fileListItr("DetCfgTable_sort.csv");
25 
26  int run, subrun, dben;
27  int thisdb = -1;
28  int thisrun = -1;
29 
30  int thisFile = 0;
31 
32  vector<RunInfo> allruns;
33 
34  RunInfo emptystruct;
35 
36  RunInfo runstruct;
37 
38  while(fileListItr >> run >> subrun >> dben){
39 
40  if(thisrun!=run){
41 
42  if(thisrun>0) allruns.push_back(runstruct);
43 
44  thisrun = run;
45 
46  runstruct = emptystruct;
47 
48  runstruct.run = run;
49  runstruct.dbmask = dben;
50 
51  }
52  else{
53  runstruct.dbmask = dben & runstruct.dbmask;
54  }
55 
56  thisFile++;
57 
58  if(thisFile%50000==0) cout << thisFile << " files done" << endl;
59 
60  }
61  allruns.push_back(runstruct);
62 
63  thisrun = -1;
64 
65  int nruns = allruns.size();
66 
67  int tnow = TDatime().Convert();
68 
69  for(int i=0; i<nruns; i++){
70 
71  if(thisdb != allruns[i].dbmask || true){
72 
73  if(thisdb>=0) runfile << TString::Format("%d,%d",thisrun,thisdb) << endl;
74 
75  thisdb = allruns[i].dbmask;
76  thisrun = allruns[i].run;
77 
78  }
79 
80  }
81 
82  runfile << TString::Format("%d,%d",thisrun,thisdb) << endl;
83 
84  cout << "Finished " << thisFile << " files" << endl;
85 
86  runfile.close();
87 
88 }
89 
OStream cout
Definition: OStream.cxx:6
TFile * thisFile
ifstream fileListItr("ManBadSubruns.txt")
void CondenseDetCfg()
void Format(TGraph *gr, int lcol, int lsty, int lwid, int mcol, int msty, double msiz)
Definition: Style.cxx:154