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  class CutMasks;
27 
28  namespace MonElemFuncs {
29 
30 
31  void initStdEleHists(std::vector<MonElemManagerBase<OffEle>*>& histVec,const std::string& filterName,const std::string& baseName,const BinData& bins);
32  void initStdPhoHists(std::vector<MonElemManagerBase<OffPho>*>& histVec,const std::string& filterName,const std::string& baseName,const BinData& bins);
33  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);
34  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);
35  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);
36  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);
37 
38  //we own the passed in pointer
39  void initStdEleCutHists(std::vector<MonElemWithCutBase<OffEle>*>& histVec,const std::string& filterName,const std::string& baseName,const BinData& bins,EgHLTDQMCut<OffEle>* cut=NULL);
40  void initStdPhoCutHists(std::vector<MonElemWithCutBase<OffPho>*>& histVec,const std::string& filterName,const std::string& baseName,const BinData& bins,EgHLTDQMCut<OffPho>* cut=NULL);
41 
42 
43 
44 
45  void initTightLooseTrigHists(std::vector<MonElemContainer<OffEle>*>& eleMonElems,const std::vector<std::string>& tightLooseTrigs,const BinData& bins,EgHLTDQMCut<OffEle>* eleCut);
46  void initTightLooseTrigHists(std::vector<MonElemContainer<OffPho>*>& phoMonElems,const std::vector<std::string>& tightLooseTrigs,const BinData& bins,EgHLTDQMCut<OffPho>* phoCut);
47 
48  void initTightLooseTrigHistsTrigCuts(std::vector<MonElemContainer<OffEle>*>& eleMonElems,const std::vector<std::string>& tightLooseTrigs,const BinData& bins);
49  void initTightLooseTrigHistsTrigCuts(std::vector<MonElemContainer<OffPho>*>& phoMonElems,const std::vector<std::string>& tightLooseTrigs,const BinData& bins);
50 
51  void addTightLooseTrigHist(std::vector<MonElemContainer<OffEle>*>& eleMonElems,
52  const std::string& tightTrig,const std::string& looseTrig,
53  EgHLTDQMCut<OffEle>* eleCut,const std::string& histId,const BinData& bins);
54 
55 
56  void addTightLooseTrigHist(std::vector<MonElemContainer<OffPho>*>& phoMonElems,
57  const std::string& tightTrig,const std::string& looseTrig,
58  EgHLTDQMCut<OffPho>* phoCut,const std::string& histId,const BinData& bins);
59 
60 
61 
62  void initTightLooseDiObjTrigHistsTrigCuts(std::vector<MonElemContainer<OffEle>*>& eleMonElems,const std::vector<std::string>& tightLooseTrigs,const BinData& bins);
63  void initTightLooseDiObjTrigHistsTrigCuts(std::vector<MonElemContainer<OffPho>*>& phoMonElems,const std::vector<std::string>& tightLooseTrigs,const BinData& bins);
64 
65  //ele only (Now for pho also!)
66  void initTrigTagProbeHists(std::vector<MonElemContainer<OffEle>*>& eleMonElems,const std::vector<std::string> filterNames,int cutMask,const BinData& bins);
67  void initTrigTagProbeHists(std::vector<MonElemContainer<OffPho>*>& phoMonElems,const std::vector<std::string> filterNames,int cutMask,const BinData& bins);
68  void initTrigTagProbeHist(std::vector<MonElemContainer<OffEle>*>& eleMonElems,const std::string filterName,int cutMask,const BinData& bins);
69  void initTrigTagProbeHist(std::vector<MonElemContainer<OffPho>*>& phoMonElems,const std::string filterName,int cutMask,const BinData& bins);
70  void initTrigTagProbeHist_2Leg(std::vector<MonElemContainer<OffEle>*>& eleMonElems,const std::string filterName,int cutMask,const BinData& bins);
71 
72 
73  template<class T,typename varType> void addStdHist(std::vector<MonElemManagerBase<T>*>& histVec,const std::string& name,const std::string& title,
74  const BinData::Data1D& binData,varType (T::*varFunc)()const){
75  histVec.push_back(new MonElemMgrEBEE<T,varType>(name,title,binData.nr,binData.min,binData.max,varFunc));
76  }
77 
78  //this function is special in that it figures out the Et cut from the trigger name
79  //it then passes the cut as normal into the other addTightLooseTrigHist functions
80  //it also makes an uncut et distribution
81  template<class T> void addTightLooseTrigHist(std::vector<MonElemContainer<T>*>& monElems,
82  const std::string& tightTrig,const std::string& looseTrig,
83  const std::string& histId,const BinData& bins)
84  {
85 
86  float etCutValue = trigTools::getEtThresFromName(tightTrig);
87 
88  EgHLTDQMCut<T>* etCut = new EgGreaterCut<T,float>(etCutValue,&T::etSC); //note the cut in trigger is on SC Et
89  addTightLooseTrigHist(monElems,tightTrig,looseTrig,etCut,histId,bins);
90 
91  //now make the new mon elems without the et cut (have to be placed in containers even though each container just has one monelem)
92  MonElemContainer<T>* passEtMonElem;
93  passEtMonElem = new MonElemContainer<T>(tightTrig+"_"+looseTrig+"_"+histId+"_passTrig","",
94  new EgObjTrigCut<T>(TrigCodes::getCode(tightTrig+":"+looseTrig),EgObjTrigCut<T>::AND));
95  addStdHist<T,float>(passEtMonElem->monElems(),passEtMonElem->name()+"_etUnCut",passEtMonElem->name()+" E_{T} (Uncut);E_{T} (GeV)",bins.et,&T::et);
96 
97  MonElemContainer<T>* failEtMonElem;
98  failEtMonElem = new MonElemContainer<T>(tightTrig+"_"+looseTrig+"_"+histId+"_failTrig","",
100  addStdHist<T,float>(failEtMonElem->monElems(),failEtMonElem->name()+"_etUnCut",failEtMonElem->name()+" E_{T} (Uncut);E_{T} (GeV)",bins.et,&T::et);
101 
102  monElems.push_back(passEtMonElem);
103  monElems.push_back(failEtMonElem);
104  }
105 
106 
107  //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
108  template<class T> void initTightLooseTrigHists(std::vector<MonElemContainer<T>*>& monElems,const std::vector<std::string>& tightLooseTrigs,const BinData& bins,const std::string& objName)
109  {
110  for(size_t trigNr=0;trigNr<tightLooseTrigs.size();trigNr++){
111  //dbe_->SetCurrentFolder(dirName_+"/"+tightLooseTrigs[trigNr]);
112  std::vector<std::string> splitString;
113  boost::split(splitString,tightLooseTrigs[trigNr],boost::is_any_of(std::string(":")));
114  if(splitString.size()!=2) continue; //format incorrect
115  const std::string& tightTrig = splitString[0];
116  const std::string& looseTrig = splitString[1];
117  //this step is necessary as we want to transfer ownership of eleCut to the addTrigLooseTrigHist func on the last iteration
118  //but clone it before that
119  //perhaps my object ownership rules need to be re-evalulated
120  if(trigNr!=tightLooseTrigs.size()-2) addTightLooseTrigHist(monElems,tightTrig,looseTrig,objName,bins);
121  else addTightLooseTrigHist(monElems,tightTrig,looseTrig,objName,bins);
122  }
123  //dbe_->SetCurrentFolder(dirName_);
124  }
125 
126 
127  }//end namespace
128 }
129 #endif
static TrigBitSet getCode(const std::string &descript)
const std::string & name() const
void initTightLooseTrigHists(std::vector< MonElemContainer< OffEle > * > &eleMonElems, const std::vector< std::string > &tightLooseTrigs, const BinData &bins, EgHLTDQMCut< OffEle > *eleCut)
#define NULL
Definition: scimark2.h:8
void initStdEleCutHists(std::vector< MonElemWithCutBase< OffEle > * > &histVec, const std::string &filterName, const std::string &baseName, const BinData &bins, EgHLTDQMCut< OffEle > *cut=NULL)
void initTightLooseDiObjTrigHistsTrigCuts(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)
std::vector< std::string > splitString(const std::string &fLine)
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 initStdPhoCutHists(std::vector< MonElemWithCutBase< OffPho > * > &histVec, const std::string &filterName, const std::string &baseName, const BinData &bins, EgHLTDQMCut< OffPho > *cut=NULL)
void addStdHist(std::vector< MonElemManagerBase< T > * > &histVec, const std::string &name, const std::string &title, const BinData::Data1D &binData, varType(T::*varFunc)() const)
void initTrigTagProbeHists(std::vector< MonElemContainer< OffEle > * > &eleMonElems, const std::vector< std::string > filterNames, int cutMask, const BinData &bins)
float getEtThresFromName(const std::string &trigName)
void initTrigTagProbeHist_2Leg(std::vector< MonElemContainer< OffEle > * > &eleMonElems, const std::string filterName, int cutMask, const BinData &bins)
std::vector< MonElemManagerBase< T > * > & monElems()
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)
void initTrigTagProbeHist(std::vector< MonElemContainer< OffEle > * > &eleMonElems, const std::string filterName, int cutMask, const BinData &bins)
void initStdPhoHists(std::vector< MonElemManagerBase< OffPho > * > &histVec, const std::string &filterName, const std::string &baseName, const BinData &bins)
long double T
double split
Definition: MVATrainer.cc:139
void initTightLooseTrigHistsTrigCuts(std::vector< MonElemContainer< OffEle > * > &eleMonElems, const std::vector< std::string > &tightLooseTrigs, const BinData &bins)
static const uint32_t masks[]
Definition: CaloRecHit.cc:12