CMS 3D CMS Logo

Classes | Functions
OccupancyPlotMacros.h File Reference
#include <vector>
#include <string>
#include <utility>

Go to the source code of this file.

Classes

struct  SubDetParams
 

Functions

float combinedOccupancy (TFile *ff, const char *module, const int lowerbin, const int upperbin)
 
TCanvas * drawMap (const char *cname, const TH1 *hval, const TProfile *averadius, const TProfile *avez, const float mmin, const float mmax, std::pair< float, float >(*size)(int), float(*scale)(float), const int color, const char *ptitle="")
 
float linear (float x)
 
float logarithm (float x)
 
std::pair< float, float > phase2bin (int i)
 
void PlotDebugFPIX_XYMap (TFile *ff, const char *module, const unsigned int offset, const char *name)
 
void PlotOccupancyMap (TFile *ff, const char *module, const float min, const float max, const float mmin, const float mmax, const int color)
 
void PlotOccupancyMapGeneric (TFile *ff, const char *module, const float min, const float max, const float mmin, const float mmax, const int color, std::pair< float, float >(*size)(int), const std::vector< SubDetParams > &vsub)
 
void PlotOccupancyMapPhase1 (TFile *ff, const char *module, const float min, const float max, const float mmin, const float mmax, const int color)
 
void PlotOccupancyMapPhase2 (TFile *ff, const char *module, const float min, const float max, const float mmin, const float mmax, const int color)
 
void PlotOnTrackOccupancy (TFile *ff, const char *module, const char *ontrkmod, const float mmin, const float mmax, const int color)
 
void PlotOnTrackOccupancyGeneric (TFile *ff, const char *module, const char *ontrkmod, const float mmin, const float mmax, const int color, std::pair< float, float >(*size)(int), const std::vector< SubDetParams > &vsub)
 
void PlotOnTrackOccupancyPhase1 (TFile *ff, const char *module, const char *ontrkmod, const float mmin, const float mmax, const int color)
 
void PlotOnTrackOccupancyPhase2 (TFile *ff, const char *module, const char *ontrkmod, const float mmin, const float mmax, const int color)
 
void PlotTrackerXsect (TFile *ff, const char *module)
 
void printFrame (TCanvas *c, TH1D *h, const char *label, const int frame, const int min, const int max, const bool same=false)
 
TH1D * TrendPlotSingleBin (TFile *ff, const char *module, const char *hname, const int bin)
 

Function Documentation

◆ combinedOccupancy()

float combinedOccupancy ( TFile *  ff,
const char *  module,
const int  lowerbin,
const int  upperbin 
)

Definition at line 370 of file OccupancyPlotMacros.cc.

370  {
371  float cumoccu = -2.;
372  double cumerr = -2;
373 
374  if (ff->cd(module)) {
375  TProfile* aveoccu = (TProfile*)gDirectory->Get("aveoccu");
376  // TProfile* avemult= (TProfile*)gDirectory->Get("avemult");
377  TH1F* nchannels = (TH1F*)gDirectory->Get("nchannels_real");
378 
379  float sumoccu = 0.;
380  float sumnchannels = 0;
381  double sumerrsq = 0;
382 
383  for (int i = lowerbin; i < upperbin + 1; ++i) {
384  std::cout << "processing bin " << i << " " << aveoccu->GetBinContent(i) << "+/-" << aveoccu->GetBinError(i)
385  << std::endl;
386  sumoccu += aveoccu->GetBinContent(i);
387  sumnchannels += nchannels->GetBinContent(i);
388  sumerrsq += aveoccu->GetBinError(i) * aveoccu->GetBinError(i);
389  }
390  cumoccu = sumnchannels != 0 ? sumoccu / sumnchannels : -1;
391  cumerr = sumnchannels != 0 ? sqrt(sumerrsq) / sumnchannels : -1;
392  std::cout << "Cumulative occupancy: " << sumoccu << " " << sumnchannels << " " << cumoccu << "+/-" << cumerr;
393  }
394 
395  return cumoccu;
396 }

References gather_cfg::cout, alignCSCRings::ff, mps_fire::i, and mathSSE::sqrt().

◆ drawMap()

TCanvas* drawMap ( const char *  cname,
const TH1 *  hval,
const TProfile *  averadius,
const TProfile *  avez,
const float  mmin,
const float  mmax,
std::pair< float, float >(*)(int)  size,
float(*)(float)  scale,
const int  color,
const char *  ptitle = "" 
)

Definition at line 599 of file OccupancyPlotMacros.cc.

