CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Macros | Functions
DMRtrends.cc File Reference
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <iomanip>
#include <experimental/filesystem>
#include "TPad.h"
#include "TCanvas.h"
#include "TGraph.h"
#include "TGraphErrors.h"
#include "TMultiGraph.h"
#include "TH1.h"
#include "THStack.h"
#include "TROOT.h"
#include "TFile.h"
#include "TColor.h"
#include "TLegend.h"
#include "TLegendEntry.h"
#include "TMath.h"
#include "TRegexp.h"
#include "TPaveLabel.h"
#include "TPaveText.h"
#include "TStyle.h"
#include "TLine.h"
#include "Alignment/OfflineValidation/plugins/ColorParser.C"

Go to the source code of this file.

Classes

class  Geometry
 Class Geometry Contains vector for fit parameters (mean, sigma, etc.) obtained from multiple IOVs See Structure Point for description of the parameters. More...
 
struct  Point
 Structure Point Contains parameters of Gaussian fits to DMRs. More...
 

Macros

#define DMRFactor   10000.
 
#define DUMMY   -999.
 
#define lumiFactor   1000.
 

Functions

bool checkrunlist (vector< int > runs, vector< int > IOVlist={}, TString Year="2018")
 
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)
 
TH1F * ConvertToHist (TGraphErrors *g)
 
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)
 
double getintegratedlumiuptorun (int run, TString Year="2018", double min=0.)
 
TString getName (TString structure, int layer, TString geometry)
 
TString lumifileperyear (TString Year="2018", string RunOrIOV="IOV")
 
vector< pair< int, double > > lumiperIOV (vector< int > IOVlist, TString Year="2018")
 
int main (int argc, char *argv[])
 
const map< TString, int > numberOfLayers (TString Year="2018")
 
void PixelUpdateLines (TCanvas *c, TString Year="2018", bool showlumi=false, vector< int > pixelupdateruns={314881, 316758, 317527, 318228, 320377})
 
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)
 
vector< int > runlistfromlumifile (TString Year="2018")
 
void scalebylumi (TGraphErrors *g, vector< pair< int, double >> lumiIOVpairs)
 

Macro Definition Documentation

#define DMRFactor   10000.

Definition at line 42 of file DMRtrends.cc.

Referenced by compileDMRTrends().

#define DUMMY   -999.

Definition at line 34 of file DMRtrends.cc.

Referenced by Point::GetDeltaMu(), Point::GetSigmaDeltaMu(), and scalebylumi().

#define lumiFactor   1000.

Definition at line 38 of file DMRtrends.cc.

Referenced by getintegratedlumiuptorun(), and scalebylumi().

Function Documentation

bool checkrunlist ( vector< int >  runs,
vector< int >  IOVlist = {},
TString  Year = "2018" 
)

Definition at line 308 of file DMRtrends.cc.

References gather_cfg::cout, spr::find(), run_AlCaRecoTriggerBitsUpdateWorkflow::IOV, submitPVValidationJobs::run, test_db_connect::runlist, and runlistfromlumifile().

Referenced by compileDMRTrends(), and PlotDMRTrends().

