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 240 of file OccupancyPlotMacros.cc.

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

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

References gather_cfg::cout, runTauDisplay::dr, 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().

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

References dqm-mbProfile::log.

Referenced by PlotOccupancyMapGeneric().

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

Definition at line 58 of file OccupancyPlotMacros.cc.

References runTauDisplay::dr.

Referenced by PlotOccupancyMapPhase2(), and PlotOnTrackOccupancyPhase2().

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

Definition at line 607 of file OccupancyPlotMacros.cc.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

References diffTwoXMLs::label, and t.

Referenced by PlotOccupancyMapGeneric(), and PlotOnTrackOccupancyGeneric().

113  {
114  c->cd(frame);
115  h->SetAxisRange(min,max);
116  if(same) {
117  h->DrawCopy("same");
118  } else {
119  h->DrawCopy();
120  TText* t = new TText((max+min)/2,h->GetMaximum(),label); t->SetTextAlign(22);
121  t->DrawClone();
122  }
123 }
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 683 of file OccupancyPlotMacros.cc.

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

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