608  {
609  if (color == 1) {
610  // A not-so-great color version
611  const Int_t NRGBs = 5;
612  const Int_t NCont = 255;
613  Double_t stops[NRGBs] = {0.00, 0.25, 0.50, 0.75, 1.00};
614  Double_t red[NRGBs] = {0.00, 0.00, 0.40, 1.00, 1.00};
615  Double_t green[NRGBs] = {0.00, 0.40, 0.70, 0.60, 1.00};
616  Double_t blue[NRGBs] = {0.30, 0.60, 0.00, 0.00, 0.20};
617  TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
618  gStyle->SetNumberContours(NCont);
619  } else if (color == 2) {
620  // Gray scale
621  const Int_t NRGBs = 3;
622  const Int_t NCont = 255;
623  Double_t stops[NRGBs] = {0.00, 0.50, 1.00};
624  Double_t red[NRGBs] = {0.90, 0.50, 0.00};
625  Double_t green[NRGBs] = {0.90, 0.50, 0.00};
626  Double_t blue[NRGBs] = {0.90, 0.50, 0.00};
627  TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
628  gStyle->SetNumberContours(NCont);
629  } else if (color == 3) {
630  // used by Kevin in the TRK-11-001 paper
631  const Int_t NRGBs = 7;
632  const Int_t NCont = 255;
633  Double_t stops[NRGBs] = {0.00, 0.15, 0.30, 0.45, 0.65, 0.85, 1.00};
634  Double_t red[NRGBs] = {0.60, 0.30, 0.00, 0.00, 0.60, 0.40, 0.00};
635  Double_t green[NRGBs] = {1.00, 0.90, 0.80, 0.75, 0.20, 0.00, 0.00};
636  Double_t blue[NRGBs] = {1.00, 1.00, 1.00, 0.30, 0.00, 0.00, 0.00};
637  TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
638  gStyle->SetNumberContours(NCont);
639  }
640 
641  int ncol = gStyle->GetNumberOfColors();
642  std::cout << "Number of colors " << ncol << std::endl;
643  // Loop on bins and creation of boxes
644 
645  TList modulesmult;
646 
647  for (int i = 1; i < hval->GetNbinsX(); ++i) {
648  if ((averadius->GetBinEntries(i) * avez->GetBinEntries(i)) != 0) {
649  double dz = -1.;
650  double dr = -1.;
651  // determine module size
652 
653  dz = (*size)(i).first;
654  dr = (*size)(i).second;
655 
656  if (dz < 0 && dr < 0)
657  continue;
658 
659  {
660  TBox* modmult = new TBox(avez->GetBinContent(i) - dz,
661  averadius->GetBinContent(i) - dr,
662  avez->GetBinContent(i) + dz,
663  averadius->GetBinContent(i) + dr);
664  modmult->SetFillStyle(1001);
665  if (color < 0) {
666  modmult->SetFillColor(kBlack);
667  } else {
668  int icol = int(ncol * (scale(hval->GetBinContent(i)) - scale(mmin)) / (scale(mmax) - scale(mmin)));
669  if (icol < 0)
670  icol = 0;
671  if (icol > (ncol - 1))
672  icol = (ncol - 1);
673  std::cout << i << " " << icol << " " << hval->GetBinContent(i) << std::endl;
674  modmult->SetFillColor(gStyle->GetColorPalette(icol));
675  }
676  modulesmult.Add(modmult);
677  }
678  }
679  }
680  // eta boundaries lines
681  double etavalext[] = {4., 3.5, 3., 2.8, 2.6, 2.4, 2.2, 2.0, 1.8, 1.6};
682  double etavalint[] = {-1.4, -1.2, -1.0, -0.8, -0.6, -0.4, -0.2, 0., 0.2, 0.4, 0.6, 0.8, 1.0, 1.2, 1.4};
683  TList etalines;
684  TList etalabels;
685  TList paperlabels;
686  for (int i = 0; i < 10; ++i) {
687  // double eta = 3.0-i*0.2;
688  double eta = etavalext[i];
689  TLine* lin = new TLine(295, 2 * 295 / (exp(eta) - exp(-eta)), 305, 2 * 305 / (exp(eta) - exp(-eta)));
690  etalines.Add(lin);
691  char lab[100];
692  sprintf(lab, "%3.1f", eta);
693  TText* label = new TText(285, 2 * 285 / (exp(eta) - exp(-eta)), lab);
694  label->SetTextSize(.03);
695  label->SetTextAlign(22);
696  etalabels.Add(label);
697  }
698  for (int i = 0; i < 10; ++i) {
699  // double eta = -3.0+i*0.2;
700  double eta = -1 * etavalext[i];
701  TLine* lin = new TLine(-295, -2 * 295 / (exp(eta) - exp(-eta)), -305, -2 * 305 / (exp(eta) - exp(-eta)));
702  etalines.Add(lin);
703  char lab[100];
704  sprintf(lab, "%3.1f", eta);
705  TText* label = new TText(-285, -2 * 285 / (exp(eta) - exp(-eta)), lab);
706  label->SetTextSize(.03);
707  label->SetTextAlign(22);
708  etalabels.Add(label);
709  }
710  for (int i = 0; i < 15; ++i) {
711  // double eta = -1.4+i*0.2;
712  double eta = etavalint[i];
713  TLine* lin = new TLine(130. * (exp(eta) - exp(-eta)) / 2., 130, 138. * (exp(eta) - exp(-eta)) / 2., 138);
714  etalines.Add(lin);
715  char lab[100];
716  sprintf(lab, "%3.1f", eta);
717  TText* label = new TText(125. * (exp(eta) - exp(-eta)) / 2., 125, lab);
718  label->SetTextSize(.03);
719  label->SetTextAlign(22);
720  etalabels.Add(label);
721  }
722  TLatex* etalab = new TLatex(0, 115, "#eta");
723  etalab->SetTextSize(.03);
724  etalab->SetTextAlign(22);
725  etalabels.Add(etalab);
726 
727  // CMS label
728  TLatex* cmslab = new TLatex(0.15, 0.965, "CMS");
729  cmslab->SetNDC();
730  cmslab->SetTextSize(0.04);
731  cmslab->SetTextAlign(31);
732  paperlabels.Add(cmslab);
733  TLatex* enelab = new TLatex(0.92, 0.965, "#sqrt{s} = 7 TeV");
734  enelab->SetNDC();
735  enelab->SetTextSize(0.04);
736  enelab->SetTextAlign(31);
737  paperlabels.Add(enelab);
738  /*
739  TLatex *lumilab = new TLatex(0.6,0.965,Form("L = %.1f fb^{-1}",19.7));
740  lumilab->SetNDC();
741  lumilab->SetTextSize(0.04);
742  lumilab->SetTextAlign(31);
743  paperlabels.Add(lumilab);
744  */
745 
746  TGaxis* raxis = new TGaxis(-310, 0, -310, 140, 0, 140, 10, "S");
747  TGaxis* zaxis = new TGaxis(-310, 0, 310, 0, -310, 310, 10, "S");
748  raxis->SetTickSize(.01);
749  zaxis->SetTickSize(.01);
750  raxis->SetTitle("r (cm)");
751  zaxis->SetTitle("z (cm)");
752 
753  TList mpalette;
754 
755  for (int i = 0; i < ncol; ++i) {
756  TBox* box = new TBox(315, 0 + 140. / ncol * i, 330, 0 + 140. / ncol * (i + 1));
757  box->SetFillStyle(1001);
758  box->SetFillColor(gStyle->GetColorPalette(i));
759  mpalette.Add(box);
760  }
761 
762  TGaxis* mpaxis = nullptr;
763  if (scale(1) != 1) {
764  mpaxis = new TGaxis(330, 0, 330, 140, mmin, mmax, 510, "SLG+");
765  } else {
766  mpaxis = new TGaxis(330, 0, 330, 140, mmin, mmax, 510, "SL+");
767  }
768  mpaxis->SetTickSize(.02);
769  mpaxis->SetLabelOffset(mpaxis->GetLabelOffset() * 0.5);
770  mpaxis->SetTitle(ptitle);
771  mpalette.Add(mpaxis);
772 
773  TCanvas* cc2 = new TCanvas(cname, cname, 1000, 500);
774  cc2->Range(-370., -20., 390., 150.);
775  TFrame* fr2 = new TFrame(-310, 0, 310, 140);
776  fr2->UseCurrentStyle();
777  fr2->Draw();
778  raxis->Draw();
779  zaxis->Draw();
780  std::cout << modulesmult.GetSize() << std::endl;
781  etalines.Draw();
782  etalabels.Draw();
783  if (color >= 0)
784  mpalette.Draw();
785  modulesmult.Draw();
786 
787  return cc2;
788 }

