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 43 of file HLTExoticaPlotter.h.

Member Typedef Documentation

◆ DQMStore

Definition at line 45 of file HLTExoticaPlotter.h.

◆ MonitorElement

Definition at line 46 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 19 of file HLTExoticaPlotter.cc.

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

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

◆ ~HLTExoticaPlotter()

HLTExoticaPlotter::~HLTExoticaPlotter ( )

Definition at line 42 of file HLTExoticaPlotter.cc.

42 {}

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 103 of file HLTExoticaPlotter.cc.

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

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.

◆ beginJob()

void HLTExoticaPlotter::beginJob ( void  )

Definition at line 44 of file HLTExoticaPlotter.cc.

44 {}

◆ 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 192 of file HLTExoticaPlotter.cc.

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

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, min(), Skims_PA_cff::name, seedmultiplicitymonitor_newtracking_cfi::nBins, electrons_cff::objType, CalibrationSummaryClient_cfi::params, source, AlCaHLTBitMon_QueryRunRegistry::string, runGCPTkAlMap::title, and taus_updatedMVAIds_cff::variable.

Referenced by plotterBookHistos().

◆ 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 260 of file HLTExoticaPlotter.cc.

264  {
265  std::string sourceUpper = source;
266  sourceUpper[0] = toupper(sourceUpper[0]);
268 
269  LogDebug("ExoticaValidation") << "In HLTExoticaPlotter::fillHist()" << name << " " << value;
270  _elements[name]->Fill(value);
271  LogDebug("ExoticaValidation") << "In HLTExoticaPlotter::fillHist()" << name << " worked";
272 }

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().

◆ gethltpath()

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

Definition at line 61 of file HLTExoticaPlotter.h.

61 { return _hltPath; }

References _hltPath.

◆ plotterBookHistos()

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

Definition at line 46 of file HLTExoticaPlotter.cc.

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

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.

Member Data Documentation

◆ _drop_pt2

bool HLTExoticaPlotter::_drop_pt2
private

Definition at line 88 of file HLTExoticaPlotter.h.

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

◆ _drop_pt3

bool HLTExoticaPlotter::_drop_pt3
private

Definition at line 89 of file HLTExoticaPlotter.h.

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

◆ _elements

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

Definition at line 91 of file HLTExoticaPlotter.h.

Referenced by bookHist(), and fillHist().

◆ _hltPath

std::string HLTExoticaPlotter::_hltPath
private

Definition at line 74 of file HLTExoticaPlotter.h.

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

◆ _hltProcessName

std::string HLTExoticaPlotter::_hltProcessName
private

Definition at line 75 of file HLTExoticaPlotter.h.

◆ _nObjects

unsigned int HLTExoticaPlotter::_nObjects
private

Definition at line 79 of file HLTExoticaPlotter.h.

◆ _objectsType

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

Definition at line 77 of file HLTExoticaPlotter.h.

Referenced by analyze(), and plotterBookHistos().

◆ _parametersDxy

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

Definition at line 85 of file HLTExoticaPlotter.h.

Referenced by bookHist().

◆ _parametersEta

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

Definition at line 81 of file HLTExoticaPlotter.h.

Referenced by bookHist().

◆ _parametersPhi

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

Definition at line 82 of file HLTExoticaPlotter.h.

Referenced by bookHist().

◆ _parametersTurnOn

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

Definition at line 83 of file HLTExoticaPlotter.h.

Referenced by bookHist().

◆ _parametersTurnOnSumEt

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

Definition at line 84 of file HLTExoticaPlotter.h.

Referenced by bookHist().

EVTColContainer::getTypeString
const static std::string getTypeString(const unsigned int &objtype)
Tranform types into strings.
Definition: EVTColContainer.cc:232
HLTExoticaPlotter::_elements
std::map< std::string, MonitorElement * > _elements
Definition: HLTExoticaPlotter.h:91
runGCPTkAlMap.title
string title
Definition: runGCPTkAlMap.py:94
mps_fire.i
i
Definition: mps_fire.py:428
EVTColContainer::ELEC
Definition: EVTColContainer.cc:49
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
min
T min(T a, T b)
Definition: MathUtil.h:58
TriggerAnalyzer.hltPath
hltPath
Definition: TriggerAnalyzer.py:62
oniaPATMuonsWithTrigger_cff.matches
matches
Definition: oniaPATMuonsWithTrigger_cff.py:77
HLTExoticaPlotter::_objectsType
std::set< unsigned int > _objectsType
Definition: HLTExoticaPlotter.h:77
CalibrationSummaryClient_cfi.sources
sources
Definition: CalibrationSummaryClient_cfi.py:23
HLTExoticaPlotter::_parametersTurnOnSumEt
std::vector< double > _parametersTurnOnSumEt
Definition: HLTExoticaPlotter.h:84
h
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
EVTColContainer::MUON
Definition: EVTColContainer.cc:50
HLTExoticaPlotter::_parametersDxy
std::vector< double > _parametersDxy
Definition: HLTExoticaPlotter.h:85
HLTExoticaPlotter::_parametersEta
std::vector< double > _parametersEta
Definition: HLTExoticaPlotter.h:81
cms::cuda::co
__host__ __device__ VT * co
Definition: prefixScan.h:47
PVValHelper::eta
Definition: PVValidationHelpers.h:70
source
static const std::string source
Definition: EdmProvDump.cc:47
seedmultiplicitymonitor_newtracking_cfi.nBins
nBins
Definition: seedmultiplicitymonitor_newtracking_cfi.py:8
h
EVTColContainer::MUTRK
Definition: EVTColContainer.cc:51
HLTExoticaPlotter::_hltPath
std::string _hltPath
Definition: HLTExoticaPlotter.h:74
electrons_cff.objType
objType
Definition: electrons_cff.py:519
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
HLTExoticaPlotter::_hltProcessName
std::string _hltProcessName
Definition: HLTExoticaPlotter.h:75
HLTExoticaPlotter::_parametersTurnOn
std::vector< double > _parametersTurnOn
Definition: HLTExoticaPlotter.h:83
createfilelist.int
int
Definition: createfilelist.py:10
value
Definition: value.py:1
HLTExoticaPlotter::fillHist
void fillHist(const bool &passTrigger, const std::string &source, const std::string &objType, const std::string &var, const float &value)
Definition: HLTExoticaPlotter.cc:260
HLTExoticaPlotter::_parametersPhi
std::vector< double > _parametersPhi
Definition: HLTExoticaPlotter.h:82
SelectiveReadoutTask_cfi.edges
edges
Definition: SelectiveReadoutTask_cfi.py:107
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HLTExoticaPlotter::bookHist
void bookHist(DQMStore::IBooker &iBooker, const std::string &source, const std::string &objType, const std::string &variable)
Definition: HLTExoticaPlotter.cc:192
DDAxes::phi
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
taus_updatedMVAIds_cff.variable
variable
Definition: taus_updatedMVAIds_cff.py:33
HLTExoticaPlotter::_nObjects
unsigned int _nObjects
Definition: HLTExoticaPlotter.h:79
relativeConstraints.value
value
Definition: relativeConstraints.py:53
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
HLTExoticaPlotter::_drop_pt3
bool _drop_pt3
Definition: HLTExoticaPlotter.h:89
HLTExoticaPlotter::_drop_pt2
bool _drop_pt2
Definition: HLTExoticaPlotter.h:88
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98