CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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)
 

Function Documentation

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

Definition at line 238 of file OccupancyPlotMacros.cc.

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

238  {
239 
240  float cumoccu = -2.;
241  double cumerr = -2;
242 
243  if(ff->cd(module)) {
244 
245  TProfile* aveoccu= (TProfile*)gDirectory->Get("aveoccu");
246  // TProfile* avemult= (TProfile*)gDirectory->Get("avemult");
247  TH1F* nchannels = (TH1F*)gDirectory->Get("nchannels_real");
248 
249  float sumoccu=0.;
250  float sumnchannels=0;
251  double sumerrsq=0;
252 
253  for(int i=lowerbin; i<upperbin+1; ++i) {
254  std::cout << "processing bin " << i << " " << aveoccu->GetBinContent(i) << "+/-" << aveoccu->GetBinError(i) << std::endl;
255  sumoccu += aveoccu->GetBinContent(i);
256  sumnchannels += nchannels->GetBinContent(i);
257  sumerrsq += aveoccu->GetBinError(i)*aveoccu->GetBinError(i);
258  }
259  cumoccu = sumnchannels!=0 ? sumoccu/sumnchannels : -1;
260  cumerr = sumnchannels!=0 ? sqrt(sumerrsq)/sumnchannels : -1;
261  std::cout << "Cumulative occupancy: " << sumoccu << " " << sumnchannels << " " << cumoccu << "+/-" << cumerr;
262  }
263 
264  return cumoccu;
265 
266 }
int i
Definition: DBlmapReader.cc:9
T sqrt(T t)
Definition: SSEVec.h:48
tuple cout
Definition: gather_cfg.py:121
Definition: vlib.h:208
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 419 of file OccupancyPlotMacros.cc.

References gather_cfg::cout, eta, create_public_lumi_plots::exp, plotBeamSpotDB::first, cmsRelvalreport::green(), i, diffTwoXMLs::label, cmsRelvalreport::red(), pileupReCalc_HLTpaths::scale, and edm::second().

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