References electronCompare::blue, gather_cfg::cout, flavorHistoryFilter_cfi::dr, PVValHelper::dz, PVValHelper::eta, JetChargeProducer_cfi::exp, dqmdumpme::first, mps_fire::i, createfilelist::int, label, electronCompare::red, Scenarios_cff::scale, edm::second(), and LaserClient_cfi::zaxis.

Referenced by PlotOccupancyMapGeneric(), PlotOnTrackOccupancyGeneric(), and PlotTrackerXsect().

◆ linear()

float linear ( float  x)

◆ logarithm()

float logarithm ( float  x)

Definition at line 27 of file OccupancyPlotMacros.cc.

27 { return log(x); }

References dqm-mbProfile::log, and vertices_cff::x.

Referenced by PlotOccupancyMapGeneric().

◆ phase2bin()

std::pair<float, float> phase2bin ( int  i)

Definition at line 103 of file OccupancyPlotMacros.cc.

103  {
104  float dz = -1;
105  float dr = -1;
106 
107  if (i > 1000 && i < 1040) {
108  dz = 3.33;
109  dr = 0.4;
110  }
111  if (i > 1040 && i < 1130) {
112  dr = 3.33;
113  dz = 0.4;
114  }
115 
116  if (i > 2000 && i < 2550) {
117  dz = 2.5;
118  dr = 0.1;
119  }
120  if (i > 2550 && i < 3000) {
121  dz = 5.0;
122  dr = 0.1;
123  }
124 
125  if (i > 3000 && i < 5000) {
126  dz = 0.2;
127  dr = 5.0;
128  }
129 
130  if (i > 3100 && i < 3119) {
131  dz = 0.2;
132  dr = 2.5;
133  }
134  if (i > 3140 && i < 3159) {
135  dz = 0.2;
136  dr = 2.5;
137  }
138  if (i > 3180 && i < 3199) {
139  dz = 0.2;
140  dr = 2.5;
141  }
142  if (i > 3220 && i < 3239) {
143  dz = 0.2;
144  dr = 2.5;
145  }
146  if (i > 3260 && i < 3279) {
147  dz = 0.2;
148  dr = 2.5;
149  }
150 
151  if (i > 4100 && i < 4119) {
152  dz = 0.2;
153  dr = 2.5;
154  }
155  if (i > 4140 && i < 4159) {
156  dz = 0.2;
157  dr = 2.5;
158  }
159  if (i > 4180 && i < 4199) {
160  dz = 0.2;
161  dr = 2.5;
162  }
163  if (i > 4220 && i < 4239) {
164  dz = 0.2;
165  dr = 2.5;
166  }
167  if (i > 4260 && i < 4279) {
168  dz = 0.2;
169  dr = 2.5;
170  }
171 
172  std::pair<float, float> res(dz, dr);
173  return res;
174 }

