Skip to content

Commit

Permalink
Use of the ibooker.
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrien committed Apr 17, 2014
1 parent fe1d47e commit 09aa4ea
Show file tree
Hide file tree
Showing 17 changed files with 46 additions and 38 deletions.
5 changes: 3 additions & 2 deletions DQMOffline/RecoB/interface/BTagDifferentialPlot.h
Expand Up @@ -11,14 +11,15 @@

#include "DQMOffline/RecoB/interface/EtaPtBin.h"
#include "DQMOffline/RecoB/interface/JetTagPlotter.h"
#include "DQMServices/Core/interface/DQMStore.h"

class BTagDifferentialPlot {

public:

enum ConstVarType {constPT, constETA };

BTagDifferentialPlot (const double& bEff, const ConstVarType& constVariable, const std::string & tagName) ;
BTagDifferentialPlot (const double& bEff, const ConstVarType& constVariable, const std::string & tagName, DQMStore::IBooker & ibook) ;

~BTagDifferentialPlot () ;

Expand Down Expand Up @@ -81,7 +82,7 @@ class BTagDifferentialPlot {

// the common name to describe histograms
std::string commonName ;

DQMStore::IBooker & ibook_;

// the input
std::vector<JetTagPlotter *> theBinPlotters ;
Expand Down
2 changes: 1 addition & 1 deletion DQMOffline/RecoB/interface/EffPurFromHistos.h
Expand Up @@ -31,7 +31,7 @@ class EffPurFromHistos {
~EffPurFromHistos () ;

// do the computation
void compute () ;
void compute (DQMStore::IBooker & ibook) ;

// return the newly created histos
TH1F * getEffFlavVsBEff_d () { return EffFlavVsBEff_d->getTH1F() ; };
Expand Down
5 changes: 3 additions & 2 deletions DQMOffline/RecoB/interface/FlavourHistorgrams.h
Expand Up @@ -174,7 +174,7 @@ FlavourHistograms<T>::FlavourHistograms (const std::string& baseNameTitle_ , con

if (!update) {
// book histos
HistoProviderDQM prov("Btag",folder);
HistoProviderDQM prov("Btag",folder,ibook);
if(mcPlots_%2==0) theHisto_all = (prov.book1D( theBaseNameTitle + "ALL" , theBaseNameDescription + " all jets" , theNBins , theLowerBound , theUpperBound )) ;
else theHisto_all = 0;
if (mcPlots_) {
Expand Down Expand Up @@ -229,7 +229,8 @@ FlavourHistograms<T>::FlavourHistograms (const std::string& baseNameTitle_ , con
}
}
} else {
HistoProviderDQM prov("Btag",folder);
//is it useful? anyway access function is deprecated...
HistoProviderDQM prov("Btag",folder,ibook);
if(theHisto_all) theHisto_all = prov.access(theBaseNameTitle + "ALL" ) ;
if (mcPlots_) {
if (mcPlots_>2 ) {
Expand Down
5 changes: 3 additions & 2 deletions DQMOffline/RecoB/interface/FlavourHistorgrams2D.h
Expand Up @@ -190,7 +190,7 @@ FlavourHistograms2D<T, G>::FlavourHistograms2D (TString baseNameTitle_ , TString

if (!update) {
// book histos
HistoProviderDQM prov("Btag",folder);
HistoProviderDQM prov("Btag",folder,ibook);
if(mcPlots_%2 == 0) theHisto_all = (prov.book2D( theBaseNameTitle + "ALL" , theBaseNameDescription + " all jets" , theNBinsX , theLowerBoundX , theUpperBoundX , theNBinsY, theLowerBoundY, theUpperBoundY )) ;
else theHisto_all = 0;
if (mcPlots_) {
Expand Down Expand Up @@ -310,7 +310,8 @@ FlavourHistograms2D<T, G>::FlavourHistograms2D (TString baseNameTitle_ , TString
}
}
} else {
HistoProviderDQM prov("Btag",folder);
//is it useful? anyway access function is deprecated...
HistoProviderDQM prov("Btag",folder,ibook);
if(theHisto_all) theHisto_all = prov.access(theBaseNameTitle + "ALL" ) ;
if (mcPlots_) {
if (mcPlots_>2) {
Expand Down
7 changes: 4 additions & 3 deletions DQMOffline/RecoB/interface/HistoProviderDQM.h
@@ -1,15 +1,15 @@
#ifndef HistoProviderDQM_H
#define HistoProviderDQM_H

#include "DQMServices/Core/interface/DQMStore.h"

class DQMStore;
class MonitorElement;

#include <string>

class HistoProviderDQM {
public:
HistoProviderDQM(const std::string& prefix, const std::string& label);
HistoProviderDQM(const std::string& prefix, const std::string& label, DQMStore::IBooker & ibook);
virtual ~HistoProviderDQM(){}
void show();

Expand Down Expand Up @@ -41,7 +41,8 @@ class HistoProviderDQM {
virtual MonitorElement * access(const std::string &name);

private:
DQMStore * dqmStore_;
std::string label_;
//DQMStore * dqmStore_;
DQMStore::IBooker & ibook_;
};
#endif
1 change: 1 addition & 0 deletions DQMOffline/RecoB/interface/TrackCountingTagPlotter.h
Expand Up @@ -44,6 +44,7 @@ class TrackCountingTagPlotter : public BaseTagInfoPlotter {

EffPurFromHistos * effPurFromHistos[4] ;
bool finalized;
DQMStore::IBooker & ibook_;
} ;

#endif
5 changes: 3 additions & 2 deletions DQMOffline/RecoB/interface/TrackIPHistograms.h
Expand Up @@ -54,7 +54,7 @@ TrackIPHistograms<T>::TrackIPHistograms (const std::string& baseNameTitle_, cons
{
if(quality_) {
if(!update) {
HistoProviderDQM prov("Btag",folder);
HistoProviderDQM prov("Btag",folder,ibook);
theQual_undefined = prov.book1D( baseNameTitle_ + "QualUnDef" , baseNameDescription_ + " Undefined Quality", nBins_, lowerBound_, upperBound_);
theQual_loose = prov.book1D( baseNameTitle_ + "QualLoose" , baseNameDescription_ + " Loose Quality", nBins_, lowerBound_, upperBound_);
theQual_tight = prov.book1D( baseNameTitle_ + "QualTight" , baseNameDescription_ + " Tight Quality", nBins_, lowerBound_, upperBound_);
Expand All @@ -67,7 +67,8 @@ TrackIPHistograms<T>::TrackIPHistograms (const std::string& baseNameTitle_, cons
theQual_highpur->getTH1F()->Sumw2();
}
} else {
HistoProviderDQM prov("Btag",folder);
//is it useful? anyway access function is deprecated...
HistoProviderDQM prov("Btag",folder,ibook);
theQual_undefined = prov.access(baseNameTitle_ + "QualUnDef");
theQual_loose = prov.access(baseNameTitle_ + "QualLoose");
theQual_tight = prov.access(baseNameTitle_ + "QualTight");
Expand Down
2 changes: 1 addition & 1 deletion DQMOffline/RecoB/interface/TrackProbabilityTagPlotter.h
Expand Up @@ -42,7 +42,7 @@ class TrackProbabilityTagPlotter : public BaseTagInfoPlotter {
bool finalized;
unsigned int mcPlots_;
bool willFinalize_;

DQMStore::IBooker & ibook_;
} ;

#endif
4 changes: 2 additions & 2 deletions DQMOffline/RecoB/plugins/BTagPerformanceAnalyzerOnData.cc
Expand Up @@ -136,14 +136,14 @@ void BTagPerformanceAnalyzerOnData::bookHistograms(DQMStore::IBooker & ibook, ed
// the objects for the differential plots vs. eta,pt for
for ( int iEta = iEtaStart ; iEta < iEtaEnd ; ++iEta ) {
BTagDifferentialPlot * etaConstDifferentialPlot = new BTagDifferentialPlot
(effBConst, BTagDifferentialPlot::constETA, moduleLabel.label());
(effBConst, BTagDifferentialPlot::constETA, moduleLabel.label(), ibook);
differentialPlotsConstantEta->push_back ( etaConstDifferentialPlot );
}

for ( int iPt = iPtStart ; iPt < iPtEnd ; ++iPt ) {
// differentialPlots for this pt bin
BTagDifferentialPlot * ptConstDifferentialPlot = new BTagDifferentialPlot
(effBConst, BTagDifferentialPlot::constPT, moduleLabel.label());
(effBConst, BTagDifferentialPlot::constPT, moduleLabel.label(), ibook);
differentialPlotsConstantPt->push_back ( ptConstDifferentialPlot );
}
}
Expand Down
6 changes: 3 additions & 3 deletions DQMOffline/RecoB/src/BTagDifferentialPlot.cc
Expand Up @@ -18,11 +18,11 @@ using namespace std ;


BTagDifferentialPlot::BTagDifferentialPlot (const double& bEff, const ConstVarType& constVariable,
const std::string & tagName) :
const std::string & tagName, DQMStore::IBooker & ibook) :
fixedBEfficiency ( bEff ) ,
noProcessing ( false ) , processed(false), constVar(constVariable),
constVariableName ( "" ) , diffVariableName ( "" ) ,
constVariableValue ( 999.9 , 999.9 ) , commonName( "MisidForBEff_" + tagName+"_") ,
constVariableValue ( 999.9 , 999.9 ) , commonName( "MisidForBEff_" + tagName+"_") , ibook_(ibook),
theDifferentialHistoB_d ( 0 ) ,
theDifferentialHistoB_u ( 0 ) ,
theDifferentialHistoB_s ( 0 ) ,
Expand Down Expand Up @@ -249,7 +249,7 @@ void BTagDifferentialPlot::bookHisto () {
std::replace(commonName.begin(), commonName.end(), '.' , 'v' ) ;

std::string label(commonName);
HistoProviderDQM prov ("Btag",label);
HistoProviderDQM prov ("Btag",label,ibook_);

theDifferentialHistoB_d = (prov.book1D ( "D_" + commonName , "D_" + commonName , nBins , binArray )) ;
theDifferentialHistoB_u = (prov.book1D ( "U_" + commonName , "U_" + commonName , nBins , binArray )) ;
Expand Down
4 changes: 2 additions & 2 deletions DQMOffline/RecoB/src/EffPurFromHistos.cc
Expand Up @@ -452,7 +452,7 @@ void EffPurFromHistos::check () {
}


void EffPurFromHistos::compute ()
void EffPurFromHistos::compute (DQMStore::IBooker & ibook)
{
if (!mcPlots_) {

Expand All @@ -479,7 +479,7 @@ void EffPurFromHistos::compute ()

// create histograms from base name and extension as given from user
// BINNING MUST BE IDENTICAL FOR ALL OF THEM!!
HistoProviderDQM prov("Btag",label_);
HistoProviderDQM prov("Btag",label_,ibook);
if(mcPlots_>2){
EffFlavVsBEff_d = (prov.book1D ( hB + "D" + hE , hB + "D" + hE , nBinOutput , startOutput , endOutput ));
EffFlavVsBEff_u = (prov.book1D ( hB + "U" + hE , hB + "U" + hE , nBinOutput , startOutput , endOutput )) ;
Expand Down
22 changes: 12 additions & 10 deletions DQMOffline/RecoB/src/HistoProviderDQM.cc
Expand Up @@ -5,41 +5,41 @@
#include "FWCore/ServiceRegistry/interface/Service.h"


HistoProviderDQM::HistoProviderDQM(const std::string& prefix, const std::string& label){
HistoProviderDQM::HistoProviderDQM(const std::string& prefix, const std::string& label, DQMStore::IBooker & ibook): ibook_(ibook){
// get the store
dqmStore_ = edm::Service<DQMStore>().operator->();
label_ =prefix+"/"+label;
setDir(label_);
}

void HistoProviderDQM::show(){
dqmStore_->showDirStructure();
//ibook_.showDirStructure();
std::cout<<"No showDirStructure() avaialble with DQMStore::IBooker: obsolete method!"<<std::endl;
}


void HistoProviderDQM::setDir(const std::string& name){
dqmStore_->setCurrentFolder(name);
ibook_.setCurrentFolder(name);
}

MonitorElement* HistoProviderDQM::book1D(const std::string &name,
const std::string &title,
const int& nchX, const double& lowX, const double& highX) {
return (dqmStore_->book1D (name, title, nchX,lowX,highX));
return (ibook_.book1D (name, title, nchX,lowX,highX));

}


MonitorElement* HistoProviderDQM::book1D (const std::string &name,
const std::string &title,
const int& nchX, float *xbinsize){
return (dqmStore_->book1D (name, title,nchX, xbinsize));
return (ibook_.book1D (name, title,nchX, xbinsize));
}

MonitorElement* HistoProviderDQM::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) {
return (dqmStore_->book2D (name, title, nchX,lowX,highX, nchY, lowY, highY));
return (ibook_.book2D (name, title, nchX,lowX,highX, nchY, lowY, highY));

}

Expand All @@ -48,18 +48,20 @@ MonitorElement* HistoProviderDQM::book2D (const std::string &name,
const std::string &title,
const int& nchX, float *xbinsize,
const int& nchY, float *ybinsize){
return (dqmStore_->book2D (name, title,nchX, xbinsize, nchY, ybinsize));
return (ibook_.book2D (name, title,nchX, xbinsize, nchY, ybinsize));
}

MonitorElement* HistoProviderDQM::bookProfile(const std::string &name,
const std::string &title,
int nchX, double lowX, double highX,
int nchY, double lowY, double highY) {
return (dqmStore_->bookProfile (name,title, nchX,lowX,highX, nchY, lowY, highY));
return (ibook_.bookProfile (name,title, nchX,lowX,highX, nchY, lowY, highY));

}

MonitorElement * HistoProviderDQM::access(const std::string &name){
return dqmStore_->get(label_+"/"+name);
//return ibook_.get(label_+"/"+name);
std::cout<<"'get' forbidden with DQMStore::IBooker: obsolete method!"<<std::endl;
return 0;
}

2 changes: 1 addition & 1 deletion DQMOffline/RecoB/src/JetTagPlotter.cc
Expand Up @@ -353,7 +353,7 @@ void JetTagPlotter::finalize()

effPurFromHistos = new EffPurFromHistos ( dDiscriminator,theExtensionString.substr(1), mcPlots_, ibook_,
nBinEffPur_, startEffPur_, endEffPur_);
effPurFromHistos->compute();
effPurFromHistos->compute(ibook_);
finalized = true;
}

Expand Down
4 changes: 2 additions & 2 deletions DQMOffline/RecoB/src/TrackCountingTagPlotter.cc
Expand Up @@ -12,7 +12,7 @@ TrackCountingTagPlotter::TrackCountingTagPlotter(const std::string & tagName,
nBinEffPur_(pSet.getParameter<int>("nBinEffPur")),
startEffPur_(pSet.getParameter<double>("startEffPur")),
endEffPur_(pSet.getParameter<double>("endEffPur")),
willFinalize_(wf), lowerIPSBound(-35.0), upperIPSBound(35.0), finalized(false)
willFinalize_(wf), lowerIPSBound(-35.0), upperIPSBound(35.0), finalized(false), ibook_(ibook)
{
const std::string dir(theExtensionString.substr(1));

Expand Down Expand Up @@ -148,7 +148,7 @@ void TrackCountingTagPlotter::createPlotsForFinalize (DQMStore::IBooker & ibook)

void TrackCountingTagPlotter::finalize ()
{
for(int n=0; n != 4; ++n) effPurFromHistos[n]->compute();
for(int n=0; n != 4; ++n) effPurFromHistos[n]->compute(ibook_);
finalized = true;
}

Expand Down
2 changes: 1 addition & 1 deletion DQMOffline/RecoB/src/TrackIPTagPlotter.cc
Expand Up @@ -810,7 +810,7 @@ void TrackIPTagPlotter::finalize ()
effPurFromHistos[3] = new EffPurFromHistos (tkcntHistosSig2D[2],trackIPDir, mcPlots_, ibook_,
nBinEffPur_, startEffPur_,
endEffPur_);
for(int n=0; n != 4; ++n) effPurFromHistos[n]->compute();
for(int n=0; n != 4; ++n) effPurFromHistos[n]->compute(ibook_);
finalized = true;
}

Expand Down
4 changes: 2 additions & 2 deletions DQMOffline/RecoB/src/TrackProbabilityTagPlotter.cc
Expand Up @@ -11,7 +11,7 @@ TrackProbabilityTagPlotter::TrackProbabilityTagPlotter(const std::string & tagNa
nBinEffPur_(pSet.getParameter<int>("nBinEffPur")),
startEffPur_(pSet.getParameter<double>("startEffPur")),
endEffPur_(pSet.getParameter<double>("endEffPur")),
finalized(false), mcPlots_(mc), willFinalize_(wf)
finalized(false), mcPlots_(mc), willFinalize_(wf), ibook_(ibook)
{
const std::string dir(theExtensionString.substr(1));

Expand Down Expand Up @@ -123,7 +123,7 @@ void TrackProbabilityTagPlotter::finalize ()
// final processing:
// produce the misid. vs. eff histograms
//
for(int n=0; n != 4; ++n) effPurFromHistos[n]->compute();
for(int n=0; n != 4; ++n) effPurFromHistos[n]->compute(ibook_);
finalized = true;
}

Expand Down
4 changes: 2 additions & 2 deletions Validation/RecoB/plugins/BTagPerformanceAnalyzerMC.cc
Expand Up @@ -162,14 +162,14 @@ void BTagPerformanceAnalyzerMC::bookHistograms(DQMStore::IBooker & ibook, edm::R
// the objects for the differential plots vs. eta,pt for
for ( int iEta = iEtaStart ; iEta < iEtaEnd ; iEta++ ) {
BTagDifferentialPlot * etaConstDifferentialPlot = new BTagDifferentialPlot
(effBConst, BTagDifferentialPlot::constETA, folderName);
(effBConst, BTagDifferentialPlot::constETA, folderName, ibook);
differentialPlotsConstantEta->push_back ( etaConstDifferentialPlot );
}

for ( int iPt = iPtStart ; iPt < iPtEnd ; iPt++ ) {
// differentialPlots for this pt bin
BTagDifferentialPlot * ptConstDifferentialPlot = new BTagDifferentialPlot
(effBConst, BTagDifferentialPlot::constPT, folderName);
(effBConst, BTagDifferentialPlot::constPT, folderName, ibook);
differentialPlotsConstantPt->push_back ( ptConstDifferentialPlot );
}
}
Expand Down

0 comments on commit 09aa4ea

Please sign in to comment.