420  {
421 
422  if(color == 1) {
423  // A not-so-great color version
424  const Int_t NRGBs = 5;
425  const Int_t NCont = 255;
426  Double_t stops[NRGBs] = { 0.00, 0.25, 0.50, 0.75, 1.00 };
427  Double_t red[NRGBs] = { 0.00, 0.00, 0.40, 1.00, 1.00 };
428  Double_t green[NRGBs] = { 0.00, 0.40, 0.70, 0.60, 1.00 };
429  Double_t blue[NRGBs] = { 0.30, 0.60, 0.00, 0.00, 0.20 };
430  TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
431  gStyle->SetNumberContours(NCont);
432  }
433  else if(color==2) {
434  // Gray scale
435  const Int_t NRGBs = 3;
436  const Int_t NCont = 255;
437  Double_t stops[NRGBs] = { 0.00, 0.50, 1.00 };
438  Double_t red[NRGBs] = { 0.90, 0.50, 0.00};
439  Double_t green[NRGBs] = { 0.90, 0.50, 0.00};
440  Double_t blue[NRGBs] = { 0.90, 0.50, 0.00};
441  TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
442  gStyle->SetNumberContours(NCont);
443  }
444  else if(color==3) {
445  // used by Kevin in the TRK-11-001 paper
446  const Int_t NRGBs = 7;
447  const Int_t NCont = 255;
448  Double_t stops[NRGBs] = { 0.00, 0.15, 0.30, 0.45, 0.65, 0.85, 1.00 };
449  Double_t red[NRGBs] = { 0.60, 0.30, 0.00, 0.00, 0.60, 0.40, 0.00 };
450  Double_t green[NRGBs] = { 1.00, 0.90, 0.80, 0.75, 0.20, 0.00, 0.00 };
451  Double_t blue[NRGBs] = { 1.00, 1.00, 1.00, 0.30, 0.00, 0.00, 0.00 };
452  TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
453  gStyle->SetNumberContours(NCont);
454  }
455 
456  int ncol = gStyle->GetNumberOfColors();
457  std::cout << "Number of colors " << ncol << std::endl;
458  // Loop on bins and creation of boxes
459 
460  TList modulesmult;
461 
462  for(int i=1;i<hval->GetNbinsX();++i) {
463 
464  if(averadius->GetBinEntries(i)*avez->GetBinEntries(i)) {
465 
466  double dz = -1.;
467  double dr = -1.;
468  // determine module size
469 
470  dz=(*size)(i).first;
471  dr=(*size)(i).second;
472 
473  if(dz<0 && dr<0) continue;
474 
475  {
476  TBox* modmult = new TBox(avez->GetBinContent(i)-dz,averadius->GetBinContent(i)-dr,avez->GetBinContent(i)+dz,averadius->GetBinContent(i)+dr);
477  modmult->SetFillStyle(1001);
478  if(color < 0) {
479  modmult->SetFillColor(kBlack);
480  }
481  else {
482  int icol=int(ncol*(scale(hval->GetBinContent(i))-scale(mmin))/(scale(mmax)-scale(mmin)));
483  if(icol < 0) icol=0;
484  if(icol > (ncol-1)) icol=(ncol-1);
485  std::cout << i << " " << icol << " " << hval->GetBinContent(i) << std::endl;
486  modmult->SetFillColor(gStyle->GetColorPalette(icol));
487  }
488  modulesmult.Add(modmult);
489  }
490 
491  }
492 
493  }
494  // eta boundaries lines
495  double etavalext[] = {4.,3.5,3.,2.8,2.6,2.4,2.2,2.0,1.8,1.6};
496  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};
497  TList etalines;
498  TList etalabels;
499  TList paperlabels;
500  for(int i=0;i<10;++i) {
501  // double eta = 3.0-i*0.2;
502  double eta = etavalext[i];
503  TLine* lin = new TLine(295,2*295/(exp(eta)-exp(-eta)),305,2*305/(exp(eta)-exp(-eta)));
504  etalines.Add(lin);
505  char lab[100];
506  sprintf(lab,"%3.1f",eta);
507  TText* label = new TText(285,2*285/(exp(eta)-exp(-eta)),lab);
508  label->SetTextSize(.03);
509  label->SetTextAlign(22);
510  etalabels.Add(label);
511  }
512  for(int i=0;i<10;++i) {
513  // double eta = -3.0+i*0.2;
514  double eta = -1*etavalext[i];
515  TLine* lin = new TLine(-295,-2*295/(exp(eta)-exp(-eta)),-305,-2*305/(exp(eta)-exp(-eta)));
516  etalines.Add(lin);
517  char lab[100];
518  sprintf(lab,"%3.1f",eta);
519  TText* label = new TText(-285,-2*285/(exp(eta)-exp(-eta)),lab);
520  label->SetTextSize(.03);
521  label->SetTextAlign(22);
522  etalabels.Add(label);
523  }
524  for(int i=0;i<15;++i) {
525  // double eta = -1.4+i*0.2;
526  double eta = etavalint[i];
527  TLine* lin = new TLine(130.*(exp(eta)-exp(-eta))/2.,130,138.*(exp(eta)-exp(-eta))/2.,138);
528  etalines.Add(lin);
529  char lab[100];
530  sprintf(lab,"%3.1f",eta);
531  TText* label = new TText(125.*(exp(eta)-exp(-eta))/2.,125,lab);
532  label->SetTextSize(.03);
533  label->SetTextAlign(22);
534  etalabels.Add(label);
535  }
536  TLatex* etalab = new TLatex(0,115,"#eta");
537  etalab->SetTextSize(.03);
538  etalab->SetTextAlign(22);
539  etalabels.Add(etalab);
540 
541  // CMS label
542  TLatex *cmslab = new TLatex(0.15,0.965,"CMS");
543  cmslab->SetNDC();
544  cmslab->SetTextSize(0.04);
545  cmslab->SetTextAlign(31);
546  paperlabels.Add(cmslab);
547  TLatex *enelab = new TLatex(0.92,0.965,"#sqrt{s} = 7 TeV");
548  enelab->SetNDC();
549  enelab->SetTextSize(0.04);
550  enelab->SetTextAlign(31);
551  paperlabels.Add(enelab);
552  /*
553  TLatex *lumilab = new TLatex(0.6,0.965,Form("L = %.1f fb^{-1}",19.7));
554  lumilab->SetNDC();
555  lumilab->SetTextSize(0.04);
556  lumilab->SetTextAlign(31);
557  paperlabels.Add(lumilab);
558  */
559 
560 
561  TGaxis *raxis = new TGaxis(-310,0,-310,140,0,140,10,"S");
562  TGaxis *zaxis = new TGaxis(-310,0,310,0,-310,310,10,"S");
563  raxis->SetTickSize(.01); zaxis->SetTickSize(.01);
564  raxis->SetTitle("r (cm)"); zaxis->SetTitle("z (cm)");
565 
566  TList mpalette;
567 
568  for(int i = 0;i< ncol ; ++i) {
569  TBox* box= new TBox(315,0+140./ncol*i,330,0+140./ncol*(i+1));
570  box->SetFillStyle(1001);
571  box->SetFillColor(gStyle->GetColorPalette(i));
572  mpalette.Add(box);
573 
574  }
575 
576  TGaxis *mpaxis=0;
577  if(scale(1)!=1) {
578  mpaxis = new TGaxis(330,0,330,140,mmin,mmax,510,"SLG+");
579  }
580  else {
581  mpaxis = new TGaxis(330,0,330,140,mmin,mmax,510,"SL+");
582  }
583  mpaxis->SetTickSize(.02);
584  mpaxis->SetLabelOffset(mpaxis->GetLabelOffset()*0.5);
585  mpaxis->SetTitle(ptitle);
586  mpalette.Add(mpaxis);
587 
588  TCanvas* cc2 = new TCanvas(cname,cname,1000,500);
589  cc2->Range(-370.,-20.,390.,150.);
590  TFrame* fr2 = new TFrame(-310,0,310,140);
591  fr2->UseCurrentStyle();
592  fr2->Draw();
593  raxis->Draw(); zaxis->Draw();
594  std::cout << modulesmult.GetSize() << std::endl;
595  etalines.Draw();
596  etalabels.Draw();
597  if(color>=0) mpalette.Draw();
598  modulesmult.Draw();
599 
600  return cc2;
601 
602 }
int i
Definition: DBlmapReader.cc:9
U second(std::pair< T, U > const &p)
tuple cout
Definition: gather_cfg.py:121
float linear ( float  x)
float logarithm ( float  x)

