CMS 3D CMS Logo

Functions | Variables
ls_cert.cc File Reference
#include <Riostream.h>
#include <TDirectory.h>
#include <TFile.h>
#include <TROOT.h>
#include <TStyle.h>
#include <TKey.h>
#include <TH1.h>
#include <TH2.h>
#include <TH2D.h>
#include <TCanvas.h>
#include <TGraph.h>
#include <TPaveStats.h>
#include <TText.h>
#include <TLegend.h>
#include <cstring>
#include <utility>
#include <vector>
#include <sstream>
#include <algorithm>
#include <TString.h>
#include <TColor.h>

Go to the source code of this file.

Functions

void cert_plot (float threshold_pixel, float threshold, string filename, vector< string > &cert_strip, vector< string > &cert_track, vector< string > &cert_pixel, vector< pair< string, vector< float > > > &LS_strip, vector< pair< string, vector< float > > > &LS_track, vector< pair< string, vector< float > > > &LS_pixel)
 
void Cleaning (vector< int > &LSlist)
 
string ListOut (vector< int > &LSlist)
 
void ls_cert (float threshold_pixel, float threshold, string filename)
 
void ls_cert_type (string iDir, float threshold, string filename, vector< string > &cert, vector< pair< string, vector< float > > > &gLS, vector< pair< string, vector< float > > > &bLS, vector< pair< string, vector< float > > > &mLS)
 
int main (int argc, char *argv[])
 
int nlumis (string filename)
 
string runnum_str (string filename)
 

Variables

int numlumis = -1
 

Function Documentation

◆ cert_plot()

void cert_plot ( float  threshold_pixel,
float  threshold,
string  filename,
vector< string > &  cert_strip,
vector< string > &  cert_track,
vector< string > &  cert_pixel,
vector< pair< string, vector< float > > > &  LS_strip,
vector< pair< string, vector< float > > > &  LS_track,
vector< pair< string, vector< float > > > &  LS_pixel 
)

Definition at line 327 of file ls_cert.cc.

