test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EgHLTMonElemFuncs.h
Go to the documentation of this file.
1 #ifndef DQMOFFLINE_TRIGGER_EGHLTMONELEMFUNCS
2 #define DQMOFFLINE_TRIGGER_EGHLTMONELEMFUNCS
3 
4 
5 //Author: Sam Harper
6 
7 //Description: A collection of functions which assist and automate the creation
8 // of useful monitor elements for Eg DQM
9 //
10 
21 
22 #include <boost/algorithm/string.hpp>
23 
24 namespace egHLT {
25 
26  struct CutMasks;
27 
28  class MonElemFuncs {
29  private:
32 
33  public:
37 
38  public:
39 
40  void initStdEleHists(std::vector<MonElemManagerBase<OffEle>*>& histVec,const std::string& filterName,const std::string& baseName,const BinData& bins);
41  void initStdPhoHists(std::vector<MonElemManagerBase<OffPho>*>& histVec,const std::string& filterName,const std::string& baseName,const BinData& bins);
42  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);
43  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);
44  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);
45  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);
46 
47  //we own the passed in pointer
48  void initStdEleCutHists(std::vector<MonElemWithCutBase<OffEle>*>& histVec,const std::string& filterName,const std::string& baseName,const BinData& bins,EgHLTDQMCut<OffEle>* cut=NULL);
49  void initStdPhoCutHists(std::vector<MonElemWithCutBase<OffPho>*>& histVec,const std::string& filterName,const std::string& baseName,const BinData& bins,EgHLTDQMCut<OffPho>* cut=NULL);
50 
51 
52 
53 
54  void initTightLooseTrigHists( std::vector<MonElemContainer<OffEle>*>& eleMonElems,const std::vector<std::string>& tightLooseTrigs,const BinData& bins,EgHLTDQMCut<OffEle>* eleCut);
55  void initTightLooseTrigHists( std::vector<MonElemContainer<OffPho>*>& phoMonElems,const std::vector<std::string>& tightLooseTrigs,const BinData& bins,EgHLTDQMCut<OffPho>* phoCut);
56 
57  void initTightLooseTrigHistsTrigCuts( std::vector<MonElemContainer<OffEle>*>& eleMonElems,const std::vector<std::string>& tightLooseTrigs,const BinData& bins);
58  void initTightLooseTrigHistsTrigCuts( std::vector<MonElemContainer<OffPho>*>& phoMonElems,const std::vector<std::string>& tightLooseTrigs,const BinData& bins);
59 
60  void addTightLooseTrigHist( std::vector<MonElemContainer<OffEle>*>& eleMonElems,
61  const std::string& tightTrig,const std::string& looseTrig,
62  EgHLTDQMCut<OffEle>* eleCut,const std::string& histId,const BinData& bins);
63 
64 
65  void addTightLooseTrigHist( std::vector<MonElemContainer<OffPho>*>& phoMonElems,
66  const std::string& tightTrig,const std::string& looseTrig,
67  EgHLTDQMCut<OffPho>* phoCut,const std::string& histId,const BinData& bins);
68 
69 
70 
71  void initTightLooseDiObjTrigHistsTrigCuts( std::vector<MonElemContainer<OffEle>*>& eleMonElems,const std::vector<std::string>& tightLooseTrigs,const BinData& bins);
72  void initTightLooseDiObjTrigHistsTrigCuts( std::vector<MonElemContainer<OffPho>*>& phoMonElems,const std::vector<std::string>& tightLooseTrigs,const BinData& bins);
73 
74  //ele only (Now for pho also!)
75  void initTrigTagProbeHists(std::vector<MonElemContainer<OffEle>*>& eleMonElems,const std::vector<std::string> filterNames,int cutMask,const BinData& bins);
76  void initTrigTagProbeHists(std::vector<MonElemContainer<OffPho>*>& phoMonElems,const std::vector<std::string> filterNames,int cutMask,const BinData& bins);
77  void initTrigTagProbeHist(std::vector<MonElemContainer<OffEle>*>& eleMonElems,const std::string filterName,int cutMask,const BinData& bins);
78  void initTrigTagProbeHist(std::vector<MonElemContainer<OffPho>*>& phoMonElems,const std::string filterName,int cutMask,const BinData& bins);
79  void initTrigTagProbeHist_2Leg(std::vector<MonElemContainer<OffEle>*>& eleMonElems,const std::string filterName,int cutMask,const BinData& bins);
80 
81 
82  template<class T,typename varType> void addStdHist( std::vector<MonElemManagerBase<T>*>& histVec,const std::string& name,const std::string& title,
83  const BinData::Data1D& binData,varType (T::*varFunc)()const){
84  histVec.push_back(new MonElemMgrEBEE<T,varType>(iBooker, name,title,binData.nr,binData.min,binData.max,varFunc));
85  }
86 
87  //this function is special in that it figures out the Et cut from the trigger name
88  //it then passes the cut as normal into the other addTightLooseTrigHist functions
89  //it also makes an uncut et distribution
90  template<class T> void addTightLooseTrigHist( std::vector<MonElemContainer<T>*>& monElems,
91  const std::string& tightTrig,const std::string& looseTrig,
92  const std::string& histId,const BinData& bins)
93  {
94 
95  float etCutValue = trigTools::getEtThresFromName(tightTrig);
96 
97  EgHLTDQMCut<T>* etCut = new EgGreaterCut<T,float>(etCutValue,&T::etSC); //note the cut in trigger is on SC Et
98  addTightLooseTrigHist(monElems,tightTrig,looseTrig,etCut,histId,bins);
99 
100  //now make the new mon elems without the et cut (have to be placed in containers even though each container just has one monelem)
101  MonElemContainer<T>* passEtMonElem;
102  passEtMonElem = new MonElemContainer<T>(tightTrig+"_"+looseTrig+"_"+histId+"_passTrig","",
103  new EgObjTrigCut<T>(trigCodes.getCode(tightTrig+":"+looseTrig),EgObjTrigCut<T>::AND));
104  addStdHist<T,float>(passEtMonElem->monElems(),passEtMonElem->name()+"_etUnCut",passEtMonElem->name()+" E_{T} (Uncut);E_{T} (GeV)",bins.et,&T::et);
105 
106  MonElemContainer<T>* failEtMonElem;
107  failEtMonElem = new MonElemContainer<T>(tightTrig+"_"+looseTrig+"_"+histId+"_failTrig","",
109  addStdHist<T,float>(failEtMonElem->monElems(),failEtMonElem->name()+"_etUnCut",failEtMonElem->name()+" E_{T} (Uncut);E_{T} (GeV)",bins.et,&T::et);
110 
111  monElems.push_back(passEtMonElem);
112  monElems.push_back(failEtMonElem);
113  }
114 
115 
116  //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
117  template<class T> void initTightLooseTrigHists(std::vector<MonElemContainer<T>*>& monElems,const std::vector<std::string>& tightLooseTrigs,const BinData& bins,const std::string& objName)
118  {
119  for(size_t trigNr=0;trigNr<tightLooseTrigs.size();trigNr++){
120  //dbe_->SetCurrentFolder(dirName_+"/"+tightLooseTrigs[trigNr]);
121  std::vector<std::string> splitString;
122  boost::split(splitString,tightLooseTrigs[trigNr],boost::is_any_of(std::string(":")));
123  if(splitString.size()!=2) continue; //format incorrect
124  const std::string& tightTrig = splitString[0];
125  const std::string& looseTrig = splitString[1];
126  //this step is necessary as we want to transfer ownership of eleCut to the addTrigLooseTrigHist func on the last iteration
127  //but clone it before that
128  //perhaps my object ownership rules need to be re-evalulated
129  if(trigNr!=tightLooseTrigs.size()-2) addTightLooseTrigHist(monElems,tightTrig,looseTrig,objName,bins);
130  else addTightLooseTrigHist(monElems,tightTrig,looseTrig,objName,bins);
131  }
132  //dbe_->SetCurrentFolder(dirName_);
133  }
134 
135 
136  }; // end of class
137 }
138 #endif
int i
Definition: DBlmapReader.cc:9
void initTightLooseTrigHistsTrigCuts(std::vector< MonElemContainer< OffEle > * > &eleMonElems, const std::vector< std::string > &tightLooseTrigs, const BinData &bins)
void initStdEleHists(std::vector< MonElemManagerBase< OffEle > * > &histVec, const std::string &filterName, const std::string &baseName, const BinData &bins)
void initStdEleCutHists(std::vector< MonElemWithCutBase< OffEle > * > &histVec, const std::string &filterName, const std::string &baseName, const BinData &bins, EgHLTDQMCut< OffEle > *cut=NULL)
const TrigCodes & trigCodes
void initTrigTagProbeHists(std::vector< MonElemContainer< OffEle > * > &eleMonElems, const std::vector< std::string > filterNames, int cutMask, const BinData &bins)
void initStdPhoHists(std::vector< MonElemManagerBase< OffPho > * > &histVec, const std::string &filterName, const std::string &baseName, const BinData &bins)
TrigBitSet getCode(const char *descript) const
const std::string & name() const
#define NULL
Definition: scimark2.h:8
void initTrigTagProbeHist_2Leg(std::vector< MonElemContainer< OffEle > * > &eleMonElems, const std::string filterName, int cutMask, const BinData &bins)
MonElemFuncs(DQMStore::IBooker &i, const TrigCodes &c)
void initTightLooseDiObjTrigHistsTrigCuts(std::vector< MonElemContainer< OffEle > * > &eleMonElems, const std::vector< std::string > &tightLooseTrigs, const BinData &bins)
std::vector< std::string > splitString(const std::string &fLine)
void addTightLooseTrigHist(std::vector< MonElemContainer< T > * > &monElems, const std::string &tightTrig, const std::string &looseTrig, const std::string &histId, const BinData &bins)
void addStdHist(std::vector< MonElemManagerBase< T > * > &histVec, const std::string &name, const std::string &title, const BinData::Data1D &binData, varType(T::*varFunc)() const)
void initStdPhoCutHists(std::vector< MonElemWithCutBase< OffPho > * > &histVec, const std::string &filterName, const std::string &baseName, const BinData &bins, EgHLTDQMCut< OffPho > *cut=NULL)
float getEtThresFromName(const std::string &trigName)
void initTightLooseTrigHists(std::vector< MonElemContainer< OffEle > * > &eleMonElems, const std::vector< std::string > &tightLooseTrigs, const BinData &bins, EgHLTDQMCut< OffEle > *eleCut)
void initTrigTagProbeHist(std::vector< MonElemContainer< OffEle > * > &eleMonElems, const std::string filterName, int cutMask, const BinData &bins)
DQMStore::IBooker & iBooker
constexpr uint32_t masks[]
Definition: CaloRecHit.cc:12
std::vector< MonElemManagerBase< T > * > & monElems()
DQMStore::IBooker & getIB()
void addTightLooseTrigHist(std::vector< MonElemContainer< OffEle > * > &eleMonElems, const std::string &tightTrig, const std::string &looseTrig, EgHLTDQMCut< OffEle > *eleCut, const std::string &histId, const BinData &bins)
long double T
void initTightLooseTrigHists(std::vector< MonElemContainer< T > * > &monElems, const std::vector< std::string > &tightLooseTrigs, const BinData &bins, const std::string &objName)
double split
Definition: MVATrainer.cc:139
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)