Definition at line 25 of file OccupancyPlotMacros.cc.

References create_public_lumi_plots::log.

Referenced by PlotOccupancyMapGeneric().

25 {return log(x);}
T x() const
Cartesian x coordinate.
std::pair<float,float> phase2bin ( int  i)

Definition at line 56 of file OccupancyPlotMacros.cc.

Referenced by PlotOccupancyMapPhase2(), and PlotOnTrackOccupancyPhase2().

56  {
57 
58  float dz=-1; float dr=-1;
59 
60  if(i > 1000 && i < 1040) { dz=3.33;dr=0.4;}
61  if(i > 1040 && i < 1130) { dr=3.33;dz=0.4;}
62 
63  if(i > 2000 && i < 2550) { dz=2.5;dr=0.1;}
64  if(i > 2550 && i < 3000) { dz=5.0;dr=0.1;}
65 
66  if(i > 3000 && i < 5000) { dz=0.2;dr=5.0;}
67 
68  if(i > 3100 && i < 3119) { dz=0.2;dr=2.5;}
69  if(i > 3140 && i < 3159) { dz=0.2;dr=2.5;}
70  if(i > 3180 && i < 3199) { dz=0.2;dr=2.5;}
71  if(i > 3220 && i < 3239) { dz=0.2;dr=2.5;}
72  if(i > 3260 && i < 3279) { dz=0.2;dr=2.5;}
73 
74  if(i > 4100 && i < 4119) { dz=0.2;dr=2.5;}
75  if(i > 4140 && i < 4159) { dz=0.2;dr=2.5;}
76  if(i > 4180 && i < 4199) { dz=0.2;dr=2.5;}
77  if(i > 4220 && i < 4239) { dz=0.2;dr=2.5;}
78  if(i > 4260 && i < 4279) { dz=0.2;dr=2.5;}
79 
80  std::pair<float,float> res(dz,dr);
81  return res;
82 }
int i
Definition: DBlmapReader.cc:9
void PlotDebugFPIX_XYMap ( TFile *  ff,
const char *  module,
const unsigned int  offset,
const char *  name 
)

