CMS 3D CMS Logo

EgHLTMonElemFuncs.h
Go to the documentation of this file.
1 #ifndef DQMOFFLINE_TRIGGER_EGHLTMONELEMFUNCS
2 #define DQMOFFLINE_TRIGGER_EGHLTMONELEMFUNCS
3 
4 //Author: Sam Harper
5 
6 //Description: A collection of functions which assist and automate the creation
7 // of useful monitor elements for Eg DQM
8 //
9 
21 
22 #include <boost/algorithm/string.hpp>
23 
24 namespace egHLT {
27 
28  struct CutMasks;
29 
30  class MonElemFuncs {
31  private:
34 
35  public:
37  ~MonElemFuncs() = default;
38  ;
40 
41  public:
43  const std::string& filterName,
44  const std::string& baseName,
45  const BinData& bins);
47  const std::string& filterName,
48  const std::string& baseName,
49  const BinData& bins);
51  const std::string& filterName,
52  const std::string& baseName,
53  int nrBins,
54  double xMin,
55  double xMax,
56  float (OffEle::*vsVarFunc)() const,
57  const CutMasks& masks);
59  const std::string& filterName,
60  const std::string& baseName,
61  const BinData::Data1D& bins,
62  float (OffEle::*vsVarFunc)() const,
63  const CutMasks& masks);
65  const std::string& filterName,
66  const std::string& baseName,
67  int nrBins,
68  double xMin,
69  double xMax,
70  float (OffPho::*vsVarFunc)() const,
71  const CutMasks& masks);
73  const std::string& filterName,
74  const std::string& baseName,
75  const BinData::Data1D& bins,
76  float (OffPho::*vsVarFunc)() const,
77  const CutMasks& masks);
78 
79  //for hep region plots
81  const std::string& filterName,
82  const std::string& baseName,
83  const BinData& bins);
85  const std::string& filterName,
86  const std::string& baseName,
87  const BinData& bins);
88  //we own the passed in pointer
90  const std::string& filterName,
91  const std::string& baseName,
92  const BinData& bins,
93  EgHLTDQMCut<OffEle>* cut = nullptr);
95  const std::string& filterName,
96  const std::string& baseName,
97  const BinData& bins,
98  EgHLTDQMCut<OffPho>* cut = nullptr);
99 
101  const std::vector<std::string>& tightLooseTrigs,
102  const BinData& bins,
103  EgHLTDQMCut<OffEle>* eleCut);
105  const std::vector<std::string>& tightLooseTrigs,
106  const BinData& bins,
107  EgHLTDQMCut<OffPho>* phoCut);
108 
110  const std::vector<std::string>& tightLooseTrigs,
111  const BinData& bins);
113  const std::vector<std::string>& tightLooseTrigs,
114  const BinData& bins);
115 
117  const std::string& tightTrig,
118  const std::string& looseTrig,
119  EgHLTDQMCut<OffEle>* eleCut,
120  const std::string& histId,
121  const BinData& bins);
122 
124  const std::string& tightTrig,
125  const std::string& looseTrig,
126  EgHLTDQMCut<OffPho>* phoCut,
127  const std::string& histId,
128  const BinData& bins);
129 
131  const std::vector<std::string>& tightLooseTrigs,
132  const BinData& bins);
134  const std::vector<std::string>& tightLooseTrigs,
135  const BinData& bins);
136 
137  //ele only (Now for pho also!)
139  const std::vector<std::string>& filterNames,
140  int cutMask,
141  const BinData& bins);
143  const std::vector<std::string>& filterNames,
144  int cutMask,
145  const BinData& bins);
147  const std::string& filterName,
148  int cutMask,
149  const BinData& bins);
151  const std::string& filterName,
152  int cutMask,
153  const BinData& bins);
155  const std::string& filterName,
156  int cutMask,
157  const BinData& bins);
158 
159  template <class T, typename varType>
161  const std::string& name,
162  const std::string& title,
163  const BinData::Data1D& binData,
164  varType (T::*varFunc)() const) {
165  histVec.push_back(
166  new MonElemMgrEBEE<T, varType>(iBooker, name, title, binData.nr, binData.min, binData.max, varFunc));
167  }
168 
169  template <class T, typename varType>
171  const std::string& name,
172  const std::string& title,
173  const BinData::Data1D& binData,
174  varType (T::*varFunc)() const) {
175  histVec.push_back(
176  new MonElemMgrHEP<T, varType>(iBooker, name, title, binData.nr, binData.min, binData.max, varFunc));
177  }
178  //this function is special in that it figures out the Et cut from the trigger name
179  //it then passes the cut as normal into the other addTightLooseTrigHist functions
180  //it also makes an uncut et distribution
181  template <class T>
183  const std::string& tightTrig,
184  const std::string& looseTrig,
185  const std::string& histId,
186  const BinData& bins) {
187  float etCutValue = trigTools::getEtThresFromName(tightTrig);
188 
189  EgHLTDQMCut<T>* etCut = new EgGreaterCut<T, float>(etCutValue, &T::etSC); //note the cut in trigger is on SC Et
190  addTightLooseTrigHist(monElems, tightTrig, looseTrig, etCut, histId, bins);
191 
192  //now make the new mon elems without the et cut (have to be placed in containers even though each container just has one monelem)
193  MonElemContainer<T>* passEtMonElem;
194  passEtMonElem = new MonElemContainer<T>(
195  tightTrig + "_" + looseTrig + "_" + histId + "_passTrig",
196  "",
197  new EgObjTrigCut<T>(trigCodes.getCode(tightTrig + ":" + looseTrig), EgObjTrigCut<T>::AND));
198  addStdHist<T, float>(passEtMonElem->monElems(),
199  passEtMonElem->name() + "_etUnCut",
200  passEtMonElem->name() + " E_{T} (Uncut);E_{T} (GeV)",
201  bins.et,
202  &T::et);
203 
204  MonElemContainer<T>* failEtMonElem;
205  failEtMonElem = new MonElemContainer<T>(
206  tightTrig + "_" + looseTrig + "_" + histId + "_failTrig",
207  "",
209  addStdHist<T, float>(failEtMonElem->monElems(),
210  failEtMonElem->name() + "_etUnCut",
211  failEtMonElem->name() + " E_{T} (Uncut);E_{T} (GeV)",
212  bins.et,
213  &T::et);
214 
215  monElems.push_back(passEtMonElem);
216  monElems.push_back(failEtMonElem);
217  }
218 
219  //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
220  template <class T>
222  const std::vector<std::string>& tightLooseTrigs,
223  const BinData& bins,
224  const std::string& objName) {
225  for (size_t trigNr = 0; trigNr < tightLooseTrigs.size(); trigNr++) {
226  //dbe_->SetCurrentFolder(dirName_+"/"+tightLooseTrigs[trigNr]);
227  std::vector<std::string> splitString;
228  boost::split(splitString, tightLooseTrigs[trigNr], boost::is_any_of(std::string(":")));
229  if (splitString.size() != 2)
230  continue; //format incorrect
231  const std::string& tightTrig = splitString[0];
232  const std::string& looseTrig = splitString[1];
233  //this step is necessary as we want to transfer ownership of eleCut to the addTrigLooseTrigHist func on the last iteration
234  //but clone it before that
235  //perhaps my object ownership rules need to be re-evalulated
236  if (trigNr != tightLooseTrigs.size() - 2)
237  addTightLooseTrigHist(monElems, tightTrig, looseTrig, objName, bins);
238  else
239  addTightLooseTrigHist(monElems, tightTrig, looseTrig, objName, bins);
240  }
241  //dbe_->SetCurrentFolder(dirName_);
242  }
243 
244  }; // end of class
245 } // namespace egHLT
246 #endif
egHLT::MonElemFuncs::iBooker
DQMStore::IBooker & iBooker
Definition: EgHLTMonElemFuncs.h:32
egHLT::MonElemFuncs::MonElemFuncs
MonElemFuncs(DQMStore::IBooker &i, const TrigCodes &c)
Definition: EgHLTMonElemFuncs.h:36
EgHLTMonElemWithCut.h
runGCPTkAlMap.title
string title
Definition: runGCPTkAlMap.py:94
egHLT::MonElemFuncs::initTrigTagProbeHist_2Leg
void initTrigTagProbeHist_2Leg(std::vector< MonElemContainer< OffEle > * > &eleMonElems, const std::string &filterName, int cutMask, const BinData &bins)
Definition: EgHLTMonElemFuncs.cc:1055
mps_fire.i
i
Definition: mps_fire.py:428
egHLT::MonElemFuncs::initTrigTagProbeHist
void initTrigTagProbeHist(std::vector< MonElemContainer< OffEle > * > &eleMonElems, const std::string &filterName, int cutMask, const BinData &bins)
Definition: EgHLTMonElemFuncs.cc:983
egHLT::MonElemMgrEBEE
Definition: EgHLTMonElemMgrEBEE.h:25
TkAlMuonSelectors_cfi.cut
cut
Definition: TkAlMuonSelectors_cfi.py:5
egHLT::MonElemMgrHEP
Definition: EgHLTMonElemMgrHEP.h:8
EgHLTOffPho.h
egHLT::MonElemFuncs::getIB
DQMStore::IBooker & getIB()
Definition: EgHLTMonElemFuncs.h:39
egHLT::MonElemFuncs::initTightLooseTrigHists
void initTightLooseTrigHists(std::vector< MonElemContainer< OffEle > * > &eleMonElems, const std::vector< std::string > &tightLooseTrigs, const BinData &bins, EgHLTDQMCut< OffEle > *eleCut)
Definition: EgHLTMonElemFuncs.cc:734
egHLT::TrigCodes
Definition: EgHLTTrigCodes.h:20
splitString
std::vector< std::string > splitString(const std::string &fLine)
Definition: HcalDbASCIIIO.cc:58
egHLT::MonElemFuncs::addStdHistHEP
void addStdHistHEP(std::vector< MonElemManagerBase< T > * > &histVec, const std::string &name, const std::string &title, const BinData::Data1D &binData, varType(T::*varFunc)() const)
Definition: EgHLTMonElemFuncs.h:170
EgHLTMonElemContainer.h
egHLT::MonElemContainer::name
const std::string & name() const
Definition: EgHLTMonElemContainer.h:55
egHLT::MonElemFuncs::initTightLooseTrigHistsTrigCuts
void initTightLooseTrigHistsTrigCuts(std::vector< MonElemContainer< OffEle > * > &eleMonElems, const std::vector< std::string > &tightLooseTrigs, const BinData &bins)
Definition: EgHLTMonElemFuncs.cc:838
egHLT::OffEle
Definition: EgHLTOffEle.h:29
egHLT::MonElemFuncs::initStdPhoHistsHEP
void initStdPhoHistsHEP(std::vector< MonElemManagerBase< OffPho > * > &histVec, const std::string &filterName, const std::string &baseName, const BinData &bins)
Definition: EgHLTMonElemFuncs.cc:280
egHLT::MonElemFuncs::initTightLooseDiObjTrigHistsTrigCuts
void initTightLooseDiObjTrigHistsTrigCuts(std::vector< MonElemContainer< OffEle > * > &eleMonElems, const std::vector< std::string > &tightLooseTrigs, const BinData &bins)
Definition: EgHLTMonElemFuncs.cc:872
photonAnalyzer_cfi.xMin
xMin
Definition: photonAnalyzer_cfi.py:82
EgHLTOfflineSource_cfi.binData
binData
Definition: EgHLTOfflineSource_cfi.py:13
HLT_FULL_cff.etCut
etCut
Definition: HLT_FULL_cff.py:84569
egHLT::trigTools::getEtThresFromName
float getEtThresFromName(const std::string &trigName)
Definition: EgHLTTrigTools.cc:343
egHLT::OffPho
Definition: EgHLTOffPho.h:26
egHLT::EgHLTDQMCut< OffEle >
submitPVValidationJobs.split
def split(sequence, size)
Definition: submitPVValidationJobs.py:352
egHLT::MonElemManagerBase
Definition: EgHLTMonElemManager.h:33
egHLT::MonElemFuncs::~MonElemFuncs
~MonElemFuncs()=default
egHLT::MonElemFuncs::initStdEleCutHists
void initStdEleCutHists(std::vector< MonElemWithCutBase< OffEle > * > &histVec, const std::string &filterName, const std::string &baseName, const BinData &bins, EgHLTDQMCut< OffEle > *cut=nullptr)
Definition: EgHLTMonElemFuncs.cc:655
egHLT::MonElemFuncs::initStdPhoCutHists
void initStdPhoCutHists(std::vector< MonElemWithCutBase< OffPho > * > &histVec, const std::string &filterName, const std::string &baseName, const BinData &bins, EgHLTDQMCut< OffPho > *cut=nullptr)
Definition: EgHLTMonElemFuncs.cc:698
EgHLTMonElemWithCutEBEE.h
egHLT::MonElemFuncs::trigCodes
const TrigCodes & trigCodes
Definition: EgHLTMonElemFuncs.h:33
EgHLTOffEle.h
dumpRecoGeometry_cfg.varType
varType
Definition: dumpRecoGeometry_cfg.py:8
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
egHLT::MonElemFuncs::addStdHist
void addStdHist(std::vector< MonElemManagerBase< T > * > &histVec, const std::string &name, const std::string &title, const BinData::Data1D &binData, varType(T::*varFunc)() const)
Definition: EgHLTMonElemFuncs.h:160
egHLT::MonElemFuncs
Definition: EgHLTMonElemFuncs.h:30
egHLT::TrigCodes::getCode
TrigBitSet getCode(const char *descript) const
Definition: EgHLTTrigCodes.cc:42
egHLT::MonElemFuncs::initTightLooseTrigHists
void initTightLooseTrigHists(std::vector< MonElemContainer< T > * > &monElems, const std::vector< std::string > &tightLooseTrigs, const BinData &bins, const std::string &objName)
Definition: EgHLTMonElemFuncs.h:221
EgHLTMonElemMgrEBEE.h
egHLT::BinData::Data1D
Definition: EgHLTBinData.h:13
egHLT::EgObjTrigCut
Definition: EgHLTDQMCut.h:173
egHLT::MonElemFuncs::initStdPhoHists
void initStdPhoHists(std::vector< MonElemManagerBase< OffPho > * > &histVec, const std::string &filterName, const std::string &baseName, const BinData &bins)
Definition: EgHLTMonElemFuncs.cc:107
egHLT::MonElemContainer::monElems
std::vector< MonElemManagerBase< T > * > & monElems()
Definition: EgHLTMonElemContainer.h:52
egHLT::EgGreaterCut
Definition: EgHLTDQMCut.h:98
egHLT::MonElemWithCutBase
Definition: EgHLTMonElemWithCut.h:24
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
EgHLTOffHistBins_cfi.et
et
Definition: EgHLTOffHistBins_cfi.py:8
egHLT::MonElemFuncs::initStdEleHistsHEP
void initStdEleHistsHEP(std::vector< MonElemManagerBase< OffEle > * > &histVec, const std::string &filterName, const std::string &baseName, const BinData &bins)
Definition: EgHLTMonElemFuncs.cc:194
egHLT::BinData
Definition: EgHLTBinData.h:12
egHLT::MonElemContainer
Definition: EgHLTMonElemContainer.h:28
egHLT::CutMasks
Definition: EgHLTCutMasks.h:12
pdwgDoubleElectron_cfi.filterName
filterName
Definition: pdwgDoubleElectron_cfi.py:7
EgHLTBinData.h
T
long double T
Definition: Basic3DVectorLD.h:48
phase2tkutil::DQMStore
dqm::reco::DQMStore DQMStore
Definition: TrackerPhase2DQMUtil.h:16
egHLT::MonElemFuncs::initStdEffHists
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)
Definition: EgHLTMonElemFuncs.cc:374
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
multiplicitycorr_cfi.xMax
xMax
Definition: multiplicitycorr_cfi.py:5
EgHLTDQMCut.h
MonitorElement
dqm::legacy::MonitorElement MonitorElement
Definition: SiPixelSCurveCalibrationAnalysis.h:55
dqm::implementation::IBooker
Definition: DQMStore.h:43
EgHLTTrigTools.h
egHLT::MonElemFuncs::addTightLooseTrigHist
void addTightLooseTrigHist(std::vector< MonElemContainer< T > * > &monElems, const std::string &tightTrig, const std::string &looseTrig, const std::string &histId, const BinData &bins)
Definition: EgHLTMonElemFuncs.h:182
trigObjTnPSource_cfi.bins
bins
Definition: trigObjTnPSource_cfi.py:20
EgHLTMonElemMgrHEP.h
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:46
egHLT
Definition: EgHLTBinData.h:10
electrons_cff.objName
objName
Definition: electrons_cff.py:519
egHLT::MonElemFuncs::initTrigTagProbeHists
void initTrigTagProbeHists(std::vector< MonElemContainer< OffEle > * > &eleMonElems, const std::vector< std::string > &filterNames, int cutMask, const BinData &bins)
Definition: EgHLTMonElemFuncs.cc:908
EgHLTMonElemManager.h
egHLT::MonElemFuncs::addTightLooseTrigHist
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)
Definition: EgHLTMonElemFuncs.cc:778
egHLT::MonElemFuncs::initStdEleHists
void initStdEleHists(std::vector< MonElemManagerBase< OffEle > * > &histVec, const std::string &filterName, const std::string &baseName, const BinData &bins)
Definition: EgHLTMonElemFuncs.cc:11