CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
List of all members | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes
FlavourHistograms< T > Class Template Reference

#include <FlavourHistorgrams.h>

Inheritance diagram for FlavourHistograms< T >:
TrackIPHistograms< T >

Public Types

typedef dqm::legacy::DQMStore DQMStore
 
typedef dqm::legacy::MonitorElement MonitorElement
 

Public Member Functions

int * arrayDimension () const
 
std::string baseNameDescription () const
 
std::string baseNameTitle () const
 
void divide (const FlavourHistograms< T > &bHD)
 
void epsPlot (const std::string &name)
 
void fill (const int &flavour, const T &variable) const
 
void fill (const int &flavour, const T &variable, const T &w) const
 
void fill (const int &flavour, const T *variable) const
 
 FlavourHistograms (const std::string &baseNameTitle_, const std::string &baseNameDescription_, const int &nBins_, const double &lowerBound_, const double &upperBound_, const std::string &plotFirst_, const std::string &folder, const unsigned int &mc, DQMStore::IGetter &iget)
 
 FlavourHistograms (const std::string &baseNameTitle_, const std::string &baseNameDescription_, const int &nBins_, const double &lowerBound_, const double &upperBound_, const bool &statistics_, const bool &plotLog_, const bool &plotNormalized_, const std::string &plotFirst_, const std::string &folder, const unsigned int &mc, DQMStore::IBooker &ibook)
 
std::vector< TH1F * > getHistoVector () const
 
TH1F * histo_all () const
 
TH1F * histo_b () const
 
TH1F * histo_c () const
 
TH1F * histo_d () const
 
TH1F * histo_dus () const
 
TH1F * histo_dusg () const
 
TH1F * histo_g () const
 
TH1F * histo_ni () const
 
TH1F * histo_pu () const
 
TH1F * histo_s () const
 
TH1F * histo_u () const
 
int indexToPlot () const
 
double lowerBound () const
 
int maxDimension () const
 
int nBins () const
 
void plot (TPad *theCanvas=nullptr)
 
std::string plotFirst () const
 
bool plotLog () const
 
bool plotNormalized () const
 
void setEfficiencyFlag ()
 
void SetMaximum (const double &max)
 
void SetMinimum (const double &min)
 
void settitle (const char *title)
 
bool statistics () const
 
double upperBound () const
 
virtual ~FlavourHistograms ()
 

Protected Member Functions

double ClopperPearsonUnc (double num, double den)
 
void ComputeEfficiency (TH1F *num, TH1F *den, int bin)
 
void fillVariable (const int &flavour, const T &var, const T &w) const
 

Protected Attributes

int * theArrayDimension
 
std::string theBaseNameDescription
 
std::string theBaseNameTitle
 
TCanvas * theCanvas
 
MonitorElementtheHisto_all
 
MonitorElementtheHisto_b
 
MonitorElementtheHisto_c
 
MonitorElementtheHisto_d
 
MonitorElementtheHisto_dus
 
MonitorElementtheHisto_dusg
 
MonitorElementtheHisto_g
 
MonitorElementtheHisto_ni
 
MonitorElementtheHisto_pu
 
MonitorElementtheHisto_s
 
MonitorElementtheHisto_u
 
int theIndexToPlot
 
double theLowerBound
 
double theMax
 
int theMaxDimension
 
double theMin
 
int theNBins
 
std::string thePlotFirst
 
bool thePlotLog
 
bool thePlotNormalized
 
bool theStatistics
 
double theUpperBound
 

Private Member Functions

 FlavourHistograms ()
 

Private Attributes

unsigned int mcPlots_
 

Detailed Description

template<class T>
class FlavourHistograms< T >

Definition at line 26 of file FlavourHistorgrams.h.

Member Typedef Documentation

◆ DQMStore

template<class T>
typedef dqm::legacy::DQMStore FlavourHistograms< T >::DQMStore

Definition at line 28 of file FlavourHistorgrams.h.

◆ MonitorElement

Definition at line 29 of file FlavourHistorgrams.h.

Constructor & Destructor Documentation

◆ FlavourHistograms() [1/3]

template<class T >
FlavourHistograms< T >::FlavourHistograms ( const std::string &  baseNameTitle_,
const std::string &  baseNameDescription_,
const int &  nBins_,
const double &  lowerBound_,
const double &  upperBound_,
const std::string &  plotFirst_,
const std::string &  folder,
const unsigned int &  mc,
DQMStore::IGetter iget 
)

Definition at line 157 of file FlavourHistorgrams.h.

References gather_cfg::cout, printsummarytable::folder, dqm::implementation::IGetter::get(), FlavourHistograms< T >::mcPlots_, FlavourHistograms< T >::theArrayDimension, FlavourHistograms< T >::theBaseNameTitle, FlavourHistograms< T >::theCanvas, FlavourHistograms< T >::theHisto_all, FlavourHistograms< T >::theHisto_b, FlavourHistograms< T >::theHisto_c, FlavourHistograms< T >::theHisto_d, FlavourHistograms< T >::theHisto_dus, FlavourHistograms< T >::theHisto_dusg, FlavourHistograms< T >::theHisto_g, FlavourHistograms< T >::theHisto_ni, FlavourHistograms< T >::theHisto_pu, FlavourHistograms< T >::theHisto_s, FlavourHistograms< T >::theHisto_u, and FlavourHistograms< T >::thePlotFirst.

