CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
HLTHiggsPlotter Class Reference

#include <HLTHiggsPlotter.h>

Public Types

typedef dqm::legacy::DQMStore DQMStore
 
typedef dqm::legacy::MonitorElement MonitorElement
 

Public Member Functions

void analyze (const bool &isPassTrigger, const std::string &source, const std::vector< MatchStruct > &matches, const unsigned int &minCandidates)
 
void analyze (const bool &isPassTrigger, const std::string &source, const std::vector< MatchStruct > &matches, std::map< std::string, bool > &nMinOne, const float &dEtaqq, const float &mqq, const float &dPhibb, const float &CSV1, const float &CSV2, const float &CSV3, const bool &passAllCuts)
 
void beginJob ()
 
void beginRun (const edm::Run &, const edm::EventSetup &)
 
void bookHistograms (DQMStore::IBooker &, const bool &)
 
const std::string gethltpath () const
 
 HLTHiggsPlotter (const edm::ParameterSet &pset, const std::string &hltPath, const std::vector< unsigned int > &objectsType, const unsigned int &minCandidates, const std::vector< double > &NminOneCuts)
 
 ~HLTHiggsPlotter ()
 

Private Member Functions

void bookHist (const std::string &source, const std::string &objType, const std::string &variable, DQMStore::IBooker &)
 
void fillHist (const bool &passTrigger, const std::string &source, const std::string &objType, const std::string &var, const float &value)
 

Private Attributes

std::map< unsigned int, double > _cutMaxEta
 
std::map< unsigned int, double > _cutMinPt
 
std::map< unsigned int,
unsigned int > 
_cutMotherId
 
std::map< unsigned int,
std::vector< double > > 
_cutsDr
 
std::map< std::string,
MonitorElement * > 
_elements
 
std::string _hltPath
 
std::string _hltProcessName
 
std::vector< double > _NminOneCuts
 
unsigned int _nObjects
 
unsigned int _NptPlots
 
std::set< unsigned int > _objectsType
 
std::vector< double > _parametersEta
 
std::vector< double > _parametersPhi
 
std::vector< double > _parametersTurnOn
 

Detailed Description

Generate histograms for trigger efficiencies Higgs related Documentation available on the CMS TWiki: https://twiki.cern.ch/twiki/bin/view/CMS/HiggsWGHLTValidate

Author
J. Duarte Campderros (based and adapted on J. Klukas, M. Vander Donckt and J. Alcaraz code from the HLTriggerOffline/Muon package)
J. Klukas, M. Vander Donckt, J. Alcaraz

Definition at line 46 of file HLTHiggsPlotter.h.

Member Typedef Documentation

Definition at line 48 of file HLTHiggsPlotter.h.

Definition at line 49 of file HLTHiggsPlotter.h.

Constructor & Destructor Documentation

HLTHiggsPlotter::HLTHiggsPlotter ( const edm::ParameterSet pset,
const std::string &  hltPath,
const std::vector< unsigned int > &  objectsType,
const unsigned int &  minCandidates,
const std::vector< double > &  NminOneCuts 
)

Definition at line 23 of file HLTHiggsPlotter.cc.

References _cutMaxEta, _cutMinPt, _objectsType, edm::ParameterSet::getParameter(), EVTColContainer::getTypeString(), and AlCaHLTBitMon_QueryRunRegistry::string.

28  : _hltPath(hltPath),
29  _hltProcessName(pset.getParameter<std::string>("hltProcessName")),
30  _objectsType(std::set<unsigned int>(objectsType.begin(), objectsType.end())),
31  _nObjects(objectsType.size()),
32  _parametersEta(pset.getParameter<std::vector<double> >("parametersEta")),
33  _parametersPhi(pset.getParameter<std::vector<double> >("parametersPhi")),
34  _parametersTurnOn(pset.getParameter<std::vector<double> >("parametersTurnOn")),
35  _NptPlots(NptPlots),
37  for (std::set<unsigned int>::iterator it = _objectsType.begin(); it != _objectsType.end(); ++it) {
38  // Some parameters extracted from the .py
40  _cutMinPt[*it] = pset.getParameter<double>(std::string(objStr + "_cutMinPt").c_str());
41  _cutMaxEta[*it] = pset.getParameter<double>(std::string(objStr + "_cutMaxEta").c_str());
42  }
43 }
std::map< unsigned int, double > _cutMaxEta
unsigned int _NptPlots
std::string _hltProcessName
std::vector< double > _parametersPhi
std::set< unsigned int > _objectsType
std::string _hltPath
std::vector< double > _parametersTurnOn
std::vector< double > _parametersEta
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::map< unsigned int, double > _cutMinPt
unsigned int _nObjects
static const std::string getTypeString(const unsigned int &objtype)
Tranform types into strings.
std::vector< double > _NminOneCuts
HLTHiggsPlotter::~HLTHiggsPlotter ( )