Definition at line 605 of file OccupancyPlotMacros.cc.

References gather_cfg::cout, mod(), x(), and detailsBasic3DVector::y.

605  {
606 
607  gROOT->SetStyle("Plain");
608 
609  TCanvas* cc = new TCanvas(name,name,750,750);
610  cc->Range(-25,-25,25,25);
611  TFrame* fr1 = new TFrame(-20,-20,20,20);
612  fr1->UseCurrentStyle();
613  fr1->Draw();
614  ff->cd(module);
615  gDirectory->ls();
616  TProfile* avex = (TProfile*)gDirectory->Get("avex");
617  TProfile* avey = (TProfile*)gDirectory->Get("avey");
618  TProfile* avez = (TProfile*)gDirectory->Get("avez");
619 
620  if(avex && avey && avez) {
621  TText* tittext = new TText(0,0,name);
622  tittext->SetTextSize(.04); tittext->SetTextAlign(22);
623  tittext->Draw();
624  for(unsigned int mod=ioffset+1;mod<ioffset+57;++mod) {
625  double x = avex->GetBinContent(mod);
626  double y = avey->GetBinContent(mod);
627  // TBox* modbox = new TBox(x-1,y-1,x+1,y+1);
628  char modstring[30];
629  sprintf(modstring,"%d",mod%100);
630  TText* modtext = new TText(x,y,modstring);
631  modtext->SetTextAngle(atan(y/x)*180/3.14159);
632  modtext->SetTextSize(.02); modtext->SetTextAlign(22); modtext->SetTextColor(kRed);
633  std::cout << mod << " " << x << " " << y << std::endl;
634  // modbox->Draw();
635  modtext->Draw();
636  }
637  for(unsigned int mod=ioffset+101;mod<ioffset+157;++mod) {
638  double x = avex->GetBinContent(mod);
639  double y = avey->GetBinContent(mod);
640  // TBox* modbox = new TBox(x-1,y-1,x+1,y+1);
641  char modstring[30];
642  sprintf(modstring,"%d",mod%100);
643  TText* modtext = new TText(x,y,modstring);
644  modtext->SetTextAngle(atan(y/x)*180/3.14159);
645  modtext->SetTextSize(.02); modtext->SetTextAlign(22); modtext->SetTextColor(kBlue);
646  std::cout << mod << " " << x << " " << y << " " << atan(y/x) << std::endl;
647  // modbox->Draw();
648  modtext->Draw();
649  }
650 
651  }
652 }
T x() const
Cartesian x coordinate.
tuple cout
Definition: gather_cfg.py:121
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
Definition: vlib.h:208
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 268 of file OccupancyPlotMacros.cc.

References PlotOccupancyMapGeneric(), presentbin(), and findQualityFiles::size.