335  {
336  int nLumiSections = nlumis(filename);
337 
338  char plottitles[200];
339  sprintf(plottitles, "Lumisection Certification: Run %s;Luminosity Section;", runnum_str(filename).c_str());
340  TH2D* cert_plot = new TH2D("cert_plot", plottitles, nLumiSections, 1, nLumiSections + 1, 5, 1, 6);
341  cert_plot->SetStats(false);
342  char label[100];
343  for (int ityp = 0; ityp < 4; ityp++) {
344  sprintf(label, "SiStrip %s", cert_strip[ityp].c_str());
345  cert_plot->GetYaxis()->SetBinLabel(5 - ityp, label);
346 
347  for (unsigned int idx = 0; idx < LS_strip[ityp].second.size(); idx++)
348  if (LS_strip[ityp].second[idx] > -1)
349  cert_plot->SetBinContent(idx + 1, 5 - ityp, LS_strip[ityp].second[idx]);
350  }
351  for (int ityp = 0; ityp < 1; ityp++) {
352  sprintf(label, "Tracking %s", cert_track[ityp].c_str());
353  cert_plot->GetYaxis()->SetBinLabel(1 - ityp, label);
354  for (unsigned int idx = 0; idx < LS_track[ityp].second.size(); idx++)
355  if (LS_track[ityp].second[idx] > -1)
356  cert_plot->SetBinContent(idx + 1, 1 - ityp, LS_track[ityp].second[idx]);
357  }
358 
359  const Int_t colNum = 20; // defining of a new palette
360  Int_t palette[colNum];
361  float rgb[colNum][3];
362  int col_thr = colNum * threshold;
363  for (Int_t i = 0; i < colNum; i++) {
364  if (i >= col_thr) {
365  // green
366  rgb[i][0] = 0.00;
367  rgb[i][1] = 0.80;
368  rgb[i][2] = 0.00;
369  } else {
370  // red to yellow //yellow red
371  rgb[i][0] = 0.80 + (0.98 - 0.80) / (col_thr - 1) * i; //0.98 0.80
372  rgb[i][1] = 0.00 + (0.79 - 0.00) / (col_thr - 1) * i; //0.79 0.00
373  rgb[i][2] = 0.00; //0.00
374  }
375 
376  palette[i] = 9001 + i;
377 
378  TColor* color = gROOT->GetColor(9001 + i);
379  if (!color)
380  color = new TColor(9001 + i, 0, 0, 0, "");
381  color->SetRGB(rgb[i][0], rgb[i][1], rgb[i][2]);
382  }
383  gStyle->SetPalette(colNum, palette);
384  gROOT->SetStyle("Plain");
385 
386  TCanvas* cc = new TCanvas("name", "title", 1000, 600);
387  cert_plot->Draw("colz");
388  gPad->SetLeftMargin(0.17);
389  string plotfilename = "Certification_run_" + runnum_str(filename) + ".png";
390  cc->Print(plotfilename.c_str());
391 
392  //PIXEL plot
393 
394  TH2D* cert_plot_pixel = new TH2D("cert_plot_pixel", plottitles, nLumiSections, 1, nLumiSections + 1, 4, 1, 5);
395  cert_plot_pixel->SetStats(false);
396 
397  for (int ityp = 0; ityp < 4; ityp++) {
398  sprintf(label, "Pixel %s", cert_pixel[ityp].c_str());
399  cert_plot_pixel->GetYaxis()->SetBinLabel(4 - ityp, label);
400 
401  for (unsigned int idx = 0; idx < LS_pixel[ityp].second.size(); idx++)
402  if (LS_pixel[ityp].second[idx] > -1)
403  cert_plot_pixel->SetBinContent(idx + 1, 4 - ityp, LS_pixel[ityp].second[idx]);
404  }
405 
406  int col_thr_pixel = colNum * threshold_pixel;
407 
408  for (Int_t i = 0; i < colNum; i++) {
409  if (i >= col_thr_pixel) {
410  // green
411  rgb[i][0] = 0.00;
412  rgb[i][1] = 0.80;
413  rgb[i][2] = 0.00;
414  } else {
415  // red to yellow //yellow red
416  rgb[i][0] = 0.80 + (0.98 - 0.80) / (col_thr - 1) * i; //0.98 0.80
417  rgb[i][1] = 0.00 + (0.79 - 0.00) / (col_thr - 1) * i; //0.79 0.00
418  rgb[i][2] = 0.00; //0.00
419  }
420 
421  palette[i] = 10001 + i;
422 
423  TColor* color = gROOT->GetColor(10001 + i);
424  if (!color)
425  color = new TColor(10001 + i, 0, 0, 0, "");
426  color->SetRGB(rgb[i][0], rgb[i][1], rgb[i][2]);
427  }
428  gStyle->SetPalette(colNum, palette);
429  gROOT->SetStyle("Plain");
430 
431  cert_plot_pixel->Draw("colz");
432  //gPad->SetLeftMargin(0.17);
433  string plotfilename_pixel = "Certification_run_" + runnum_str(filename) + "_pixel.png";
434  cc->Print(plotfilename_pixel.c_str());
435 
436  delete cc;
437 }

References corrVsCorr::filename, mps_fire::i, heavyIonCSV_trainingSettings::idx, label, nlumis(), svgfig::rgb(), runnum_str(), edm::second(), and remoteMonitoring_LED_IterMethod_cfg::threshold.

Referenced by ls_cert().

◆ Cleaning()

void Cleaning ( vector< int > &  LSlist)

Definition at line 494 of file ls_cert.cc.

494  {
495  if (LSlist.empty())
496  return;
497 
498  //cleaning: keep only 1st and last lumisection in the range
499  int refLS = LSlist[0];
500  for (unsigned int at = 1; at < LSlist.size() - 1; at++) {
501  //delete LSnums in between a single continuous range
502  if (refLS + 1 == LSlist[at] && LSlist[at] + 1 == LSlist[at + 1]) {
503  refLS = LSlist[at];
504  LSlist[at] = -1;
505  } else {
506  refLS = LSlist[at];
507  }
508  }
509 }

Referenced by ls_cert_type().

◆ ListOut()

string ListOut ( vector< int > &  LSlist)

Definition at line 511 of file ls_cert.cc.

511  {
512  string strout = "";
513  bool rangeset = false;
514 
515  for (unsigned int at = 0; at < LSlist.size(); at++) {
516  if (LSlist[at] != -1) {
517  if (at > 0 && LSlist[at - 1] != -1)
518  strout += ",";
519  stringstream lsnum;
520  lsnum << LSlist[at];
521  strout += lsnum.str();
522  rangeset = false;
523  }
524  if (LSlist[at] == -1 && !rangeset) {
525  strout += "-";
526  rangeset = true;
527  }
528  }
529 
530  return strout;
531 }