308  {
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 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
tuple runs
Definition: gather_cfg.py:88
vector< int > runlistfromlumifile(TString Year="2018")
Definition: DMRtrends.cc:288
tuple cout
Definition: gather_cfg.py:144
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 at line 395 of file DMRtrends.cc.

References checkrunlist(), gather_cfg::cout, Geometry::DeltaMu(), DMRFactor, mps_splice::entry, beamvalidation::exit(), validate-o2o-wbm::f, lut2db_cfg::filename, groupFilesInBlocks::fout, g, relativeConstraints::geom, relativeConstraints::geometry, getName(), timingPdfMaker::histo, mps_fire::i, utils::is_empty(), label, phase1PixelTopology::layer, Geometry::Mu(), Geometry::MuMinus(), Geometry::MuPlus(), dqmiodumpmetadata::n, mergeVDriftHistosByStation::name, nlayers, numberOfLayers(), DeadROCCounter_Phase1::outname, point, Geometry::Run(), Geometry::Sigma(), Geometry::SigmaDeltaMu(), Geometry::SigmaMinus(), Geometry::SigmaPlus(), and L1TEGammaDiff_cfi::variables.

Referenced by DMRtrends().

402  {
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 }
vector< float > SigmaPlus() const
Definition: DMRtrends.cc:214
vector< float > SigmaDeltaMu() const
Definition: DMRtrends.cc:217
vector< float > DeltaMu() const
Definition: DMRtrends.cc:216
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
bool checkrunlist(vector< int > runs, vector< int > IOVlist={}, TString Year="2018")
Definition: DMRtrends.cc:308
constexpr std::array< uint8_t, layerIndexSize > layer
tuple runs
Definition: gather_cfg.py:88
vector< float > MuMinus() const
Definition: DMRtrends.cc:212
char const * label
Class Geometry Contains vector for fit parameters (mean, sigma, etc.) obtained from multiple IOVs See...
Definition: DMRtrends.cc:183
vector< float > Run() const
Definition: DMRtrends.cc:209
vector< float > Sigma() const
Definition: DMRtrends.cc:213
math::XYZPoint Point
vector< float > Mu() const
Definition: DMRtrends.cc:210
TString getName(TString structure, int layer, TString geometry)
Definition: DMRtrends.cc:236
const map< TString, int > numberOfLayers(TString Year="2018")
Definition: DMRtrends.cc:254
def is_empty
Definition: utils.py:179
vector< float > SigmaMinus() const
Definition: DMRtrends.cc:215
Structure Point Contains parameters of Gaussian fits to DMRs.
Definition: DMRtrends.cc:57
vector< float > MuPlus() const
Definition: DMRtrends.cc:211
tuple filename
Definition: lut2db_cfg.py:20
list entry
Definition: mps_splice.py:68
tuple cout
Definition: gather_cfg.py:144
#define DMRFactor
Definition: DMRtrends.cc:42
*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
TH1F * ConvertToHist ( TGraphErrors *  g)

Definition at line 761 of file DMRtrends.cc.

References timingPdfMaker::histo, mps_fire::i, N, and funct::pow().

Referenced by PlotDMRTrends().

761  {
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 }
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
uint16_t const *__restrict__ x
Definition: gpuClustering.h:39
#define N
Definition: blowfish.cc:9
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
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 at line 350 of file DMRtrends.cc.

References compileDMRTrends(), gather_cfg::cout, beamvalidation::exit(), fed_dqm_sourceclient-live_cfg::path, and PlotDMRTrends().

Referenced by main().

361  {
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 };
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:789
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:395
tuple cout
Definition: gather_cfg.py:144
double getintegratedlumiuptorun ( int  run,
TString  Year = "2018",
double  min = 0. 
)

Definition at line 634 of file DMRtrends.cc.

References dqmiolumiharvest::j, dqmdumpme::lumi, lumiFactor, lumifileperyear(), min(), and pileupReCalc_HLTpaths::scale.

Referenced by PixelUpdateLines().

634  {
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 }
TString lumifileperyear(TString Year="2018", string RunOrIOV="IOV")
Definition: DMRtrends.cc:267
T min(T a, T b)
Definition: MathUtil.h:58
list lumi
Definition: dqmdumpme.py:53
#define lumiFactor
Definition: DMRtrends.cc:38
TString getName ( TString  structure,
int  layer,
TString  geometry 
)

Definition at line 236 of file DMRtrends.cc.

References phase1PixelTopology::layer, and mergeVDriftHistosByStation::name.

Referenced by CaloTowersClient::CaloTowersEndjob(), CaloTowersDQMClient::CaloTowersEndjob(), jsoncollector::FastMonitor::commit(), compileDMRTrends(), FWGUIManager::createHelpGLPopup(), FWGUIManager::createShortcutPopup(), HGCalDigiClient::digisEndjob(), JetMETHLTOfflineClient::dqmEndJob(), StraightTrackAlignment::finish(), HGCalGeometryClient::geometryEndjob(), HGCalHitClient::geometryEndjob(), HcalDigisClient::HcalDigisEndjob(), HcalRecHitsDQMClient::HcalRecHitsEndjob(), NoiseRatesClient::NoiseRatesEndjob(), HcalNoiseRatesClient::NoiseRatesEndjob(), GenericMVAComputer::TaggingVariableIterator< Iter_t >::Value::operator PhysicsTools::Variable::Value(), PlotDMRTrends(), StraightTrackAlignment::printAlgorithmsLine(), HGCalRecHitsClient::recHitsEndjob(), HcalSimHitsClient::SimHitsEndjob(), and HGCalSimHitsClient::simHitsEndjob().

236  {
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 };
constexpr std::array< uint8_t, layerIndexSize > layer
TString lumifileperyear ( TString  Year = "2018",
string  RunOrIOV = "IOV" 
)

Definition at line 267 of file DMRtrends.cc.

References gather_cfg::cout, and beamvalidation::exit().

Referenced by getintegratedlumiuptorun(), lumiperIOV(), and runlistfromlumifile().

267  {
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 };
tuple cout
Definition: gather_cfg.py:144
vector< pair< int, double > > lumiperIOV ( vector< int >  IOVlist,
TString  Year = "2018" 
)

Definition at line 710 of file DMRtrends.cc.

References funct::abs(), gather_cfg::cout, beamvalidation::exit(), mps_fire::i, dqmiolumiharvest::j, dqmdumpme::lumi, lumifileperyear(), N, submitPVValidationJobs::run, and pileupReCalc_HLTpaths::scale.

Referenced by PlotDMRTrends().

710  {
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 }
TString lumifileperyear(TString Year="2018", string RunOrIOV="IOV")
Definition: DMRtrends.cc:267
vector< pair< int, double > > lumiperIOV(vector< int > IOVlist, TString Year="2018")
Definition: DMRtrends.cc:710
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
list lumi
Definition: dqmdumpme.py:53
#define N
Definition: blowfish.cc:9
tuple cout
Definition: gather_cfg.py:144
int main ( int  argc,
char *  argv[] 
)

Definition at line 1053 of file DMRtrends.cc.

References gather_cfg::cout, DMRtrends(), mps_fire::i, HLT_FULL_cff::labels, and test_db_connect::runlist.

1053  {
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 }
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:350
tuple argc
Definition: dir2webdir.py:39
tuple cout
Definition: gather_cfg.py:144
const map< TString, int > numberOfLayers ( TString  Year = "2018")

Definition at line 254 of file DMRtrends.cc.

Referenced by RealisticSimClusterMapper::buildClusters(), compileDMRTrends(), and PlotDMRTrends().

254  {
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 }
void PixelUpdateLines ( TCanvas *  c,
TString  Year = "2018",
bool  showlumi = false,
vector< int >  pixelupdateruns = {314881, 316758, 317527, 318228, 320377} 
)

Definition at line 569 of file DMRtrends.cc.

References getintegratedlumiuptorun(), label, HLT_FULL_cff::labels, geometryCSVtoXML::line, dqmdumpme::lumi, Min(), and corrVsCorr::rx.

Referenced by PlotDMRTrends().

569  {
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 }
const edm::EventSetup & c
double getintegratedlumiuptorun(int run, TString Year="2018", double min=0.)
Definition: DMRtrends.cc:634
T Min(T a, T b)
Definition: MathUtil.h:39
char const * label
list lumi
Definition: dqmdumpme.py:53
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 at line 789 of file DMRtrends.cc.

References checkrunlist(), ConvertToHist(), gather_cfg::cout, lut2db_cfg::filename, g, relativeConstraints::geometry, getName(), h, mps_fire::i, recoMuon::in, fwlog::kWarning, label, phase1PixelTopology::layer, lumiperIOV(), SiStripPI::max, min(), mergeVDriftHistosByStation::name, nlayers, numberOfLayers(), PixelUpdateLines(), sistrip::SpyUtilities::range(), scalebylumi(), and L1TEGammaDiff_cfi::variables.

Referenced by DMRtrends().

799  {
800  gErrorIgnoreLevel = kWarning;
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 }
const edm::EventSetup & c
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
bool checkrunlist(vector< int > runs, vector< int > IOVlist={}, TString Year="2018")
Definition: DMRtrends.cc:308
constexpr std::array< uint8_t, layerIndexSize > layer
const uint16_t range(const Frame &aFrame)
char const * label
vector< pair< int, double > > lumiperIOV(vector< int > IOVlist, TString Year="2018")
Definition: DMRtrends.cc:710
T min(T a, T b)
Definition: MathUtil.h:58
TString getName(TString structure, int layer, TString geometry)
Definition: DMRtrends.cc:236
const map< TString, int > numberOfLayers(TString Year="2018")
Definition: DMRtrends.cc:254
void scalebylumi(TGraphErrors *g, vector< pair< int, double >> lumiIOVpairs)
Definition: DMRtrends.cc:659
tuple filename
Definition: lut2db_cfg.py:20
tuple cout
Definition: gather_cfg.py:144
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
void PixelUpdateLines(TCanvas *c, TString Year="2018", bool showlumi=false, vector< int > pixelupdateruns={314881, 316758, 317527, 318228, 320377})
Definition: DMRtrends.cc:569
TH1F * ConvertToHist(TGraphErrors *g)
Definition: DMRtrends.cc:761
vector< int > runlistfromlumifile ( TString  Year = "2018")

Definition at line 288 of file DMRtrends.cc.

References gather_cfg::cout, beamvalidation::exit(), lut2db_cfg::filename, mps_fire::i, utils::is_empty(), lumifileperyear(), N, fed_dqm_sourceclient-live_cfg::path, gather_cfg::runs, and pileupReCalc_HLTpaths::scale.

Referenced by checkrunlist().

288  {
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 }
TString lumifileperyear(TString Year="2018", string RunOrIOV="IOV")
Definition: DMRtrends.cc:267
tuple runs
Definition: gather_cfg.py:88
#define N
Definition: blowfish.cc:9
def is_empty
Definition: utils.py:179
tuple filename
Definition: lut2db_cfg.py:20
tuple cout
Definition: gather_cfg.py:144
void scalebylumi ( TGraphErrors *  g,
vector< pair< int, double >>  lumiIOVpairs 
)

Definition at line 659 of file DMRtrends.cc.

References DUMMY, mps_fire::i, dqmiolumiharvest::j, lumiFactor, N, and submitPVValidationJobs::run.

Referenced by PlotDMRTrends().

659  {
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 }
#define DUMMY
Definition: DMRtrends.cc:34
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
uint16_t const *__restrict__ x
Definition: gpuClustering.h:39
#define lumiFactor
Definition: DMRtrends.cc:38
#define N
Definition: blowfish.cc:9