Definition at line 45 of file HLTHiggsPlotter.cc.

45 {}

Member Function Documentation

void HLTHiggsPlotter::analyze ( const bool &  isPassTrigger,
const std::string &  source,
const std::vector< MatchStruct > &  matches,
const unsigned int &  minCandidates 
)

Definition at line 98 of file HLTHiggsPlotter.cc.

References _NptPlots, _objectsType, cms::cuda::co, PVValHelper::eta, fillHist(), EVTColContainer::getTypeString(), dqmiolumiharvest::j, phi, DiDispStaMuonMonitor_cfi::pt, and AlCaHLTBitMon_QueryRunRegistry::string.

101  {
102  if (!isPassTrigger) {
103  return;
104  }
105  std::map<unsigned int, int> countobjects;
106  // Initializing the count of the used object
107  for (std::set<unsigned int>::iterator co = _objectsType.begin(); co != _objectsType.end(); ++co) {
108  countobjects[*co] = 0;
109  }
110 
111  int counttotal = 0;
112  const int totalobjectssize2 = _NptPlots * countobjects.size();
113  // Fill the histos if pass the trigger (just the two with higher pt)
114  for (size_t j = 0; j < matches.size(); ++j) {
115  // Is this object owned by this trigger? If not we are not interested...
116  if (_objectsType.find(matches[j].objType) == _objectsType.end()) {
117  continue;
118  }
119 
120  const unsigned int objType = matches[j].objType;
121  const std::string objTypeStr = EVTColContainer::getTypeString(matches[j].objType);
122 
123  float pt = matches[j].pt;
124  float eta = matches[j].eta;
125  float phi = matches[j].phi;
126 
127  TString maxPt;
128  if ((unsigned)countobjects[objType] < _NptPlots) {
129  maxPt = "MaxPt";
130  maxPt += (countobjects[objType] + 1);
131  this->fillHist(isPassTrigger, source, objTypeStr, maxPt.Data(), pt);
132  // Filled the high pt ...
133  ++(countobjects[objType]);
134  ++counttotal;
135  } else {
136  if ((unsigned)countobjects[objType] < minCandidates) { // To get correct results for HZZ
137  ++(countobjects[objType]);
138  ++counttotal;
139  } else
140  continue; // Otherwise too many entries in Eta and Phi distributions
141  }
142 
143  this->fillHist(isPassTrigger, source, objTypeStr, "Eta", eta);
144  this->fillHist(isPassTrigger, source, objTypeStr, "Phi", phi);
145 
146  if (counttotal == totalobjectssize2) {
147  break;
148  }
149  }
150 }
unsigned int _NptPlots
__host__ __device__ VT * co
Definition: prefixScan.h:47
std::set< unsigned int > _objectsType
void fillHist(const bool &passTrigger, const std::string &source, const std::string &objType, const std::string &var, const float &value)
static const std::string getTypeString(const unsigned int &objtype)
Tranform types into strings.
static std::string const source
Definition: EdmProvDump.cc:46
void HLTHiggsPlotter::analyze ( const bool &  isPassTrigger,
const std::string &  source,
const std::vector< MatchStruct > &  matches,
std::map< std::string, bool > &  nMinOne,
const float &  dEtaqq,
const float &  mqq,
const float &  dPhibb,
const float &  CSV1,
const float &  CSV2,
const float &  CSV3,
const bool &  passAllCuts 
)

Definition at line 152 of file HLTHiggsPlotter.cc.