Referenced by ls_cert_type().

◆ ls_cert()

void ls_cert ( float  threshold_pixel,
float  threshold,
string  filename 
)

Definition at line 55 of file ls_cert.cc.

55  {
56  void ls_cert_type(string iDir,
57  float threshold,
58  string filename,
59  vector<string>&,
60  vector<pair<string, vector<float> > >&,
61  vector<pair<string, vector<float> > >&,
62  vector<pair<string, vector<float> > >&);
63  void cert_plot(float threshold_pixel,
64  float threshold,
65  string filename,
66  vector<string>&,
67  vector<string>&,
68  vector<string>&,
69  vector<pair<string, vector<float> > >&,
70  vector<pair<string, vector<float> > >&,
71  vector<pair<string, vector<float> > >&);
72 
73  //presets
74  numlumis = -1;
75 
76  //certifications
77  vector<string> cert_strip;
78  vector<string> cert_track;
79  vector<string> cert_pixel;
80 
81  //good lumisections
82  vector<pair<string, vector<float> > > gLS_strip;
83  vector<pair<string, vector<float> > > gLS_track;
84  vector<pair<string, vector<float> > > gLS_pixel;
85 
86  //bad lumisections
87  vector<pair<string, vector<float> > > bLS_strip;
88  vector<pair<string, vector<float> > > bLS_track;
89  vector<pair<string, vector<float> > > bLS_pixel;
90 
91  //missing lumisections
92  vector<pair<string, vector<float> > > mLS_strip;
93  vector<pair<string, vector<float> > > mLS_track;
94  vector<pair<string, vector<float> > > mLS_pixel;
95 
96  ls_cert_type("SiStrip", threshold, filename, cert_strip, gLS_strip, bLS_strip, mLS_strip);
97  ls_cert_type("Tracking", threshold, filename, cert_track, gLS_track, bLS_track, mLS_track);
98  ls_cert_type("Pixel", threshold_pixel, filename, cert_pixel, gLS_pixel, bLS_pixel, mLS_pixel);
99 
100  std::ofstream outfile;
101  string namefile = "Certification_run_" + runnum_str(filename) + ".txt";
102  outfile.open(namefile.c_str());
103  outfile << "Lumisection Certification (GOOD: >= " << threshold_pixel << " [Pixel]; >= " << threshold
104  << " [SiStrip,Tracking] "
105  << ", otherwise BAD):" << endl
106  << endl;
107  outfile << "GOOD Lumisections:" << endl;
108  char line[200];
109  for (int ityp = 0; ityp < 4; ityp++) {
110  sprintf(line, " Pixel %*sSummary: %s", 13, cert_pixel[ityp].c_str(), gLS_pixel[ityp].first.c_str());
111  outfile << line << endl;
112  }
113  for (int ityp = 0; ityp < 4; ityp++) {
114  sprintf(line, " SiStrip %*sSummary: %s", 13, cert_strip[ityp].c_str(), gLS_strip[ityp].first.c_str());
115  outfile << line << endl;
116  }
117  for (int ityp = 0; ityp < 1; ityp++) {
118  sprintf(line, " Tracking %*sSummary: %s", 13, cert_track[ityp].c_str(), gLS_track[ityp].first.c_str());
119  outfile << line << endl;
120  }
121 
122  outfile << "\nBAD Lumisections:" << endl;
123  for (int ityp = 0; ityp < 4; ityp++) {
124  sprintf(line, " Pixel %*sSummary: %s", 13, cert_pixel[ityp].c_str(), bLS_pixel[ityp].first.c_str());
125  outfile << line << endl;
126  }
127  for (int ityp = 0; ityp < 4; ityp++) {
128  sprintf(line, " SiStrip %*sSummary: %s", 13, cert_strip[ityp].c_str(), bLS_strip[ityp].first.c_str());
129  outfile << line << endl;
130  }
131  for (int ityp = 0; ityp < 1; ityp++) {
132  sprintf(line, " Tracking %*sSummary: %s", 13, cert_track[ityp].c_str(), bLS_track[ityp].first.c_str());
133  outfile << line << endl;
134  }
135 
136  outfile << "\nMISSING Lumisections:" << endl;
137  for (int ityp = 0; ityp < 4; ityp++) {
138  sprintf(line, " Pixel %*sSummary: %s", 13, cert_pixel[ityp].c_str(), mLS_pixel[ityp].first.c_str());
139  outfile << line << endl;
140  }
141  for (int ityp = 0; ityp < 4; ityp++) {
142  sprintf(line, " SiStrip %*sSummary: %s", 13, cert_strip[ityp].c_str(), mLS_strip[ityp].first.c_str());
143  outfile << line << endl;
144  }
145  for (int ityp = 0; ityp < 1; ityp++) {
146  sprintf(line, " Tracking %*sSummary: %s", 13, cert_track[ityp].c_str(), mLS_track[ityp].first.c_str());
147  outfile << line << endl;
148  }
149 
150  outfile.close();
151  std::cout << "Lumisection Certification summary saved in " << namefile << std::endl;
152 
153  cert_plot(threshold_pixel, threshold, filename, cert_strip, cert_track, cert_pixel, gLS_strip, gLS_track, gLS_pixel);
154 }

