2 #ifndef FlavourHistograms2D_H
3 #define FlavourHistograms2D_H
29 template <
class T,
class G>
35 int nBinsX_ ,
double lowerBoundX_ ,
double upperBoundX_ ,
36 int nBinsY_ ,
double lowerBoundY_ ,
double upperBoundY_ ,
37 bool statistics_ ,
bool update, std::string folder,
bool mc,
48 void fill (
const int &
flavour,
const T & variableX,
const G & variableY)
const;
51 void fill (
const int & flavour,
const T * variableX,
const G * variableY)
const;
54 void settitle(
const char* titleX,
const char* titleY) ;
106 void fillVariable (
const int & flavour ,
const T & varX ,
const G & varY )
const;
168 template <
class T,
class G>
170 int nBinsX_ ,
double lowerBoundX_ ,
double upperBoundX_ ,
171 int nBinsY_ ,
double lowerBoundY_ ,
double upperBoundY_ ,
173 bool update, std::string folder,
bool mc,
bool createProfile) :
176 theMaxDimension(-1), theIndexToPlot(-1), theBaseNameTitle ( baseNameTitle_ ) , theBaseNameDescription ( baseNameDescription_ ) ,
177 theNBinsX ( nBinsX_ ) , theNBinsY (nBinsY_),
178 theLowerBoundX ( lowerBoundX_ ) , theUpperBoundX ( upperBoundX_ ) ,
179 theLowerBoundY ( lowerBoundY_ ) , theUpperBoundY ( upperBoundY_ ) ,
180 theStatistics ( statistics_ ) , theMin(-1.), theMax(-1.), mcPlots_(mc), createProfile_(createProfile)
309 template <
class T,
class G>
323 template <
class T,
class G>
void
327 fillVariable ( flavour , variableX , variableY ) ;
330 template <
class T,
class G>
void
333 if ( theArrayDimension == 0 ) {
335 fillVariable ( flavour , *variableX, *variableY ) ;
338 int iMax = *theArrayDimension ;
339 if ( *theArrayDimension > theMaxDimension ) iMax = theMaxDimension ;
341 for (
int i = 0 ;
i != iMax ; ++
i ) {
343 if ( ( theIndexToPlot < 0 ) || (
i == theIndexToPlot ) ) {
344 fillVariable ( flavour , *(variableX+
i) , *(variableY+
i) ) ;
349 if ( theIndexToPlot >= iMax ) {
351 const T& theZeroT =
static_cast<T> ( 0.0) ;
352 const G& theZeroG =
static_cast<T> ( 0.0 );
353 fillVariable ( flavour , theZeroT , theZeroG ) ;
359 template <
class T,
class G>
361 if(theHisto_all) theHisto_all ->setAxisTitle(titleX) ;
362 if(theHisto_all) theHisto_all ->setAxisTitle(titleY, 2) ;
365 if(theHisto_d) theHisto_d ->setAxisTitle(titleX) ;
366 if(theHisto_u) theHisto_u ->setAxisTitle(titleX) ;
367 if(theHisto_s) theHisto_s ->setAxisTitle(titleX) ;
368 if(theHisto_c) theHisto_c ->setAxisTitle(titleX) ;
369 if(theHisto_b) theHisto_b ->setAxisTitle(titleX) ;
370 if(theHisto_g) theHisto_g ->setAxisTitle(titleX) ;
371 if(theHisto_ni) theHisto_ni ->setAxisTitle(titleX) ;
372 if(theHisto_dus) theHisto_dus ->setAxisTitle(titleX) ;
373 if(theHisto_dusg)theHisto_dusg->setAxisTitle(titleX) ;
374 if(theHisto_d) theHisto_d ->setAxisTitle(titleY, 2) ;
375 if(theHisto_u) theHisto_u ->setAxisTitle(titleY, 2) ;
376 if(theHisto_s) theHisto_s ->setAxisTitle(titleY, 2) ;
377 if(theHisto_c) theHisto_c ->setAxisTitle(titleY, 2) ;
378 if(theHisto_b) theHisto_b ->setAxisTitle(titleY, 2) ;
379 if(theHisto_g) theHisto_g ->setAxisTitle(titleY, 2) ;
380 if(theHisto_ni) theHisto_ni ->setAxisTitle(titleY, 2) ;
381 if(theHisto_dus) theHisto_dus ->setAxisTitle(titleY, 2) ;
382 if(theHisto_dusg)theHisto_dusg->setAxisTitle(titleY, 2) ;
386 if(theProfile_all) theProfile_all ->setAxisTitle(titleX) ;
387 if(theProfile_all) theProfile_all ->setAxisTitle(titleY, 2) ;
388 if (mcPlots_ ==
true) {
390 if(theProfile_d) theProfile_d ->setAxisTitle(titleX) ;
391 if(theProfile_u) theProfile_u ->setAxisTitle(titleX) ;
392 if(theProfile_s) theProfile_s ->setAxisTitle(titleX) ;
393 if(theProfile_c) theProfile_c ->setAxisTitle(titleX) ;
394 if(theProfile_b) theProfile_b ->setAxisTitle(titleX) ;
395 if(theProfile_g) theProfile_g ->setAxisTitle(titleX) ;
396 if(theProfile_ni) theProfile_ni ->setAxisTitle(titleX) ;
397 if(theProfile_dus) theProfile_dus ->setAxisTitle(titleX) ;
398 if(theProfile_dusg)theProfile_dusg->setAxisTitle(titleX) ;
399 if(theProfile_d) theProfile_d ->setAxisTitle(titleY, 2) ;
400 if(theProfile_u) theProfile_u ->setAxisTitle(titleY, 2) ;
401 if(theProfile_s) theProfile_s ->setAxisTitle(titleY, 2) ;
402 if(theProfile_c) theProfile_c ->setAxisTitle(titleY, 2) ;
403 if(theProfile_b) theProfile_b ->setAxisTitle(titleY, 2) ;
404 if(theProfile_g) theProfile_g ->setAxisTitle(titleY, 2) ;
405 if(theProfile_ni) theProfile_ni ->setAxisTitle(titleY, 2) ;
406 if(theProfile_dus) theProfile_dus ->setAxisTitle(titleY, 2) ;
407 if(theProfile_dusg)theProfile_dusg->setAxisTitle(titleY, 2) ;
414 template <
class T,
class G>
421 theHisto_all ->getTH2F()->
Divide ( theHisto_all->getTH2F() , bHD.
histo_all () , 1.0 , 1.0 ,
"b" ) ;
429 theHisto_ni ->getTH2F()->
Divide ( theHisto_ni->getTH2F() , bHD.
histo_ni () , 1.0 , 1.0 ,
"b" ) ;
430 theHisto_dus ->getTH2F()->
Divide ( theHisto_dus->getTH2F() , bHD.
histo_dus () , 1.0 , 1.0 ,
"b" ) ;
431 theHisto_dusg ->getTH2F()->
Divide ( theHisto_dusg->getTH2F() , bHD.
histo_dusg() , 1.0 , 1.0 ,
"b" ) ;
436 template <
class T,
class G>
439 theHisto_all ->Fill ( varX, varY ) ;
441 theProfile_all->Fill( varX, varY );
443 if (!mcPlots_)
return;
447 theHisto_d->Fill( varX, varY );
448 theHisto_dus->Fill( varX, varY );
449 theHisto_dusg->Fill( varX, varY );
451 theProfile_d->Fill(varX, varY);
452 theProfile_dus->Fill(varX, varY);
453 theProfile_dusg->Fill(varX, varY);
457 theHisto_u->Fill( varX, varY );
458 theHisto_dus->Fill( varX, varY );
459 theHisto_dusg->Fill( varX, varY );
461 theProfile_u->Fill(varX, varY);
462 theProfile_dus->Fill(varX, varY);
463 theProfile_dusg->Fill(varX, varY);
467 theHisto_s->Fill( varX, varY );
468 theHisto_dus->Fill( varX, varY );
469 theHisto_dusg->Fill( varX, varY );
471 theProfile_s->Fill(varX, varY);
472 theProfile_dus->Fill(varX, varY);
473 theProfile_dusg->Fill(varX, varY);
477 theHisto_c->Fill( varX, varY );
478 if(createProfile_) theProfile_c->Fill(varX, varY);
481 theHisto_b->Fill( varX, varY );
482 if(createProfile_) theProfile_b->Fill(varX, varY);
485 theHisto_g->Fill( varX, varY );
486 theHisto_dusg->Fill( varX, varY );
488 theProfile_g->Fill(varX, varY);
489 theProfile_dusg->Fill(varX, varY);
493 theHisto_ni->Fill( varX, varY );
494 if(createProfile_) theProfile_ni->Fill(varX, varY);
499 template <
class T,
class G>
502 std::vector<TH2F*> histoVector;
503 histoVector.push_back ( theHisto_all->getTH2F() );
505 histoVector.push_back ( theHisto_d->getTH2F() );
506 histoVector.push_back ( theHisto_u->getTH2F() );
507 histoVector.push_back ( theHisto_s->getTH2F() );
508 histoVector.push_back ( theHisto_c->getTH2F() );
509 histoVector.push_back ( theHisto_b->getTH2F() );
510 histoVector.push_back ( theHisto_g ->
getTH2F() );
511 histoVector.push_back ( theHisto_ni->getTH2F() );
512 histoVector.push_back ( theHisto_dus->getTH2F() );
513 histoVector.push_back ( theHisto_dusg->getTH2F());
518 template <
class T,
class G>
521 std::vector<TProfile*> profileVector;
523 profileVector.push_back ( theProfile_all->getTProfile() );
525 profileVector.push_back ( theProfile_d->getTProfile() );
526 profileVector.push_back ( theProfile_u->getTProfile() );
527 profileVector.push_back ( theProfile_s->getTProfile() );
528 profileVector.push_back ( theProfile_c->getTProfile() );
529 profileVector.push_back ( theProfile_b->getTProfile() );
530 profileVector.push_back ( theProfile_g ->
getTProfile() );
531 profileVector.push_back ( theProfile_ni->getTProfile() );
532 profileVector.push_back ( theProfile_dus->getTProfile() );
533 profileVector.push_back ( theProfile_dusg->getTProfile());
536 return profileVector;
void fillVariable(const int &flavour, const T &varX, const G &varY) const
TProfile * profile_c() const
std::string theBaseNameDescription
MonitorElement * theProfile_s
double lowerBoundX() const
TProfile * getTProfile(std::string name, std::string process, std::string rootfolder, DQMStore *dbe_, bool verb, bool clone)
double lowerBoundY() const
MonitorElement * theHisto_g
void SetMaximum(const double &max)
MonitorElement * theProfile_dusg
void settitle(const char *titleX, const char *titleY)
MonitorElement * theHisto_dusg
MonitorElement * theHisto_u
virtual MonitorElement * bookProfile(const std::string &name, const std::string &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
virtual MonitorElement * book2D(const std::string &name, const std::string &title, const int &nchX, const double &lowX, const double &highX, const int &nchY, const double &lowY, const double &highY)
virtual ~FlavourHistograms2D()
std::string baseNameTitle() const
TProfile * profile_b() const
std::string theBaseNameTitle
void divide(const FlavourHistograms2D< T, G > &bHD) const
MonitorElement * theHisto_c
void fill(const int &flavour, const T &variableX, const G &variableY) const
MonitorElement * theProfile_all
MonitorElement * theProfile_ni
const T & max(const T &a, const T &b)
MonitorElement * theHisto_dus
TH2F * histo_dusg() const
MonitorElement * theProfile_u
MonitorElement * theHisto_s
std::vector< TProfile * > getProfileVector() const
TProfile * profile_u() const
TProfile * profile_all() const
MonitorElement * theProfile_b
void SetMinimum(const double &min)
MonitorElement * theProfile_c
double upperBoundX() const
std::vector< TH2F * > getHistoVector() const
MonitorElement * theProfile_d
std::string baseNameDescription() const
TProfile * profile_d() const
MonitorElement * theProfile_dus
MonitorElement * theHisto_all
TProfile * profile_ni() const
TProfile * getTProfile(void) const
TH2F * getTH2F(std::string name, std::string process, std::string rootfolder, DQMStore *dbe_, bool verb, bool clone)
TProfile * profile_s() const
virtual MonitorElement * access(const std::string &name)
TH2F * getTH2F(void) const
MonitorElement * theProfile_g
TProfile * profile_dusg() const
double upperBoundY() const
MonitorElement * theHisto_b
int flavour(const Candidate &part)
TProfile * profile_dus() const
TProfile * profile_g() const
MonitorElement * theHisto_ni
MonitorElement * theHisto_d