166  : theMaxDimension(-1),
167  theIndexToPlot(-1),
168  theBaseNameTitle(baseNameTitle_),
169  theBaseNameDescription(baseNameDescription_),
170  theNBins(nBins_),
171  theLowerBound(lowerBound_),
172  theUpperBound(upperBound_),
173  theStatistics(false),
174  thePlotLog(false),
175  thePlotNormalized(false),
176  thePlotFirst(plotFirst_),
177  theMin(-1.),
178  theMax(-1.),
179  mcPlots_(mc) {
180  // defaults for array dimensions
181  theArrayDimension = nullptr;
182 
183  // check plot order string
184  if (thePlotFirst == "l" || thePlotFirst == "c" || thePlotFirst == "b") {
185  // OK
186  } else {
187  // not correct: print warning and set default (l)
188  std::cout << "FlavourHistograms::FlavourHistograms : thePlotFirst was not correct : " << thePlotFirst << std::endl;
189  std::cout << "FlavourHistograms::FlavourHistograms : Set it to default value (l)! " << std::endl;
190  thePlotFirst = "l";
191  }
192 
193  if (mcPlots_ % 2 == 0)
194  theHisto_all = iget.get("Btag/" + folder + "/" + theBaseNameTitle + "ALL");
195  else
196  theHisto_all = nullptr;
197  if (mcPlots_) {
198  if (mcPlots_ > 2) {
199  theHisto_d = iget.get("Btag/" + folder + "/" + theBaseNameTitle + "D");
200  theHisto_u = iget.get("Btag/" + folder + "/" + theBaseNameTitle + "U");
201  theHisto_s = iget.get("Btag/" + folder + "/" + theBaseNameTitle + "S");
202  theHisto_g = iget.get("Btag/" + folder + "/" + theBaseNameTitle + "G");
203  theHisto_dus = iget.get("Btag/" + folder + "/" + theBaseNameTitle + "DUS");
204  } else {
205  theHisto_d = nullptr;
206  theHisto_u = nullptr;
207  theHisto_s = nullptr;
208  theHisto_g = nullptr;
209  theHisto_dus = nullptr;
210  }
211  theHisto_c = iget.get("Btag/" + folder + "/" + theBaseNameTitle + "C");
212  theHisto_b = iget.get("Btag/" + folder + "/" + theBaseNameTitle + "B");
213  theHisto_ni = iget.get("Btag/" + folder + "/" + theBaseNameTitle + "NI");
214  theHisto_dusg = iget.get("Btag/" + folder + "/" + theBaseNameTitle + "DUSG");
215  theHisto_pu = iget.get("Btag/" + folder + "/" + theBaseNameTitle + "PU");
216  } else {
217  theHisto_d = nullptr;
218  theHisto_u = nullptr;
219  theHisto_s = nullptr;
220  theHisto_c = nullptr;
221  theHisto_b = nullptr;
222  theHisto_g = nullptr;
223  theHisto_ni = nullptr;
224  theHisto_dus = nullptr;
225  theHisto_dusg = nullptr;
226  theHisto_pu = nullptr;
227  }
228  // defaults for other data members
229  theCanvas = nullptr;
230 }
MonitorElement * theHisto_g
MonitorElement * theHisto_c
MonitorElement * theHisto_u
MonitorElement * theHisto_all
MonitorElement * theHisto_pu
MonitorElement * theHisto_d
MonitorElement * theHisto_dusg
std::string theBaseNameDescription
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:712
MonitorElement * theHisto_b
std::string theBaseNameTitle
MonitorElement * theHisto_s
MonitorElement * theHisto_dus
MonitorElement * theHisto_ni

◆ FlavourHistograms() [2/3]

template<class T >
FlavourHistograms< T >::FlavourHistograms ( const std::string &  baseNameTitle_,
const std::string &  baseNameDescription_,
const int &  nBins_,
const double &  lowerBound_,
const double &  upperBound_,
const bool &  statistics_,
const bool &  plotLog_,
const bool &  plotNormalized_,
const std::string &  plotFirst_,
const std::string &  folder,
const unsigned int &  mc,
DQMStore::IBooker ibook 
)

Definition at line 233 of file FlavourHistorgrams.h.

References HistoProviderDQM::book1D(), gather_cfg::cout, dqm::impl::MonitorElement::enableSumw2(), printsummarytable::folder, FlavourHistograms< T >::mcPlots_, FlavourHistograms< T >::theArrayDimension, FlavourHistograms< T >::theBaseNameDescription, FlavourHistograms< T >::theBaseNameTitle, FlavourHistograms< T >::theCanvas, FlavourHistograms< T >::theHisto_all, FlavourHistograms< T >::theHisto_b, FlavourHistograms< T >::theHisto_c, FlavourHistograms< T >::theHisto_d, FlavourHistograms< T >::theHisto_dus, FlavourHistograms< T >::theHisto_dusg, FlavourHistograms< T >::theHisto_g, FlavourHistograms< T >::theHisto_ni, FlavourHistograms< T >::theHisto_pu, FlavourHistograms< T >::theHisto_s, FlavourHistograms< T >::theHisto_u, FlavourHistograms< T >::theLowerBound, FlavourHistograms< T >::theNBins, FlavourHistograms< T >::thePlotFirst, FlavourHistograms< T >::theStatistics, and FlavourHistograms< T >::theUpperBound.

