CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
HLTExoticaPlotter Class Reference

#include <HLTExoticaPlotter.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< reco::LeafCandidate > &matches, std::map< int, double > theSumEt, std::vector< float > &dxys)
 
void beginJob ()
 
void beginRun (const edm::Run &, const edm::EventSetup &)
 
const std::string gethltpath () const
 
 HLTExoticaPlotter (const edm::ParameterSet &pset, const std::string &hltPath, const std::vector< unsigned int > &objectsType)
 
void plotterBookHistos (DQMStore::IBooker &iBooker, const edm::Run &iRun, const edm::EventSetup &iSetup)
 
 ~HLTExoticaPlotter ()
 

Private Member Functions

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

Private Attributes

bool _drop_pt2
 
bool _drop_pt3
 
std::map< std::string, MonitorElement * > _elements
 
std::string _hltPath
 
std::string _hltProcessName
 
unsigned int _nObjects
 
std::set< unsigned int > _objectsType
 
std::vector< double > _parametersDxy
 
std::vector< double > _parametersEta
 
std::vector< double > _parametersPhi
 
std::vector< double > _parametersTurnOn
 
std::vector< double > _parametersTurnOnSumEt
 

Detailed Description

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

Author
Thiago R. Fernandez Perez Tomei Based and adapted from: J. Duarte Campderros code from HLTriggerOffline/Higgs J. Klukas, M. Vander Donckt and J. Alcaraz code from the HLTriggerOffline/Muon package.

Definition at line 42 of file HLTExoticaPlotter.h.

Member Typedef Documentation

◆ DQMStore

Definition at line 44 of file HLTExoticaPlotter.h.

◆ MonitorElement

Definition at line 45 of file HLTExoticaPlotter.h.

Constructor & Destructor Documentation

◆ HLTExoticaPlotter()

HLTExoticaPlotter::HLTExoticaPlotter ( const edm::ParameterSet pset,
const std::string &  hltPath,
const std::vector< unsigned int > &  objectsType 
)

Definition at line 17 of file HLTExoticaPlotter.cc.

References _drop_pt2, _drop_pt3, LogDebug, and muonDTDigis_cfi::pset.

20  : _hltPath(hltPath),
21  _hltProcessName(pset.getParameter<std::string>("hltProcessName")),
22  _objectsType(std::set<unsigned int>(objectsType.begin(), objectsType.end())),
23  _nObjects(objectsType.size()),
24  _parametersEta(pset.getParameter<std::vector<double>>("parametersEta")),
25  _parametersPhi(pset.getParameter<std::vector<double>>("parametersPhi")),
26  _parametersTurnOn(pset.getParameter<std::vector<double>>("parametersTurnOn")),
27  _parametersTurnOnSumEt(pset.getParameter<std::vector<double>>("parametersTurnOnSumEt")),
28  _parametersDxy(pset.getParameter<std::vector<double>>("parametersDxy")),
29  _drop_pt2(false),
30  _drop_pt3(false) {
31  if (pset.exists("dropPt2")) {
32  _drop_pt2 = pset.getParameter<bool>("dropPt2");
33  }
34  if (pset.exists("dropPt3")) {
35  _drop_pt3 = pset.getParameter<bool>("dropPt3");
36  }
37  LogDebug("ExoticaValidation") << "In HLTExoticaPlotter::constructor()";
38 }
std::set< unsigned int > _objectsType
std::vector< double > _parametersDxy
std::vector< double > _parametersTurnOnSumEt
std::vector< double > _parametersEta
std::string _hltProcessName
std::vector< double > _parametersTurnOn
std::vector< double > _parametersPhi
unsigned int _nObjects
#define LogDebug(id)

◆ ~HLTExoticaPlotter()

HLTExoticaPlotter::~HLTExoticaPlotter ( )

Definition at line 40 of file HLTExoticaPlotter.cc.

40 {}

Member Function Documentation

◆ analyze()

void HLTExoticaPlotter::analyze ( const bool &  isPassTrigger,
const std::string &  source,
const std::vector< reco::LeafCandidate > &  matches,
std::map< int, double >  theSumEt,
std::vector< float > &  dxys 
)

Definition at line 101 of file HLTExoticaPlotter.cc.

References _drop_pt2, _drop_pt3, _objectsType, cms::cuda::co, EVTColContainer::ELEC, PVValHelper::eta, fillHist(), EVTColContainer::getTypeString(), dqmiolumiharvest::j, LogDebug, oniaPATMuonsWithTrigger_cff::matches, EVTColContainer::MUON, EVTColContainer::MUTRK, electrons_cff::objType, phi, DiDispStaMuonMonitor_cfi::pt, source, and AlCaHLTBitMon_QueryRunRegistry::string.

