Skip to content

Commit

Permalink
Merge pull request cms-sw#7289 from dmitrijus/dqm_multithread_migrati…
Browse files Browse the repository at this point in the history
…on_a4

Migration to the thread-safe DQM: #4
  • Loading branch information
cmsbuild committed Jan 22, 2015
2 parents e5c03a7 + aa68042 commit 9a889ec
Show file tree
Hide file tree
Showing 16 changed files with 565 additions and 742 deletions.
2 changes: 1 addition & 1 deletion DQMOffline/Trigger/interface/EgHLTEleHLTFilterMon.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ namespace egHLT {
EleHLTFilterMon(const EleHLTFilterMon&){}
EleHLTFilterMon& operator=(const EleHLTFilterMon&){return *this;}
public:
EleHLTFilterMon(const std::string& filterName,TrigCodes::TrigBitSet filterBit,const BinData& bins,const CutMasks& masks);
EleHLTFilterMon(DQMStore::IBooker &iBooker, const std::string& filterName,TrigCodes::TrigBitSet filterBit,const BinData& bins,const CutMasks& masks);
~EleHLTFilterMon();


Expand Down
60 changes: 30 additions & 30 deletions DQMOffline/Trigger/interface/EgHLTMonElemFuncs.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,84 +28,84 @@ namespace egHLT {
namespace MonElemFuncs {


void initStdEleHists(std::vector<MonElemManagerBase<OffEle>*>& histVec,const std::string& filterName,const std::string& baseName,const BinData& bins);
void initStdPhoHists(std::vector<MonElemManagerBase<OffPho>*>& histVec,const std::string& filterName,const std::string& baseName,const BinData& bins);
void initStdEffHists(std::vector<MonElemWithCutBase<OffEle>*>& histVec,const std::string& filterName,const std::string& baseName,int nrBins,double xMin,double xMax,float (OffEle::*vsVarFunc)()const,const CutMasks& masks);
void initStdEffHists(std::vector<MonElemWithCutBase<OffEle>*>& histVec,const std::string& filterName,const std::string& baseName,const BinData::Data1D& bins,float (OffEle::*vsVarFunc)()const,const CutMasks& masks);
void initStdEffHists(std::vector<MonElemWithCutBase<OffPho>*>& histVec,const std::string& filterName,const std::string& baseName,int nrBins,double xMin,double xMax,float (OffPho::*vsVarFunc)()const,const CutMasks& masks);
void initStdEffHists(std::vector<MonElemWithCutBase<OffPho>*>& histVec,const std::string& filterName,const std::string& baseName,const BinData::Data1D& bins,float (OffPho::*vsVarFunc)()const,const CutMasks& masks);
void initStdEleHists(DQMStore::IBooker &iBooker,std::vector<MonElemManagerBase<OffEle>*>& histVec,const std::string& filterName,const std::string& baseName,const BinData& bins);
void initStdPhoHists(DQMStore::IBooker &iBooker,std::vector<MonElemManagerBase<OffPho>*>& histVec,const std::string& filterName,const std::string& baseName,const BinData& bins);
void initStdEffHists(DQMStore::IBooker &iBooker,std::vector<MonElemWithCutBase<OffEle>*>& histVec,const std::string& filterName,const std::string& baseName,int nrBins,double xMin,double xMax,float (OffEle::*vsVarFunc)()const,const CutMasks& masks);
void initStdEffHists(DQMStore::IBooker &iBooker,std::vector<MonElemWithCutBase<OffEle>*>& histVec,const std::string& filterName,const std::string& baseName,const BinData::Data1D& bins,float (OffEle::*vsVarFunc)()const,const CutMasks& masks);
void initStdEffHists(DQMStore::IBooker &iBooker,std::vector<MonElemWithCutBase<OffPho>*>& histVec,const std::string& filterName,const std::string& baseName,int nrBins,double xMin,double xMax,float (OffPho::*vsVarFunc)()const,const CutMasks& masks);
void initStdEffHists(DQMStore::IBooker &iBooker,std::vector<MonElemWithCutBase<OffPho>*>& histVec,const std::string& filterName,const std::string& baseName,const BinData::Data1D& bins,float (OffPho::*vsVarFunc)()const,const CutMasks& masks);

//we own the passed in pointer
void initStdEleCutHists(std::vector<MonElemWithCutBase<OffEle>*>& histVec,const std::string& filterName,const std::string& baseName,const BinData& bins,EgHLTDQMCut<OffEle>* cut=NULL);
void initStdPhoCutHists(std::vector<MonElemWithCutBase<OffPho>*>& histVec,const std::string& filterName,const std::string& baseName,const BinData& bins,EgHLTDQMCut<OffPho>* cut=NULL);
void initStdEleCutHists(DQMStore::IBooker &iBooker,std::vector<MonElemWithCutBase<OffEle>*>& histVec,const std::string& filterName,const std::string& baseName,const BinData& bins,EgHLTDQMCut<OffEle>* cut=NULL);
void initStdPhoCutHists(DQMStore::IBooker &iBooker,std::vector<MonElemWithCutBase<OffPho>*>& histVec,const std::string& filterName,const std::string& baseName,const BinData& bins,EgHLTDQMCut<OffPho>* cut=NULL);




void initTightLooseTrigHists(std::vector<MonElemContainer<OffEle>*>& eleMonElems,const std::vector<std::string>& tightLooseTrigs,const BinData& bins,EgHLTDQMCut<OffEle>* eleCut);
void initTightLooseTrigHists(std::vector<MonElemContainer<OffPho>*>& phoMonElems,const std::vector<std::string>& tightLooseTrigs,const BinData& bins,EgHLTDQMCut<OffPho>* phoCut);
void initTightLooseTrigHists(DQMStore::IBooker &iBooker, std::vector<MonElemContainer<OffEle>*>& eleMonElems,const std::vector<std::string>& tightLooseTrigs,const BinData& bins,EgHLTDQMCut<OffEle>* eleCut);
void initTightLooseTrigHists(DQMStore::IBooker &iBooker, std::vector<MonElemContainer<OffPho>*>& phoMonElems,const std::vector<std::string>& tightLooseTrigs,const BinData& bins,EgHLTDQMCut<OffPho>* phoCut);

void initTightLooseTrigHistsTrigCuts(std::vector<MonElemContainer<OffEle>*>& eleMonElems,const std::vector<std::string>& tightLooseTrigs,const BinData& bins);
void initTightLooseTrigHistsTrigCuts(std::vector<MonElemContainer<OffPho>*>& phoMonElems,const std::vector<std::string>& tightLooseTrigs,const BinData& bins);
void initTightLooseTrigHistsTrigCuts(DQMStore::IBooker &iBooker, std::vector<MonElemContainer<OffEle>*>& eleMonElems,const std::vector<std::string>& tightLooseTrigs,const BinData& bins);
void initTightLooseTrigHistsTrigCuts(DQMStore::IBooker &iBooker, std::vector<MonElemContainer<OffPho>*>& phoMonElems,const std::vector<std::string>& tightLooseTrigs,const BinData& bins);

void addTightLooseTrigHist(std::vector<MonElemContainer<OffEle>*>& eleMonElems,
void addTightLooseTrigHist(DQMStore::IBooker &iBooker, std::vector<MonElemContainer<OffEle>*>& eleMonElems,
const std::string& tightTrig,const std::string& looseTrig,
EgHLTDQMCut<OffEle>* eleCut,const std::string& histId,const BinData& bins);


void addTightLooseTrigHist(std::vector<MonElemContainer<OffPho>*>& phoMonElems,
void addTightLooseTrigHist(DQMStore::IBooker &iBooker, std::vector<MonElemContainer<OffPho>*>& phoMonElems,
const std::string& tightTrig,const std::string& looseTrig,
EgHLTDQMCut<OffPho>* phoCut,const std::string& histId,const BinData& bins);



void initTightLooseDiObjTrigHistsTrigCuts(std::vector<MonElemContainer<OffEle>*>& eleMonElems,const std::vector<std::string>& tightLooseTrigs,const BinData& bins);
void initTightLooseDiObjTrigHistsTrigCuts(std::vector<MonElemContainer<OffPho>*>& phoMonElems,const std::vector<std::string>& tightLooseTrigs,const BinData& bins);
void initTightLooseDiObjTrigHistsTrigCuts(DQMStore::IBooker &iBooker, std::vector<MonElemContainer<OffEle>*>& eleMonElems,const std::vector<std::string>& tightLooseTrigs,const BinData& bins);
void initTightLooseDiObjTrigHistsTrigCuts(DQMStore::IBooker &iBooker, std::vector<MonElemContainer<OffPho>*>& phoMonElems,const std::vector<std::string>& tightLooseTrigs,const BinData& bins);

//ele only (Now for pho also!)
void initTrigTagProbeHists(std::vector<MonElemContainer<OffEle>*>& eleMonElems,const std::vector<std::string> filterNames,int cutMask,const BinData& bins);
void initTrigTagProbeHists(std::vector<MonElemContainer<OffPho>*>& phoMonElems,const std::vector<std::string> filterNames,int cutMask,const BinData& bins);
void initTrigTagProbeHist(std::vector<MonElemContainer<OffEle>*>& eleMonElems,const std::string filterName,int cutMask,const BinData& bins);
void initTrigTagProbeHist(std::vector<MonElemContainer<OffPho>*>& phoMonElems,const std::string filterName,int cutMask,const BinData& bins);
void initTrigTagProbeHist_2Leg(std::vector<MonElemContainer<OffEle>*>& eleMonElems,const std::string filterName,int cutMask,const BinData& bins);
void initTrigTagProbeHists(DQMStore::IBooker &iBooker,std::vector<MonElemContainer<OffEle>*>& eleMonElems,const std::vector<std::string> filterNames,int cutMask,const BinData& bins);
void initTrigTagProbeHists(DQMStore::IBooker &iBooker,std::vector<MonElemContainer<OffPho>*>& phoMonElems,const std::vector<std::string> filterNames,int cutMask,const BinData& bins);
void initTrigTagProbeHist(DQMStore::IBooker &iBooker,std::vector<MonElemContainer<OffEle>*>& eleMonElems,const std::string filterName,int cutMask,const BinData& bins);
void initTrigTagProbeHist(DQMStore::IBooker &iBooker,std::vector<MonElemContainer<OffPho>*>& phoMonElems,const std::string filterName,int cutMask,const BinData& bins);
void initTrigTagProbeHist_2Leg(DQMStore::IBooker &iBooker,std::vector<MonElemContainer<OffEle>*>& eleMonElems,const std::string filterName,int cutMask,const BinData& bins);


template<class T,typename varType> void addStdHist(std::vector<MonElemManagerBase<T>*>& histVec,const std::string& name,const std::string& title,
template<class T,typename varType> void addStdHist(DQMStore::IBooker &iBooker, std::vector<MonElemManagerBase<T>*>& histVec,const std::string& name,const std::string& title,
const BinData::Data1D& binData,varType (T::*varFunc)()const){
histVec.push_back(new MonElemMgrEBEE<T,varType>(name,title,binData.nr,binData.min,binData.max,varFunc));
histVec.push_back(new MonElemMgrEBEE<T,varType>(iBooker, name,title,binData.nr,binData.min,binData.max,varFunc));
}

//this function is special in that it figures out the Et cut from the trigger name
//it then passes the cut as normal into the other addTightLooseTrigHist functions
//it also makes an uncut et distribution
template<class T> void addTightLooseTrigHist(std::vector<MonElemContainer<T>*>& monElems,
template<class T> void addTightLooseTrigHist(DQMStore::IBooker &iBooker, std::vector<MonElemContainer<T>*>& monElems,
const std::string& tightTrig,const std::string& looseTrig,
const std::string& histId,const BinData& bins)
{

float etCutValue = trigTools::getEtThresFromName(tightTrig);

EgHLTDQMCut<T>* etCut = new EgGreaterCut<T,float>(etCutValue,&T::etSC); //note the cut in trigger is on SC Et
addTightLooseTrigHist(monElems,tightTrig,looseTrig,etCut,histId,bins);
addTightLooseTrigHist(iBooker,monElems,tightTrig,looseTrig,etCut,histId,bins);

//now make the new mon elems without the et cut (have to be placed in containers even though each container just has one monelem)
MonElemContainer<T>* passEtMonElem;
passEtMonElem = new MonElemContainer<T>(tightTrig+"_"+looseTrig+"_"+histId+"_passTrig","",
new EgObjTrigCut<T>(TrigCodes::getCode(tightTrig+":"+looseTrig),EgObjTrigCut<T>::AND));
addStdHist<T,float>(passEtMonElem->monElems(),passEtMonElem->name()+"_etUnCut",passEtMonElem->name()+" E_{T} (Uncut);E_{T} (GeV)",bins.et,&T::et);
addStdHist<T,float>(iBooker, passEtMonElem->monElems(),passEtMonElem->name()+"_etUnCut",passEtMonElem->name()+" E_{T} (Uncut);E_{T} (GeV)",bins.et,&T::et);

MonElemContainer<T>* failEtMonElem;
failEtMonElem = new MonElemContainer<T>(tightTrig+"_"+looseTrig+"_"+histId+"_failTrig","",
new EgObjTrigCut<T>(TrigCodes::getCode(looseTrig),EgObjTrigCut<T>::AND,TrigCodes::getCode(tightTrig)));
addStdHist<T,float>(failEtMonElem->monElems(),failEtMonElem->name()+"_etUnCut",failEtMonElem->name()+" E_{T} (Uncut);E_{T} (GeV)",bins.et,&T::et);
addStdHist<T,float>(iBooker, failEtMonElem->monElems(),failEtMonElem->name()+"_etUnCut",failEtMonElem->name()+" E_{T} (Uncut);E_{T} (GeV)",bins.et,&T::et);

monElems.push_back(passEtMonElem);
monElems.push_back(failEtMonElem);
}


//this function will ultimately produce a set of distributions with the Et cut of the trigger applied + make an additional un cut et monitor element for turn on purposes
template<class T> void initTightLooseTrigHists(std::vector<MonElemContainer<T>*>& monElems,const std::vector<std::string>& tightLooseTrigs,const BinData& bins,const std::string& objName)
template<class T> void initTightLooseTrigHists(DQMStore::IBooker &iBooker,std::vector<MonElemContainer<T>*>& monElems,const std::vector<std::string>& tightLooseTrigs,const BinData& bins,const std::string& objName)
{
for(size_t trigNr=0;trigNr<tightLooseTrigs.size();trigNr++){
//dbe_->SetCurrentFolder(dirName_+"/"+tightLooseTrigs[trigNr]);
Expand All @@ -117,8 +117,8 @@ namespace egHLT {
//this step is necessary as we want to transfer ownership of eleCut to the addTrigLooseTrigHist func on the last iteration
//but clone it before that
//perhaps my object ownership rules need to be re-evalulated
if(trigNr!=tightLooseTrigs.size()-2) addTightLooseTrigHist(monElems,tightTrig,looseTrig,objName,bins);
else addTightLooseTrigHist(monElems,tightTrig,looseTrig,objName,bins);
if(trigNr!=tightLooseTrigs.size()-2) addTightLooseTrigHist(iBooker,monElems,tightTrig,looseTrig,objName,bins);
else addTightLooseTrigHist(iBooker,monElems,tightTrig,looseTrig,objName,bins);
}
//dbe_->SetCurrentFolder(dirName_);
}
Expand Down
22 changes: 10 additions & 12 deletions DQMOffline/Trigger/interface/EgHLTMonElemManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ namespace egHLT {
MonElemManagerHist(const MonElemManagerHist& rhs){}
MonElemManagerHist& operator=(const MonElemManagerHist& rhs){return *this;}
public:
MonElemManagerHist(std::string name,std::string title,int nrBins,double xMin,double xMax);
MonElemManagerHist(std::string name,std::string title,int nrBinsX,double xMin,double xMax,int nrBinsY,double yMin,double yMax);
MonElemManagerHist(DQMStore::IBooker &iBooker, std::string name,std::string title,int nrBins,double xMin,double xMax);
MonElemManagerHist(DQMStore::IBooker &iBooker, std::string name,std::string title,int nrBinsX,double xMin,double xMax,int nrBinsY,double yMin,double yMax);
virtual ~MonElemManagerHist();

MonitorElement* monElem(){return monElem_;}
Expand All @@ -63,20 +63,18 @@ namespace egHLT {

};

template <class T> MonElemManagerHist<T>::MonElemManagerHist(std::string name,std::string title,int nrBins,double xMin,double xMax):
template <class T> MonElemManagerHist<T>::MonElemManagerHist(DQMStore::IBooker &iBooker, std::string name,std::string title,int nrBins,double xMin,double xMax):
monElem_(NULL)
{
DQMStore* dbe = edm::Service<DQMStore>().operator->();
monElem_ =dbe->book1D(name,title,nrBins,xMin,xMax);
monElem_ = iBooker.book1D(name,title,nrBins,xMin,xMax);
}

template <class T> MonElemManagerHist<T>::MonElemManagerHist(std::string name,std::string title,
template <class T> MonElemManagerHist<T>::MonElemManagerHist(DQMStore::IBooker &iBooker, std::string name,std::string title,
int nrBinsX,double xMin,double xMax,
int nrBinsY,double yMin,double yMax):
monElem_(NULL)
{
DQMStore* dbe = edm::Service<DQMStore>().operator->();
monElem_ =dbe->book2D(name,title,nrBinsX,xMin,xMax,nrBinsY,yMin,yMax);
monElem_ = iBooker.book2D(name,title,nrBinsX,xMin,xMax,nrBinsY,yMin,yMax);
}


Expand All @@ -98,9 +96,9 @@ namespace egHLT {
MonElemManager& operator=(const MonElemManager& rhs){return *this;}

public:
MonElemManager(std::string name,std::string title,int nrBins,double xMin,double xMax,
MonElemManager(DQMStore::IBooker &iBooker, std::string name,std::string title,int nrBins,double xMin,double xMax,
varType (T::*varFunc)()const):
MonElemManagerHist<T>(name,title,nrBins,xMin,xMax),
MonElemManagerHist<T>(iBooker, name,title,nrBins,xMin,xMax),
varFunc_(varFunc){}
~MonElemManager();

Expand Down Expand Up @@ -134,9 +132,9 @@ namespace egHLT {
MonElemManager2D& operator=(const MonElemManager2D& rhs){return *this;}

public:
MonElemManager2D(std::string name,std::string title,int nrBinsX,double xMin,double xMax,int nrBinsY,double yMin,double yMax,
MonElemManager2D(DQMStore::IBooker &iBooker, std::string name,std::string title,int nrBinsX,double xMin,double xMax,int nrBinsY,double yMin,double yMax,
varTypeX (T::*varFuncX)()const,varTypeY (T::*varFuncY)()const):
MonElemManagerHist<T>(name,title,nrBinsX,xMin,xMax,nrBinsY,yMin,yMax),
MonElemManagerHist<T>(iBooker, name,title,nrBinsX,xMin,xMax,nrBinsY,yMin,yMax),
varFuncX_(varFuncX),varFuncY_(varFuncY){}
~MonElemManager2D();

Expand Down
12 changes: 6 additions & 6 deletions DQMOffline/Trigger/interface/EgHLTMonElemMgrEBEE.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ namespace egHLT {
MonElemManager<T,varType> endcap_;

public:
MonElemMgrEBEE(const std::string& name,const std::string& title,int nrBins,float min,float max,varType (T::*varFunc)()const):
barrel_(name+"_eb","Barrel "+title,nrBins,min,max,varFunc),
endcap_(name+"_ee","Endcap "+title,nrBins,min,max,varFunc){}
MonElemMgrEBEE(DQMStore::IBooker &iBooker, const std::string& name,const std::string& title,int nrBins,float min,float max,varType (T::*varFunc)()const):
barrel_(iBooker, name+"_eb","Barrel "+title,nrBins,min,max,varFunc),
endcap_(iBooker, name+"_ee","Endcap "+title,nrBins,min,max,varFunc){}

~MonElemMgrEBEE(){}

Expand All @@ -52,10 +52,10 @@ namespace egHLT {
MonElemManager2D<T,varTypeX,varTypeY> endcap_;

public:
MonElemMgr2DEBEE(const std::string& name,const std::string& title,int nrBinsX,double xMin,double xMax,int nrBinsY,double yMin,double yMax,
MonElemMgr2DEBEE(DQMStore::IBooker &iBooker, const std::string& name,const std::string& title,int nrBinsX,double xMin,double xMax,int nrBinsY,double yMin,double yMax,
varTypeX (T::*varFuncX)()const,varTypeY (T::*varFuncY)()const):
barrel_(name+"_eb","Barrel "+title,nrBinsX,xMin,xMax,nrBinsY,yMin,yMax,varFuncX,varFuncY),
endcap_(name+"_ee","Endcap "+title,nrBinsX,xMin,xMax,nrBinsY,yMin,yMax,varFuncX,varFuncY){}
barrel_(iBooker, name+"_eb","Barrel "+title,nrBinsX,xMin,xMax,nrBinsY,yMin,yMax,varFuncX,varFuncY),
endcap_(iBooker, name+"_ee","Endcap "+title,nrBinsX,xMin,xMax,nrBinsY,yMin,yMax,varFuncX,varFuncY){}

~MonElemMgr2DEBEE(){}

Expand Down
8 changes: 4 additions & 4 deletions DQMOffline/Trigger/interface/EgHLTMonElemWithCut.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ namespace egHLT {
MonElemWithCut& operator=(const MonElemWithCut& rhs){return *this;}
public:

MonElemWithCut(const std::string& name,const std::string& title,int nrBins,double xMin,double xMax,
MonElemWithCut(DQMStore::IBooker &iBooker,const std::string& name,const std::string& title,int nrBins,double xMin,double xMax,
varTypeX (T::*varFunc)()const,const EgHLTDQMCut<T>* cut=NULL):
monElemMgr_(new MonElemManager<T,varTypeX>(name,title,nrBins,xMin,xMax,varFunc)),
monElemMgr_(new MonElemManager<T,varTypeX>(iBooker,name,title,nrBins,xMin,xMax,varFunc)),
cut_(cut){}

MonElemWithCut(const std::string& name,const std::string& title,int nrBinsX,double xMin,double xMax,int nrBinsY,double yMin,double yMax,
MonElemWithCut(DQMStore::IBooker &iBooker,const std::string& name,const std::string& title,int nrBinsX,double xMin,double xMax,int nrBinsY,double yMin,double yMax,
varTypeX (T::*varFuncX)()const,varTypeY (T::*varFuncY)()const,const EgHLTDQMCut<T>* cut=NULL):
monElemMgr_(new MonElemManager2D<T,varTypeX,varTypeY>(name,title,nrBinsX,xMin,xMax,nrBinsY,yMin,yMax,varFuncX,varFuncY)),
monElemMgr_(new MonElemManager2D<T,varTypeX,varTypeY>(iBooker,name,title,nrBinsX,xMin,xMax,nrBinsY,yMin,yMax,varFuncX,varFuncY)),
cut_(cut){}
~MonElemWithCut();

Expand Down
Loading

0 comments on commit 9a889ec

Please sign in to comment.