CMS 3D CMS Logo

DMRtrends.cc
Go to the documentation of this file.
1 #include <iostream>
2 #include <string>
3 #include <vector>
4 #include <algorithm>
5 #include <map>
6 #include <iomanip>
7 #include <experimental/filesystem>
8 #include "TPad.h"
9 #include "TCanvas.h"
10 #include "TGraph.h"
11 #include "TGraphErrors.h"
12 #include "TMultiGraph.h"
13 #include "TH1.h"
14 #include "THStack.h"
15 #include "TROOT.h"
16 #include "TFile.h"
17 #include "TColor.h"
18 #include "TLegend.h"
19 #include "TLegendEntry.h"
20 #include "TMath.h"
21 #include "TRegexp.h"
22 #include "TPaveLabel.h"
23 #include "TPaveText.h"
24 #include "TStyle.h"
25 #include "TLine.h"
26 #include "Alignment/OfflineValidation/plugins/ColorParser.C"
27 
28 using namespace std;
29 namespace fs = std::experimental::filesystem;
30 
34 #define DUMMY -999.
35 
38 #define lumiFactor 1000.
39 
42 #define DMRFactor 10000.
43 
57 struct Point {
58  float run, scale, mu, sigma, muplus, muminus, sigmaplus, sigmaminus;
59 
63  Point(float Run = DUMMY,
64  float ScaleFactor = DMRFactor,
65  float y1 = DUMMY,
66  float y2 = DUMMY,
67  float y3 = DUMMY,
68  float y4 = DUMMY,
69  float y5 = DUMMY,
70  float y6 = DUMMY)
71  : run(Run), scale(ScaleFactor), mu(y1), sigma(y2), muplus(y3), muminus(y5), sigmaplus(y4), sigmaminus(y6) {}
72 
76  Point(float Run, float ScaleFactor, TH1 *histo, TH1 *histoplus, TH1 *histominus)
77  : Point(Run,
78  ScaleFactor,
79  histo->GetMean(),
80  histo->GetMeanError(),
81  histoplus->GetMean(),
82  histoplus->GetMeanError(),
83  histominus->GetMean(),
84  histominus->GetMeanError()) {}
85 
89  Point(float Run, float ScaleFactor, TH1 *histo) : Point(Run, ScaleFactor, histo->GetMean(), histo->GetMeanError()) {}
90 
91  Point &operator=(const Point &p) {
92  run = p.run;
93  mu = p.mu;
94  muplus = p.muplus;
95  muminus = p.muminus;
96  sigma = p.sigma;
97  sigmaplus = p.sigmaplus;
98  sigmaminus = p.sigmaminus;
99  return *this;
100  }
101 
102  float GetRun() const { return run; }
103  float GetMu() const { return scale * mu; }
104  float GetMuPlus() const { return scale * muplus; }
105  float GetMuMinus() const { return scale * muminus; }
106  float GetSigma() const { return scale * sigma; }
107  float GetSigmaPlus() const { return scale * sigmaplus; }
108  float GetSigmaMinus() const { return scale * sigmaminus; }
109  float GetDeltaMu() const {
110  if (muplus == DUMMY && muminus == DUMMY)
111  return DUMMY;
112  else
113  return scale * (muplus - muminus);
114  }
115  float GetSigmaDeltaMu() const {
116  if (sigmaplus == DUMMY && sigmaminus == DUMMY)
117  return DUMMY;
118  else
119  return scale * hypot(sigmaplus, sigmaminus);
120  };
121 };
122 
126 
127 TString getName(TString structure, int layer, TString geometry);
128 TH1F *ConvertToHist(TGraphErrors *g);
129 const map<TString, int> numberOfLayers(TString Year = "2018");
130 vector<int> runlistfromlumifile(TString Year = "2018");
131 bool checkrunlist(vector<int> runs, vector<int> IOVlist = {}, TString Year = "2018");
132 TString lumifileperyear(TString Year = "2018", string RunOrIOV = "IOV");
133 void scalebylumi(TGraphErrors *g, vector<pair<int, double>> lumiIOVpairs);
134 vector<pair<int, double>> lumiperIOV(vector<int> IOVlist, TString Year = "2018");
135 double getintegratedlumiuptorun(int run, TString Year = "2018", double min = 0.);
136 void PixelUpdateLines(TCanvas *c,
137  TString Year = "2018",
138  bool showlumi = false,
139  vector<int> pixelupdateruns = {314881, 316758, 317527, 318228, 320377});
140 void PlotDMRTrends(
141  vector<int> IOVlist,
142  TString Variable = "median",
143  vector<string> labels = {"MB"},
144  TString Year = "2018",
145  string myValidation = "/afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERALIGN/data/commonValidation/results/acardini/DMRs/",
146  vector<string> geometries = {"GT", "SG", "MP pix LBL", "PIX HLS+ML STR fix"},
147  vector<Color_t> colours = {kBlue, kRed, kGreen, kCyan},
148  TString outputdir =
149  "/afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERALIGN/data/commonValidation/alignmentObjects/acardini/DMRsTrends/",
150  bool pixelupdate = false,
151  vector<int> pixelupdateruns = {314881, 316758, 317527, 318228, 320377},
152  bool showlumi = false);
153 void compileDMRTrends(
154  vector<int> IOVlist,
155  TString Variable = "median",
156  vector<string> labels = {"MB"},
157  TString Year = "2018",
158  string myValidation = "/afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERALIGN/data/commonValidation/results/acardini/DMRs/",
159  vector<string> geometries = {"GT", "SG", "MP pix LBL", "PIX HLS+ML STR fix"},
160  bool showlumi = false,
161  bool FORCE = false);
162 void DMRtrends(
163  vector<int> IOVlist,
164  vector<string> Variables = {"median", "DrmsNR"},
165  vector<string> labels = {"MB"},
166  TString Year = "2018",
167  string myValidation = "/afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERALIGN/data/commonValidation/results/acardini/DMRs/",
168  vector<string> geometries = {"GT", "SG", "MP pix LBL", "PIX HLS+ML STR fix"},
169  vector<Color_t> colours = {kBlue, kRed, kGreen, kCyan},
170  TString outputdir =
171  "/afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERALIGN/data/commonValidation/alignmentObjects/acardini/DMRsTrends/",
172  bool pixelupdate = false,
173  vector<int> pixelupdateruns = {314881, 316758, 317527, 318228, 320377},
174  bool showlumi = false,
175  bool FORCE = false);
176 
183 class Geometry {
184 public:
185  vector<Point> points;
186 
187 private:
188  //template<typename T> vector<T> GetQuantity (T (Point::*getter)() const) const {
189  vector<float> GetQuantity(float (Point::*getter)() const) const {
190  vector<float> v;
191  for (Point point : points) {
192  float value = (point.*getter)();
193  v.push_back(value);
194  }
195  return v;
196  }
197 
198 public:
199  TString title;
200  Geometry() : title("") {}
201  Geometry(TString Title) : title(Title) {}
202  Geometry &operator=(const Geometry &geom) {
203  title = geom.title;
204  points = geom.points;
205  return *this;
206  }
207  void SetTitle(TString Title) { title = Title; }
208  TString GetTitle() { return title; }
209  vector<float> Run() const { return GetQuantity(&Point::GetRun); }
210  vector<float> Mu() const { return GetQuantity(&Point::GetMu); }
211  vector<float> MuPlus() const { return GetQuantity(&Point::GetMuPlus); }
212  vector<float> MuMinus() const { return GetQuantity(&Point::GetMuMinus); }
213  vector<float> Sigma() const { return GetQuantity(&Point::GetSigma); }
214  vector<float> SigmaPlus() const { return GetQuantity(&Point::GetSigmaPlus); }
215  vector<float> SigmaMinus() const { return GetQuantity(&Point::GetSigmaMinus); }
216  vector<float> DeltaMu() const { return GetQuantity(&Point::GetDeltaMu); }
217  vector<float> SigmaDeltaMu() const { return GetQuantity(&Point::GetSigmaDeltaMu); }
218  //vector<float> Graph (string variable) const {
219  // };
220 };
221 
223 //struct Layer {
224 // map<string,Geometry> geometries;
225 //};
226 //
227 //struct HLS {
228 // vector<Layer> layers;
229 // map<string,Geometry> geometries;
230 //};
231 
236 TString getName(TString structure, int layer, TString geometry) {
237  geometry.ReplaceAll(" ", "_");
238  TString name = geometry + "_" + structure;
239  if (layer != 0) {
240  if (structure == "TID" || structure == "TEC")
241  name += "_disc";
242  else
243  name += "_layer";
244  name += layer;
245  }
246 
247  return name;
248 };
249 
254 const map<TString, int> numberOfLayers(TString Year) {
255  if (Year == "2016")
256  return {{"BPIX", 3}, {"FPIX", 2}, {"TIB", 4}, {"TID", 3}, {"TOB", 6}, {"TEC", 9}};
257  else
258  return {{"BPIX", 4}, {"FPIX", 3}, {"TIB", 4}, {"TID", 3}, {"TOB", 6}, {"TEC", 9}};
259 }
260 
262 
267 TString lumifileperyear(TString Year, string RunOrIOV) {
268  TString LumiFile = std::getenv("CMSSW_BASE");
269  LumiFile += "/src/Alignment/OfflineValidation/data/lumiper";
270  if (RunOrIOV != "run" && RunOrIOV != "IOV") {
271  cout << "ERROR: Please specify \"run\" or \"IOV\" to retrieve the luminosity run by run or for each IOV" << endl;
272  exit(EXIT_FAILURE);
273  }
274  LumiFile += RunOrIOV;
275  if (Year != "2016" && Year != "2017" && Year != "2018") {
276  cout << "ERROR: Only 2016, 2017 and 2018 lumi-per-run files are available, please check!" << endl;
277  exit(EXIT_FAILURE);
278  }
279  LumiFile += Year;
280  LumiFile += ".txt";
281  return LumiFile;
282 };
283 
288 vector<int> runlistfromlumifile(TString Year) {
289  TString filename = lumifileperyear(Year, "run");
290  fs::path path(filename.Data());
291  if (fs::is_empty(path)) {
292  cout << "ERROR: Empty file " << path.c_str() << endl;
293  exit(EXIT_FAILURE);
294  }
295  TGraph *scale = new TGraph(filename.Data());
296  double *xscale = scale->GetX();
297  size_t N = scale->GetN();
298  vector<int> runs;
299  for (size_t i = 0; i < N; i++)
300  runs.push_back(xscale[i]);
301  return runs;
302 }
303 
308 bool checkrunlist(vector<int> runs, vector<int> IOVlist, TString Year) {
309  vector<int> runlist = runlistfromlumifile(Year);
310  vector<int> missingruns; //runs for which the luminosity is not found
311  vector<int> lostruns; //IOVs for which the DMR were not found
312  bool problemfound = false;
313  for (int run : IOVlist) {
314  if (find(runlist.begin(), runlist.end(), run) == runlist.end()) {
315  problemfound = true;
316  missingruns.push_back(run);
317  }
318  }
319  if (!IOVlist.empty())
320  for (int IOV : IOVlist) {
321  if (find(runs.begin(), runs.end(), IOV) == runs.end()) {
322  problemfound = true;
323  lostruns.push_back(IOV);
324  }
325  }
326  std::sort(missingruns.begin(), missingruns.end());
327  if (problemfound) {
328  if (!lostruns.empty()) {
329  cout << "WARNING: some IOVs where not found among the list of available DMRs" << endl
330  << "List of missing IOVs:" << endl;
331  for (int lostrun : lostruns)
332  cout << to_string(lostrun) << " ";
333  cout << endl;
334  }
335  if (!missingruns.empty()) {
336  cout << "WARNING: some IOVs are missing in the run/luminosity txt file" << endl
337  << "List of missing runs:" << endl;
338  for (int missingrun : missingruns)
339  cout << to_string(missingrun) << " ";
340  cout << endl;
341  }
342  }
343  return problemfound;
344 }
345 
350 void DMRtrends(vector<int> IOVlist,
351  vector<string> Variables,
352  vector<string> labels,
353  TString Year,
354  string myValidation,
355  vector<string> geometries,
356  vector<Color_t> colours,
357  TString outputdir,
358  bool pixelupdate,
359  vector<int> pixelupdateruns,
360  bool showlumi,
361  bool FORCE) {
362  fs::path path(outputdir.Data());
363  if (!(fs::exists(path))) {
364  cout << "WARNING: Output directory (" << outputdir.Data() << ") not found, it will be created automatically!"
365  << endl;
366  // exit(EXIT_FAILURE);
367  fs::create_directory(path);
368  if (!(fs::exists(path))) {
369  cout << "ERROR: Output directory (" << outputdir.Data() << ") has not been created!" << endl
370  << "At least the parent directory needs to exist, please check!" << endl;
371  exit(EXIT_FAILURE);
372  }
373  }
374  for (const auto &Variable : Variables) {
375  compileDMRTrends(IOVlist, Variable, labels, Year, myValidation, geometries, showlumi, FORCE);
376  cout << "Begin plotting" << endl;
377  PlotDMRTrends(IOVlist,
378  Variable,
379  labels,
380  Year,
381  myValidation,
382  geometries,
383  colours,
384  outputdir,
385  pixelupdate,
386  pixelupdateruns,
387  showlumi);
388  }
389 };
390 
395 void compileDMRTrends(vector<int> IOVlist,
396  TString Variable,
397  vector<string> labels,
398  TString Year,
399  string myValidation,
400  vector<string> geometries,
401  bool showlumi,
402  bool FORCE) {
403  gROOT->SetBatch();
404  vector<int> RunNumbers;
405  vector<TString> filenames;
406  TRegexp regexp("[0-9][0-9][0-9][0-9][0-9][0-9]");
407  for (const auto &entry : fs::recursive_directory_iterator(myValidation)) {
408  bool found_all_labels = true;
409  for (const string &label : labels) {
410  if (entry.path().string().find(label) == std::string::npos)
411  found_all_labels = false;
412  }
413  if ((entry.path().string().find("ExtendedOfflineValidation_Images/OfflineValidationSummary.root") !=
414  std::string::npos) &&
415  found_all_labels) {
416  if (fs::is_empty(entry.path()))
417  cout << "ERROR: Empty file " << entry.path() << endl;
418  else {
419  TString filename(entry.path().string());
420  filenames.push_back(filename);
421  TString runstring(filename(regexp));
422  if (runstring.IsFloat()) {
423  int runN = runstring.Atoi();
424  RunNumbers.push_back(runN);
425  }
426  }
427  }
428  }
429  if (RunNumbers.empty()) {
430  cout << "ERROR: No available DMRs found!" << endl
431  << "Please check that the OfflineValidationSummary.root file is in any directory where the DMR per IOV have "
432  "been stored!"
433  << endl;
434  exit(EXIT_FAILURE);
435  } else if (checkrunlist(RunNumbers, IOVlist, Year)) {
436  cout << "Please check the DMRs that have been produced!" << endl;
437  if (!FORCE)
438  exit(EXIT_FAILURE);
439  }
440 
441  vector<TString> structures{"BPIX", "BPIX_y", "FPIX", "FPIX_y", "TIB", "TID", "TOB", "TEC"};
442 
443  const map<TString, int> nlayers = numberOfLayers(Year);
444 
445  float ScaleFactor = DMRFactor;
446  if (Variable == "DrmsNR")
447  ScaleFactor = 1;
448 
449  map<pair<pair<TString, int>, TString>, Geometry> mappoints; // pair = (structure, layer), geometry
450 
451  std::sort(filenames.begin(), filenames.end()); //order the files in alphabetical order
452  for (const TString &filename : filenames) {
453  int runN;
454  TString runstring(filename(regexp));
455  if (runstring.IsFloat()) {
456  runN = runstring.Atoi();
457  } else {
458  cout << "ERROR: run number not retrieved for file " << filename << endl;
459  continue;
460  }
461 
462  TFile *f = new TFile(filename, "READ");
463 
464  for (TString &structure : structures) {
465  TString structname = structure;
466  structname.ReplaceAll("_y", "");
467  size_t layersnumber = nlayers.at(structname);
468  for (size_t layer = 0; layer <= layersnumber; layer++) {
469  for (const string &geometry : geometries) {
470  TString name = Variable + "_" + getName(structure, layer, geometry);
471  TH1F *histo = dynamic_cast<TH1F *>(f->Get(name));
472  //Geometry *geom =nullptr;
473  Point *point = nullptr;
474  // Three possibilities:
475  // - All histograms are produced correctly
476  // - Only the non-split histograms are produced
477  // - No histogram is produced correctly
478  // FORCE means that the Point is not added to the points collection in the chosen geometry for that structure
479  // If FORCE is not enabled a default value for the Point is used (-9999) which will appear in the plots
480  if (!histo) {
481  cout << "Run" << runN << " Histogram: " << name << " not found" << endl;
482  if (FORCE)
483  continue;
484  point = new Point(runN, ScaleFactor);
485  } else if (structure != "TID" && structure != "TEC") {
486  TH1F *histoplus = dynamic_cast<TH1F *>(f->Get((name + "_plus")));
487  TH1F *histominus = dynamic_cast<TH1F *>(f->Get((name + "_minus")));
488  if (!histoplus || !histominus) {
489  cout << "Run" << runN << " Histogram: " << name << " plus or minus not found" << endl;
490  if (FORCE)
491  continue;
492  point = new Point(runN, ScaleFactor, histo);
493  } else
494  point = new Point(runN, ScaleFactor, histo, histoplus, histominus);
495 
496  } else
497  point = new Point(runN, ScaleFactor, histo);
498  mappoints[make_pair(make_pair(structure, layer), geometry)].points.push_back(*point);
499  }
500  }
501  }
502  f->Close();
503  }
504  TString outname = myValidation + "DMRtrends";
505  for (const auto &label : labels) {
506  outname += "_";
507  outname += label;
508  }
509  outname += ".root";
510  cout << outname << endl;
511  TFile *fout = TFile::Open(outname, "RECREATE");
512  for (TString &structure : structures) {
513  TString structname = structure;
514  structname.ReplaceAll("_y", "");
515  size_t layersnumber = nlayers.at(structname);
516  for (size_t layer = 0; layer <= layersnumber; layer++) {
517  for (const string &geometry : geometries) {
518  TString name = Variable + "_" + getName(structure, layer, geometry);
519  Geometry geom = mappoints[make_pair(make_pair(structure, layer), geometry)];
520  using Trend = vector<float> (Geometry::*)() const;
521  vector<Trend> trends{&Geometry::Mu,
529  vector<TString> variables{
530  "mu", "sigma", "muplus", "sigmaplus", "muminus", "sigmaminus", "deltamu", "sigmadeltamu"};
531  vector<float> runs = geom.Run();
532  size_t n = runs.size();
533  vector<float> emptyvec;
534  for (size_t i = 0; i < runs.size(); i++)
535  emptyvec.push_back(0.);
536  for (size_t iVar = 0; iVar < variables.size(); iVar++) {
537  Trend trend = trends.at(iVar);
538  TGraphErrors *g = new TGraphErrors(n, runs.data(), (geom.*trend)().data(), emptyvec.data(), emptyvec.data());
539  g->SetTitle(geometry.c_str());
540  g->Write(name + "_" + variables.at(iVar));
541  }
542  vector<pair<Trend, Trend>> trendspair{make_pair(&Geometry::Mu, &Geometry::Sigma),
546  vector<pair<TString, TString>> variablepairs{make_pair("mu", "sigma"),
547  make_pair("muplus", "sigmaplus"),
548  make_pair("muminus", "sigmaminus"),
549  make_pair("deltamu", "sigmadeltamu")};
550  for (size_t iVar = 0; iVar < variablepairs.size(); iVar++) {
551  Trend meantrend = trendspair.at(iVar).first;
552  Trend sigmatrend = trendspair.at(iVar).second;
553  TGraphErrors *g = new TGraphErrors(
554  n, runs.data(), (geom.*meantrend)().data(), emptyvec.data(), (geom.*sigmatrend)().data());
555  g->SetTitle(geometry.c_str());
556  TString graphname = name + "_" + variablepairs.at(iVar).first;
557  graphname += variablepairs.at(iVar).second;
558  g->Write(graphname);
559  }
560  }
561  }
562  }
563  fout->Close();
564 }
565 
569 void PixelUpdateLines(TCanvas *c, TString Year, bool showlumi, vector<int> pixelupdateruns) {
570  vector<TPaveText *> labels;
571  double lastlumi = 0.;
572  c->cd();
573  size_t index = 0;
574  for (int pixelupdaterun : pixelupdateruns) {
575  double lumi = 0.;
576  if (showlumi)
578  pixelupdaterun,
579  Year); //The vertical line needs to be drawn at the beginning of the run where the pixel update was implemented, thus only the integrated luminosity up to that run is required.
580  else
581  lumi = pixelupdaterun;
582  TLine *line = new TLine(lumi, c->GetUymin(), lumi, c->GetUymax());
583  line->SetLineColor(kBlue);
584  line->SetLineStyle(9);
585  line->Draw();
586  //Due to the way the coordinates within the Canvas are set, the following steps are required to draw the TPaveText:
587  // Compute the gPad coordinates in TRUE normalized space (NDC)
588  int ix1;
589  int ix2;
590  int iw = gPad->GetWw();
591  int ih = gPad->GetWh();
592  double x1p, y1p, x2p, y2p;
593  gPad->GetPadPar(x1p, y1p, x2p, y2p);
594  ix1 = (Int_t)(iw * x1p);
595  ix2 = (Int_t)(iw * x2p);
596  double wndc = TMath::Min(1., (double)iw / (double)ih);
597  double rw = wndc / (double)iw;
598  double x1ndc = (double)ix1 * rw;
599  double x2ndc = (double)ix2 * rw;
600  // Ratios to convert user space in TRUE normalized space (NDC)
601  double rx1, ry1, rx2, ry2;
602  gPad->GetRange(rx1, ry1, rx2, ry2);
603  double rx = (x2ndc - x1ndc) / (rx2 - rx1);
604  double _sx;
605  // Left limit of the TPaveText
606  _sx = rx * (lumi - rx1) + x1ndc;
607  // To avoid an overlap between the TPaveText a vertical shift is done when the IOVs are too close
608  if (_sx < lastlumi) {
609  index++;
610  } else
611  index = 0;
612  TPaveText *box = new TPaveText(_sx + 0.0015, 0.86 - index * 0.04, _sx + 0.035, 0.89 - index * 0.04, "blNDC");
613  box->SetFillColor(10);
614  box->SetBorderSize(1);
615  box->SetLineColor(kBlack);
616  TText *textRun = box->AddText(Form("%i", int(pixelupdaterun)));
617  textRun->SetTextSize(0.025);
618  labels.push_back(box);
619  lastlumi = _sx + 0.035;
620 
621  gPad->RedrawAxis();
622  }
623  //Drawing in a separate loop to ensure that the labels are drawn on top of the lines
624  for (auto label : labels) {
625  label->Draw("same");
626  }
627  c->Update();
628 }
629 
634 double getintegratedlumiuptorun(int run, TString Year, double min) {
635  TGraph *scale = new TGraph((lumifileperyear(Year, "run")).Data());
636  int Nscale = scale->GetN();
637  double *xscale = scale->GetX();
638  double *yscale = scale->GetY();
639 
640  double lumi = min;
641  int index = -1;
642  for (int j = 0; j < Nscale; j++) {
643  lumi += yscale[j];
644  if (run >= xscale[j]) {
645  index = j;
646  continue;
647  }
648  }
649  lumi = min;
650  for (int j = 0; j < index; j++)
651  lumi += yscale[j] / lumiFactor;
652 
653  return lumi;
654 }
659 void scalebylumi(TGraphErrors *g, vector<pair<int, double>> lumiIOVpairs) {
660  size_t N = g->GetN();
661  vector<double> x, y, xerr, yerr;
662 
663  //TGraph * scale = new TGraph((lumifileperyear(Year,"IOV")).Data());
664  size_t Nscale = lumiIOVpairs.size();
665 
666  size_t i = 0;
667  while (i < N) {
668  double run, yvalue;
669  g->GetPoint(i, run, yvalue);
670  size_t index = -1;
671  for (size_t j = 0; j < Nscale; j++) {
672  if (run == (lumiIOVpairs.at(j)
673  .first)) { //If the starting run of an IOV is included in the list of IOVs, the index is stored
674  index = j;
675  continue;
676  } else if (run > (lumiIOVpairs.at(j).first))
677  continue;
678  }
679  if (lumiIOVpairs.at(index).second == 0 || index < 0.) {
680  N = N - 1;
681  g->RemovePoint(i);
682  } else {
683  double xvalue = 0.;
684  for (size_t j = 0; j < index; j++)
685  xvalue += lumiIOVpairs.at(j).second / lumiFactor;
686  x.push_back(xvalue + (lumiIOVpairs.at(index).second / (lumiFactor * 2.)));
687  if (yvalue <= DUMMY) {
688  y.push_back(DUMMY);
689  yerr.push_back(0.);
690  } else {
691  y.push_back(yvalue);
692  yerr.push_back(g->GetErrorY(i));
693  }
694  xerr.push_back(lumiIOVpairs.at(index).second / (lumiFactor * 2.));
695  i = i + 1;
696  }
697  }
698  g->GetHistogram()->Delete();
699  g->SetHistogram(nullptr);
700  for (size_t i = 0; i < N; i++) {
701  g->SetPoint(i, x.at(i), y.at(i));
702  g->SetPointError(i, xerr.at(i), yerr.at(i));
703  }
704 }
705 
710 vector<pair<int, double>> lumiperIOV(vector<int> IOVlist, TString Year) {
711  size_t N = IOVlist.size();
712  vector<pair<int, double>> lumiperIOV;
713  TGraph *scale = new TGraph((lumifileperyear(Year, "run")).Data());
714  size_t Nscale = scale->GetN();
715  double *xscale = scale->GetX();
716  double *yscale = scale->GetY();
717 
718  size_t i = 0;
719  size_t index = 0;
720  while (i <= N) {
721  double run = 0;
722  double lumi = 0.;
723  if (i != N)
724  run = IOVlist.at(i);
725  else
726  run = 0;
727  for (size_t j = index; j < Nscale; j++) {
728  if (run == xscale[j]) {
729  index = j;
730  break;
731  } else
732  lumi += yscale[j];
733  }
734  if (i == 0)
735  lumiperIOV.push_back(make_pair(0, lumi));
736  else
737  lumiperIOV.push_back(make_pair(IOVlist.at(i - 1), lumi));
738  ++i;
739  }
740  //for debugging:
741  double lumiInput = 0;
742  double lumiOutput = 0.;
743  for (size_t j = 0; j < Nscale; j++)
744  lumiInput += yscale[j];
745  //cout << "Total lumi: " << lumiInput <<endl;
746  for (size_t j = 0; j < lumiperIOV.size(); j++)
747  lumiOutput += lumiperIOV.at(j).second;
748  //cout << "Total lumi saved for IOVs: " << lumiOutput <<endl;
749  if (abs(lumiInput - lumiOutput) > 0.5) {
750  cout << "ERROR: luminosity retrieved for IOVs does not match the one for the runs" << endl
751  << "Please check that all IOV first runs are part of the run-per-lumi file!" << endl;
752  exit(EXIT_FAILURE);
753  }
754  return lumiperIOV;
755 }
756 
761 TH1F *ConvertToHist(TGraphErrors *g) {
762  size_t N = g->GetN();
763  double *x = g->GetX();
764  double *y = g->GetY();
765  double *xerr = g->GetEX();
766  vector<float> bins;
767  bins.push_back(x[0] - xerr[0]);
768  for (size_t i = 1; i < N; i++) {
769  if ((x[i - 1] + xerr[i - 1]) > (bins.back() + pow(10, -6)))
770  bins.push_back(x[i - 1] + xerr[i - 1]);
771  if ((x[i] - xerr[i]) > (bins.back() + pow(10, -6)))
772  bins.push_back(x[i] - xerr[i]);
773  }
774  bins.push_back(x[N - 1] + xerr[N - 1]);
775  TString histoname = "histo_";
776  histoname += g->GetName();
777  TH1F *histo = new TH1F(histoname, g->GetTitle(), bins.size() - 1, bins.data());
778  for (size_t i = 0; i < N; i++) {
779  histo->Fill(x[i], y[i]);
780  histo->SetBinError(histo->FindBin(x[i]), pow(10, -6));
781  }
782  return histo;
783 }
784 
789 void PlotDMRTrends(vector<int> IOVlist,
790  TString Variable,
791  vector<string> labels,
792  TString Year,
793  string myValidation,
794  vector<string> geometries,
795  vector<Color_t> colours,
796  TString outputdir,
797  bool pixelupdate,
798  vector<int> pixelupdateruns,
799  bool showlumi) {
801  checkrunlist(pixelupdateruns, {}, Year);
802  vector<TString> structures{"BPIX", "BPIX_y", "FPIX", "FPIX_y", "TIB", "TID", "TOB", "TEC"};
803 
804  const map<TString, int> nlayers = numberOfLayers(Year);
805 
806  vector<pair<int, double>> lumiIOVpairs;
807  if (showlumi)
808  lumiIOVpairs = lumiperIOV(IOVlist, Year);
809 
810  TString filename = myValidation + "DMRtrends";
811  for (const auto &label : labels) {
812  filename += "_";
813  filename += label;
814  }
815  filename += ".root";
816  cout << filename << endl;
817  TFile *in = new TFile(filename);
818  for (TString &structure : structures) {
819  TString structname = structure;
820  structname.ReplaceAll("_y", "");
821  int layersnumber = nlayers.at(structname);
822  for (int layer = 0; layer <= layersnumber; layer++) {
823  vector<TString> variables{"mu",
824  "sigma",
825  "muplus",
826  "sigmaplus",
827  "muminus",
828  "sigmaminus",
829  "deltamu",
830  "sigmadeltamu",
831  "musigma",
832  "muplussigmaplus",
833  "muminussigmaminus",
834  "deltamusigmadeltamu"};
835  vector<string> YaxisNames{
836  "#mu [#mum]",
837  "#sigma_{#mu} [#mum]",
838  "#mu outward [#mum]",
839  "#sigma_{#mu outward} [#mum]",
840  "#mu inward [#mum]",
841  "#sigma_{#mu inward} [#mum]",
842  "#Delta#mu [#mum]",
843  "#sigma_{#Delta#mu} [#mum]",
844  "#mu [#mum]",
845  "#mu outward [#mum]",
846  "#mu inward [#mum]",
847  "#Delta#mu [#mum]",
848  };
849  if (Variable == "DrmsNR")
850  YaxisNames = {
851  "RMS(x'_{pred}-x'_{hit} /#sigma)",
852  "#sigma_{RMS(x'_{pred}-x'_{hit} /#sigma)}",
853  "RMS(x'_{pred}-x'_{hit} /#sigma) outward",
854  "#sigma_{#mu outward}",
855  "RMS(x'_{pred}-x'_{hit} /#sigma) inward",
856  "#sigma_{RMS(x'_{pred}-x'_{hit} /#sigma) inward}",
857  "#DeltaRMS(x'_{pred}-x'_{hit} /#sigma)",
858  "#sigma_{#DeltaRMS(x'_{pred}-x'_{hit} /#sigma)}",
859  "RMS(x'_{pred}-x'_{hit} /#sigma)",
860  "RMS(x'_{pred}-x'_{hit} /#sigma) outward",
861  "RMS(x'_{pred}-x'_{hit} /#sigma) inward",
862  "#DeltaRMS(x'_{pred}-x'_{hit} /#sigma)",
863  };
864  //For debugging purposes we still might want to have a look at plots for a variable without errors, once ready for the PR those variables will be removed and the iterator will start from 0
865  for (size_t i = 0; i < variables.size(); i++) {
866  TString variable = variables.at(i);
867  if (variable.Contains("plus") || variable.Contains("minus") || variable.Contains("delta")) {
868  if (structname == "TEC" || structname == "TID")
869  continue; //Lorentz drift cannot appear in TEC and TID. These structures are skipped when looking at outward and inward pointing modules.
870  }
871  TCanvas *c = new TCanvas("dummy", "", 2000, 800);
872 
873  vector<Color_t>::iterator colour = colours.begin();
874 
875  TMultiGraph *mg = new TMultiGraph(structure, structure);
876  THStack *mh = new THStack(structure, structure);
877  size_t igeom = 0;
878  for (const string &geometry : geometries) {
879  TString name = Variable + "_" + getName(structure, layer, geometry);
880  TGraphErrors *g = dynamic_cast<TGraphErrors *>(in->Get(name + "_" + variables.at(i)));
881  g->SetName(name + "_" + variables.at(i));
882  if (i >= 8) {
883  g->SetLineWidth(1);
884  g->SetLineColor(*colour);
885  g->SetFillColorAlpha(*colour, 0.2);
886  }
887  vector<vector<double>> vectors;
888  //if(showlumi&&i<8)scalebylumi(dynamic_cast<TGraph*>(g));
889  if (showlumi)
890  scalebylumi(g, lumiIOVpairs);
891  g->SetLineColor(*colour);
892  g->SetMarkerColor(*colour);
893  TH1F *h = ConvertToHist(g);
894  h->SetLineColor(*colour);
895  h->SetMarkerColor(*colour);
896  h->SetMarkerSize(0);
897  h->SetLineWidth(1);
898 
899  if (i < 8) {
900  mg->Add(g, "PL");
901  mh->Add(h, "E");
902  } else {
903  mg->Add(g, "2");
904  mh->Add(h, "E");
905  }
906  ++colour;
907  ++igeom;
908  }
909 
910  gStyle->SetOptTitle(0);
911  gStyle->SetPadLeftMargin(0.08);
912  gStyle->SetPadRightMargin(0.05);
913  gPad->SetTickx();
914  gPad->SetTicky();
915  gStyle->SetLegendTextSize(0.025);
916 
917  double max = 6;
918  double min = -4;
919  if (Variable == "DrmsNR") {
920  if (variable.Contains("delta")) {
921  max = 0.15;
922  min = -0.1;
923  } else {
924  max = 1.2;
925  min = 0.6;
926  }
927  }
928  double range = max - min;
929 
930  if (((variable == "sigma" || variable == "sigmaplus" || variable == "sigmaminus" ||
931  variable == "sigmadeltamu") &&
932  range >= 2)) {
933  mg->SetMaximum(4);
934  mg->SetMinimum(-2);
935  } else {
936  mg->SetMaximum(max + range * 0.1);
937  mg->SetMinimum(min - range * 0.3);
938  }
939 
940  if (i < 8) {
941  mg->Draw("a");
942  } else {
943  mg->Draw("a2");
944  }
945 
946  char *Ytitle = (char *)YaxisNames.at(i).c_str();
947  mg->GetYaxis()->SetTitle(Ytitle);
948  mg->GetXaxis()->SetTitle(showlumi ? "Integrated lumi [1/fb]" : "IOV number");
949  mg->GetXaxis()->CenterTitle(true);
950  mg->GetYaxis()->CenterTitle(true);
951  mg->GetYaxis()->SetTitleOffset(.5);
952  mg->GetYaxis()->SetTitleSize(.05);
953  mg->GetXaxis()->SetTitleSize(.04);
954  if (showlumi)
955  mg->GetXaxis()->SetLimits(0., mg->GetXaxis()->GetXmax());
956 
957  c->Update();
958 
959  TLegend *legend = c->BuildLegend();
960  // TLegend *legend = c->BuildLegend(0.15,0.18,0.15,0.18);
961  int Ngeom = geometries.size();
962  if (Ngeom >= 6)
963  legend->SetNColumns(2);
964  else if (Ngeom >= 9)
965  legend->SetNColumns(3);
966  else
967  legend->SetNColumns(1);
968  TString structtitle = "#bf{";
969  if (structure.Contains("PIX") && !(structure.Contains("_y")))
970  structtitle += structure + " (x)";
971  else if (structure.Contains("_y")) {
972  TString substring(structure(0, 4));
973  structtitle += substring + " (y)";
974  } else
975  structtitle += structure;
976  if (layer != 0) {
977  if (structure == "TID" || structure == "TEC" || structure == "FPIX" || structure == "FPIX_y")
978  structtitle += " disc ";
979  else
980  structtitle += " layer ";
981  structtitle += layer;
982  }
983  structtitle += "}";
984  PixelUpdateLines(c, Year, showlumi, pixelupdateruns);
985 
986  TPaveText *CMSworkInProgress = new TPaveText(
987  0, mg->GetYaxis()->GetXmax() + range * 0.02, 2.5, mg->GetYaxis()->GetXmax() + range * 0.12, "nb");
988  CMSworkInProgress->AddText("#scale[1.1]{CMS} #bf{Internal}");
989  CMSworkInProgress->SetTextAlign(12);
990  CMSworkInProgress->SetTextSize(0.04);
991  CMSworkInProgress->SetFillColor(10);
992  CMSworkInProgress->Draw();
993  TPaveText *TopRightCorner = new TPaveText(0.95 * (mg->GetXaxis()->GetXmax()),
994  mg->GetYaxis()->GetXmax() + range * 0.02,
995  (mg->GetXaxis()->GetXmax()),
996  mg->GetYaxis()->GetXmax() + range * 0.12,
997  "nb");
998  TopRightCorner->AddText(Year + " pp collisions");
999  TopRightCorner->SetTextAlign(32);
1000  TopRightCorner->SetTextSize(0.04);
1001  TopRightCorner->SetFillColor(10);
1002  TopRightCorner->Draw();
1003  TPaveText *structlabel = new TPaveText(0.95 * (mg->GetXaxis()->GetXmax()),
1004  mg->GetYaxis()->GetXmin() + range * 0.02,
1005  0.99 * (mg->GetXaxis()->GetXmax()),
1006  mg->GetYaxis()->GetXmin() + range * 0.12,
1007  "nb");
1008  structlabel->AddText(structtitle.Data());
1009  structlabel->SetTextAlign(32);
1010  structlabel->SetTextSize(0.04);
1011  structlabel->SetFillColor(10);
1012  structlabel->Draw();
1013 
1014  legend->Draw();
1015  mh->Draw("nostack same");
1016  c->Update();
1017  TString structandlayer = getName(structure, layer, "");
1018  TString printfile = outputdir;
1019  if (!(outputdir.EndsWith("/")))
1020  outputdir += "/";
1021  for (const auto &label : labels) {
1022  printfile += label;
1023  printfile += "_";
1024  }
1025  printfile += Variable;
1026  printfile += "_";
1027  printfile += variable + structandlayer;
1028  c->SaveAs(printfile + ".pdf");
1029  c->SaveAs(printfile + ".eps");
1030  c->SaveAs(printfile + ".png");
1031  c->Destructor();
1032  }
1033  }
1034  }
1035  in->Close();
1036 }
1037 
1053 int main(int argc, char *argv[]) {
1054  if (argc == 1) {
1055  vector<int> IOVlist = {314881, 315257, 315488, 315489, 315506, 316239, 316271, 316361, 316363, 316378, 316456,
1056  316470, 316505, 316569, 316665, 316758, 317080, 317182, 317212, 317295, 317339, 317382,
1057  317438, 317527, 317661, 317664, 318712, 319337, 319460, 320841, 320854, 320856, 320888,
1058  320916, 320933, 320980, 321009, 321119, 321134, 321164, 321261, 321294, 321310, 321393,
1059  321397, 321431, 321461, 321710, 321735, 321773, 321774, 321778, 321820, 321831, 321880,
1060  321960, 322014, 322510, 322603, 323232, 323423, 323472, 323475, 323693, 323794, 323976,
1061  324202, 324206, 324245, 324729, 324764, 324840, 324999, 325097, 325110};
1062  vector<int> pixelupdateruns{316758, 317527, 317661, 317664, 318227, 320377}; //2018
1063  // vector<int> pixelupdateruns {290543, 297281, 298653, 299443, 300389, 301046, 302131, 303790, 303998, 304911, 305898};//2017
1064 
1065  cout << "WARNING: Running function with arguments specified in DMRtrends.cc" << endl
1066  << "If you want to specify the arguments from command line run the macro as follows:" << endl
1067  << "DMRtrends labels pathtoDMRs geometriesandcolourspairs outputdirectory showpixelupdate showlumi FORCE"
1068  << endl;
1069 
1070  //PLEASE READ: for debugging purposes please keep at least one example that works commented.
1071  // Error messages are still a W.I.P. and having a working example available is useful for debugging.
1072  //Example provided for a currently working set of parameters:
1073  DMRtrends(IOVlist,
1074  {"median", "DrmsNR"},
1075  {"minbias"},
1076  "2018",
1077  "/afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERALIGN/data/commonValidation/results/adewit/UL18_DMR_MB_eoj_v3/",
1078  {"1-step hybrid", "mid18 rereco", "counter twist"},
1079  {kBlue, kBlack, kGreen + 3},
1080  "/afs/cern.ch/user/a/acardini/commonValidation/results/acardini/DMRs/DMRTrends/test/",
1081  true,
1082  pixelupdateruns,
1083  true,
1084  true);
1085  return 0;
1086  } else if (argc < 12) {
1087  cout << "DMRtrends IOVlist labels Year pathtoDMRs geometriesandcolourspairs outputdirectory pixelupdatelist "
1088  "showpixelupdate showlumi FORCE"
1089  << endl;
1090 
1091  return 1;
1092  }
1093 
1094  TString runlist = argv[1], all_variables = argv[2], all_labels = argv[3], Year = argv[4], pathtoDMRs = argv[5],
1095  geometrieandcolours = argv[6], //name1:title1:color1,name2:title2:color2,name3:title3:color3
1096  outputdirectory = argv[7], pixelupdatelist = argv[8];
1097  bool showpixelupdate = argv[9], showlumi = argv[10], FORCE = argv[11];
1098  TObjArray *vararray = all_variables.Tokenize(",");
1099  vector<string> Variables;
1100  Variables.reserve(vararray->GetEntries());
1101  for (int i = 0; i < vararray->GetEntries(); i++)
1102  Variables.push_back((string)(vararray->At(i)->GetName()));
1103  TObjArray *labelarray = all_labels.Tokenize(",");
1104  vector<string> labels;
1105  labels.reserve(labelarray->GetEntries());
1106  for (int i = 0; i < labelarray->GetEntries(); i++)
1107  labels.push_back((string)(labelarray->At(i)->GetName()));
1108  TObjArray *IOVarray = runlist.Tokenize(",");
1109  vector<int> IOVlist;
1110  IOVlist.reserve(IOVarray->GetEntries());
1111  for (int i = 0; i < IOVarray->GetEntries(); i++)
1112  IOVlist.push_back(stoi(IOVarray->At(i)->GetName()));
1113  vector<int> pixelupdateruns;
1114  TObjArray *PIXarray = pixelupdatelist.Tokenize(",");
1115  pixelupdateruns.reserve(PIXarray->GetEntries());
1116  for (int i = 0; i < PIXarray->GetEntries(); i++)
1117  pixelupdateruns.push_back(stoi(PIXarray->At(i)->GetName()));
1118  vector<string> geometries;
1119  //TO DO: the color is not taken correctly from command line
1120  vector<Color_t> colours;
1121  TObjArray *geometrieandcolourspairs = geometrieandcolours.Tokenize(",");
1122  for (int i = 0; i < geometrieandcolourspairs->GetEntries(); i++) {
1123  TObjArray *geomandcolourvec = TString(geometrieandcolourspairs->At(i)->GetName()).Tokenize(":");
1124  geometries.push_back(geomandcolourvec->At(0)->GetName());
1125  colours.push_back(ColorParser(geomandcolourvec->At(1)->GetName()));
1126  }
1127  DMRtrends(IOVlist,
1128  Variables,
1129  labels,
1130  Year,
1131  pathtoDMRs.Data(),
1132  geometries,
1133  colours,
1134  outputdirectory.Data(),
1135  showpixelupdate,
1136  pixelupdateruns,
1137  showlumi,
1138  FORCE);
1139 
1140  return 0;
1141 }
SummaryClient_cfi.labels
labels
Definition: SummaryClient_cfi.py:61
DeadROCCounter_Phase1.outname
outname
Definition: DeadROCCounter_Phase1.py:127
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
cmsBatch.argv
argv
Definition: cmsBatch.py:279
runGCPTkAlMap.title
string title
Definition: runGCPTkAlMap.py:94
mps_fire.i
i
Definition: mps_fire.py:428
Point::GetDeltaMu
float GetDeltaMu() const
Definition: DMRtrends.cc:109
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
HLT_FULL_cff.points
points
Definition: HLT_FULL_cff.py:21521
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
dir2webdir.argc
argc
Definition: dir2webdir.py:39
Geometry::MuMinus
vector< float > MuMinus() const
Definition: DMRtrends.cc:211
amptDefaultParameters_cff.mu
mu
Definition: amptDefaultParameters_cff.py:16
Geometry::MuPlus
vector< float > MuPlus() const
Definition: DMRtrends.cc:210
L1TEGammaDiff_cfi.variables
variables
Definition: L1TEGammaDiff_cfi.py:5
HLT_FULL_cff.scale
scale
Definition: HLT_FULL_cff.py:6637
min
T min(T a, T b)
Definition: MathUtil.h:58
compileDMRTrends
void compileDMRTrends(vector< int > IOVlist, TString Variable="median", vector< string > labels={"MB"}, TString Year="2018", string myValidation="/afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERALIGN/data/commonValidation/results/acardini/DMRs/", vector< string > geometries={"GT", "SG", "MP pix LBL", "PIX HLS+ML STR fix"}, bool showlumi=false, bool FORCE=false)
Definition: DMRtrends.cc:394
mps_splice.entry
entry
Definition: mps_splice.py:68
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
Geometry::SigmaPlus
vector< float > SigmaPlus() const
Definition: DMRtrends.cc:213
PixelUpdateLines
void PixelUpdateLines(TCanvas *c, TString Year="2018", bool showlumi=false, vector< int > pixelupdateruns={314881, 316758, 317527, 318228, 320377})
Definition: DMRtrends.cc:568
gather_cfg.cout
cout
Definition: gather_cfg.py:144
geometry
Definition: geometry.py:1
dtNoiseDBValidation_cfg.outputdir
outputdir
Definition: dtNoiseDBValidation_cfg.py:8
writedatasetfile.runs
runs
Definition: writedatasetfile.py:27
timingPdfMaker.histo
histo
Definition: timingPdfMaker.py:279
main
int main(int argc, char *argv[])
Definition: DMRtrends.cc:1052
findQualityFiles.v
v
Definition: findQualityFiles.py:179
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
DMRFactor
#define DMRFactor
Definition: DMRtrends.cc:42
Point::Point
Point(float Run=-999., float ScaleFactor=10000., float y1=-999., float y2=-999., float y3=-999., float y4=-999., float y5=-999., float y6=-999.)
Definition: DMRtrends.cc:63
fetchall_from_DQM_v2.regexp
regexp
Definition: fetchall_from_DQM_v2.py:93
ConvertToHist
TH1F * ConvertToHist(TGraphErrors *g)
Definition: DMRtrends.cc:760
Geometry::SigmaDeltaMu
vector< float > SigmaDeltaMu() const
Definition: DMRtrends.cc:216
Point::GetRun
float GetRun() const
Definition: DMRtrends.cc:102
BXlumiParameters_cfi.lumi
lumi
Definition: BXlumiParameters_cfi.py:6
Point
math::XYZPoint Point
Definition: TrackerDpgAnalysis.cc:106
testProducerWithPsetDescEmpty_cfi.y1
y1
Definition: testProducerWithPsetDescEmpty_cfi.py:29
Point::operator=
Point & operator=(const Point &p)
Definition: DMRtrends.cc:91
h
Point::Point
Point(float Run, float ScaleFactor, TH1 *histo, TH1 *histoplus, TH1 *histominus)
Definition: DMRtrends.cc:76
utils.is_empty
def is_empty(h)
Definition: utils.py:179
Point::GetSigmaDeltaMu
float GetSigmaDeltaMu() const
Definition: DMRtrends.cc:115
Point::GetSigmaMinus
float GetSigmaMinus() const
Definition: DMRtrends.cc:108
getName
TString getName(TString structure, int layer, TString geometry)
Definition: DMRtrends.cc:235
N
#define N
Definition: blowfish.cc:9
Point::sigmaplus
float sigmaplus
Definition: DMRtrends.cc:58
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
corrVsCorr.filename
filename
Definition: corrVsCorr.py:123
Point::GetSigmaPlus
float GetSigmaPlus() const
Definition: DMRtrends.cc:107
utils.gErrorIgnoreLevel
gErrorIgnoreLevel
Definition: utils.py:27
Geometry::SigmaMinus
vector< float > SigmaMinus() const
Definition: DMRtrends.cc:214
getintegratedlumiuptorun
double getintegratedlumiuptorun(int run, TString Year="2018", double min=0.)
Definition: DMRtrends.cc:633
testProducerWithPsetDescEmpty_cfi.y2
y2
Definition: testProducerWithPsetDescEmpty_cfi.py:30
Point
Structure Point Contains parameters of Gaussian fits to DMRs.
Definition: DMRtrends.cc:57
BPhysicsValidation_cfi.muplus
muplus
Definition: BPhysicsValidation_cfi.py:18
test_db_connect.runlist
runlist
Definition: test_db_connect.py:20
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
scalebylumi
void scalebylumi(TGraphErrors *g, vector< pair< int, double >> lumiIOVpairs)
Definition: DMRtrends.cc:658
recoMuon::in
Definition: RecoMuonEnumerators.h:6
listHistos.legend
legend
Definition: listHistos.py:41
groupFilesInBlocks.fout
fout
Definition: groupFilesInBlocks.py:162
value
Definition: value.py:1
lumiperIOV
vector< pair< int, double > > lumiperIOV(vector< int > IOVlist, TString Year="2018")
Definition: DMRtrends.cc:709
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
Geometry::Mu
vector< float > Mu() const
Definition: DMRtrends.cc:209
runlistfromlumifile
vector< int > runlistfromlumifile(TString Year="2018")
Definition: DMRtrends.cc:287
fwlog::kWarning
Definition: fwLog.h:35
corrVsCorr.rx
rx
Definition: corrVsCorr.py:103
BPhysicsValidation_cfi.muminus
muminus
Definition: BPhysicsValidation_cfi.py:12
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
Geometry::Geometry
Geometry(TString Title)
Definition: DMRtrends.cc:200
Mu
Definition: L1GtObject.h:29
Geometry::DeltaMu
vector< float > DeltaMu() const
Definition: DMRtrends.cc:215
taus_updatedMVAIds_cff.variable
variable
Definition: taus_updatedMVAIds_cff.py:33
std
Definition: JetResolutionObject.h:76
writedatasetfile.run
run
Definition: writedatasetfile.py:27
Geometry::Sigma
vector< float > Sigma() const
Definition: DMRtrends.cc:212
lumifileperyear
TString lumifileperyear(TString Year="2018", string RunOrIOV="IOV")
Definition: DMRtrends.cc:266
TagProbeFitTreeAnalyzer_cfi.Variables
Variables
Definition: TagProbeFitTreeAnalyzer_cfi.py:16
genVertex_cff.x
x
Definition: genVertex_cff.py:12
detailsBasic3DVector::y
float float y
Definition: extBasic3DVector.h:14
Point::GetSigma
float GetSigma() const
Definition: DMRtrends.cc:106
Point::GetMu
float GetMu() const
Definition: DMRtrends.cc:103
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
Point::Point
Point(float Run, float ScaleFactor, TH1 *histo)
Definition: DMRtrends.cc:89
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
Point::GetMuPlus
float GetMuPlus() const
Definition: DMRtrends.cc:104
DUMMY
#define DUMMY
Definition: DMRtrends.cc:34
PlotDMRTrends
void PlotDMRTrends(vector< int > IOVlist, TString Variable="median", vector< string > labels={"MB"}, TString Year="2018", string myValidation="/afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERALIGN/data/commonValidation/results/acardini/DMRs/", vector< string > geometries={"GT", "SG", "MP pix LBL", "PIX HLS+ML STR fix"}, vector< Color_t > colours={kBlue, kRed, kGreen, kCyan}, TString outputdir="/afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERALIGN/data/commonValidation/alignmentObjects/acardini/DMRsTrends/", bool pixelupdate=false, vector< int > pixelupdateruns={314881, 316758, 317527, 318228, 320377}, bool showlumi=false)
Definition: DMRtrends.cc:788
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
castor_dqm_sourceclient_file_cfg.path
path
Definition: castor_dqm_sourceclient_file_cfg.py:37
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
trigObjTnPSource_cfi.bins
bins
Definition: trigObjTnPSource_cfi.py:20
beamvalidation.exit
def exit(msg="")
Definition: beamvalidation.py:53
numberOfLayers
const map< TString, int > numberOfLayers(TString Year="2018")
Definition: DMRtrends.cc:253
lumiFactor
#define lumiFactor
Definition: DMRtrends.cc:38
Min
T Min(T a, T b)
Definition: MathUtil.h:39
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
point
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
DMRtrends
void DMRtrends(vector< int > IOVlist, vector< string > Variables={"median", "DrmsNR"}, vector< string > labels={"MB"}, TString Year="2018", string myValidation="/afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERALIGN/data/commonValidation/results/acardini/DMRs/", vector< string > geometries={"GT", "SG", "MP pix LBL", "PIX HLS+ML STR fix"}, vector< Color_t > colours={kBlue, kRed, kGreen, kCyan}, TString outputdir="/afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERALIGN/data/commonValidation/alignmentObjects/acardini/DMRsTrends/", bool pixelupdate=false, vector< int > pixelupdateruns={314881, 316758, 317527, 318228, 320377}, bool showlumi=false, bool FORCE=false)
Definition: DMRtrends.cc:349
mps_splice.line
line
Definition: mps_splice.py:76
lumi
Definition: LumiSectionData.h:20
label
const char * label
Definition: PFTauDecayModeTools.cc:11
Geometry
Class Geometry Contains vector for fit parameters (mean, sigma, etc.) obtained from multiple IOVs See...
Definition: DMRtrends.cc:182
g
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
Point::GetMuMinus
float GetMuMinus() const
Definition: DMRtrends.cc:105
checkrunlist
bool checkrunlist(vector< int > runs, vector< int > IOVlist={}, TString Year="2018")
Definition: DMRtrends.cc:307
nlayers
Definition: HIMultiTrackSelector.h:48
Run