References flavorHistoryFilter_cfi::dr, PVValHelper::dz, and mps_fire::i.

Referenced by PlotOccupancyMapPhase2(), and PlotOnTrackOccupancyPhase2().

◆ PlotDebugFPIX_XYMap()

void PlotDebugFPIX_XYMap ( TFile *  ff,
const char *  module,
const unsigned int  offset,
const char *  name 
)

Definition at line 790 of file OccupancyPlotMacros.cc.

790  {
791  gROOT->SetStyle("Plain");
792 
793  TCanvas* cc = new TCanvas(name, name, 750, 750);
794  cc->Range(-25, -25, 25, 25);
795  TFrame* fr1 = new TFrame(-20, -20, 20, 20);
796  fr1->UseCurrentStyle();
797  fr1->Draw();
798  ff->cd(module);
799  gDirectory->ls();
800  TProfile* avex = (TProfile*)gDirectory->Get("avex");
801  TProfile* avey = (TProfile*)gDirectory->Get("avey");
802  TProfile* avez = (TProfile*)gDirectory->Get("avez");
803 
804  if (avex && avey && avez) {
805  TText* tittext = new TText(0, 0, name);
806  tittext->SetTextSize(.04);
807  tittext->SetTextAlign(22);
808  tittext->Draw();
809  for (unsigned int mod = ioffset + 1; mod < ioffset + 57; ++mod) {
810  double x = avex->GetBinContent(mod);
811  double y = avey->GetBinContent(mod);
812  // TBox* modbox = new TBox(x-1,y-1,x+1,y+1);
813  char modstring[30];
814  sprintf(modstring, "%d", mod % 100);
815  TText* modtext = new TText(x, y, modstring);
816  modtext->SetTextAngle(atan(y / x) * 180 / 3.14159);
817  modtext->SetTextSize(.02);
818  modtext->SetTextAlign(22);
819  modtext->SetTextColor(kRed);
820  std::cout << mod << " " << x << " " << y << std::endl;
821  // modbox->Draw();
822  modtext->Draw();
823  }
824  for (unsigned int mod = ioffset + 101; mod < ioffset + 157; ++mod) {
825  double x = avex->GetBinContent(mod);
826  double y = avey->GetBinContent(mod);
827  // TBox* modbox = new TBox(x-1,y-1,x+1,y+1);
828  char modstring[30];
829  sprintf(modstring, "%d", mod % 100);
830  TText* modtext = new TText(x, y, modstring);
831  modtext->SetTextAngle(atan(y / x) * 180 / 3.14159);
832  modtext->SetTextSize(.02);
833  modtext->SetTextAlign(22);
834  modtext->SetTextColor(kBlue);
835  std::cout << mod << " " << x << " " << y << " " << atan(y / x) << std::endl;
836  // modbox->Draw();
837  modtext->Draw();
838  }
839  }
840 }