268  {
269 
270  std::pair<float,float> (*size)(int);
271  size = &presentbin;
272 
273  std::vector<SubDetParams> vsub;
274  SubDetParams ppix={"BPIX+FPIX",100,270}; vsub.push_back(ppix);
275  SubDetParams ptib={"TIB",1050,1450}; vsub.push_back(ptib);
276  SubDetParams ptid={"TID",2070,2400}; vsub.push_back(ptid);
277  SubDetParams ptob={"TOB",3000,3700}; vsub.push_back(ptob);
278  SubDetParams ptecm={"TEC-",4000,4850}; vsub.push_back(ptecm);
279  SubDetParams ptecp={"TEC+",5000,5850}; vsub.push_back(ptecp);
280 
281  PlotOccupancyMapGeneric(ff,module,min,max,mmin,mmax,color,size,vsub);
282 }
std::pair< float, float > presentbin(int i)
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)
T min(T a, T b)
Definition: MathUtil.h:58
Definition: vlib.h:208
tuple size
Write out results.
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 
)
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 284 of file OccupancyPlotMacros.cc.

References phase1bin(), PlotOccupancyMapGeneric(), and findQualityFiles::size.

284  {
285 
286  std::pair<float,float> (*size)(int);
287  size = &phase1bin;
288 
289  std::vector<SubDetParams> vsub;
290  SubDetParams ppix={"BPIX+FPIX",1000,1080}; vsub.push_back(ppix);
291  SubDetParams ptib={"TIB",1090,1450}; vsub.push_back(ptib);
292  SubDetParams ptid={"TID",2070,2400}; vsub.push_back(ptid);
293  SubDetParams ptob={"TOB",3000,3700}; vsub.push_back(ptob);
294  SubDetParams ptecm={"TEC-",4000,4850}; vsub.push_back(ptecm);
295  SubDetParams ptecp={"TEC+",5000,5850}; vsub.push_back(ptecp);
296 
297  PlotOccupancyMapGeneric(ff,module,min,max,mmin,mmax,color,size,vsub);
298 }
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)
std::pair< float, float > phase1bin(int i)
T min(T a, T b)
Definition: MathUtil.h:58
Definition: vlib.h:208
tuple size
Write out results.
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 300 of file OccupancyPlotMacros.cc.

References phase2bin(), PlotOccupancyMapGeneric(), and findQualityFiles::size.

300  {
301 
302  std::pair<float,float> (*size)(int);
303  size = &phase2bin;
304 
305  std::vector<SubDetParams> vsub;
306  SubDetParams ppix={"BPIX+FPIX",1000,1090}; vsub.push_back(ppix);
307  SubDetParams ptob={"TOB",2000,2900}; vsub.push_back(ptob);
308  SubDetParams ptecm={"TEC-",3100,3300}; vsub.push_back(ptecm);
309  SubDetParams ptecp={"TEC+",4100,4300}; vsub.push_back(ptecp);
310 
311  PlotOccupancyMapGeneric(ff,module,min,max,mmin,mmax,color,size,vsub);
312 }
std::pair< float, float > phase2bin(int i)
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)
T min(T a, T b)
Definition: MathUtil.h:58
Definition: vlib.h:208
tuple size
Write out results.
void PlotOnTrackOccupancy ( TFile *  ff,
const char *  module,
const char *  ontrkmod,
const float  mmin,
const float  mmax,
const int  color 
)

Definition at line 314 of file OccupancyPlotMacros.cc.

References PlotOnTrackOccupancyGeneric(), presentbin(), and findQualityFiles::size.

