Skip to content

Commit

Permalink
Merge pull request #3457 from cms-btv-pog/BtagThreadedDQM
Browse files Browse the repository at this point in the history
Multithreading -- Btag threaded dqm
  • Loading branch information
ktf committed Apr 24, 2014
2 parents b952205 + 09aa4ea commit 62b1e69
Show file tree
Hide file tree
Showing 46 changed files with 705 additions and 755 deletions.
5 changes: 1 addition & 4 deletions DQMOffline/Configuration/python/DQMOffline_cff.py
Expand Up @@ -50,7 +50,6 @@
egammaDQMOffline *
triggerOfflineDQMSource *
pvMonitor *
prebTagSequence *
bTagPlotsDATA *
alcaBeamMonitor *
dqmPhysics *
Expand All @@ -65,7 +64,6 @@
DQMMessageLogger )

DQMOfflinePrePOGMC = cms.Sequence( pvMonitor *
prebTagSequence *
bTagPlotsDATA *
dqmPhysics )

Expand Down Expand Up @@ -117,7 +115,6 @@

DQMOfflineEGamma = cms.Sequence( egammaDQMOffline )

DQMOfflineBTag = cms.Sequence( prebTagSequence *
bTagPlotsDATA )
DQMOfflineBTag = cms.Sequence( bTagPlotsDATA )


8 changes: 6 additions & 2 deletions DQMOffline/RecoB/interface/AcceptJet.h
Expand Up @@ -15,9 +15,10 @@ class AcceptJet {

public:
AcceptJet(const double& etaMin_, const double& etaMax_, const double& ptMin_, const double& ptMax_,
const double& pMin_, const double& pMax_, const double& ratioMin_, const double& ratioMax_);
const double& pMin_, const double& pMax_, const double& ratioMin_, const double& ratioMax_,
const bool& doJetID_);
/// Returns true if jet and associated parton satisfy kinematic cuts.
bool operator() (const reco::Jet & jet, const int & jetFlavour, const edm::Handle<reco::SoftLeptonTagInfoCollection> & infos) const;
bool operator() (const reco::Jet & jet, const int & jetFlavour, const edm::Handle<reco::SoftLeptonTagInfoCollection> & infos, const double jec) const;