References _NminOneCuts, _NptPlots, _objectsType, cms::cuda::co, PVValHelper::eta, fillHist(), EVTColContainer::getTypeString(), dqmiolumiharvest::j, EVTColContainer::PFJET, EVTColContainer::PFMET, phi, DiDispStaMuonMonitor_cfi::pt, and AlCaHLTBitMon_QueryRunRegistry::string.

162  {
163  if (!isPassTrigger) {
164  return;
165  }
166  std::map<unsigned int, int> countobjects;
167  // Initializing the count of the used object
168  for (std::set<unsigned int>::iterator co = _objectsType.begin(); co != _objectsType.end(); ++co) {
169  if (!(*co == EVTColContainer::PFJET && source == "gen")) // genJets are not there
170  countobjects[*co] = 0;
171  }
172 
173  int counttotal = 0;
174  const int totalobjectssize2 = _NptPlots * countobjects.size();
175  // Fill the histos if pass the trigger (just the two with higher pt)
176  for (size_t j = 0; j < matches.size(); ++j) {
177  // Is this object owned by this trigger? If not we are not interested...
178  if (_objectsType.find(matches[j].objType) == _objectsType.end()) {
179  continue;
180  }
181 
182  const unsigned int objType = matches[j].objType;
183  const std::string objTypeStr = EVTColContainer::getTypeString(matches[j].objType);
184 
185  float pt = matches[j].pt;
186  float eta = matches[j].eta;
187  float phi = matches[j].phi;
188 
189  // PFMET N-1 cut
190  if (objType == EVTColContainer::PFMET && _NminOneCuts[8] && !nMinOne["PFMET"])
191  continue;
192 
193  TString maxPt;
194  if ((unsigned)(countobjects)[objType] < _NptPlots) {
195  maxPt = "MaxPt";
196  maxPt += (countobjects[objType] + 1);
197  if (objType != EVTColContainer::PFJET || nMinOne[maxPt.Data()]) {
198  this->fillHist(isPassTrigger, source, objTypeStr, maxPt.Data(), pt);
199  }
200  ++(countobjects[objType]);
201  ++counttotal;
202  } else
203  continue; // if not needed (minCandidates == _NptPlots if _useNminOneCuts
204  if (objType != EVTColContainer::PFJET || passAllCuts) {
205  this->fillHist(isPassTrigger, source, objTypeStr, "Eta", eta);
206  this->fillHist(isPassTrigger, source, objTypeStr, "Phi", phi);
207  }
208 
209  if (counttotal == totalobjectssize2) {
210  break;
211  }
212  }
213  if (source == "rec" && _objectsType.find(EVTColContainer::PFJET) != _objectsType.end()) {
214  if (_NminOneCuts[0] && nMinOne["dEtaqq"]) {
215  this->fillHist(isPassTrigger, source, EVTColContainer::getTypeString(EVTColContainer::PFJET), "dEtaqq", dEtaqq);
216  }
217  if (_NminOneCuts[1] && nMinOne["mqq"]) {
218  this->fillHist(isPassTrigger, source, EVTColContainer::getTypeString(EVTColContainer::PFJET), "mqq", mqq);
219  }
220  if (_NminOneCuts[2] && nMinOne["dPhibb"]) {
221  this->fillHist(isPassTrigger, source, EVTColContainer::getTypeString(EVTColContainer::PFJET), "dPhibb", dPhibb);
222  }
223  if (_NminOneCuts[3]) {
224  std::string nameCSVplot = "CSV1";
225  if (_NminOneCuts[6])
226  nameCSVplot = "maxCSV";
227  if (nMinOne[nameCSVplot])
228  this->fillHist(
229  isPassTrigger, source, EVTColContainer::getTypeString(EVTColContainer::PFJET), nameCSVplot, CSV1);
230  }
231  if (_NminOneCuts[4] && nMinOne["CSV2"]) {
232  this->fillHist(isPassTrigger, source, EVTColContainer::getTypeString(EVTColContainer::PFJET), "CSV2", CSV2);
233  }
234  if (_NminOneCuts[5] && nMinOne["CSV3"]) {
235  this->fillHist(isPassTrigger, source, EVTColContainer::getTypeString(EVTColContainer::PFJET), "CSV3", CSV3);
236  }
237  }
238 }
unsigned int _NptPlots
__host__ __device__ VT * co
Definition: prefixScan.h:47
std::set< unsigned int > _objectsType
void fillHist(const bool &passTrigger, const std::string &source, const std::string &objType, const std::string &var, const float &value)
static const std::string getTypeString(const unsigned int &objtype)
Tranform types into strings.
static std::string const source
Definition: EdmProvDump.cc:46
std::vector< double > _NminOneCuts
void HLTHiggsPlotter::beginJob ( void  )