References gather_cfg::cout, alignCSCRings::ff, mod(), Skims_PA_cff::name, vertices_cff::x, and detailsBasic3DVector::y.

◆ PlotOccupancyMap()

void PlotOccupancyMap ( TFile *  ff,
const char *  module,
const float  min,
const float  max,
const float  mmin,
const float  mmax,
const int  color 
)

Definition at line 398 of file OccupancyPlotMacros.cc.

404  {
405  std::pair<float, float> (*size)(int);
406  size = &presentbin;
407 
408  std::vector<SubDetParams> vsub;
409  SubDetParams ppix = {"BPIX+FPIX", 100, 270};
410  vsub.push_back(ppix);
411  SubDetParams ptib = {"TIB", 1050, 1450};
412  vsub.push_back(ptib);
413  SubDetParams ptid = {"TID", 2070, 2400};
414  vsub.push_back(ptid);
415  SubDetParams ptob = {"TOB", 3000, 3700};
416  vsub.push_back(ptob);
417  SubDetParams ptecm = {"TEC-", 4000, 4850};
418  vsub.push_back(ptecm);
419  SubDetParams ptecp = {"TEC+", 5000, 5850};
420  vsub.push_back(ptecp);
421 
422  PlotOccupancyMapGeneric(ff, module, min, max, mmin, mmax, color, size, vsub);
423 }

References alignCSCRings::ff, createfilelist::int, SiStripPI::max, min(), PlotOccupancyMapGeneric(), presentbin(), and findQualityFiles::size.

◆ PlotOccupancyMapGeneric()

void PlotOccupancyMapGeneric ( TFile *  ff,
const char *  module,
const float  min,
const float  max,
const float  mmin,
const float  mmax,
const int  color,
std::pair< float, float >(*)(int)  size,
const std::vector< SubDetParams > &  vsub 
)

◆ PlotOccupancyMapPhase1()

void PlotOccupancyMapPhase1 ( TFile *  ff,
const char *  module,
const float  min,
const float  max,
const float  mmin,
const float  mmax,
const int  color 
)

Definition at line 425 of file OccupancyPlotMacros.cc.

431  {
432  std::pair<float, float> (*size)(int);
433  size = &phase1bin;
434 
435  std::vector<SubDetParams> vsub;
436  SubDetParams ppix = {"BPIX+FPIX", 1000, 1080};
437  vsub.push_back(ppix);
438  SubDetParams ptib = {"TIB", 1090, 1450};
439  vsub.push_back(ptib);
440  SubDetParams ptid = {"TID", 2070, 2400};
441  vsub.push_back(ptid);
442  SubDetParams ptob = {"TOB", 3000, 3700};
443  vsub.push_back(ptob);
444  SubDetParams ptecm = {"TEC-", 4000, 4850};
445  vsub.push_back(ptecm);
446  SubDetParams ptecp = {"TEC+", 5000, 5850};
447  vsub.push_back(ptecp);
448 
449  PlotOccupancyMapGeneric(ff, module, min, max, mmin, mmax, color, size, vsub);
450 }

References alignCSCRings::ff, createfilelist::int, SiStripPI::max, min(), phase1bin(), PlotOccupancyMapGeneric(), and findQualityFiles::size.

◆ PlotOccupancyMapPhase2()

void PlotOccupancyMapPhase2 ( TFile *  ff,
const char *  module,
const float  min,
const float  max,
const float  mmin,
const float  mmax,
const int  color 
)

Definition at line 452 of file OccupancyPlotMacros.cc.

458  {
459  std::pair<float, float> (*size)(int);
460  size = &phase2bin;
461 
462  std::vector<SubDetParams> vsub;
463  SubDetParams ppix = {"BPIX+FPIX", 1000, 1090};
464  vsub.push_back(ppix);
465  SubDetParams ptob = {"TOB", 2000, 2900};
466  vsub.push_back(ptob);
467  SubDetParams ptecm = {"TEC-", 3100, 3300};
468  vsub.push_back(ptecm);
469  SubDetParams ptecp = {"TEC+", 4100, 4300};
470  vsub.push_back(ptecp);
471 
472  PlotOccupancyMapGeneric(ff, module, min, max, mmin, mmax, color, size, vsub);
473 }

References alignCSCRings::ff, createfilelist::int, SiStripPI::max, min(), phase2bin(), PlotOccupancyMapGeneric(), and findQualityFiles::size.

◆ PlotOnTrackOccupancy()