/// Set cut parameters
void setEtaMin ( double d ) { etaMin = d ; }
Expand All @@ -30,6 +31,7 @@ class AcceptJet {
void setPRecJetMax ( double d ) { pRecJetMax = d ; }
void setRatioMin ( double d ) { ratioMin = d ; }
void setRatioMax ( double d ) { ratioMax = d ; }
void setDoJetID ( bool b ) { doJetID = b ; }

// void setPtPartonMin ( double d ) { ptPartonMin = d ; }
// void setPtPartonMax ( double d ) { ptPartonMax = d ; }
Expand Down Expand Up @@ -61,6 +63,8 @@ class AcceptJet {
double ratioMin ;
double ratioMax ;

//Apply loose Jet ID in case of PF jets
bool doJetID;
} ;

#endif
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
8 changes: 4 additions & 4 deletions DQMOffline/RecoB/interface/BaseTagInfoPlotter.h
Expand Up @@ -16,10 +16,10 @@ class BaseTagInfoPlotter : public BaseBTagPlotter {
BaseBTagPlotter(tagName, etaPtBin) {};

virtual ~BaseTagInfoPlotter () {};
virtual void analyzeTag(const reco::BaseTagInfo * tagInfo, const int & jetFlavour);
virtual void analyzeTag(const std::vector<const reco::BaseTagInfo *> &tagInfos, const int & jetFlavour);
virtual void analyzeTag(const reco::BaseTagInfo * tagInfo, const int & jetFlavour, const float & w);
virtual void analyzeTag(const std::vector<const reco::BaseTagInfo *> &tagInfos, const int & jetFlavour, const float & w);
virtual void analyzeTag(const reco::BaseTagInfo * tagInfo, const double & jec, const int & jetFlavour);
virtual void analyzeTag(const std::vector<const reco::BaseTagInfo *> &tagInfos, const double & jec, const int & jetFlavour);
virtual void analyzeTag(const reco::BaseTagInfo * tagInfo, const double & jec, const int & jetFlavour, const float & w);
virtual void analyzeTag(const std::vector<const reco::BaseTagInfo *> &tagInfos, const double & jec, const int & jetFlavour, const float & w);

virtual void setEventSetup(const edm::EventSetup & setup);
virtual std::vector<std::string> tagInfoRequirements() const;
Expand Down
7 changes: 4 additions & 3 deletions DQMOffline/RecoB/interface/EffPurFromHistos.h
Expand Up @@ -3,6 +3,7 @@

#include "DQMOffline/RecoB/interface/FlavourHistorgrams.h"
#include "DQMOffline/RecoB/interface/HistoProviderDQM.h"
#include "DQMServices/Core/interface/DQMStore.h"

#include "TH1F.h"
#include "TCanvas.h"
Expand All @@ -23,14 +24,14 @@ class EffPurFromHistos {
int nBin = 100 , double startO = 0.005 , double endO = 1.005 ) ;
// defaults reasonable for lifetime based tags

EffPurFromHistos (const FlavourHistograms<double> * dDiscriminatorFC, const std::string& label, const unsigned int& mc,
int nBin = 100 , double startO = 0.005 , double endO = 1.005 ) ;
EffPurFromHistos (const FlavourHistograms<double> * dDiscriminatorFC, const std::string& label, const unsigned int& mc, DQMStore::IBooker & ibook,
int nBin = 100 , double startO = 0.005 , double endO = 1.005 ) ;
// defaults reasonable for lifetime based tags

~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
2 changes: 1 addition & 1 deletion DQMOffline/RecoB/interface/EtaPtBin.h
Expand Up @@ -43,7 +43,7 @@ class EtaPtBin {

/// Check if jet/parton are within rapidity/pt cuts.
bool inBin(const double & eta , const double & pt) const;
bool inBin(const reco::Jet & jet) const;
bool inBin(const reco::Jet & jet, const double jec) const;
// bool inBin(const BTagMCTools::JetFlavour & jetFlavour) const;

private:
Expand Down
11 changes: 7 additions & 4 deletions DQMOffline/RecoB/interface/FlavourHistorgrams.h
Expand Up @@ -32,7 +32,8 @@ class FlavourHistograms {
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 bool& update, const std::string& folder, const unsigned int& mc) ;
const std::string& plotFirst_ , const bool& update, const std::string& folder,
const unsigned int& mc, DQMStore::IBooker & ibook) ;

virtual ~FlavourHistograms () ;

Expand Down Expand Up @@ -148,7 +149,8 @@ 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 bool& update, const std::string& folder, const unsigned int& mc) :
const std::string& plotFirst_, const bool& update, const std::string& folder,
const unsigned int& mc, DQMStore::IBooker & ibook) :
// BaseFlavourHistograms () ,
// theVariable ( variable_ ) ,
theMaxDimension(-1), theIndexToPlot(-1), theBaseNameTitle ( baseNameTitle_ ) , theBaseNameDescription ( baseNameDescription_ ) ,
Expand All @@ -172,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 @@ -227,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
21 changes: 11 additions & 10 deletions DQMOffline/RecoB/interface/FlavourHistorgrams2D.h
Expand Up @@ -32,10 +32,10 @@ class FlavourHistograms2D {
public:

FlavourHistograms2D (TString baseNameTitle_ , TString baseNameDescription_ ,
int nBinsX_ , double lowerBoundX_ , double upperBoundX_ ,
int nBinsY_ , double lowerBoundY_ , double upperBoundY_ ,
bool statistics_ , bool update, std::string folder, unsigned int mc,
bool createProfile) ;
int nBinsX_ , double lowerBoundX_ , double upperBoundX_ ,
int nBinsY_ , double lowerBoundY_ , double upperBoundY_ ,
bool statistics_ , bool update, std::string folder, unsigned int mc,
bool createProfile, DQMStore::IBooker & ibook) ;

virtual ~FlavourHistograms2D () ;