105  {
106  LogDebug("ExoticaValidation") << "In HLTExoticaPlotter::analyze()";
107  if (!isPassTrigger) {
108  return;
109  }
110 
111  std::map<unsigned int, int> countobjects;
112  // Initializing the count of the used object
113  for (std::set<unsigned int>::iterator co = _objectsType.begin(); co != _objectsType.end(); ++co) {
114  countobjects[*co] = 0;
115  }
116 
117  int counttotal = 0;
118 
119  // 3 : pt1, pt2, pt3
120  int totalobjectssize = 1;
121  if (!_drop_pt2)
122  totalobjectssize++;
123  if (!_drop_pt3)
124  totalobjectssize++;
125  totalobjectssize *= countobjects.size();
126  // Fill the histos if pass the trigger (just the two with higher pt)
127  unsigned int jaux = 0;
128  // jaux is being used as a dedicated counter to avoid getting
129  // a non-existent element inside dxys
130  // more information in the issue https://github.com/cms-sw/cmssw/issues/32550
131  for (size_t j = 0; j < matches.size(); ++j) {
132  // Is this object owned by this trigger? If not we are not interested...
133  if (_objectsType.find(matches[j].pdgId()) == _objectsType.end()) {
134  ++jaux;
135  continue;
136  }
137 
138  const unsigned int objType = matches[j].pdgId();
140 
141  float pt = matches[j].pt();
142  float eta = matches[j].eta();
143  float phi = matches[j].phi();
144 
145  if (!(TString(objTypeStr).Contains("MET") || TString(objTypeStr).Contains("MHT"))) {
146  this->fillHist(isPassTrigger, source, objTypeStr, "Eta", eta);
147  this->fillHist(isPassTrigger, source, objTypeStr, "Phi", phi);
148  } else if (source != "gen") {
149  if (theSumEt[objType] >= 0 && countobjects[objType] == 0) {
150  this->fillHist(isPassTrigger, source, objTypeStr, "SumEt", theSumEt[objType]);
151  }
152  }
153 
154  if (!dxys.empty() &&
156  this->fillHist(isPassTrigger, source, objTypeStr, "Dxy", dxys[jaux]);
157  ++jaux;
158  }
159 
160  if (countobjects[objType] == 0) {
161  if (!(TString(objTypeStr).Contains("MET") || TString(objTypeStr).Contains("MHT")) || source != "gen") {
162  this->fillHist(isPassTrigger, source, objTypeStr, "MaxPt1", pt);
163  }
164  // Filled the high pt ...
165  ++(countobjects[objType]);
166  ++counttotal;
167  } else if (countobjects[objType] == 1 && !_drop_pt2) {
168  if (!(TString(objTypeStr).Contains("MET") || TString(objTypeStr).Contains("MHT"))) {
169  this->fillHist(isPassTrigger, source, objTypeStr, "MaxPt2", pt);
170  }
171  // Filled the second high pt ...
172  ++(countobjects[objType]);
173  ++counttotal;
174  } else if (countobjects[objType] == 2 && !_drop_pt3) {
175  if (!(TString(objTypeStr).Contains("MET") || TString(objTypeStr).Contains("MHT"))) {
176  this->fillHist(isPassTrigger, source, objTypeStr, "MaxPt3", pt);
177  }
178  // Filled the third highest pt ...
179  ++(countobjects[objType]);
180  ++counttotal;
181  } else {
182  if (counttotal == totalobjectssize) {
183  break;
184  }
185  }
186 
187  } // end loop over matches
188 }
std::set< unsigned int > _objectsType
__host__ __device__ VT * co
Definition: prefixScan.h:47
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
#define LogDebug(id)

◆ beginJob()

void HLTExoticaPlotter::beginJob ( void  )

Definition at line 42 of file HLTExoticaPlotter.cc.

42 {}

◆ beginRun()

void HLTExoticaPlotter::beginRun ( const edm::Run ,
const edm::EventSetup  
)

◆ bookHist()

void HLTExoticaPlotter::bookHist ( DQMStore::IBooker iBooker,
const std::string &  source,
const std::string &  objType,
const std::string &  variable 
)
private

Definition at line 190 of file HLTExoticaPlotter.cc.

References _elements, _hltPath, _parametersDxy, _parametersEta, _parametersPhi, _parametersTurnOn, _parametersTurnOnSumEt, dqm::implementation::IBooker::book1D(), submitPVResolutionJobs::desc, SelectiveReadoutTask_cfi::edges, h, mps_fire::i, createfilelist::int, LogDebug, SiStripPI::max, SiStripPI::min, Skims_PA_cff::name, seedmultiplicitymonitor_newtracking_cfi::nBins, electrons_cff::objType, submitPVValidationJobs::params, source, AlCaHLTBitMon_QueryRunRegistry::string, runGCPTkAlMap::title, and taus_updatedMVAIds_cff::variable.

Referenced by plotterBookHistos().