void PlotOnTrackOccupancy ( TFile *  ff,
const char *  module,
const char *  ontrkmod,
const float  mmin,
const float  mmax,
const int  color 
)

Definition at line 475 of file OccupancyPlotMacros.cc.

476  {
477  std::pair<float, float> (*size)(int);
478  size = &presentbin;
479 
480  std::vector<SubDetParams> vsub;
481  SubDetParams ppix = {"BPIX+FPIX", 100, 270};
482  vsub.push_back(ppix);
483  SubDetParams ptib = {"TIB", 1050, 1450};
484  vsub.push_back(ptib);
485  SubDetParams ptid = {"TID", 2070, 2400};
486  vsub.push_back(ptid);
487  SubDetParams ptob = {"TOB", 3000, 3700};
488  vsub.push_back(ptob);
489  SubDetParams ptecm = {"TEC-", 4000, 4850};
490  vsub.push_back(ptecm);
491  SubDetParams ptecp = {"TEC+", 5000, 5850};
492  vsub.push_back(ptecp);
493 
494  PlotOnTrackOccupancyGeneric(ff, module, ontrkmod, mmin, mmax, color, size, vsub);
495 }

References alignCSCRings::ff, createfilelist::int, PlotOnTrackOccupancyGeneric(), presentbin(), and findQualityFiles::size.

◆ PlotOnTrackOccupancyGeneric()

void PlotOnTrackOccupancyGeneric ( TFile *  ff,
const char *  module,
const char *  ontrkmod,
const float  mmin,
const float  mmax,
const int  color,
std::pair< float, float >(*)(int)  size,
const std::vector< SubDetParams > &  vsub 
)

Definition at line 537 of file OccupancyPlotMacros.cc.

544  {
545  gROOT->SetStyle("Plain");
546 
547  TProfile* avemult = nullptr;
548  TProfile* aveontrkmult = nullptr;
549  TProfile* averadius = nullptr;
550  TProfile* avez = nullptr;
551 
552  if (ff->cd(module)) {
553  avemult = (TProfile*)gDirectory->Get("avemult");
554  averadius = (TProfile*)gDirectory->Get("averadius");
555  avez = (TProfile*)gDirectory->Get("avez");
556  }
557  if (ff->cd(ontrkmod))
558  aveontrkmult = (TProfile*)gDirectory->Get("avemult");
559 
560  std::cout << "pointers " << avemult << " " << aveontrkmult << " " << averadius << " " << avez << std::endl;
561 
562  if (averadius && avez && avemult && aveontrkmult) {
563  TH1D* havemult = avemult->ProjectionX("havemult");
564  TH1D* haveontrkmult = aveontrkmult->ProjectionX("haveontrkmult");
565  havemult->SetDirectory(nullptr);
566  haveontrkmult->SetDirectory(nullptr);
567  haveontrkmult->Divide(havemult);
568 
569  new TCanvas("ontrkmult", "ontrkmult", 1200, 500);
570  gPad->SetLogy(1);
571  haveontrkmult->SetStats(false);
572  haveontrkmult->SetLineColor(kRed);
573  haveontrkmult->SetMarkerColor(kRed);
574  haveontrkmult->SetMarkerSize(.5);
575  haveontrkmult->SetMarkerStyle(20);
576  haveontrkmult->DrawCopy();
577 
578  bool same = false;
579  TCanvas* o2 = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("ontrkmult2");
580  if (o2) {
581  same = true;
582  haveontrkmult->SetLineColor(kBlue);
583  haveontrkmult->SetMarkerColor(kBlue);
584  } else {
585  o2 = new TCanvas("ontrkmult2", "ontrkmult2", 1200, 800);
586  o2->Divide(3, 2);
587  }
588  for (unsigned int isub = 0; isub < vsub.size(); ++isub) {
589  printFrame(o2, haveontrkmult, vsub[isub].label.c_str(), isub + 1, vsub[isub].min, vsub[isub].max, same);
590  }
591 
592  float (*scale)(float);
593  scale = &linear;
594 
595  drawMap("ontrkmultmap", haveontrkmult, averadius, avez, mmin, mmax, size, scale, color);
596  }
597 }

References gather_cfg::cout, drawMap(), alignCSCRings::ff, dqmMemoryStats::float, label, linear(), printFrame(), Scenarios_cff::scale, and findQualityFiles::size.

Referenced by PlotOnTrackOccupancy(), PlotOnTrackOccupancyPhase1(), and PlotOnTrackOccupancyPhase2().

◆ PlotOnTrackOccupancyPhase1()

void PlotOnTrackOccupancyPhase1 ( TFile *  ff,
const char *  module,
const char *  ontrkmod,
const float  mmin,
const float  mmax,
const int  color 
)