Definition at line 47 of file HLTHiggsPlotter.cc.

47 {}
void HLTHiggsPlotter::beginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)

Definition at line 49 of file HLTHiggsPlotter.cc.

49 {}
void HLTHiggsPlotter::bookHist ( const std::string &  source,
const std::string &  objType,
const std::string &  variable,
DQMStore::IBooker ibooker 
)
private

Definition at line 240 of file HLTHiggsPlotter.cc.

References _elements, _hltPath, _parametersEta, _parametersPhi, _parametersTurnOn, dqm::implementation::IBooker::book1D(), submitPVResolutionJobs::desc, EVTColContainer::getTypeString(), h, mps_fire::i, SiStripPI::max, min(), mergeVDriftHistosByStation::name, submitPVValidationJobs::params, EVTColContainer::PFJET, EVTColContainer::PFMET, source, AlCaHLTBitMon_QueryRunRegistry::string, and runGCPTkAlMap::title.

Referenced by bookHistograms().

243  {
244  std::string sourceUpper = source;
245  sourceUpper[0] = std::toupper(sourceUpper[0]);
246  std::string name = source + objType + variable + "_" + _hltPath;
247  TH1F *h = nullptr;
248 
249  if (variable.find("MaxPt") != std::string::npos) {
251  if (variable == "MaxPt1")
252  desc = "Leading";
253  else if (variable == "MaxPt2")
254  desc = "Next-to-Leading";
255  else
256  desc = variable.substr(5, 6) + "th Leading";
257  std::string title = "pT of " + desc + " " + sourceUpper + " " + objType +
258  " "
259  "where event pass the " +
260  _hltPath;
261  const size_t nBinsStandard = _parametersTurnOn.size() - 1;
262  size_t nBins = nBinsStandard;
263  float *edges = new float[nBinsStandard + 1];
264  for (size_t i = 0; i < nBinsStandard + 1; i++) {
265  edges[i] = _parametersTurnOn[i];
266  }
267 
269  if (objType == jetObj) {
270  const size_t nBinsJets = 25;
271  nBins = nBinsJets;
272  delete[] edges;
273  edges = new float[nBinsJets + 1];
274  for (size_t i = 0; i < nBinsJets + 1; i++) {
275  edges[i] = i * 10;
276  }
277  }
279  const size_t nBinsJets = 30;
280  nBins = nBinsJets;
281  delete[] edges;
282  edges = new float[nBinsJets + 1];
283  for (size_t i = 0; i < nBinsJets + 1; i++) {
284  edges[i] = i * 10;
285  }
286  }
287  h = new TH1F(name.c_str(), title.c_str(), nBins, edges);
288  delete[] edges;
289  } else {
290  if (variable == "dEtaqq") {
291  std::string title = "#Delta #eta_{qq} of " + sourceUpper + " " + objType;
292  int nBins = 20;
293  double min = 0;
294  double max = 4.8;
295  h = new TH1F(name.c_str(), title.c_str(), nBins, min, max);
296  } else if (variable == "mqq") {
297  std::string title = "m_{qq} of " + sourceUpper + " " + objType;
298  int nBins = 20;
299  double min = 0;
300  double max = 1000;
301  h = new TH1F(name.c_str(), title.c_str(), nBins, min, max);
302  } else if (variable == "dPhibb") {
303  std::string title = "#Delta #phi_{bb} of " + sourceUpper + " " + objType;
304  int nBins = 10;
305  double min = 0;
306  double max = 3.1416;
307  h = new TH1F(name.c_str(), title.c_str(), nBins, min, max);
308  } else if (variable == "CSV1") {
309  std::string title = "CSV1 of " + sourceUpper + " " + objType;
310  int nBins = 20;
311  double min = 0;
312  double max = 1;
313  h = new TH1F(name.c_str(), title.c_str(), nBins, min, max);
314  } else if (variable == "CSV2") {
315  std::string title = "CSV2 of " + sourceUpper + " " + objType;
316  int nBins = 20;
317  double min = 0;
318  double max = 1;
319  h = new TH1F(name.c_str(), title.c_str(), nBins, min, max);
320  } else if (variable == "CSV3") {
321  std::string title = "CSV3 of " + sourceUpper + " " + objType;
322  int nBins = 20;
323  double min = 0;
324  double max = 1;
325  h = new TH1F(name.c_str(), title.c_str(), nBins, min, max);
326  } else if (variable == "maxCSV") {
327  std::string title = "max CSV of " + sourceUpper + " " + objType;
328  int nBins = 20;
329  double min = 0;
330  double max = 1;
331  h = new TH1F(name.c_str(), title.c_str(), nBins, min, max);
332  } else {
333  std::string symbol = (variable == "Eta") ? "#eta" : "#phi";
334  std::string title = symbol + " of " + sourceUpper + " " + objType + " " + "where event pass the " + _hltPath;
335  std::vector<double> params = (variable == "Eta") ? _parametersEta : _parametersPhi;
336 
337  int nBins = (int)params[0];
338  double min = params[1];
339  double max = params[2];
340  h = new TH1F(name.c_str(), title.c_str(), nBins, min, max);
341  }
342  }
343  h->Sumw2();
344  _elements[name] = ibooker.book1D(name.c_str(), h);
345  delete h;
346 }
std::vector< double > _parametersPhi
std::map< std::string, MonitorElement * > _elements
std::string _hltPath
std::vector< double > _parametersTurnOn
T min(T a, T b)
Definition: MathUtil.h:58
std::vector< double > _parametersEta
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
static const std::string getTypeString(const unsigned int &objtype)
Tranform types into strings.
static std::string const source
Definition: EdmProvDump.cc:46
void HLTHiggsPlotter::bookHistograms ( DQMStore::IBooker ibooker,
const bool &  useNminOneCuts 
)