193  {
194  LogDebug("ExoticaValidation") << "In HLTExoticaPlotter::bookHist()";
195  std::string sourceUpper = source;
196  sourceUpper[0] = std::toupper(sourceUpper[0]);
198  TH1F *h = nullptr;
199 
200  if (variable.find("SumEt") != std::string::npos) {
201  std::string title = "Sum ET of " + sourceUpper + " " + objType;
202  const size_t nBins = _parametersTurnOnSumEt.size() - 1;
203  float *edges = new float[nBins + 1];
204  for (size_t i = 0; i < nBins + 1; i++) {
206  }
207  h = new TH1F(name.c_str(), title.c_str(), nBins, edges);
208  delete[] edges;
209  } else if (variable.find("Dxy") != std::string::npos) {
210  std::string title = "Dxy " + sourceUpper + " " + objType;
211  int nBins = _parametersDxy[0];
212  double min = _parametersDxy[1];
213  double max = _parametersDxy[2];
214  h = new TH1F(name.c_str(), title.c_str(), nBins, min, max);
215  } else if (variable.find("MaxPt") != std::string::npos) {
216  std::string desc; //=
217  // (variable == "MaxPt1") ? "Leading" : (variable == "MaxPt2") ? "Next-to-Leading" : "Next-to-next-to-Leading";
218  if (variable == "MaxPt1") {
219  desc = "Leading";
220  } else if (variable == "MaxPt2") {
221  desc = "Next-to-Leading";
222  } else {
223  desc = "Next-to-next-to-Leading";
224  }
225  std::string title = "pT of " + desc + " " + sourceUpper + " " + objType +
226  " "
227  "where event pass the " +
228  _hltPath;
229  const size_t nBins = _parametersTurnOn.size() - 1;
230  float *edges = new float[nBins + 1];
231  for (size_t i = 0; i < nBins + 1; i++) {
233  }
234  h = new TH1F(name.c_str(), title.c_str(), nBins, edges);
235  delete[] edges;
236  }
237 
238  else {
239  std::string symbol = (variable == "Eta") ? "#eta" : "#phi";
240  std::string title = symbol + " of " + sourceUpper + " " + objType + " " + "where event pass the " + _hltPath;
241  std::vector<double> params = (variable == "Eta") ? _parametersEta : _parametersPhi;
242 
243  int nBins = (int)params[0];
244  double min = params[1];
245  double max = params[2];
246  h = new TH1F(name.c_str(), title.c_str(), nBins, min, max);
247  }
248 
249  h->Sumw2();
250  _elements[name] = iBooker.book1D(name, h);
251  // LogDebug("ExoticaValidation") << " booked histo
252  // with name " << name << "\n"
253  // << " at location " <<
254  //(unsigned long int)_elements[name];
255  delete h;
256 }
std::vector< double > _parametersDxy
std::vector< double > _parametersTurnOnSumEt
std::vector< double > _parametersEta
std::vector< double > _parametersTurnOn
std::vector< double > _parametersPhi
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 std::string const source
Definition: EdmProvDump.cc:46
std::map< std::string, MonitorElement * > _elements
#define LogDebug(id)

◆ fillHist()

void HLTExoticaPlotter::fillHist ( const bool &  passTrigger,
const std::string &  source,
const std::string &  objType,
const std::string &  var,
const float &  value 
)
private

Definition at line 258 of file HLTExoticaPlotter.cc.

References _elements, _hltPath, LogDebug, Skims_PA_cff::name, electrons_cff::objType, source, AlCaHLTBitMon_QueryRunRegistry::string, relativeConstraints::value, and taus_updatedMVAIds_cff::variable.

Referenced by analyze().

262  {
263  std::string sourceUpper = source;
264  sourceUpper[0] = toupper(sourceUpper[0]);
266 
267  LogDebug("ExoticaValidation") << "In HLTExoticaPlotter::fillHist()" << name << " " << value;
268  _elements[name]->Fill(value);
269  LogDebug("ExoticaValidation") << "In HLTExoticaPlotter::fillHist()" << name << " worked";
270 }
Definition: value.py:1
static std::string const source
Definition: EdmProvDump.cc:46
std::map< std::string, MonitorElement * > _elements
#define LogDebug(id)

◆ gethltpath()

const std::string HLTExoticaPlotter::gethltpath ( ) const
inline

Definition at line 60 of file HLTExoticaPlotter.h.

References _hltPath.

60 { return _hltPath; }

◆ plotterBookHistos()

void HLTExoticaPlotter::plotterBookHistos ( DQMStore::IBooker iBooker,
const edm::Run iRun,
const edm::EventSetup iSetup 
)

Definition at line 44 of file HLTExoticaPlotter.cc.