Definition at line 497 of file OccupancyPlotMacros.cc.

498  {
499  std::pair<float, float> (*size)(int);
500  size = &phase1bin;
501 
502  std::vector<SubDetParams> vsub;
503  SubDetParams ppix = {"BPIX+FPIX", 1000, 1080};
504  vsub.push_back(ppix);
505  SubDetParams ptib = {"TIB", 1090, 1450};
506  vsub.push_back(ptib);
507  SubDetParams ptid = {"TID", 2070, 2400};
508  vsub.push_back(ptid);
509  SubDetParams ptob = {"TOB", 3000, 3700};
510  vsub.push_back(ptob);
511  SubDetParams ptecm = {"TEC-", 4000, 4850};
512  vsub.push_back(ptecm);
513  SubDetParams ptecp = {"TEC+", 5000, 5850};
514  vsub.push_back(ptecp);
515 
516  PlotOnTrackOccupancyGeneric(ff, module, ontrkmod, mmin, mmax, color, size, vsub);
517 }

References alignCSCRings::ff, createfilelist::int, phase1bin(), PlotOnTrackOccupancyGeneric(), and findQualityFiles::size.

◆ PlotOnTrackOccupancyPhase2()

void PlotOnTrackOccupancyPhase2 ( TFile *  ff,
const char *  module,
const char *  ontrkmod,
const float  mmin,
const float  mmax,
const int  color 
)

Definition at line 519 of file OccupancyPlotMacros.cc.

520  {
521  std::pair<float, float> (*size)(int);
522  size = &phase2bin;
523 
524  std::vector<SubDetParams> vsub;
525  SubDetParams ppix = {"BPIX+FPIX", 1000, 1090};
526  vsub.push_back(ppix);
527  SubDetParams ptob = {"TOB", 2000, 2900};
528  vsub.push_back(ptob);
529  SubDetParams ptecm = {"TEC-", 3100, 3300};
530  vsub.push_back(ptecm);
531  SubDetParams ptecp = {"TEC+", 4100, 4300};
532  vsub.push_back(ptecp);
533 
534  PlotOnTrackOccupancyGeneric(ff, module, ontrkmod, mmin, mmax, color, size, vsub);
535 }

References alignCSCRings::ff, createfilelist::int, phase2bin(), PlotOnTrackOccupancyGeneric(), and findQualityFiles::size.

◆ PlotTrackerXsect()

void PlotTrackerXsect ( TFile *  ff,
const char *  module 
)

Definition at line 842 of file OccupancyPlotMacros.cc.

842  {
843  gROOT->SetStyle("Plain");
844 
845  if (ff->cd(module)) {
846  TProfile* averadius = (TProfile*)gDirectory->Get("averadius");
847  TProfile* avez = (TProfile*)gDirectory->Get("avez");
848 
849  std::cout << "pointers " << averadius << " " << avez << std::endl;
850 
851  if (averadius && avez) {
852  std::pair<float, float> (*size)(int);
853  size = &presentbin;
854  float (*scale)(float);
855  scale = &linear;
856 
857  drawMap("trackermap", averadius, averadius, avez, 0, 0, size, scale, -1);
858  }
859  }
860 }

References gather_cfg::cout, drawMap(), alignCSCRings::ff, dqmMemoryStats::float, createfilelist::int, linear(), presentbin(), Scenarios_cff::scale, and findQualityFiles::size.

◆ printFrame()

void printFrame ( TCanvas *  c,
TH1D *  h,
const char *  label,
const int  frame,
const int  min,
const int  max,
const bool  same = false 
)

Definition at line 245 of file OccupancyPlotMacros.cc.

245  {
246  c->cd(frame);
247  h->SetAxisRange(min, max);
248  if (same) {
249  h->DrawCopy("same");
250  } else {
251  h->DrawCopy();
252  TText* t = new TText((max + min) / 2, h->GetMaximum(), label);
253  t->SetTextAlign(22);
254  t->DrawClone();
255  }
256 }

References HltBtagPostValidation_cff::c, amptDefault_cfi::frame, label, SiStripPI::max, min(), and OrderedSet::t.

Referenced by PlotOccupancyMapGeneric(), and PlotOnTrackOccupancyGeneric().

◆ TrendPlotSingleBin()

TH1D* TrendPlotSingleBin ( TFile *  ff,
const char *  module,
const char *  hname,
const int  bin 
)

Definition at line 862 of file OccupancyPlotMacros.cc.

