test
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)
 
TH1D * TrendPlotSingleBin (TFile *ff, const char *module, const char *hname, const int bin)
 

Function Documentation

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

Definition at line 239 of file OccupancyPlotMacros.cc.

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

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

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

Definition at line 26 of file OccupancyPlotMacros.cc.

References dqm-mbProfile::log.

Referenced by PlotOccupancyMapGeneric().

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

Definition at line 57 of file OccupancyPlotMacros.cc.

Referenced by PlotOccupancyMapPhase2(), and PlotOnTrackOccupancyPhase2().

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

Definition at line 606 of file OccupancyPlotMacros.cc.

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

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

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

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

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

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

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

301  {
302 
303  std::pair<float,float> (*size)(int);
304  size = &phase2bin;
305 
306  std::vector<SubDetParams> vsub;
307  SubDetParams ppix={"BPIX+FPIX",1000,1090}; vsub.push_back(ppix);
308  SubDetParams ptob={"TOB",2000,2900}; vsub.push_back(ptob);
309  SubDetParams ptecm={"TEC-",3100,3300}; vsub.push_back(ptecm);
310  SubDetParams ptecp={"TEC+",4100,4300}; vsub.push_back(ptecp);
311 
312  PlotOccupancyMapGeneric(ff,module,min,max,mmin,mmax,color,size,vsub);
313 }
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 315 of file OccupancyPlotMacros.cc.

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

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

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

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

331  {
332 
333  std::pair<float,float> (*size)(int);
334  size = &phase1bin;
335 
336  std::vector<SubDetParams> vsub;
337  SubDetParams ppix={"BPIX+FPIX",1000,1080}; vsub.push_back(ppix);
338  SubDetParams ptib={"TIB",1090,1450}; vsub.push_back(ptib);
339  SubDetParams ptid={"TID",2070,2400}; vsub.push_back(ptid);
340  SubDetParams ptob={"TOB",3000,3700}; vsub.push_back(ptob);
341  SubDetParams ptecm={"TEC-",4000,4850}; vsub.push_back(ptecm);
342  SubDetParams ptecp={"TEC+",5000,5850}; vsub.push_back(ptecp);
343 
344  PlotOnTrackOccupancyGeneric(ff,module,ontrkmod,mmin,mmax,color,size,vsub);
345 }
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 347 of file OccupancyPlotMacros.cc.

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

347  {
348 
349  std::pair<float,float> (*size)(int);
350  size = &phase2bin;
351 
352  std::vector<SubDetParams> vsub;
353  SubDetParams ppix={"BPIX+FPIX",1000,1090}; vsub.push_back(ppix);
354  SubDetParams ptob={"TOB",2000,2900}; vsub.push_back(ptob);
355  SubDetParams ptecm={"TEC-",3100,3300}; vsub.push_back(ptecm);
356  SubDetParams ptecp={"TEC+",4100,4300}; vsub.push_back(ptecp);
357 
358  PlotOnTrackOccupancyGeneric(ff,module,ontrkmod,mmin,mmax,color,size,vsub);
359 }
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 655 of file OccupancyPlotMacros.cc.

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

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

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

Referenced by PlotOccupancyMapGeneric(), and PlotOnTrackOccupancyGeneric().

112  {
113  c->cd(frame);
114  h->SetAxisRange(min,max);
115  if(same) {
116  h->DrawCopy("same");
117  } else {
118  h->DrawCopy();
119  TText* t = new TText((max+min)/2,h->GetMaximum(),label); t->SetTextAlign(22);
120  t->DrawClone();
121  }
122 }
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
T min(T a, T b)
Definition: MathUtil.h:58
TH1D* TrendPlotSingleBin ( TFile *  ff,
const char *  module,
const char *  hname,
const int  bin 
)

Definition at line 682 of file OccupancyPlotMacros.cc.

References gather_cfg::cout, CommonAnalyzer::getObject(), CommonAnalyzer::getRunList(), i, gather_cfg::runs, and CommonAnalyzer::setPath().

682  {
683 
684  CommonAnalyzer caoccu(ff,"",module);
685 
686  TH1D* occutrend = new TH1D("occutrend","Average number of clusters vs run",10,0.,10.);
687  occutrend->SetCanExtend(TH1::kXaxis);
688  occutrend->Sumw2();
689 
690  std::vector<unsigned int> runs = caoccu.getRunList();
691  std::sort(runs.begin(),runs.end());
692 
693  {
694  for(unsigned int i=0;i<runs.size();++i) {
695 
696  char runlabel[100];
697  sprintf(runlabel,"%d",runs[i]);
698  char runpath[100];
699  sprintf(runpath,"run_%d",runs[i]);
700  caoccu.setPath(runpath);
701 
702 
703  TProfile* occu=0;
704  if(occu==0) occu = (TProfile*)caoccu.getObject(hname);
705  if(occu) {
706 
707  const int ibin=occu->FindBin(bin);
708  std::cout << runlabel << " " << " " << ibin << " " << occu->GetBinContent(ibin) << " " << occu->GetBinError(ibin) << std::endl;
709  const int jbin=occutrend->Fill(runlabel,occu->GetBinContent(ibin));
710  occutrend->SetBinError(jbin,occu->GetBinError(ibin));
711 
712  }
713  }
714  }
715  return occutrend;
716 }
int i
Definition: DBlmapReader.cc:9
tuple runs
Definition: gather_cfg.py:87
tuple cout
Definition: gather_cfg.py:145
Definition: vlib.h:208