References _drop_pt2, _drop_pt3, _objectsType, bookHist(), EVTColContainer::ELEC, EVTColContainer::getTypeString(), mps_fire::i, LogDebug, EVTColContainer::MUON, EVTColContainer::MUTRK, source, CalibrationSummaryClient_cfi::sources, and AlCaHLTBitMon_QueryRunRegistry::string.

46  {
47  LogDebug("ExoticaValidation") << "In HLTExoticaPlotter::plotterBookHistos()";
48  for (std::set<unsigned int>::iterator it = _objectsType.begin(); it != _objectsType.end(); ++it) {
49  std::vector<std::string> sources(2);
50  sources[0] = "gen";
51  sources[1] = "rec";
52 
53  const std::string objTypeStr = EVTColContainer::getTypeString(*it);
54 
55  for (size_t i = 0; i < sources.size(); i++) {
57 
58  if (source == "gen") {
59  if (TString(objTypeStr).Contains("MET") || TString(objTypeStr).Contains("MHT") ||
60  TString(objTypeStr).Contains("Jet")) {
61  continue;
62  } else {
63  bookHist(iBooker, source, objTypeStr, "MaxPt1");
64  if (!_drop_pt2)
65  bookHist(iBooker, source, objTypeStr, "MaxPt2");
66  if (!_drop_pt3)
67  bookHist(iBooker, source, objTypeStr, "MaxPt3");
68  bookHist(iBooker, source, objTypeStr, "Eta");
69  bookHist(iBooker, source, objTypeStr, "Phi");
70 
71  // If the target is electron or muon,
72  // we will add Dxy plots.
74  bookHist(iBooker, source, objTypeStr, "Dxy");
75  }
76  }
77  } else { // reco
78  if (TString(objTypeStr).Contains("MET") || TString(objTypeStr).Contains("MHT")) {
79  bookHist(iBooker, source, objTypeStr, "MaxPt1");
80  bookHist(iBooker, source, objTypeStr, "SumEt");
81  } else {
82  bookHist(iBooker, source, objTypeStr, "MaxPt1");
83  if (!_drop_pt2)
84  bookHist(iBooker, source, objTypeStr, "MaxPt2");
85  if (!_drop_pt3)
86  bookHist(iBooker, source, objTypeStr, "MaxPt3");
87  bookHist(iBooker, source, objTypeStr, "Eta");
88  bookHist(iBooker, source, objTypeStr, "Phi");
89 
90  // If the target is electron or muon,
91  // we will add Dxy plots.
93  bookHist(iBooker, source, objTypeStr, "Dxy");
94  }
95  }
96  }
97  }
98  }
99 }
std::set< unsigned int > _objectsType
void bookHist(DQMStore::IBooker &iBooker, const std::string &source, const std::string &objType, const std::string &variable)
static const std::string getTypeString(const unsigned int &objtype)
Tranform types into strings.
static std::string const source
Definition: EdmProvDump.cc:46
#define LogDebug(id)

Member Data Documentation

◆ _drop_pt2

bool HLTExoticaPlotter::_drop_pt2
private

Definition at line 87 of file HLTExoticaPlotter.h.

Referenced by analyze(), HLTExoticaPlotter(), and plotterBookHistos().

◆ _drop_pt3

bool HLTExoticaPlotter::_drop_pt3
private

Definition at line 88 of file HLTExoticaPlotter.h.

Referenced by analyze(), HLTExoticaPlotter(), and plotterBookHistos().

◆ _elements

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

Definition at line 90 of file HLTExoticaPlotter.h.

Referenced by bookHist(), and fillHist().

◆ _hltPath

std::string HLTExoticaPlotter::_hltPath
private

Definition at line 73 of file HLTExoticaPlotter.h.

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

◆ _hltProcessName

std::string HLTExoticaPlotter::_hltProcessName
private

Definition at line 74 of file HLTExoticaPlotter.h.

◆ _nObjects

unsigned int HLTExoticaPlotter::_nObjects
private

Definition at line 78 of file HLTExoticaPlotter.h.

◆ _objectsType

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

Definition at line 76 of file HLTExoticaPlotter.h.

Referenced by analyze(), and plotterBookHistos().

◆ _parametersDxy

std::vector<double> HLTExoticaPlotter::_parametersDxy
private

Definition at line 84 of file HLTExoticaPlotter.h.

Referenced by bookHist().

◆ _parametersEta

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

Definition at line 80 of file HLTExoticaPlotter.h.

Referenced by bookHist().

◆ _parametersPhi

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

Definition at line 81 of file HLTExoticaPlotter.h.

Referenced by bookHist().

◆ _parametersTurnOn

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

Definition at line 82 of file HLTExoticaPlotter.h.

Referenced by bookHist().

◆ _parametersTurnOnSumEt

std::vector<double> HLTExoticaPlotter::_parametersTurnOnSumEt
private

Definition at line 83 of file HLTExoticaPlotter.h.

Referenced by bookHist().