References cert_plot(), gather_cfg::cout, corrVsCorr::filename, dqmdumpme::first, mps_splice::line, ls_cert_type(), numlumis, timingPdfMaker::outfile, runnum_str(), remoteMonitoring_LED_IterMethod_cfg::threshold, and trackerHitRTTI::vector.

Referenced by main().

◆ ls_cert_type()

void ls_cert_type ( string  iDir,
float  threshold,
string  filename,
vector< string > &  cert,
vector< pair< string, vector< float > > > &  gLS,
vector< pair< string, vector< float > > > &  bLS,
vector< pair< string, vector< float > > > &  mLS 
)

Definition at line 156 of file ls_cert.cc.

162  {
163  void Cleaning(vector<int>&);
164  string ListOut(vector<int>&);
165 
166  bool debug = false;
167  string run = runnum_str(filename);
168  if (debug)
169  std::cout << filename.c_str() << std::endl;
170 
171  TDirectory* topDir;
172  vector<float> ls;
173 
174  TFile* file = TFile::Open(filename.c_str());
175  if (!file->IsOpen()) {
176  std::cerr << "Failed to open " << filename << std::endl;
177  return;
178  }
179 
180  string dir = "DQMData/Run " + run + "/" + iDir;
181  topDir = dynamic_cast<TDirectory*>(file->Get(dir.c_str()));
182  topDir->cd();
183  if (debug)
184  std::cout << topDir->GetTitle() << std::endl;
185 
186  //
187  // Reading the LS directory
188  //
189  TIter next(topDir->GetListOfKeys());
190  TKey* key;
191  while ((key = dynamic_cast<TKey*>(next()))) {
192  string clName(key->GetClassName());
193  if (clName == "TDirectoryFile") {
194  TDirectory* curr_dir = dynamic_cast<TDirectory*>(key->ReadObj());
195  string name = curr_dir->GetName();
196  if (name == "Run summary")
197  continue;
198  name = name.substr(name.find('-') + 1);
199  float temp1 = atof(name.c_str());
200  ls.push_back(temp1);
201  }
202  }
203  sort(ls.begin(), ls.end());
204  int vecsize = ls.size();
205 
206  //
207  // Definition of vectors for LS certification
208  //
209  Float_t* lsd = new Float_t[vecsize];
210 
211  Float_t** v = new Float_t*[4];
212  for (int k = 0; k < 4; k++) {
213  v[k] = new Float_t[vecsize];
214  }
215  //string certflag[4] = {"CertificationSummary","DAQSummary","DCSSummary","reportSummary"};
216  //string certflagPrint[4] = {"Certification","DAQ","DCS","DQM"};
217  string certflag[4] = {"DAQSummary", "DCSSummary", "reportSummary", "CertificationSummary"};
218  string certflagPrint[4] = {"DAQ", "DCS", "DQM", "Certification"};
219 
220  int smax = 2;
221  if (iDir == "SiStrip" || iDir == "Pixel")
222  smax = 4;
223 
224  if (iDir == "Tracking") {
225  certflag[0] = "CertificationSummary";
226  certflagPrint[0] = "Certification";
227  certflag[1] = "reportSummary";
228  certflagPrint[1] = "DQM";
229  }
230 
231  for (int icert_type = 0; icert_type < smax; icert_type++) {
232  cert.push_back(certflagPrint[icert_type]);
233  }
234 
235  if (debug)
236  std::cout << gDirectory->GetName() << std::endl;
237 
238  for (int i = 0; i < vecsize; i++) {
239  stringstream lsdir;
240  lsdir << dir << "/By Lumi Section " << ls[i] << "-" << ls[i] << "/EventInfo";
241  if (debug)
242  std::cout << lsdir.str().c_str() << std::endl;
243  float templs = ls[i];
244  lsd[i] = templs;
245  TDirectory* tempDir = dynamic_cast<TDirectory*>(file->Get(lsdir.str().c_str()));
246  tempDir->cd();
247  int j = 0;
248  TIter nextTemp(tempDir->GetListOfKeys());
249  TKey* keyTemp;
250  while ((keyTemp = dynamic_cast<TKey*>(nextTemp()))) {
251  float tempvalue = -1.;
252  string classname(keyTemp->GetClassName());
253  if (classname == "TObjString") {
254  string sflag = keyTemp->GetName();
255  string tempname = sflag.substr(sflag.find("f=") + 2);
256  size_t pos1 = tempname.find('<');
257  size_t pos2 = sflag.find_first_of('>');
258  string detvalue = tempname.substr(0, pos1);
259  string typecert = sflag.substr(1, pos2 - 1);
260  if (debug)
261  std::cout << typecert.c_str() << std::endl;
262  tempvalue = atof(detvalue.c_str());
263 
264  for (j = 0; j < smax; j++) {
265  if (strstr(typecert.c_str(), certflag[j].c_str()) != nullptr)
266  v[j][i] = tempvalue;
267  if (debug)
268  std::cout << "Entering value " << tempvalue << " " << v[j][i] << " for " << certflag[j].c_str()
269  << std::endl;
270  }
271  j = j + 1;
272  }
273  }
274  }
275 
276  int nLS_run = nlumis(filename);
277 
278  for (int iS = 0; iS < smax; iS++) {
279  vector<int> goodLS;
280  vector<int> badLS;
281  vector<int> missingLS;
282  vector<float> allLSthr;
283 
284  //loop over all available lumisections and fill good/bad lists
285  for (int iLS = 0; iLS < vecsize; iLS++) {
286  if (v[iS][iLS] >= threshold)
287  goodLS.push_back(lsd[iLS]);
288  else if (v[iS][iLS] > -1) //protect from flagging non-tested LS as bad
289  badLS.push_back(lsd[iLS]);
290  }
291 
292  int last_idx = 0;
293  for (int i_ls = 1; i_ls <= nLS_run; i_ls++) {
294  for (int j = last_idx; j < vecsize; j++) {
295  if (lsd[j] == i_ls) {
296  last_idx = j + 1;
297  if (v[iS][j] == 0)
298  allLSthr.push_back(0.00001);
299  else
300  allLSthr.push_back(v[iS][j]);
301  break;
302  }
303  if (lsd[j] > i_ls) {
304  last_idx = j;
305  missingLS.push_back(i_ls);
306  allLSthr.push_back(-1);
307  break;
308  }
309  }
310  }
311 
312  Cleaning(goodLS);
313  Cleaning(badLS);
314  Cleaning(missingLS);
315 
316  string goodList = ListOut(goodLS);
317  string badList = ListOut(badLS);
318  string missingList = ListOut(missingLS);
319 
320  //save lumisections for this certification type
321  gLS.push_back(make_pair(goodList, allLSthr));
322  bLS.push_back(make_pair(badList, allLSthr));
323  mLS.push_back(make_pair(missingList, allLSthr));
324  }
325 }

References EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr, data-class-funcs::classname, Cleaning(), gather_cfg::cout, debug, DeadROC_duringRun::dir, FrontierConditions_GlobalTag_cff::file, corrVsCorr::filename, mps_fire::i, dqmiolumiharvest::j, dqmdumpme::k, crabWrapper::key, ListOut(), eostools::ls(), Skims_PA_cff::name, GetRecoTauVFromDQM_MC_cff::next, nlumis(), writedatasetfile::run, runnum_str(), remoteMonitoring_LED_IterMethod_cfg::threshold, and findQualityFiles::v.

Referenced by ls_cert().

◆ main()

int main ( int  argc,
char *  argv[] 
)

===============================================================================================================================================================================================


variant2: for each run define phi-averaged A for normalization channel (Dref,16) and then, divide Rijk on it, i.e. get RRijk

eta=27

eta=25

eta=23

eta=22

eta=21

eta=26

eta=24

eta=19

eta=17

eta=25

eta=23

eta=22

eta=21

eta=26

eta=24

eta=20

eta=19

eta=18

eta=27 L1=1

eta=25 L1=1

eta=23 L1=1

eta=22 L1=1

eta=21 L1=1

eta=29 L1=1

eta=26 L1=1

eta=24 L1=1

eta=20 L1=1