245  : theMaxDimension(-1),
246  theIndexToPlot(-1),
247  theBaseNameTitle(baseNameTitle_),
248  theBaseNameDescription(baseNameDescription_),
249  theNBins(nBins_),
250  theLowerBound(lowerBound_),
251  theUpperBound(upperBound_),
252  theStatistics(statistics_),
253  thePlotLog(plotLog_),
254  thePlotNormalized(plotNormalized_),
255  thePlotFirst(plotFirst_),
256  theMin(-1.),
257  theMax(-1.),
258  mcPlots_(mc) {
259  // defaults for array dimensions
260  theArrayDimension = nullptr;
261 
262  // check plot order string
263  if (thePlotFirst == "l" || thePlotFirst == "c" || thePlotFirst == "b") {
264  // OK
265  } else {
266  // not correct: print warning and set default (l)
267  std::cout << "FlavourHistograms::FlavourHistograms : thePlotFirst was not correct : " << thePlotFirst << std::endl;
268  std::cout << "FlavourHistograms::FlavourHistograms : Set it to default value (l)! " << std::endl;
269  thePlotFirst = "l";
270  }
271 
272  // book histos
273  HistoProviderDQM prov("Btag", folder, ibook);
274  if (mcPlots_ % 2 == 0)
275  theHisto_all = (prov.book1D(
277  else
278  theHisto_all = nullptr;
279  if (mcPlots_) {
280  if (mcPlots_ > 2) {
281  theHisto_d = (prov.book1D(
283  theHisto_u = (prov.book1D(
285  theHisto_s = (prov.book1D(
287  theHisto_g = (prov.book1D(
289  theHisto_dus = (prov.book1D(
291  } else {
292  theHisto_d = nullptr;
293  theHisto_u = nullptr;
294  theHisto_s = nullptr;
295  theHisto_g = nullptr;
296  theHisto_dus = nullptr;
297  }
298  theHisto_c = (prov.book1D(
300  theHisto_b = (prov.book1D(
302  theHisto_ni = (prov.book1D(
304  theHisto_dusg = (prov.book1D(
306  theHisto_pu = (prov.book1D(
308  } else {
309  theHisto_d = nullptr;
310  theHisto_u = nullptr;
311  theHisto_s = nullptr;
312  theHisto_c = nullptr;
313  theHisto_b = nullptr;
314  theHisto_g = nullptr;
315  theHisto_ni = nullptr;
316  theHisto_dus = nullptr;
317  theHisto_dusg = nullptr;
318  theHisto_pu = nullptr;
319  }
320 
321  // statistics if requested
322  if (theStatistics) {
323  if (theHisto_all)
325  if (mcPlots_) {
326  if (mcPlots_ > 2) {
332  }
338  }
339  }
340  // defaults for other data members
341  theCanvas = nullptr;
342 }
MonitorElement * theHisto_g
MonitorElement * theHisto_c
MonitorElement * theHisto_u
MonitorElement * theHisto_all
MonitorElement * theHisto_pu
MonitorElement * theHisto_d
MonitorElement * theHisto_dusg
std::string theBaseNameDescription
MonitorElement * theHisto_b
std::string theBaseNameTitle
MonitorElement * theHisto_s
MonitorElement * theHisto_dus
MonitorElement * theHisto_ni

◆ ~FlavourHistograms()

template<class T >
FlavourHistograms< T >::~FlavourHistograms ( )
virtual

Definition at line 345 of file FlavourHistorgrams.h.

345  {
346  // delete the canvas*/
347  delete theCanvas;
348 }

◆ FlavourHistograms() [3/3]

template<class T>
FlavourHistograms< T >::FlavourHistograms ( )
inlineprivate

Definition at line 151 of file FlavourHistorgrams.h.

151 {}

Member Function Documentation

◆ arrayDimension()

template<class T>
int* FlavourHistograms< T >::arrayDimension ( ) const
inline

◆ baseNameDescription()

template<class T>
std::string FlavourHistograms< T >::baseNameDescription ( ) const
inline

◆ baseNameTitle()

template<class T>
std::string FlavourHistograms< T >::baseNameTitle ( ) const
inline

Definition at line 77 of file FlavourHistorgrams.h.

References FlavourHistograms< T >::theBaseNameTitle.

Referenced by EffPurFromHistos::EffPurFromHistos().

77 { return theBaseNameTitle; }
std::string theBaseNameTitle

◆ ClopperPearsonUnc()

template<class T >
double FlavourHistograms< T >::ClopperPearsonUnc ( double  num,
double  den 
)
protected

Definition at line 570 of file FlavourHistorgrams.h.

References SiStripPI::max, and EgammaValidation_cff::num.

570  {
571  double effVal = num / den;
572  double errLo = TEfficiency::ClopperPearson(static_cast<int>(den), static_cast<int>(num), 0.683, false);
573  double errUp = TEfficiency::ClopperPearson(static_cast<int>(den), static_cast<int>(num), 0.683, true);
574  return std::max(effVal - errLo, errUp - effVal);
575 }

◆ ComputeEfficiency()

template<class T >
void FlavourHistograms< T >::ComputeEfficiency ( TH1F *  num,
TH1F *  den,
int  bin 
)
protected

Definition at line 578 of file FlavourHistorgrams.h.

References newFWLiteAna::bin, and EgammaValidation_cff::num.

578  {
579  double effVal = 1.;
580  double errVal = 0.;
581  double numVal = num->GetBinContent(bin);
582  double denVal = den->GetBinContent(bin);
583  if (denVal > 0 && numVal <= denVal) {
584  effVal = numVal / denVal;
585  errVal = ClopperPearsonUnc(numVal, denVal);
586  }
587  num->SetBinContent(bin, effVal);
588  num->SetBinError(bin, errVal);
589 }
double ClopperPearsonUnc(double num, double den)

◆ divide()

template<class T >
void FlavourHistograms< T >::divide ( const FlavourHistograms< T > &  bHD)

Definition at line 592 of file FlavourHistorgrams.h.

References newFWLiteAna::bin, FlavourHistograms< T >::histo_all(), FlavourHistograms< T >::histo_b(), FlavourHistograms< T >::histo_c(), FlavourHistograms< T >::histo_d(), FlavourHistograms< T >::histo_dus(), FlavourHistograms< T >::histo_dusg(), FlavourHistograms< T >::histo_g(), FlavourHistograms< T >::histo_ni(), FlavourHistograms< T >::histo_pu(), FlavourHistograms< T >::histo_s(), and FlavourHistograms< T >::histo_u().

Referenced by python.rootplot.utilities.Hist::__div__().

592  {
593  for (int bin = 0; bin < theNBins + 2; bin++) {
594  if (theHisto_all)
596  if (mcPlots_) {
597  if (mcPlots_ > 2) {
603  }
609  }
610  }
611 }
MonitorElement * theHisto_g
TH1F * histo_d() const
MonitorElement * theHisto_c
TH1F * histo_ni() const
TH1F * histo_c() const
TH1F * histo_dusg() const
MonitorElement * theHisto_u
MonitorElement * theHisto_all
TH1F * histo_pu() const
void ComputeEfficiency(TH1F *num, TH1F *den, int bin)
TH1F * histo_g() const
TH1F * histo_u() const
TH1F * histo_dus() const
MonitorElement * theHisto_pu
TH1F * histo_s() const
MonitorElement * theHisto_d
MonitorElement * theHisto_dusg
virtual TH1F * getTH1F() const
MonitorElement * theHisto_b
TH1F * histo_b() const
MonitorElement * theHisto_s
TH1F * histo_all() const
MonitorElement * theHisto_dus
MonitorElement * theHisto_ni

◆ epsPlot()

template<class T >
void FlavourHistograms< T >::epsPlot ( const std::string &  name)

Definition at line 562 of file FlavourHistorgrams.h.

References Skims_PA_cff::name, and plotFactory::plot.

562  {
563  TCanvas tc(theBaseNameTitle.c_str(), theBaseNameDescription.c_str());
564 
565  plot(&tc);
566  tc.Print((name + theBaseNameTitle + ".eps").c_str());
567 }
void plot(TPad *theCanvas=nullptr)
std::string theBaseNameDescription
std::string theBaseNameTitle

◆ fill() [1/3]

template<class T >
void FlavourHistograms< T >::fill ( const int &  flavour,
const T variable 
) const

Definition at line 352 of file FlavourHistorgrams.h.

References HPSPFTaus_cff::variable.

Referenced by TrackIPHistograms< T >::fill().

352  {
353  // For single variables and arrays (for arrays only a single index can be filled)
355 }
void fillVariable(const int &flavour, const T &var, const T &w) const

◆ fill() [2/3]

template<class T >
void FlavourHistograms< T >::fill ( const int &  flavour,
const T variable,
const T w 
) const

Definition at line 358 of file FlavourHistorgrams.h.

References HPSPFTaus_cff::variable, and w().

358  {
359  // For single variables and arrays (for arrays only a single index can be filled)
361 }
void fillVariable(const int &flavour, const T &var, const T &w) const
T w() const

◆ fill() [3/3]

template<class T >
void FlavourHistograms< T >::fill ( const int &  flavour,
const T variable 
) const

Definition at line 364 of file FlavourHistorgrams.h.

References mps_fire::i, and HPSPFTaus_cff::variable.

364  {
365  if (theArrayDimension == nullptr) {
366  // single variable
368  } else {
369  // array
371  //
372  for (int i = 0; i != iMax; ++i) {
373  // check if only one index to be plotted (<0: switched off -> plot all)
374  if ((theIndexToPlot < 0) || (i == theIndexToPlot)) {
375  fillVariable(flavour, *(variable + i), 1.);
376  }
377  }
378 
379  // if single index to be filled but not enough entries: fill 0.0 (convention!)
380  if (theIndexToPlot >= iMax) {
381  // cout << "==>> The index to be filled is too big -> fill 0.0 : " << theBaseNameTitle << " : " << theIndexToPlot << " >= " << iMax << endl ;
382  const T& theZero = static_cast<T>(0.0);
383  fillVariable(flavour, theZero, 1.);
384  }
385  }
386 }
void fillVariable(const int &flavour, const T &var, const T &w) const
long double T

◆ fillVariable()

template<class T >
void FlavourHistograms< T >::fillVariable ( const int &  flavour,
const T var,
const T w 
) const
protected

Definition at line 634 of file FlavourHistorgrams.h.

References funct::abs(), trigObjTnPSource_cfi::var, and w().

634  {
635  // all, except for the Jet Multiplicity which is not filled for each jets but for each events
636  if ((theBaseNameDescription != "Jet Multiplicity" || flavour == -1) && theHisto_all)
637  theHisto_all->Fill(var, w);
638 
639  // flavour specific
640  if (!mcPlots_ || (theBaseNameDescription == "Jet Multiplicity" && flavour == -1))
641  return;
642 
643  switch (std::abs(flavour)) {
644  case 1:
645  if (mcPlots_ > 2) {
646  theHisto_d->Fill(var, w);
647  if (theBaseNameDescription != "Jet Multiplicity")
648  theHisto_dus->Fill(var, w);
649  }
650  if (theBaseNameDescription != "Jet Multiplicity")
651  theHisto_dusg->Fill(var, w);
652  return;
653  case 2:
654  if (mcPlots_ > 2) {
655  theHisto_u->Fill(var, w);
656  if (theBaseNameDescription != "Jet Multiplicity")
657  theHisto_dus->Fill(var, w);
658  }
659  if (theBaseNameDescription != "Jet Multiplicity")
660  theHisto_dusg->Fill(var, w);
661  return;
662  case 3:
663  if (mcPlots_ > 2) {
664  theHisto_s->Fill(var, w);
665  if (theBaseNameDescription != "Jet Multiplicity")
666  theHisto_dus->Fill(var, w);
667  }
668  if (theBaseNameDescription != "Jet Multiplicity")
669  theHisto_dusg->Fill(var, w);
670  return;
671  case 4:
672  theHisto_c->Fill(var, w);
673  return;
674  case 5:
675  theHisto_b->Fill(var, w);
676  return;
677  case 21:
678  if (mcPlots_ > 2)
679  theHisto_g->Fill(var, w);
680  if (theBaseNameDescription != "Jet Multiplicity")
681  theHisto_dusg->Fill(var, w);
682  return;
683  case 123:
684  if (mcPlots_ > 2 && theBaseNameDescription == "Jet Multiplicity")
685  theHisto_dus->Fill(var, w);
686  return;
687  case 12321:
688  if (theBaseNameDescription == "Jet Multiplicity")
689  theHisto_dusg->Fill(var, w);
690  return;
691  case 20:
692  theHisto_pu->Fill(var, w);
693  return;
694  default:
695  theHisto_ni->Fill(var, w);
696  return;
697  }
698 }
MonitorElement * theHisto_g
MonitorElement * theHisto_c
T w() const
MonitorElement * theHisto_u
MonitorElement * theHisto_all
void Fill(long long x)
MonitorElement * theHisto_pu
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
MonitorElement * theHisto_d
MonitorElement * theHisto_dusg
std::string theBaseNameDescription
MonitorElement * theHisto_b
MonitorElement * theHisto_s
MonitorElement * theHisto_dus
MonitorElement * theHisto_ni

◆ getHistoVector()

template<class T >
std::vector< TH1F * > FlavourHistograms< T >::getHistoVector ( ) const

Definition at line 701 of file FlavourHistorgrams.h.

Referenced by EffPurFromHistos::EffPurFromHistos().

701  {
702  std::vector<TH1F*> histoVector;
703  if (theHisto_all)
704  histoVector.push_back(theHisto_all->getTH1F());
705  if (mcPlots_) {
706  if (mcPlots_ > 2) {
707  histoVector.push_back(theHisto_d->getTH1F());
708  histoVector.push_back(theHisto_u->getTH1F());
709  histoVector.push_back(theHisto_s->getTH1F());
710  histoVector.push_back(theHisto_g->getTH1F());
711  histoVector.push_back(theHisto_dus->getTH1F());
712  }
713  histoVector.push_back(theHisto_c->getTH1F());
714  histoVector.push_back(theHisto_b->getTH1F());
715  histoVector.push_back(theHisto_ni->getTH1F());
716  histoVector.push_back(theHisto_dusg->getTH1F());
717  histoVector.push_back(theHisto_pu->getTH1F());
718  }
719  return histoVector;
720 }
MonitorElement * theHisto_g
MonitorElement * theHisto_c
MonitorElement * theHisto_u
MonitorElement * theHisto_all
MonitorElement * theHisto_pu
MonitorElement * theHisto_d
MonitorElement * theHisto_dusg
virtual TH1F * getTH1F() const
MonitorElement * theHisto_b
MonitorElement * theHisto_s
MonitorElement * theHisto_dus
MonitorElement * theHisto_ni

◆ histo_all()

template<class T>
TH1F* FlavourHistograms< T >::histo_all ( ) const
inline

◆ histo_b()

template<class T>
TH1F* FlavourHistograms< T >::histo_b ( ) const
inline

Definition at line 96 of file FlavourHistorgrams.h.

References dqm::legacy::MonitorElement::getTH1F(), and FlavourHistograms< T >::theHisto_b.

Referenced by FlavourHistograms< T >::divide().

96 { return theHisto_b->getTH1F(); }
virtual TH1F * getTH1F() const
MonitorElement * theHisto_b

◆ histo_c()

template<class T>
TH1F* FlavourHistograms< T >::histo_c ( ) const
inline

Definition at line 95 of file FlavourHistorgrams.h.

References dqm::legacy::MonitorElement::getTH1F(), and FlavourHistograms< T >::theHisto_c.

Referenced by FlavourHistograms< T >::divide().

95 { return theHisto_c->getTH1F(); }
MonitorElement * theHisto_c
virtual TH1F * getTH1F() const

◆ histo_d()

template<class T>
TH1F* FlavourHistograms< T >::histo_d ( ) const
inline

Definition at line 92 of file FlavourHistorgrams.h.

References dqm::legacy::MonitorElement::getTH1F(), and FlavourHistograms< T >::theHisto_d.

Referenced by FlavourHistograms< T >::divide().

92 { return theHisto_d->getTH1F(); }
MonitorElement * theHisto_d
virtual TH1F * getTH1F() const

◆ histo_dus()

template<class T>
TH1F* FlavourHistograms< T >::histo_dus ( ) const
inline

◆ histo_dusg()

template<class T>
TH1F* FlavourHistograms< T >::histo_dusg ( ) const
inline

◆ histo_g()

template<class T>
TH1F* FlavourHistograms< T >::histo_g ( ) const
inline

Definition at line 97 of file FlavourHistorgrams.h.

References dqm::legacy::MonitorElement::getTH1F(), and FlavourHistograms< T >::theHisto_g.

Referenced by FlavourHistograms< T >::divide().

97 { return theHisto_g->getTH1F(); }
MonitorElement * theHisto_g
virtual TH1F * getTH1F() const

◆ histo_ni()

template<class T>
TH1F* FlavourHistograms< T >::histo_ni ( ) const
inline

Definition at line 98 of file FlavourHistorgrams.h.

References dqm::legacy::MonitorElement::getTH1F(), and FlavourHistograms< T >::theHisto_ni.

Referenced by FlavourHistograms< T >::divide().

98 { return theHisto_ni->getTH1F(); }
virtual TH1F * getTH1F() const
MonitorElement * theHisto_ni

◆ histo_pu()

template<class T>
TH1F* FlavourHistograms< T >::histo_pu ( ) const
inline

Definition at line 101 of file FlavourHistorgrams.h.

References dqm::legacy::MonitorElement::getTH1F(), and FlavourHistograms< T >::theHisto_pu.

Referenced by FlavourHistograms< T >::divide().

101 { return theHisto_pu->getTH1F(); }
MonitorElement * theHisto_pu
virtual TH1F * getTH1F() const

◆ histo_s()

template<class T>
TH1F* FlavourHistograms< T >::histo_s ( ) const
inline

Definition at line 94 of file FlavourHistorgrams.h.

References dqm::legacy::MonitorElement::getTH1F(), and FlavourHistograms< T >::theHisto_s.

Referenced by FlavourHistograms< T >::divide().

94 { return theHisto_s->getTH1F(); }
virtual TH1F * getTH1F() const
MonitorElement * theHisto_s

◆ histo_u()

template<class T>
TH1F* FlavourHistograms< T >::histo_u ( ) const
inline

Definition at line 93 of file FlavourHistorgrams.h.

References dqm::legacy::MonitorElement::getTH1F(), and FlavourHistograms< T >::theHisto_u.

Referenced by FlavourHistograms< T >::divide().

93 { return theHisto_u->getTH1F(); }
MonitorElement * theHisto_u
virtual TH1F * getTH1F() const

◆ indexToPlot()

template<class T>
int FlavourHistograms< T >::indexToPlot ( ) const
inline

◆ lowerBound()

template<class T>
double FlavourHistograms< T >::lowerBound ( ) const
inline

◆ maxDimension()

template<class T>
int FlavourHistograms< T >::maxDimension ( ) const
inline

◆ nBins()

template<class T>
int FlavourHistograms< T >::nBins ( ) const
inline

Definition at line 79 of file FlavourHistorgrams.h.

References FlavourHistograms< T >::theNBins.

Referenced by EffPurFromHistos::EffPurFromHistos().

79 { return theNBins; }

◆ plot()

template<class T >
void FlavourHistograms< T >::plot ( TPad *  theCanvas = nullptr)

Definition at line 409 of file FlavourHistorgrams.h.

References cuy::col, timingPdfMaker::histo, mps_fire::i, RecoTauValidation_cfi::lineStyle, RecoTauValidation_cfi::lineWidth, RecoTauValidation_cfi::markerSize, RecoTauValidation_cfi::markerStyle, SiStripPI::max, and RecoBTag::setTDRStyle().

409  {
410  //fixme:
411  bool btppNI = false;
412  bool btppColour = true;
413 
414  if (theCanvas)
415  theCanvas->cd();
416 
417  RecoBTag::setTDRStyle()->cd();
418  gPad->UseCurrentStyle();
419  // if ( !btppTitle ) gStyle->SetOptTitle ( 0 ) ;
420  //
421  // // here: plot histograms in a canvas
422  // theCanvas = new TCanvas ( "C" + theBaseNameTitle , "C" + theBaseNameDescription ,
423  // btppXCanvas , btppYCanvas ) ;
424  // theCanvas->SetFillColor ( 0 ) ;
425  // theCanvas->cd ( 1 ) ;
426  gPad->SetLogy(0);
427  if (thePlotLog)
428  gPad->SetLogy(1);
429  gPad->SetGridx(0);
430  gPad->SetGridy(0);
431  gPad->SetTitle(nullptr);
432 
433  MonitorElement* histo[4];
434  int col[4], lineStyle[4], markerStyle[4];
435  int lineWidth = 1;
436 
437  const double markerSize = gPad->GetWh() * gPad->GetHNDC() / 500.;
438 
439  // default (l)
440  histo[0] = theHisto_dusg;
441  //CW histo_1 = theHisto_dus ;
442  histo[1] = theHisto_b;
443  histo[2] = theHisto_c;
444  histo[3] = nullptr;
445 
446  double max = theMax;
447  if (theMax <= 0.) {
448  max = theHisto_dusg->getTH1F()->GetMaximum();
449  if (theHisto_b->getTH1F()->GetMaximum() > max)
450  max = theHisto_b->getTH1F()->GetMaximum();
451  if (theHisto_c->getTH1F()->GetMaximum() > max)
452  max = theHisto_c->getTH1F()->GetMaximum();
453  }
454 
455  if (btppNI) {
456  histo[3] = theHisto_ni;
457  if (theHisto_ni->getTH1F()->GetMaximum() > max)
458  max = theHisto_ni->getTH1F()->GetMaximum();
459  }
460 
461  if (btppColour) { // print colours
462  col[0] = 4;
463  col[1] = 2;
464  col[2] = 6;
465  col[3] = 3;
466  lineStyle[0] = 1;
467  lineStyle[1] = 1;
468  lineStyle[2] = 1;
469  lineStyle[3] = 1;
470  markerStyle[0] = 20;
471  markerStyle[1] = 21;
472  markerStyle[2] = 22;
473  markerStyle[3] = 23;
474  lineWidth = 1;
475  } else { // different marker/line styles
476  col[1] = 1;
477  col[2] = 1;
478  col[3] = 1;
479  col[0] = 1;
480  lineStyle[0] = 2;
481  lineStyle[1] = 1;
482  lineStyle[2] = 3;
483  lineStyle[3] = 4;
484  markerStyle[0] = 20;
485  markerStyle[1] = 21;
486  markerStyle[2] = 22;
487  markerStyle[3] = 23;
488  }
489 
490  // if changing order (NI stays always last)
491 
492  // c to plot first
493  if (thePlotFirst == "c") {
494  histo[0] = theHisto_c;
495  if (btppColour)
496  col[0] = 6;
497  if (!btppColour)
498  lineStyle[0] = 3;
499  histo[2] = theHisto_dusg;
500  if (btppColour)
501  col[2] = 4;
502  if (!btppColour)
503  lineStyle[2] = 2;
504  }
505 
506  // b to plot first
507  if (thePlotFirst == "b") {
508  histo[0] = theHisto_b;
509  if (btppColour)
510  col[0] = 2;
511  if (!btppColour)
512  lineStyle[0] = 1;
513  histo[1] = theHisto_dusg;
514  if (btppColour)
515  col[1] = 4;
516  if (!btppColour)
517  lineStyle[1] = 2;
518  }
519 
520  histo[0]->setAxisTitle(theBaseNameDescription);
521  histo[0]->getTH1F()->GetYaxis()->SetTitle("Arbitrary Units");
522  histo[0]->getTH1F()->GetYaxis()->SetTitleOffset(1.25);
523 
524  for (int i = 0; i != 4; ++i) {
525  if (histo[i] == nullptr)
526  continue;
527  histo[i]->getTH1F()->SetStats(false);
528  histo[i]->getTH1F()->SetLineStyle(lineStyle[i]);
529  histo[i]->getTH1F()->SetLineWidth(lineWidth);
530  histo[i]->getTH1F()->SetLineColor(col[i]);
531  histo[i]->getTH1F()->SetMarkerStyle(markerStyle[i]);
532  histo[i]->getTH1F()->SetMarkerColor(col[i]);
533  histo[i]->getTH1F()->SetMarkerSize(markerSize);
534  }
535 
536  if (thePlotNormalized) {
537  if (histo[0]->getTH1F()->GetEntries() != 0) {
538  histo[0]->getTH1F()->DrawNormalized();
539  } else {
540  histo[0]->getTH1F()->SetMaximum(1.0);
541  histo[0]->getTH1F()->Draw();
542  }
543  if (histo[1]->getTH1F()->GetEntries() != 0)
544  histo[1]->getTH1F()->DrawNormalized("Same");
545  if (histo[2]->getTH1F()->GetEntries() != 0)
546  histo[2]->getTH1F()->DrawNormalized("Same");
547  if ((histo[3] != nullptr) && (histo[3]->getTH1F()->GetEntries() != 0))
548  histo[3]->getTH1F()->DrawNormalized("Same");
549  } else {
550  histo[0]->getTH1F()->SetMaximum(max * 1.05);
551  if (theMin != -1.)
552  histo[0]->getTH1F()->SetMinimum(theMin);
553  histo[0]->getTH1F()->Draw();
554  histo[1]->getTH1F()->Draw("Same");
555  histo[2]->getTH1F()->Draw("Same");
556  if (histo[3] != nullptr)
557  histo[3]->getTH1F()->Draw("Same");
558  }
559 }
MonitorElement * theHisto_c
TStyle * setTDRStyle()
Definition: Tools.cc:343
MonitorElement * theHisto_dusg
std::string theBaseNameDescription
virtual TH1F * getTH1F() const
MonitorElement * theHisto_b
col
Definition: cuy.py:1009
MonitorElement * theHisto_ni

◆ plotFirst()

template<class T>
std::string FlavourHistograms< T >::plotFirst ( ) const
inline

Definition at line 85 of file FlavourHistorgrams.h.

References FlavourHistograms< T >::thePlotFirst.

85 { return thePlotFirst; }

◆ plotLog()

template<class T>
bool FlavourHistograms< T >::plotLog ( ) const
inline

Definition at line 83 of file FlavourHistorgrams.h.

References FlavourHistograms< T >::thePlotLog.

83 { return thePlotLog; }

◆ plotNormalized()

template<class T>
bool FlavourHistograms< T >::plotNormalized ( ) const
inline

Definition at line 84 of file FlavourHistorgrams.h.

References FlavourHistograms< T >::thePlotNormalized.

84 { return thePlotNormalized; }

◆ setEfficiencyFlag()

template<class T >
void FlavourHistograms< T >::setEfficiencyFlag ( )

Definition at line 614 of file FlavourHistorgrams.h.

614  {
615  if (theHisto_all)
617  if (mcPlots_) {
618  if (mcPlots_ > 2) {
624  }
630  }
631 }
MonitorElement * theHisto_g
MonitorElement * theHisto_c
MonitorElement * theHisto_u
MonitorElement * theHisto_all
MonitorElement * theHisto_pu
MonitorElement * theHisto_d
MonitorElement * theHisto_dusg
MonitorElement * theHisto_b
MonitorElement * theHisto_s
MonitorElement * theHisto_dus
MonitorElement * theHisto_ni

◆ SetMaximum()

template<class T>
void FlavourHistograms< T >::SetMaximum ( const double &  max)
inline

◆ SetMinimum()

template<class T>
void FlavourHistograms< T >::SetMinimum ( const double &  min)
inline

◆ settitle()

template<class T >
void FlavourHistograms< T >::settitle ( const char *  title)

Definition at line 389 of file FlavourHistorgrams.h.

References runGCPTkAlMap::title.

Referenced by TrackIPHistograms< T >::settitle().

389  {
390  if (theHisto_all)
392  if (mcPlots_) {
393  if (mcPlots_ > 2) {
399  }
405  }
406 }
MonitorElement * theHisto_g
MonitorElement * theHisto_c
MonitorElement * theHisto_u
MonitorElement * theHisto_all
MonitorElement * theHisto_pu
MonitorElement * theHisto_d
MonitorElement * theHisto_dusg
MonitorElement * theHisto_b
MonitorElement * theHisto_s
MonitorElement * theHisto_dus
MonitorElement * theHisto_ni
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)

◆ statistics()

template<class T>
bool FlavourHistograms< T >::statistics ( ) const
inline

Definition at line 82 of file FlavourHistorgrams.h.

References FlavourHistograms< T >::theStatistics.

82 { return theStatistics; }

◆ upperBound()

template<class T>
double FlavourHistograms< T >::upperBound ( ) const
inline

Member Data Documentation

◆ mcPlots_

template<class T>
unsigned int FlavourHistograms< T >::mcPlots_
private

Definition at line 153 of file FlavourHistorgrams.h.

Referenced by FlavourHistograms< T >::FlavourHistograms().

◆ theArrayDimension

template<class T>
int* FlavourHistograms< T >::theArrayDimension
protected

◆ theBaseNameDescription

template<class T>
std::string FlavourHistograms< T >::theBaseNameDescription
protected

◆ theBaseNameTitle

template<class T>
std::string FlavourHistograms< T >::theBaseNameTitle
protected

◆ theCanvas

template<class T>
TCanvas* FlavourHistograms< T >::theCanvas
protected

Definition at line 148 of file FlavourHistorgrams.h.

Referenced by FlavourHistograms< T >::FlavourHistograms().

◆ theHisto_all

template<class T>
MonitorElement* FlavourHistograms< T >::theHisto_all
protected

◆ theHisto_b

template<class T>
MonitorElement* FlavourHistograms< T >::theHisto_b
protected

◆ theHisto_c

template<class T>
MonitorElement* FlavourHistograms< T >::theHisto_c
protected

◆ theHisto_d

template<class T>
MonitorElement* FlavourHistograms< T >::theHisto_d
protected

◆ theHisto_dus

template<class T>
MonitorElement* FlavourHistograms< T >::theHisto_dus
protected

◆ theHisto_dusg

template<class T>
MonitorElement* FlavourHistograms< T >::theHisto_dusg
protected

◆ theHisto_g

template<class T>
MonitorElement* FlavourHistograms< T >::theHisto_g
protected

◆ theHisto_ni

template<class T>
MonitorElement* FlavourHistograms< T >::theHisto_ni
protected

◆ theHisto_pu

template<class T>
MonitorElement* FlavourHistograms< T >::theHisto_pu
protected

◆ theHisto_s

template<class T>
MonitorElement* FlavourHistograms< T >::theHisto_s
protected

◆ theHisto_u

template<class T>
MonitorElement* FlavourHistograms< T >::theHisto_u
protected

◆ theIndexToPlot

template<class T>
int FlavourHistograms< T >::theIndexToPlot
protected

Definition at line 119 of file FlavourHistorgrams.h.

Referenced by FlavourHistograms< T >::indexToPlot().

◆ theLowerBound

template<class T>
double FlavourHistograms< T >::theLowerBound
protected

◆ theMax

template<class T>
double FlavourHistograms< T >::theMax
protected

Definition at line 130 of file FlavourHistorgrams.h.

Referenced by FlavourHistograms< T >::SetMaximum().

◆ theMaxDimension

template<class T>
int FlavourHistograms< T >::theMaxDimension
protected

Definition at line 118 of file FlavourHistorgrams.h.

Referenced by FlavourHistograms< T >::maxDimension().

◆ theMin

template<class T>
double FlavourHistograms< T >::theMin
protected

Definition at line 130 of file FlavourHistorgrams.h.

Referenced by FlavourHistograms< T >::SetMinimum().

◆ theNBins

template<class T>
int FlavourHistograms< T >::theNBins
protected

◆ thePlotFirst

template<class T>
std::string FlavourHistograms< T >::thePlotFirst
protected

◆ thePlotLog

template<class T>
bool FlavourHistograms< T >::thePlotLog
protected

Definition at line 127 of file FlavourHistorgrams.h.

Referenced by FlavourHistograms< T >::plotLog().

◆ thePlotNormalized

template<class T>
bool FlavourHistograms< T >::thePlotNormalized
protected

Definition at line 128 of file FlavourHistorgrams.h.

Referenced by FlavourHistograms< T >::plotNormalized().

◆ theStatistics

template<class T>
bool FlavourHistograms< T >::theStatistics
protected

◆ theUpperBound

template<class T>
double FlavourHistograms< T >::theUpperBound
protected