Expand Down Expand Up @@ -173,10 +173,10 @@ class FlavourHistograms2D {

template <class T, class G>
FlavourHistograms2D<T, G>::FlavourHistograms2D (TString baseNameTitle_ , TString baseNameDescription_ ,
int nBinsX_ , double lowerBoundX_ , double upperBoundX_ ,
int nBinsY_ , double lowerBoundY_ , double upperBoundY_ ,
bool statistics_ ,
bool update, std::string folder, unsigned int mc, bool createProfile) :
int nBinsX_ , double lowerBoundX_ , double upperBoundX_ ,
int nBinsY_ , double lowerBoundY_ , double upperBoundY_ ,
bool statistics_ , bool update, std::string folder,
unsigned int mc, bool createProfile, DQMStore::IBooker & ibook) :
// BaseFlavourHistograms2D () ,
// theVariable ( variable_ ) ,
theMaxDimension(-1), theIndexToPlot(-1), theBaseNameTitle ( baseNameTitle_ ) , theBaseNameDescription ( baseNameDescription_ ) ,
Expand All @@ -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
16 changes: 9 additions & 7 deletions DQMOffline/RecoB/interface/JetTagPlotter.h
Expand Up @@ -9,27 +9,28 @@
#include "DQMOffline/RecoB/interface/BaseBTagPlotter.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "DataFormats/BTauReco/interface/JetTag.h"

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

class JetTagPlotter : public BaseBTagPlotter {


public:

JetTagPlotter (const std::string & tagName, const EtaPtBin & etaPtBin,
const edm::ParameterSet& pSet, const unsigned int& mc , const bool& update, const bool& willFinalize);
const edm::ParameterSet& pSet, const unsigned int& mc ,
const bool& update, const bool& willFinalize, DQMStore::IBooker & ibook);

virtual ~JetTagPlotter () ;

void analyzeTag (); //added to fill the jet multiplicity on data
void analyzeTag (const float & w); //added to fill the jet multiplicity on mc
void analyzeTag (const reco::JetTag & jetTag, const int & jetFlavour);
void analyzeTag (const reco::JetTag & jetTag, const int & jetFlavour, const float & w);
void analyzeTag (const reco::Jet & jet, const float& discriminator, const int& jetFlavour);
void analyzeTag (const reco::Jet & jet, const float& discriminator, const int& jetFlavour, const float & w);
void analyzeTag (const reco::JetTag & jetTag, const double & jec, const int & jetFlavour);
void analyzeTag (const reco::JetTag & jetTag, const double & jec, const int & jetFlavour, const float & w);
void analyzeTag (const reco::Jet & jet, const double & jec, const float& discriminator, const int& jetFlavour);
void analyzeTag (const reco::Jet & jet, const double & jec, const float& discriminator, const int& jetFlavour, const float & w);

// final computation, plotting, printing .......
void createPlotsForFinalize();
void createPlotsForFinalize(DQMStore::IBooker & ibook);
void finalize () ;