314  {
315 
316  std::pair<float,float> (*size)(int);
317  size = &presentbin;
318 
319  std::vector<SubDetParams> vsub;
320  SubDetParams ppix={"BPIX+FPIX",100,270}; vsub.push_back(ppix);
321  SubDetParams ptib={"TIB",1050,1450}; vsub.push_back(ptib);
322  SubDetParams ptid={"TID",2070,2400}; vsub.push_back(ptid);
323  SubDetParams ptob={"TOB",3000,3700}; vsub.push_back(ptob);
324  SubDetParams ptecm={"TEC-",4000,4850}; vsub.push_back(ptecm);
325  SubDetParams ptecp={"TEC+",5000,5850}; vsub.push_back(ptecp);
326 
327  PlotOnTrackOccupancyGeneric(ff,module,ontrkmod,mmin,mmax,color,size,vsub);
328 }
std::pair< float, float > presentbin(int i)
Definition: vlib.h:208
tuple size
Write out results.
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 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 360 of file OccupancyPlotMacros.cc.

References gather_cfg::cout, drawMap(), diffTwoXMLs::label, linear(), printFrame(), pileupReCalc_HLTpaths::scale, and findQualityFiles::size.

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

361  {
362 
363 
364  gROOT->SetStyle("Plain");
365 
366  TProfile* avemult=0;
367  TProfile* aveontrkmult=0;
368  TProfile* averadius =0;
369  TProfile* avez =0;
370 
371  if(ff->cd(module)) {
372  avemult= (TProfile*)gDirectory->Get("avemult");
373  averadius = (TProfile*)gDirectory->Get("averadius");
374  avez = (TProfile*)gDirectory->Get("avez");
375  }
376  if(ff->cd(ontrkmod)) aveontrkmult= (TProfile*)gDirectory->Get("avemult");
377 
378  std::cout << "pointers " << avemult << " " << aveontrkmult << " " << averadius << " " << avez << std::endl;
379 
380  if( averadius && avez && avemult && aveontrkmult) {
381 
382  TH1D* havemult = avemult->ProjectionX("havemult");
383  TH1D* haveontrkmult = aveontrkmult->ProjectionX("haveontrkmult");
384  havemult->SetDirectory(0);
385  haveontrkmult->SetDirectory(0);
386  haveontrkmult->Divide(havemult);
387 
388  new TCanvas("ontrkmult","ontrkmult",1200,500);
389  gPad->SetLogy(1);
390  haveontrkmult->SetStats(0);
391  haveontrkmult->SetLineColor(kRed);
392  haveontrkmult->SetMarkerColor(kRed);
393  haveontrkmult->SetMarkerSize(.5);
394  haveontrkmult->SetMarkerStyle(20);
395  haveontrkmult->DrawCopy();
396 
397  bool same=false;
398  TCanvas* o2 = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("ontrkmult2");
399  if(o2) {
400  same=true;
401  haveontrkmult->SetLineColor(kBlue);
402  haveontrkmult->SetMarkerColor(kBlue);
403  }
404  else {
405  o2 = new TCanvas("ontrkmult2","ontrkmult2",1200,800);
406  o2->Divide(3,2);
407  }
408  for(unsigned int isub=0;isub<vsub.size();++isub) {
409  printFrame(o2,haveontrkmult,vsub[isub].label.c_str(),isub+1,vsub[isub].min,vsub[isub].max,same);
410  }
411 
412  float (*scale)(float);
413  scale = &linear;
414 
415  drawMap("ontrkmultmap",haveontrkmult,averadius,avez,mmin,mmax,size,scale,color);
416  }
417 }
void printFrame(TCanvas *c, TH1D *h, const char *label, const int frame, const int min, const int max, const bool same)
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)
tuple cout
Definition: gather_cfg.py:121
float linear(float x)
Definition: vlib.h:208
tuple size
Write out results.
void PlotOnTrackOccupancyPhase1 ( TFile *  ff,
const char *  module,
const char *  ontrkmod,
const float  mmin,
const float  mmax,
const int  color 
)

Definition at line 330 of file OccupancyPlotMacros.cc.

References phase1bin(), PlotOnTrackOccupancyGeneric(), and findQualityFiles::size.