Definition at line 51 of file HLTHiggsPlotter.cc.

References _NminOneCuts, _NptPlots, _objectsType, bookHist(), EVTColContainer::getTypeString(), mps_fire::i, EVTColContainer::PFJET, source, and AlCaHLTBitMon_QueryRunRegistry::string.

51  {
52  for (std::set<unsigned int>::iterator it = _objectsType.begin(); it != _objectsType.end(); ++it) {
53  std::vector<std::string> sources(2);
54  sources[0] = "gen";
55  sources[1] = "rec";
56  TString maxPt;
57 
58  const std::string objTypeStr = EVTColContainer::getTypeString(*it);
59 
60  for (size_t i = 0; i < sources.size(); i++) {
61  std::string source = sources[i];
62 
63  if (useNminOneCuts && *it == EVTColContainer::PFJET) {
64  if (source == "gen")
65  continue;
66  else {
67  // N-1 jet plots (dEtaqq, mqq, dPhibb, CSV1, maxCSV_jets, maxCSV_E, PFMET, pt1, pt2, pt3, pt4)
68  if (_NminOneCuts[0])
69  bookHist(source, objTypeStr, "dEtaqq", ibooker);
70  if (_NminOneCuts[1])
71  bookHist(source, objTypeStr, "mqq", ibooker);
72  if (_NminOneCuts[2])
73  bookHist(source, objTypeStr, "dPhibb", ibooker);
74  if (_NminOneCuts[3]) {
75  if (_NminOneCuts[6])
76  bookHist(source, objTypeStr, "maxCSV", ibooker);
77  else
78  bookHist(source, objTypeStr, "CSV1", ibooker);
79  }
80  if (_NminOneCuts[4])
81  bookHist(source, objTypeStr, "CSV2", ibooker);
82  if (_NminOneCuts[5])
83  bookHist(source, objTypeStr, "CSV3", ibooker);
84  }
85  }
86 
87  bookHist(source, objTypeStr, "Eta", ibooker);
88  bookHist(source, objTypeStr, "Phi", ibooker);
89  for (unsigned int i = 0; i < _NptPlots; i++) {
90  maxPt = "MaxPt";
91  maxPt += i + 1;
92  bookHist(source, objTypeStr, maxPt.Data(), ibooker);
93  }
94  }
95  }
96 }
unsigned int _NptPlots
std::set< unsigned int > _objectsType
void bookHist(const std::string &source, const std::string &objType, const std::string &variable, DQMStore::IBooker &)
static const std::string getTypeString(const unsigned int &objtype)
Tranform types into strings.
static std::string const source
Definition: EdmProvDump.cc:46
std::vector< double > _NminOneCuts
void HLTHiggsPlotter::fillHist ( const bool &  passTrigger,
const std::string &  source,
const std::string &  objType,
const std::string &  var,
const float &  value 
)
private