// get "2d" histograms for misid. vs. b-eff
Expand Down Expand Up @@ -60,6 +61,7 @@ class JetTagPlotter : public BaseBTagPlotter {
bool willFinalize_;

int *nJets;
DQMStore::IBooker & ibook_;
// jet multiplicity
FlavourHistograms<int> * JetMultiplicity;

Expand Down
7 changes: 4 additions & 3 deletions DQMOffline/RecoB/interface/MVAJetTagPlotter.h
Expand Up @@ -18,12 +18,13 @@ class MVAJetTagPlotter : public BaseTagInfoPlotter {
public:

MVAJetTagPlotter (const std::string & tagName, const EtaPtBin & etaPtBin,
const edm::ParameterSet& pSet, const std::string& folderName, const bool& update, const unsigned int& mc);
const edm::ParameterSet& pSet, const std::string& folderName,
const bool& update, const unsigned int& mc, DQMStore::IBooker & ibook);

~MVAJetTagPlotter ();

virtual void analyzeTag (const std::vector<const reco::BaseTagInfo *> & baseTagInfos, const int & jetFlavour);
virtual void analyzeTag (const std::vector<const reco::BaseTagInfo *> & baseTagInfos, const int & jetFlavour, const float & w);
virtual void analyzeTag (const std::vector<const reco::BaseTagInfo *> & baseTagInfos, const double & jec, const int & jetFlavour);
virtual void analyzeTag (const std::vector<const reco::BaseTagInfo *> & baseTagInfos, const double & jec, const int & jetFlavour, const float & w);

virtual void finalize ();

Expand Down
9 changes: 5 additions & 4 deletions DQMOffline/RecoB/interface/SoftLeptonTagPlotter.h
Expand Up @@ -11,14 +11,15 @@ class SoftLeptonTagPlotter : public BaseTagInfoPlotter {
public:

SoftLeptonTagPlotter(const std::string & tagName, const EtaPtBin & etaPtBin,
const edm::ParameterSet& pSet, const unsigned int& mc, const bool& update);
const edm::ParameterSet& pSet, const unsigned int& mc,
const bool& update, DQMStore::IBooker & ibook);

~SoftLeptonTagPlotter( void ) ;

void analyzeTag (const reco::BaseTagInfo * baseTagInfo, const int & jetFlavour);
void analyzeTag (const reco::BaseTagInfo * baseTagInfo, const int & jetFlavour, const float & w);
void analyzeTag (const reco::BaseTagInfo * baseTagInfo, const double & jec, const int & jetFlavour);
void analyzeTag (const reco::BaseTagInfo * baseTagInfo, const double & jec, const int & jetFlavour, const float & w);

virtual void finalize( void ) {}
virtual void finalize() {}


void psPlot( const std::string & name );
Expand Down
2 changes: 1 addition & 1 deletion DQMOffline/RecoB/interface/TagCorrelationPlotter.h
Expand Up @@ -11,7 +11,7 @@
class TagCorrelationPlotter : public BaseBTagPlotter {
public:
TagCorrelationPlotter(const std::string& tagName1, const std::string& tagName2, const EtaPtBin& etaPtBin,
const edm::ParameterSet& pSet, const unsigned int& mc , const bool& update);
const edm::ParameterSet& pSet, const unsigned int& mc , const bool& update, DQMStore::IBooker & ibook);

virtual ~TagCorrelationPlotter();

Expand Down
6 changes: 3 additions & 3 deletions DQMOffline/RecoB/interface/TagInfoPlotterFactory.h
Expand Up @@ -9,9 +9,9 @@
class TagInfoPlotterFactory {
public:
BaseTagInfoPlotter* buildPlotter(const std::string& dataFormatType, const std::string & tagName,
const EtaPtBin & etaPtBin, const edm::ParameterSet& pSet,
const std::string& folderName, const bool& update, const unsigned int& mc,
const bool& wf);
const EtaPtBin & etaPtBin, const edm::ParameterSet& pSet,
const std::string& folderName, const bool& update, const unsigned int& mc,
const bool& wf, DQMStore::IBooker & ibook);
};


Expand Down
12 changes: 7 additions & 5 deletions DQMOffline/RecoB/interface/TaggingVariablePlotter.h
Expand Up @@ -19,16 +19,17 @@ class TaggingVariablePlotter : public BaseTagInfoPlotter {
public:

TaggingVariablePlotter (const std::string & tagName, const EtaPtBin & etaPtBin,
const edm::ParameterSet& pSet, const bool& update, const unsigned int& mc,
const std::string &category = std::string());
const edm::ParameterSet& pSet, const bool& update,
const unsigned int& mc, DQMStore::IBooker & ibook,
const std::string &category = std::string());

~TaggingVariablePlotter () ;

void analyzeTag (const reco::BaseTagInfo * baseTagInfo, const int & jetFlavour);
void analyzeTag (const reco::BaseTagInfo * baseTagInfo, const double & jec, const int & jetFlavour);

void analyzeTag (const reco::TaggingVariableList & variables, const int & jetFlavour);

void analyzeTag (const reco::BaseTagInfo * baseTagInfo, const int & jetFlavour, const float & w);
void analyzeTag (const reco::BaseTagInfo * baseTagInfo, const double & jec, const int & jetFlavour, const float & w);

void analyzeTag (const reco::TaggingVariableList & variables, const int & jetFlavour, const float & w);

Expand All @@ -45,7 +46,8 @@ class TaggingVariablePlotter : public BaseTagInfoPlotter {

struct VariableConfig {
VariableConfig(const std::string &name, const edm::ParameterSet& pSet,
const bool& update, const std::string &category, const std::string& label, const unsigned int& mc);
const bool& update, const std::string &category, const std::string& label,
const unsigned int& mc, DQMStore::IBooker & ibook);

reco::TaggingVariableName var;
unsigned int nBins;
Expand Down

0 comments on commit 62b1e69

Please sign in to comment.