330  {
331 
332  std::pair<float,float> (*size)(int);
333  size = &phase1bin;
334 
335  std::vector<SubDetParams> vsub;
336  SubDetParams ppix={"BPIX+FPIX",1000,1080}; vsub.push_back(ppix);
337  SubDetParams ptib={"TIB",1090,1450}; vsub.push_back(ptib);
338  SubDetParams ptid={"TID",2070,2400}; vsub.push_back(ptid);
339  SubDetParams ptob={"TOB",3000,3700}; vsub.push_back(ptob);
340  SubDetParams ptecm={"TEC-",4000,4850}; vsub.push_back(ptecm);
341  SubDetParams ptecp={"TEC+",5000,5850}; vsub.push_back(ptecp);
342 
343  PlotOnTrackOccupancyGeneric(ff,module,ontrkmod,mmin,mmax,color,size,vsub);
344 }
std::pair< float, float > phase1bin(int i)
Definition: vlib.h:208
tuple size
Write out results.
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 PlotOnTrackOccupancyPhase2 ( TFile *  ff,
const char *  module,
const char *  ontrkmod,
const float  mmin,
const float  mmax,
const int  color 
)

Definition at line 346 of file OccupancyPlotMacros.cc.

References phase2bin(), PlotOnTrackOccupancyGeneric(), and findQualityFiles::size.

346  {
347 
348  std::pair<float,float> (*size)(int);
349  size = &phase2bin;
350 
351  std::vector<SubDetParams> vsub;
352  SubDetParams ppix={"BPIX+FPIX",1000,1090}; vsub.push_back(ppix);
353  SubDetParams ptob={"TOB",2000,2900}; vsub.push_back(ptob);
354  SubDetParams ptecm={"TEC-",3100,3300}; vsub.push_back(ptecm);
355  SubDetParams ptecp={"TEC+",4100,4300}; vsub.push_back(ptecp);
356 
357  PlotOnTrackOccupancyGeneric(ff,module,ontrkmod,mmin,mmax,color,size,vsub);
358 }
std::pair< float, float > phase2bin(int i)
Definition: vlib.h:208
tuple size
Write out results.
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 PlotTrackerXsect ( TFile *  ff,
const char *  module 
)

Definition at line 654 of file OccupancyPlotMacros.cc.

References gather_cfg::cout, drawMap(), linear(), presentbin(), pileupReCalc_HLTpaths::scale, and findQualityFiles::size.

654  {
655 
656  gROOT->SetStyle("Plain");
657 
658  if(ff->cd(module)) {
659 
660  TProfile* averadius = (TProfile*)gDirectory->Get("averadius");
661  TProfile* avez = (TProfile*)gDirectory->Get("avez");
662 
663  std::cout << "pointers " << averadius << " " << avez << std::endl;
664 
665  if(averadius && avez) {
666 
667  std::pair<float,float> (*size)(int);
668  size = &presentbin;
669  float (*scale)(float);
670  scale = &linear;
671 
672 
673  drawMap("trackermap",averadius,averadius,avez,0,0,size,scale,-1);
674  }
675 
676 
677  }
678 
679 }
std::pair< float, float > presentbin(int i)
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)
tuple cout
Definition: gather_cfg.py:121
float linear(float x)
Definition: vlib.h:208
tuple size
Write out results.
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 111 of file OccupancyPlotMacros.cc.

References diffTwoXMLs::label, and tree::t.

Referenced by PlotOccupancyMapGeneric(), and PlotOnTrackOccupancyGeneric().

111  {
112  c->cd(frame);
113  h->SetAxisRange(min,max);
114  if(same) {
115  h->DrawCopy("same");
116  } else {
117  h->DrawCopy();
118  TText* t = new TText((max+min)/2,h->GetMaximum(),label); t->SetTextAlign(22);
119  t->DrawClone();
120  }
121 }
tuple t
Definition: tree.py:139
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
T min(T a, T b)
Definition: MathUtil.h:58