2 #ifndef FlavourHistograms_H 3 #define FlavourHistograms_H 16 #include "TEfficiency.h" 33 const int& nBins_ ,
const double& lowerBound_ ,
const double& upperBound_ ,
38 const int& nBins_ ,
const double& lowerBound_ ,
const double& upperBound_ ,
39 const bool& statistics_ ,
const bool& plotLog_ ,
const bool& plotNormalized_ ,
48 void fill (
const int & flavour,
const T & variable,
const T &
w)
const;
51 void fill (
const int & flavour,
const T * variable)
const;
152 const int& nBins_ ,
const double& lowerBound_ ,
const double& upperBound_ ,
169 std::cout <<
"FlavourHistograms::FlavourHistograms : thePlotFirst was not correct : " <<
thePlotFirst << std::endl ;
170 std::cout <<
"FlavourHistograms::FlavourHistograms : Set it to default value (l)! " << std::endl ;
215 const int& nBins_ ,
const double& lowerBound_ ,
const double& upperBound_ ,
216 const bool& statistics_ ,
const bool& plotLog_ ,
const bool& plotNormalized_ ,
233 std::cout <<
"FlavourHistograms::FlavourHistograms : thePlotFirst was not correct : " <<
thePlotFirst << std::endl ;
234 std::cout <<
"FlavourHistograms::FlavourHistograms : Set it to default value (l)! " << std::endl ;
305 template <
class T>
void 312 template <
class T>
void 319 template <
class T>
void 329 for (
int i = 0 ;
i != iMax ; ++
i ) {
339 const T& theZero =
static_cast<T> ( 0.0 ) ;
371 bool btppColour =
true;
377 gPad->UseCurrentStyle();
385 gPad->SetLogy ( 0 ) ;
387 gPad->SetGridx ( 0 ) ;
388 gPad->SetGridy ( 0 ) ;
389 gPad->SetTitle ( 0 ) ;
395 const double markerSize = gPad->GetWh() * gPad->GetHNDC() / 500.;
425 markerStyle[0] = 20 ;
426 markerStyle[1] = 21 ;
427 markerStyle[2] = 22 ;
428 markerStyle[3] = 23 ;
440 markerStyle[0] = 20 ;
441 markerStyle[1] = 21 ;
442 markerStyle[2] = 22 ;
443 markerStyle[3] = 23 ;
451 if ( btppColour ) col[0] = 6 ;
452 if ( !btppColour ) lineStyle[0] = 3 ;
454 if ( btppColour ) col[2] = 4 ;
455 if ( !btppColour ) lineStyle[2] = 2 ;
461 if ( btppColour ) col[0] = 2 ;
462 if ( !btppColour ) lineStyle[0] = 1 ;
464 if ( btppColour ) col[1] = 4 ;
465 if ( !btppColour ) lineStyle[1] = 2 ;
470 histo[0] ->
getTH1F()->GetYaxis()->SetTitle (
"Arbitrary Units" ) ;
471 histo[0] ->
getTH1F()->GetYaxis()->SetTitleOffset(1.25) ;
473 for (
int i=0;
i != 4; ++
i) {
474 if (histo[
i]== 0 )
continue;
475 histo[
i] ->
getTH1F()->SetStats (
false ) ;
476 histo[
i] ->
getTH1F()->SetLineStyle ( lineStyle[
i] ) ;
477 histo[
i] ->
getTH1F()->SetLineWidth ( lineWidth ) ;
478 histo[
i] ->
getTH1F()->SetLineColor ( col[i] ) ;
479 histo[
i] ->
getTH1F()->SetMarkerStyle ( markerStyle[i] ) ;
480 histo[
i] ->
getTH1F()->SetMarkerColor ( col[i] ) ;
481 histo[
i] ->
getTH1F()->SetMarkerSize ( markerSize ) ;
485 if (histo[0]->getTH1F()->GetEntries() != 0) {histo[0]->
getTH1F() ->DrawNormalized() ;}
else { histo[0]->
getTH1F() ->SetMaximum(1.0); histo[0] ->
getTH1F()->Draw() ;}
486 if (histo[1]->getTH1F()->GetEntries() != 0) histo[1] ->
getTH1F()->DrawNormalized(
"Same") ;
487 if (histo[2]->getTH1F()->GetEntries() != 0) histo[2]->
getTH1F() ->DrawNormalized(
"Same") ;
488 if ((histo[3] != 0) && (histo[3]->getTH1F()->GetEntries() != 0)) histo[3] ->
getTH1F()->DrawNormalized(
"Same") ;
491 histo[0]->
getTH1F()->SetMaximum(max*1.05);
494 histo[1]->
getTH1F()->Draw(
"Same") ;
495 histo[2]->
getTH1F()->Draw(
"Same") ;
496 if ( histo[3] != 0 ) histo[3]->
getTH1F()->Draw(
"Same") ;
512 double effVal = num / den;
513 double errLo = TEfficiency::ClopperPearson(static_cast<int>(den), static_cast<int>(num), 0.683,
false);
514 double errUp = TEfficiency::ClopperPearson(static_cast<int>(den), static_cast<int>(num), 0.683,
true);
515 return std::max(effVal - errLo, errUp - effVal);
522 double numVal = num->GetBinContent(bin);
523 double denVal = den->GetBinContent(bin);
524 if (denVal > 0 && numVal <= denVal) {
525 effVal = numVal / denVal;
528 num->SetBinContent(bin, effVal);
529 num->SetBinError(bin, errVal);
632 std::vector<TH1F*> histoVector;
639 histoVector.push_back (
theHisto_g ->getTH1F() );
double lowerBound() const
MonitorElement * theHisto_g
void plot(TPad *theCanvas=0)
MonitorElement * theHisto_c
void SetMinimum(const double &min)
MonitorElement * get(const std::string &path)
MonitorElement * theHisto_u
void fill(const int &flavour, const T &variable) const
MonitorElement * theHisto_all
std::string baseNameDescription() const
std::vector< TH1F * > getHistoVector() const
void ComputeEfficiency(TH1F *num, TH1F *den, int bin)
void SetMaximum(const double &max)
void epsPlot(const std::string &name)
virtual MonitorElement * book1D(const std::string &name, const std::string &title, const int &nchX, const double &lowX, const double &highX)
std::string baseNameTitle() const
MonitorElement * theHisto_pu
void settitle(const char *title)
int * arrayDimension() const
MonitorElement * theHisto_d
MonitorElement * theHisto_dusg
double ClopperPearsonUnc(double num, double den)
bin
set the eta bin as selection string.
std::string theBaseNameDescription
virtual ~FlavourHistograms()
TH1F * getTH1F(void) const
MonitorElement * theHisto_b
std::string plotFirst() const
bool plotNormalized() const
std::string theBaseNameTitle
void fillVariable(const int &flavour, const T &var, const T &w) const
void setEfficiencyFlag(void)
double upperBound() const
MonitorElement * theHisto_s
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void divide(const FlavourHistograms< T > &bHD)
TH1F * histo_dusg() const
MonitorElement * theHisto_dus
MonitorElement * theHisto_ni