eta=19 L1=1

eta=18 L1=1

eta=17 L1=1

eta=28 L7=1

eta=27 L7=1

eta=25 L7=1

eta=23 L7=1

eta=22 L7=1

eta=21 L7=1

eta=26 L7=1

eta=24 L7=1

eta=20 L7=1

eta=19 L7=1

eta=18 L7=1

eta=17 L7=1

eta=27

eta=25

eta=23

eta=22

eta=21

eta=26

eta=24

eta=19

eta=17

eta=25

eta=23

eta=22

eta=21

eta=26

eta=24

eta=20

eta=19

eta=18

eta=27 L1=1

eta=25 L1=1

eta=23 L1=1

eta=22 L1=1

eta=21 L1=1

eta=26 L1=1

eta=24 L1=1

eta=20 L1=1

eta=19 L1=1

eta=18 L1=1

eta=17 L1=1

eta=28 L7=1

eta=27 L7=1

eta=25 L7=1

eta=23 L7=1

eta=22 L7=1

eta=21 L7=1

eta=26 L7=1

eta=24 L7=1

eta=20 L7=1

eta=19 L7=1

eta=18 L7=1

eta=17 L7=1

eta=27

eta=28

errA with average Amplitudes

errA with average Amplitudes

errA with average Amplitudes

errA with average Amplitudes

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

RBX:

errA with average Amplitudes

errA with average Amplitudes

errA with average Amplitudes

errA with average Amplitudes

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

RBX:

errA with average Amplitudes

errA with average Amplitudes

errA with average Amplitudes

errA with average Amplitudes

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

RBX:

Prepare maps of good/bad channels:

Prepare maps of good/bad channels:

Definition at line 32 of file ls_cert.cc.

32  {
33  if (argc == 4) {
34  char* cpixel = argv[1];
35  char* cthr = argv[2];
36  char* filename = argv[3];
37 
38  float threshold_pixel = 0;
39  sscanf(cpixel, "%f", &threshold_pixel);
40  float threshold = 0;
41  sscanf(cthr, "%f", &threshold);
42 
43  std::cout << "ready to run ls_cert: pixel thr " << threshold_pixel << " threshold " << threshold << " filename "
44  << filename << std::endl;
45 
46  ls_cert(threshold_pixel, threshold, filename);
47 
48  } else {
49  std::cout << "Too few arguments: " << argc << std::endl;
50  return -1;
51  }
52  return 0;
53 }

References dir2webdir::argc, cmsBatch::argv, gather_cfg::cout, corrVsCorr::filename, ls_cert(), and remoteMonitoring_LED_IterMethod_cfg::threshold.

◆ nlumis()

int nlumis ( string  filename)

Definition at line 439 of file ls_cert.cc.

439  {
440  if (numlumis > -1)
441  return numlumis;
442 
443  //TDirectory* topDir;
444  vector<float> ls;
445 
446  TFile* file = TFile::Open(filename.c_str());
447  if (!file->IsOpen()) {
448  std::cerr << "Failed to open " << filename << std::endl;
449  return -1;
450  }
451 
452  string run = runnum_str(filename);
453 
454  //check if HIRun or pp run
455  bool isHIRun = false;
456  if (filename.find("HIRun") != string::npos)
457  isHIRun = true;
458 
459  //valid up to the end of 2011 pp collisions
460  if (!isHIRun) {
461  string EventInfoDir = "DQMData/Run " + run + "/SiStrip/Run summary/EventInfo";
462  TDirectory* rsEventInfoDir = dynamic_cast<TDirectory*>(file->Get(EventInfoDir.c_str()));
463  rsEventInfoDir->cd();
464  TIter eiKeys(rsEventInfoDir->GetListOfKeys());
465  TKey* eiKey;
466  while ((eiKey = dynamic_cast<TKey*>(eiKeys()))) {
467  string classname(eiKey->GetClassName());
468  if (classname == "TObjString") {
469  string sflag = eiKey->GetName();
470  string tempname = sflag.substr(sflag.find("i=") + 2);
471  size_t pos1 = tempname.find('<');
472  size_t pos2 = sflag.find_first_of('>');
473  string detvalue = tempname.substr(0, pos1);
474  string numlumisec = sflag.substr(1, pos2 - 1);
475  if (numlumisec == (string) "iLumiSection") {
476  numlumis = atoi(detvalue.c_str());
477  break;
478  }
479  }
480  }
481  } else {
482  //valid since 2011 HI running (iLumiSection variable not there anymore)
483  string EventInfoDirHist = "DQMData/Run " + run + "/Info/Run summary/EventInfo/ProcessedLS";
484  TH1F* allLS = (TH1F*)file->Get(EventInfoDirHist.c_str());
485  numlumis = allLS->GetEntries() - 1;
486  delete allLS;
487  }
488 
489  return numlumis;
490 }

References EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr, data-class-funcs::classname, FrontierConditions_GlobalTag_cff::file, corrVsCorr::filename, eostools::ls(), numlumis, writedatasetfile::run, and runnum_str().

Referenced by cert_plot(), and ls_cert_type().

◆ runnum_str()

string runnum_str ( string  filename)

Definition at line 492 of file ls_cert.cc.

492 { return filename.substr(filename.find("_R000") + 5, 6); }

References corrVsCorr::filename.

Referenced by cert_plot(), ls_cert(), ls_cert_type(), and nlumis().

Variable Documentation

◆ numlumis

int numlumis = -1

Definition at line 26 of file ls_cert.cc.

Referenced by ls_cert(), and nlumis().

eostools.ls
def ls(path, rec=False)
Definition: eostools.py:349
cmsBatch.argv
argv
Definition: cmsBatch.py:279
mps_fire.i
i
Definition: mps_fire.py:428
ls_cert
void ls_cert(float threshold_pixel, float threshold, string filename)
Definition: ls_cert.cc:55
dir2webdir.argc
argc
Definition: dir2webdir.py:39
ListOut
string ListOut(vector< int > &LSlist)
Definition: ls_cert.cc:511
gather_cfg.cout
cout
Definition: gather_cfg.py:144
nlumis
int nlumis(string filename)
Definition: ls_cert.cc:439
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:222
findQualityFiles.v
v
Definition: findQualityFiles.py:179
dqmdumpme.first
first
Definition: dqmdumpme.py:55
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
cc
data-class-funcs.classname
classname
Definition: data-class-funcs.py:33
debug
#define debug
Definition: HDRShower.cc:19
corrVsCorr.filename
filename
Definition: corrVsCorr.py:123
dqmdumpme.k
k
Definition: dqmdumpme.py:60
runnum_str
string runnum_str(string filename)
Definition: ls_cert.cc:492
FrontierConditions_GlobalTag_cff.file
file
Definition: FrontierConditions_GlobalTag_cff.py:13
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
cert_plot
void cert_plot(float threshold_pixel, float threshold, string filename, vector< string > &cert_strip, vector< string > &cert_track, vector< string > &cert_pixel, vector< pair< string, vector< float > > > &LS_strip, vector< pair< string, vector< float > > > &LS_track, vector< pair< string, vector< float > > > &LS_pixel)
Definition: ls_cert.cc:327
SiStripPI::palette
palette
Definition: SiStripPayloadInspectorHelper.h:786
writedatasetfile.run
run
Definition: writedatasetfile.py:27
ls_cert_type
void ls_cert_type(string iDir, float threshold, string filename, vector< string > &cert, vector< pair< string, vector< float > > > &gLS, vector< pair< string, vector< float > > > &bLS, vector< pair< string, vector< float > > > &mLS)
Definition: ls_cert.cc:156
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
numlumis
int numlumis
Definition: ls_cert.cc:26
Cleaning
void Cleaning(vector< int > &LSlist)
Definition: ls_cert.cc:494
timingPdfMaker.outfile
outfile
Definition: timingPdfMaker.py:351
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
svgfig.rgb
def rgb(r, g, b, maximum=1.)
Definition: svgfig.py:40
remoteMonitoring_LED_IterMethod_cfg.threshold
threshold
Definition: remoteMonitoring_LED_IterMethod_cfg.py:426
mps_splice.line
line
Definition: mps_splice.py:76
crabWrapper.key
key
Definition: crabWrapper.py:19
EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.cerr
cerr
Definition: EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.py:8
label
const char * label
Definition: PFTauDecayModeTools.cc:11
GetRecoTauVFromDQM_MC_cff.next
next
Definition: GetRecoTauVFromDQM_MC_cff.py:31
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23