Definition at line 348 of file HLTHiggsPlotter.cc.

References _elements, _hltPath, mergeVDriftHistosByStation::name, source, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by analyze().

352  {
353  std::string sourceUpper = source;
354  sourceUpper[0] = toupper(sourceUpper[0]);
355  std::string name = source + objType + variable + "_" + _hltPath;
356 
357  _elements[name]->Fill(value);
358 }
std::map< std::string, MonitorElement * > _elements
std::string _hltPath
static std::string const source
Definition: EdmProvDump.cc:46
const std::string HLTHiggsPlotter::gethltpath ( ) const
inline

Definition at line 77 of file HLTHiggsPlotter.h.

References _hltPath.

77 { return _hltPath; }
std::string _hltPath

Member Data Documentation

std::map<unsigned int, double> HLTHiggsPlotter::_cutMaxEta
private

Definition at line 100 of file HLTHiggsPlotter.h.

Referenced by HLTHiggsPlotter().

std::map<unsigned int, double> HLTHiggsPlotter::_cutMinPt
private

Definition at line 99 of file HLTHiggsPlotter.h.

Referenced by HLTHiggsPlotter().

std::map<unsigned int, unsigned int> HLTHiggsPlotter::_cutMotherId
private

Definition at line 101 of file HLTHiggsPlotter.h.

std::map<unsigned int, std::vector<double> > HLTHiggsPlotter::_cutsDr
private

Definition at line 102 of file HLTHiggsPlotter.h.

std::map<std::string, MonitorElement *> HLTHiggsPlotter::_elements
private

Definition at line 110 of file HLTHiggsPlotter.h.

Referenced by bookHist(), and fillHist().

std::string HLTHiggsPlotter::_hltPath
private

Definition at line 87 of file HLTHiggsPlotter.h.

Referenced by bookHist(), fillHist(), and gethltpath().

std::string HLTHiggsPlotter::_hltProcessName
private

Definition at line 89 of file HLTHiggsPlotter.h.

std::vector<double> HLTHiggsPlotter::_NminOneCuts
private

Definition at line 108 of file HLTHiggsPlotter.h.

Referenced by analyze(), and bookHistograms().

unsigned int HLTHiggsPlotter::_nObjects
private

Definition at line 93 of file HLTHiggsPlotter.h.

unsigned int HLTHiggsPlotter::_NptPlots
private

Definition at line 105 of file HLTHiggsPlotter.h.

Referenced by analyze(), and bookHistograms().

std::set<unsigned int> HLTHiggsPlotter::_objectsType
private

Definition at line 91 of file HLTHiggsPlotter.h.

Referenced by analyze(), bookHistograms(), and HLTHiggsPlotter().

std::vector<double> HLTHiggsPlotter::_parametersEta
private

Definition at line 95 of file HLTHiggsPlotter.h.

Referenced by bookHist().

std::vector<double> HLTHiggsPlotter::_parametersPhi
private

Definition at line 96 of file HLTHiggsPlotter.h.

Referenced by bookHist().

std::vector<double> HLTHiggsPlotter::_parametersTurnOn
private

Definition at line 97 of file HLTHiggsPlotter.h.

Referenced by bookHist().