862  {
863  CommonAnalyzer caoccu(ff, "", module);
864 
865  TH1D* occutrend = new TH1D("occutrend", "Average number of clusters vs run", 10, 0., 10.);
866  occutrend->SetCanExtend(TH1::kXaxis);
867  occutrend->Sumw2();
868 
869  std::vector<unsigned int> runs = caoccu.getRunList();
870  std::sort(runs.begin(), runs.end());
871 
872  {
873  for (unsigned int i = 0; i < runs.size(); ++i) {
874  char runlabel[100];
875  sprintf(runlabel, "%d", runs[i]);
876  char runpath[100];
877  sprintf(runpath, "run_%d", runs[i]);
878  caoccu.setPath(runpath);
879 
880  TProfile* occu = nullptr;
881  if (occu == nullptr)
882  occu = (TProfile*)caoccu.getObject(hname);
883  if (occu) {
884  const int ibin = occu->FindBin(bin);
885  std::cout << runlabel << " "
886  << " " << ibin << " " << occu->GetBinContent(ibin) << " " << occu->GetBinError(ibin) << std::endl;
887  const int jbin = occutrend->Fill(runlabel, occu->GetBinContent(ibin));
888  occutrend->SetBinError(jbin, occu->GetBinError(ibin));
889  }
890  }
891  }
892  return occutrend;
893 }

References newFWLiteAna::bin, gather_cfg::cout, alignCSCRings::ff, CommonAnalyzer::getObject(), CommonAnalyzer::getRunList(), mps_fire::i, writedatasetfile::runs, and CommonAnalyzer::setPath().

mps_fire.i
i
Definition: mps_fire.py:355
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
min
T min(T a, T b)
Definition: MathUtil.h:58
printFrame
void printFrame(TCanvas *c, TH1D *h, const char *label, const int frame, const int min, const int max, const bool same)
Definition: OccupancyPlotMacros.cc:245
mod
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
gather_cfg.cout
cout
Definition: gather_cfg.py:144
writedatasetfile.runs
runs
Definition: writedatasetfile.py:27
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:215
dqmdumpme.first
first
Definition: dqmdumpme.py:55
CommonAnalyzer
Definition: CommonAnalyzer.h:12
LaserClient_cfi.zaxis
zaxis
Definition: LaserClient_cfi.py:91
electronCompare.red
red
Definition: electronCompare.py:135
PVValHelper::eta
Definition: PVValidationHelpers.h:69
alignCSCRings.ff
ff
Definition: alignCSCRings.py:148
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
vertices_cff.x
x
Definition: vertices_cff.py:29
h
OrderedSet.t
t
Definition: OrderedSet.py:90
phase1bin
std::pair< float, float > phase1bin(int i)
Definition: OccupancyPlotMacros.cc:176
drawMap
TCanvas * drawMap(const char *cname, const TH1 *hval, const TProfile *averadius, const TProfile *avez, const float mmin, const float mmax, std::pair< float, float >(*size)(int), float(*scale)(float), const int color, const char *ptitle)
Definition: OccupancyPlotMacros.cc:599
Scenarios_cff.scale
scale
Definition: Scenarios_cff.py:2186
presentbin
std::pair< float, float > presentbin(int i)
Definition: OccupancyPlotMacros.cc:29
PlotOccupancyMapGeneric
void PlotOccupancyMapGeneric(TFile *ff, const char *module, const float min, const float max, const float mmin, const float mmax, const int color, std::pair< float, float >(*size)(int), std::vector< SubDetParams > &vsub)
Definition: OccupancyPlotMacros.cc:258
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
createfilelist.int
int
Definition: createfilelist.py:10
electronCompare.blue
blue
Definition: electronCompare.py:137
phase2bin
std::pair< float, float > phase2bin(int i)
Definition: OccupancyPlotMacros.cc:103
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
module
Definition: vlib.h:198
cc
res
Definition: Electron.h:6
newFWLiteAna.bin
bin
Definition: newFWLiteAna.py:161
linear
float linear(float x)
Definition: OccupancyPlotMacros.cc:26
PVValHelper::dz
Definition: PVValidationHelpers.h:50
amptDefault_cfi.frame
frame
Definition: amptDefault_cfi.py:12
flavorHistoryFilter_cfi.dr
dr
Definition: flavorHistoryFilter_cfi.py:37
detailsBasic3DVector::y
float float y
Definition: extBasic3DVector.h:14
PlotOnTrackOccupancyGeneric
void PlotOnTrackOccupancyGeneric(TFile *ff, const char *module, const char *ontrkmod, const float mmin, const float mmax, const int color, std::pair< float, float >(*size)(int), const std::vector< SubDetParams > &vsub)
Definition: OccupancyPlotMacros.cc:537
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
SubDetParams
Definition: OccupancyPlotMacros.h:15
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
label
const char * label
Definition: PFTauDecayModeTools.cc:11
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443