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);
486 histo[0] ->
getTH1F()->Draw() ;}
487 if (histo[1]->getTH1F()->GetEntries() != 0) histo[1] ->
getTH1F()->DrawNormalized(
"Same") ;
488 if (histo[2]->getTH1F()->GetEntries() != 0) histo[2]->
getTH1F() ->DrawNormalized(
"Same") ;
489 if ((histo[3] != 0) && (histo[3]->getTH1F()->GetEntries() != 0)) histo[3] ->
getTH1F()->DrawNormalized(
"Same") ;
492 histo[0]->
getTH1F()->SetMaximum(max*1.05);
495 histo[1]->
getTH1F()->Draw(
"Same") ;
496 histo[2]->
getTH1F()->Draw(
"Same") ;
497 if ( histo[3] != 0 ) histo[3]->
getTH1F()->Draw(
"Same") ;
513 double effVal = num->GetBinContent(bin)/den->GetBinContent(bin);
514 double errLo = TEfficiency::ClopperPearson((
int)den->GetBinContent(bin),
515 (
int)num->GetBinContent(bin),
517 double errUp = TEfficiency::ClopperPearson((
int)den->GetBinContent(bin),
518 (
int)num->GetBinContent(bin),
520 return (effVal - errLo > errUp - effVal) ? effVal - errLo : errUp - effVal;
527 if (den->GetBinContent(bin)>0) {
528 effVal = num->GetBinContent(bin)/den->GetBinContent(bin);
531 num->SetBinContent(bin, effVal);
532 num->SetBinError(bin, errVal);
635 std::vector<TH1F*> histoVector;
642 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
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 ClopperPearsonUnc(TH1F *num, TH1F *den, int bin)
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