CMS 3D CMS Logo

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

#include <HLTMuonPlotter.h>

Classes

struct  matchesByDescendingPt
 
struct  MatchStruct
 

Public Types

typedef dqm::legacy::DQMStore DQMStore
 
using ESTokens = hltriggeroffline::L1MuonMatcherAlgo::ESTokens
 
typedef dqm::legacy::MonitorElement MonitorElement
 

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &)
 
void beginJob ()
 
void beginRun (DQMStore::IBooker &, const edm::Run &, const edm::EventSetup &)
 
 HLTMuonPlotter (const edm::ParameterSet &, std::string, const std::vector< std::string > &, const std::vector< std::string > &, const std::tuple< edm::EDGetTokenT< trigger::TriggerEventWithRefs >, edm::EDGetTokenT< reco::GenParticleCollection >, edm::EDGetTokenT< reco::MuonCollection >> &, const ESTokens &)
 
 ~HLTMuonPlotter ()
 

Static Public Member Functions

static std::tuple
< edm::ESGetToken
< MagneticField,
IdealMagneticFieldRecord >
, edm::ESGetToken< Propagator,
TrackingComponentsRecord >
, edm::ESGetToken< Propagator,
TrackingComponentsRecord >
, edm::ESGetToken< Propagator,
TrackingComponentsRecord >
, edm::ESGetToken
< MuonDetLayerGeometry,
MuonRecoGeometryRecord > > 
getESTokens (edm::ConsumesCollector)
 
static std::tuple
< edm::EDGetTokenT
< trigger::TriggerEventWithRefs >
, edm::EDGetTokenT
< reco::GenParticleCollection >
, edm::EDGetTokenT
< reco::MuonCollection > > 
getTokens (const edm::ParameterSet &, edm::ConsumesCollector &&)
 

Private Member Functions

void analyzePath (const edm::Event &, const std::string &, const std::string &, const std::vector< MatchStruct > &, edm::Handle< trigger::TriggerEventWithRefs >)
 
void bookHist (DQMStore::IBooker &, std::string, std::string, std::string, std::string)
 
void findMatches (std::vector< MatchStruct > &, const l1t::MuonVectorRef &candsL1, const std::vector< std::vector< const reco::RecoChargedCandidate * >> &)
 

Private Attributes

double cutMaxEta_
 
double cutMinPt_
 
unsigned int cutMotherId_
 
std::vector< double > cutsDr_
 
std::map< std::string,
MonitorElement * > 
elements_
 
std::string genMuonCut_
 
StringCutObjectSelector
< reco::GenParticle > * 
genMuonSelector_
 
edm::EDGetTokenT
< reco::GenParticleCollection
genParticleLabel_
 
std::string hltPath_
 
std::string hltProcessName_
 
edm::EDGetTokenT
< trigger::TriggerEventWithRefs
hltTriggerSummaryRAW_
 
hltriggeroffline::L1MuonMatcherAlgo l1Matcher_
 
std::vector< std::string > moduleLabels_
 
std::vector< double > parametersEta_
 
std::vector< double > parametersPhi_
 
std::vector< double > parametersTurnOn_
 
std::string recMuonCut_
 
edm::EDGetTokenT
< reco::MuonCollection
recMuonLabel_
 
StringCutObjectSelector
< reco::Muon > * 
recMuonSelector_
 
std::vector< std::string > stepLabels_
 

Detailed Description

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

Author
J. Klukas, M. Vander Donckt, J. Alcaraz

Definition at line 50 of file HLTMuonPlotter.h.

Member Typedef Documentation

Definition at line 52 of file HLTMuonPlotter.h.

Definition at line 54 of file HLTMuonPlotter.h.

Definition at line 53 of file HLTMuonPlotter.h.

Constructor & Destructor Documentation

HLTMuonPlotter::HLTMuonPlotter ( const edm::ParameterSet ,
std::string  ,
const std::vector< std::string > &  ,
const std::vector< std::string > &  ,
const std::tuple< edm::EDGetTokenT< trigger::TriggerEventWithRefs >, edm::EDGetTokenT< reco::GenParticleCollection >, edm::EDGetTokenT< reco::MuonCollection >> &  ,
const ESTokens  
)

Definition at line 27 of file HLTMuonPlotter.cc.

References cutsDr_, genMuonCut_, genMuonSelector_, genParticleLabel_, edm::ParameterSet::getParameter(), hltPath_, hltProcessName_, hltTriggerSummaryRAW_, moduleLabels_, parametersEta_, parametersPhi_, parametersTurnOn_, recMuonCut_, recMuonLabel_, recMuonSelector_, and stepLabels_.

35  :
36 
37  l1Matcher_(pset, esTokens) {
38  hltPath_ = hltPath;
39  moduleLabels_ = moduleLabels;
40  stepLabels_ = stepLabels;
41  hltProcessName_ = pset.getParameter<string>("hltProcessName");
42 
43  cutsDr_ = pset.getParameter<vector<double>>("cutsDr");
44 
45  parametersEta_ = pset.getParameter<vector<double>>("parametersEta");
46  parametersPhi_ = pset.getParameter<vector<double>>("parametersPhi");
47  parametersTurnOn_ = pset.getParameter<vector<double>>("parametersTurnOn");
48 
49  genMuonCut_ = pset.getParameter<string>("genMuonCut");
50  recMuonCut_ = pset.getParameter<string>("recMuonCut");
51 
52  genMuonSelector_ = nullptr;
53  recMuonSelector_ = nullptr;
54 
55  // set tokens
56  hltTriggerSummaryRAW_ = std::get<0>(tokens);
57  genParticleLabel_ = std::get<1>(tokens);
58  recMuonLabel_ = std::get<2>(tokens);
59 }
hltriggeroffline::L1MuonMatcherAlgo l1Matcher_
std::string hltPath_
std::vector< double > parametersEta_
std::string genMuonCut_
std::vector< std::string > moduleLabels_
std::string recMuonCut_
std::vector< double > cutsDr_
edm::EDGetTokenT< reco::MuonCollection > recMuonLabel_
StringCutObjectSelector< reco::GenParticle > * genMuonSelector_
std::vector< std::string > stepLabels_
StringCutObjectSelector< reco::Muon > * recMuonSelector_
std::vector< double > parametersPhi_
std::string hltProcessName_
edm::EDGetTokenT< reco::GenParticleCollection > genParticleLabel_
edm::EDGetTokenT< trigger::TriggerEventWithRefs > hltTriggerSummaryRAW_
std::vector< double > parametersTurnOn_
HLTMuonPlotter::~HLTMuonPlotter ( )
inline

Definition at line 65 of file HLTMuonPlotter.h.

References genMuonSelector_, and recMuonSelector_.

65  {
66  delete genMuonSelector_;
67  delete recMuonSelector_;
68  }
StringCutObjectSelector< reco::GenParticle > * genMuonSelector_
StringCutObjectSelector< reco::Muon > * recMuonSelector_

Member Function Documentation

void HLTMuonPlotter::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)

Definition at line 108 of file HLTMuonPlotter.cc.

References submitPVResolutionJobs::count, cutMaxEta_, cutMinPt_, elements_, PVValHelper::eta, edm::HandleBase::failedToGet(), HcalObjRepresent::Fill(), spr::find(), findMatches(), genMuonCut_, genMuonSelector_, genParticleLabel_, genParticleCandidates2GenParticles_cfi::genParticles, edm::Event::getByToken(), hltPath_, hltProcessName_, hltTriggerSummaryRAW_, mps_fire::i, edm::EventBase::id(), HLT_FULL_cff::InputTag, edm::HandleBase::isValid(), dqmiolumiharvest::j, testEve_cfg::level, LogTrace, moduleLabels_, phi, DiDispStaMuonMonitor_cfi::pt, recMuonCut_, recMuonLabel_, recMuonSelector_, findQualityFiles::size, source, stepLabels_, GlobalPosition_Frontier_DevDB_cff::tag, trigger::TriggerL1Mu, and trigger::TriggerMuon.

108  {
109  LogTrace("HLTMuonVal") << "In HLTMuonPlotter::analyze, "
110  << "Event: " << iEvent.id();
111 
112  // cout << hltPath_ << endl;
113  // for (size_t i = 0; i < moduleLabels_.size(); i++)
114  // cout << " " << moduleLabels_[i] << endl;
115 
116  Handle<TriggerEventWithRefs> rawTriggerEvent;
117  Handle<MuonCollection> recMuons;
119 
120  iEvent.getByToken(hltTriggerSummaryRAW_, rawTriggerEvent);
121  if (rawTriggerEvent.failedToGet()) {
122  LogError("HLTMuonVal") << "No trigger summary found";
123  return;
124  }
125  iEvent.getByToken(recMuonLabel_, recMuons);
126  iEvent.getByToken(genParticleLabel_, genParticles);
127 
128  vector<string> sources;
129  if (genParticles.isValid())
130  sources.push_back("gen");
131  if (recMuons.isValid())
132  sources.push_back("rec");
133 
134  for (size_t sourceNo = 0; sourceNo < sources.size(); sourceNo++) {
135  string source = sources[sourceNo];
136 
137  // If this is the first event, initialize selectors
138  if (!genMuonSelector_)
140  if (!recMuonSelector_)
142 
143  // Make each good gen/rec muon into the base cand for a MatchStruct
144  vector<MatchStruct> matches;
145  if (source == "gen" && genParticles.isValid())
146  for (size_t i = 0; i < genParticles->size(); i++)
147  if ((*genMuonSelector_)(genParticles->at(i)))
148  matches.push_back(MatchStruct(&genParticles->at(i)));
149  if (source == "rec" && recMuons.isValid())
150  for (size_t i = 0; i < recMuons->size(); i++)
151  if ((*recMuonSelector_)(recMuons->at(i)))
152  matches.push_back(MatchStruct(&recMuons->at(i)));
153 
154  // Sort the MatchStructs by pT for later filling of turn-on curve
155  sort(matches.begin(), matches.end(), matchesByDescendingPt());
156 
157  const bool isDoubleMuonPath = (hltPath_.find("Double") != string::npos);
158  const size_t nFilters = moduleLabels_.size();
159  const size_t nSteps = stepLabels_.size();
160  const size_t nStepsHlt = nSteps - 2;
161  const int nObjectsToPassPath = (isDoubleMuonPath) ? 2 : 1;
162  l1t::MuonVectorRef candsL1;
163  vector<vector<RecoChargedCandidateRef>> refsHlt(nStepsHlt);
164  vector<vector<const RecoChargedCandidate *>> candsHlt(nStepsHlt);
165 
166  for (size_t i = 0; i < nFilters; i++) {
167  const int hltStep = i - 1;
169  size_t iFilter = rawTriggerEvent->filterIndex(tag);
170  if (iFilter < rawTriggerEvent->size()) {
171  if (i == 0)
172  rawTriggerEvent->getObjects(iFilter, TriggerL1Mu, candsL1);
173  else
174  rawTriggerEvent->getObjects(iFilter, TriggerMuon, refsHlt[hltStep]);
175  } else
176  LogTrace("HLTMuonVal") << "No collection with label " << tag;
177  }
178  for (size_t i = 0; i < nStepsHlt; i++)
179  for (size_t j = 0; j < refsHlt[i].size(); j++)
180  if (refsHlt[i][j].isAvailable()) {
181  candsHlt[i].push_back(&*refsHlt[i][j]);
182  } else {
183  LogWarning("HLTMuonPlotter") << "Ref refsHlt[i][j]: product not available " << i << " " << j;
184  }
185 
186  // Add trigger objects to the MatchStructs
187  findMatches(matches, candsL1, candsHlt);
188 
189  vector<size_t> matchesInEtaRange;
190  vector<bool> hasMatch(matches.size(), true);
191 
192  for (size_t step = 0; step < nSteps; step++) {
193  size_t hltStep = (step >= 2) ? step - 2 : 0;
194  if (nSteps == 6)
195  hltStep = hltStep - 1; // case of the tracker muon (it has no L2)
196  size_t level = 0;
197  if ((stepLabels_[step].find("L3TkIso") != string::npos) || (stepLabels_[step].find("TkTkIso") != string::npos))
198  level = 6;
199  else if ((stepLabels_[step].find("L3HcalIso") != string::npos) ||
200  (stepLabels_[step].find("TkEcalIso") != string::npos))
201  level = 5;
202  else if ((stepLabels_[step].find("L3EcalIso") != string::npos) ||
203  (stepLabels_[step].find("TkEcalIso") != string::npos))
204  level = 4;
205  else if ((stepLabels_[step].find("L3") != string::npos) || (stepLabels_[step].find("Tk") != string::npos))
206  level = 3;
207  else if (stepLabels_[step].find("L2") != string::npos)
208  level = 2;
209  else if (stepLabels_[step].find("L1") != string::npos)
210  level = 1;
211 
212  for (size_t j = 0; j < matches.size(); j++) {
213  if (level == 0) {
214  if (fabs(matches[j].candBase->eta()) < cutMaxEta_)
215  matchesInEtaRange.push_back(j);
216  } else if (level == 1) {
217  if (matches[j].candL1 == nullptr)
218  hasMatch[j] = false;
219  } else if (level >= 2) {
220  if (matches[j].candHlt[hltStep] == nullptr)
221  hasMatch[j] = false;
222  else if (!hasMatch[j]) {
223  LogTrace("HLTMuonVal") << "Match found for HLT step " << hltStep << " of " << nStepsHlt
224  << " without previous match!";
225  break;
226  }
227  }
228  }
229 
230  if (std::count(hasMatch.begin(), hasMatch.end(), true) < nObjectsToPassPath)
231  break;
232 
233  string pre = source + "Pass";
234  string post = "_" + stepLabels_[step];
235 
236  for (size_t j = 0; j < matches.size(); j++) {
237  float pt = matches[j].candBase->pt();
238  float eta = matches[j].candBase->eta();
239  float phi = matches[j].candBase->phi();
240  if (hasMatch[j]) {
241  if (!matchesInEtaRange.empty() && j == matchesInEtaRange[0])
242  elements_[pre + "MaxPt1" + post]->Fill(pt);
243  if (matchesInEtaRange.size() >= 2 && j == matchesInEtaRange[1])
244  elements_[pre + "MaxPt2" + post]->Fill(pt);
245  if (pt > cutMinPt_) {
246  elements_[pre + "Eta" + post]->Fill(eta);
247  if (fabs(eta) < cutMaxEta_)
248  elements_[pre + "Phi" + post]->Fill(phi);
249  }
250  }
251  }
252  }
253 
254  } // End loop over sources
255 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
enum start value shifted to 81 so as to avoid clashes with PDG codes
std::string hltPath_
Log< level::Error, false > LogError
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
std::string genMuonCut_
std::vector< std::string > moduleLabels_
#define LogTrace(id)
std::vector< MuonRef > MuonVectorRef
Definition: Muon.h:15
std::string recMuonCut_
void findMatches(std::vector< MatchStruct > &, const l1t::MuonVectorRef &candsL1, const std::vector< std::vector< const reco::RecoChargedCandidate * >> &)
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
edm::EDGetTokenT< reco::MuonCollection > recMuonLabel_
bool isValid() const
Definition: HandleBase.h:70
StringCutObjectSelector< reco::GenParticle > * genMuonSelector_
std::vector< std::string > stepLabels_
bool failedToGet() const
Definition: HandleBase.h:72
Helper structure to order MatchStruct.
Definition: MatchStruct.h:58
StringCutObjectSelector< reco::Muon > * recMuonSelector_
edm::EventID id() const
Definition: EventBase.h:59
step
Definition: StallMonitor.cc:94
tuple level
Definition: testEve_cfg.py:47
std::map< std::string, MonitorElement * > elements_
std::string hltProcessName_
Log< level::Warning, false > LogWarning
edm::EDGetTokenT< reco::GenParticleCollection > genParticleLabel_
edm::EDGetTokenT< trigger::TriggerEventWithRefs > hltTriggerSummaryRAW_
static std::string const source
Definition: EdmProvDump.cc:46
tuple size
Write out results.
void HLTMuonPlotter::analyzePath ( const edm::Event ,
const std::string &  ,
const std::string &  ,
const std::vector< MatchStruct > &  ,
edm::Handle< trigger::TriggerEventWithRefs  
)
private
void HLTMuonPlotter::beginJob ( void  )

Definition at line 61 of file HLTMuonPlotter.cc.

61 {}
void HLTMuonPlotter::beginRun ( DQMStore::IBooker iBooker,
const edm::Run iRun,
const edm::EventSetup iSetup 
)

Definition at line 63 of file HLTMuonPlotter.cc.

References dqm::implementation::IBooker::bookFloat(), bookHist(), reco::ceil(), cutMaxEta_, cutMinPt_, elements_, hltPath_, mps_fire::i, hltriggeroffline::L1MuonMatcherAlgo::init(), dqmiolumiharvest::j, l1Matcher_, dqm::implementation::NavigatorBase::setCurrentFolder(), source, stepLabels_, and dtDQMClient_cfg::threshold.

63  {
64  l1Matcher_.init(iSetup);
65 
66  cutMaxEta_ = 2.4;
67  if (hltPath_.find("eta2p1") != string::npos)
68  cutMaxEta_ = 2.1;
69 
70  // Choose a pT cut for gen/rec muons based on the pT cut in the hltPath_
71  unsigned int threshold = 0;
72  TPRegexp ptRegexp("Mu([0-9]+)");
73  TObjArray *regexArray = ptRegexp.MatchS(hltPath_);
74  if (regexArray->GetEntriesFast() == 2) {
75  threshold = atoi(((TObjString *)regexArray->At(1))->GetString());
76  }
77  delete regexArray;
78  // We select a whole number min pT cut slightly above the hltPath_'s final
79  // pt threshold, then subtract a bit to let through particle gun muons with
80  // exact integer pT:
81  cutMinPt_ = ceil(threshold * 1.1) - 0.01;
82  if (cutMinPt_ < 0.)
83  cutMinPt_ = 0.;
84 
85  string baseDir = "HLT/Muon/Distributions/";
86  iBooker.setCurrentFolder(baseDir + hltPath_);
87 
88  vector<string> sources(2);
89  sources[0] = "gen";
90  sources[1] = "rec";
91 
92  elements_["CutMinPt"] = iBooker.bookFloat("CutMinPt");
93  elements_["CutMaxEta"] = iBooker.bookFloat("CutMaxEta");
94  elements_["CutMinPt"]->Fill(cutMinPt_);
95  elements_["CutMaxEta"]->Fill(cutMaxEta_);
96 
97  for (size_t i = 0; i < sources.size(); i++) {
98  string source = sources[i];
99  for (size_t j = 0; j < stepLabels_.size(); j++) {
100  bookHist(iBooker, hltPath_, stepLabels_[j], source, "Eta");
101  bookHist(iBooker, hltPath_, stepLabels_[j], source, "Phi");
102  bookHist(iBooker, hltPath_, stepLabels_[j], source, "MaxPt1");
103  bookHist(iBooker, hltPath_, stepLabels_[j], source, "MaxPt2");
104  }
105  }
106 }
constexpr int32_t ceil(float num)
hltriggeroffline::L1MuonMatcherAlgo l1Matcher_
MonitorElement * bookFloat(TString const &name, FUNC onbooking=NOOP())
Definition: DQMStore.h:80
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
std::string hltPath_
std::vector< std::string > stepLabels_
void bookHist(DQMStore::IBooker &, std::string, std::string, std::string, std::string)
void init(const edm::EventSetup &iSetup)
std::map< std::string, MonitorElement * > elements_
static std::string const source
Definition: EdmProvDump.cc:46
void HLTMuonPlotter::bookHist ( DQMStore::IBooker ,
std::string  ,
std::string  ,
std::string  ,
std::string   
)
private

Definition at line 355 of file HLTMuonPlotter.cc.

References dqm::implementation::IBooker::book1D(), submitPVResolutionJobs::desc, elements_, h, mps_fire::i, label, SiStripPI::max, min(), mergeVDriftHistosByStation::name, parametersEta_, parametersPhi_, parametersTurnOn_, submitPVValidationJobs::params, source, and runGCPTkAlMap::title.

Referenced by beginRun().

355  {
356  string sourceUpper = source;
357  sourceUpper[0] = toupper(sourceUpper[0]);
358  string name = source + "Pass" + type + "_" + label;
359  TH1F *h;
360 
361  if (type.find("MaxPt") != string::npos) {
362  string desc = (type == "MaxPt1") ? "Leading" : "Next-to-Leading";
363  string title = "pT of " + desc + " " + sourceUpper + " Muon " + "matched to " + label;
364  const size_t nBins = parametersTurnOn_.size() - 1;
365  float *edges = new float[nBins + 1];
366  for (size_t i = 0; i < nBins + 1; i++)
367  edges[i] = parametersTurnOn_[i];
368  h = new TH1F(name.c_str(), title.c_str(), nBins, edges);
369  }
370 
371  else {
372  string symbol = (type == "Eta") ? "#eta" : "#phi";
373  string title = symbol + " of " + sourceUpper + " Muons " + "matched to " + label;
374  vector<double> params = (type == "Eta") ? parametersEta_ : parametersPhi_;
375  int nBins = (int)params[0];
376  double min = params[1];
377  double max = params[2];
378  h = new TH1F(name.c_str(), title.c_str(), nBins, min, max);
379  }
380 
381  h->Sumw2();
382  elements_[name] = iBooker.book1D(name, h);
383  delete h;
384 }
std::vector< double > parametersEta_
char const * label
T min(T a, T b)
Definition: MathUtil.h:58
std::vector< double > parametersPhi_
std::map< std::string, MonitorElement * > elements_
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
std::vector< double > parametersTurnOn_
static std::string const source
Definition: EdmProvDump.cc:46
void HLTMuonPlotter::findMatches ( std::vector< MatchStruct > &  matches,
const l1t::MuonVectorRef candsL1,
const std::vector< std::vector< const reco::RecoChargedCandidate * >> &  candsHlt 
)
private

Definition at line 285 of file HLTMuonPlotter.cc.

References SplitLinear::begin, deltar::bestMatch(), cutsDr_, HLT_FULL_cff::deltaR, reco::Candidate::eta(), mps_fire::i, edm::eventsetup::heterocontainer::insert(), dqmiolumiharvest::j, kNull, testEve_cfg::level, and reco::Candidate::phi().

Referenced by analyze().

287  {
288  set<size_t>::iterator it;
289 
290  set<size_t> indicesL1;
291  for (size_t i = 0; i < candsL1.size(); i++)
292  indicesL1.insert(i);
293 
294  vector<set<size_t>> indicesHlt(candsHlt.size());
295  for (size_t i = 0; i < candsHlt.size(); i++)
296  for (size_t j = 0; j < candsHlt[i].size(); j++)
297  indicesHlt[i].insert(j);
298 
299  for (size_t i = 0; i < matches.size(); i++) {
300  const Candidate *cand = matches[i].candBase;
301 
302  double bestDeltaR = cutsDr_[0];
303  size_t bestMatch = kNull;
304  for (it = indicesL1.begin(); it != indicesL1.end(); it++) {
305  if (candsL1[*it].isAvailable()) {
306  double dR = deltaR(cand->eta(), cand->phi(), candsL1[*it]->eta(), candsL1[*it]->phi());
307  if (dR < bestDeltaR) {
308  bestMatch = *it;
309  bestDeltaR = dR;
310  }
311  // TrajectoryStateOnSurface propagated;
312  // float dR = 999., dPhi = 999.;
313  // bool isValid = l1Matcher_.match(* cand, * candsL1[*it],
314  // dR, dPhi, propagated);
315  // if (isValid && dR < bestDeltaR) {
316  // bestMatch = *it;
317  // bestDeltaR = dR;
318  // }
319  } else {
320  LogWarning("HLTMuonPlotter") << "Ref candsL1[*it]: product not available " << *it;
321  }
322  }
323 
324  if (bestMatch != kNull)
325  matches[i].candL1 = &*candsL1[bestMatch];
326  indicesL1.erase(bestMatch);
327 
328  matches[i].candHlt.assign(candsHlt.size(), nullptr);
329  for (size_t j = 0; j < candsHlt.size(); j++) {
330  size_t level = (candsHlt.size() == 4) ? (j < 2) ? 2 : 3 : (candsHlt.size() == 2) ? (j < 1) ? 2 : 3 : 2;
331  bestDeltaR = cutsDr_[level - 2];
332  bestMatch = kNull;
333  for (it = indicesHlt[j].begin(); it != indicesHlt[j].end(); it++) {
334  double dR = deltaR(cand->eta(), cand->phi(), candsHlt[j][*it]->eta(), candsHlt[j][*it]->phi());
335  if (dR < bestDeltaR) {
336  bestMatch = *it;
337  bestDeltaR = dR;
338  }
339  }
340  if (bestMatch != kNull)
341  matches[i].candHlt[j] = candsHlt[j][bestMatch];
342  indicesHlt[j].erase(bestMatch);
343  }
344 
345  // cout << " Muon: " << cand->eta() << ", ";
346  // if (matches[i].candL1) cout << matches[i].candL1->eta() << ", ";
347  // else cout << "none, ";
348  // for (size_t j = 0; j < candsHlt.size(); j++)
349  // if (matches[i].candHlt[j]) cout << matches[i].candHlt[j]->eta() <<
350  // ", "; else cout << "none, ";
351  // cout << endl;
352  }
353 }
def bestMatch
Definition: deltar.py:138
std::vector< double > cutsDr_
const unsigned int kNull
bool insert(Storage &iStorage, ItemType *iItem, const IdTag &iIdTag)
Definition: HCMethods.h:50
tuple level
Definition: testEve_cfg.py:47
Log< level::Warning, false > LogWarning
virtual double phi() const =0
momentum azimuthal angle
virtual double eta() const =0
momentum pseudorapidity

Definition at line 281 of file HLTMuonPlotter.cc.

References hltriggeroffline::PropagateToMuon::getESTokens().

Referenced by HLTMuonValidator::HLTMuonValidator().

281  {
283 }
static ESTokens getESTokens(edm::ConsumesCollector)

Definition at line 260 of file HLTMuonPlotter.cc.

References edm::ParameterSet::getParameter(), and HLT_FULL_cff::InputTag.

Referenced by HLTMuonValidator::HLTMuonValidator().

260  {
262  iC.consumes<TriggerEventWithRefs>(edm::InputTag("hltTriggerSummaryRAW"));
264  iC.consumes<GenParticleCollection>(pset.getParameter<string>("genParticleLabel"));
266  iC.consumes<MuonCollection>(pset.getParameter<string>("recMuonLabel"));
267 
268  std::tuple<edm::EDGetTokenT<trigger::TriggerEventWithRefs>,
271  myTuple(_hltTriggerSummaryRAW, _genParticleLabel, _recMuonLabel);
272 
273  return (myTuple);
274 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
std::vector< Muon > MuonCollection
collection of Muon objects
Definition: MuonFwd.h:9
T getParameter(std::string const &) const
Definition: ParameterSet.h:303

Member Data Documentation

double HLTMuonPlotter::cutMaxEta_
private

Definition at line 131 of file HLTMuonPlotter.h.

Referenced by analyze(), and beginRun().

double HLTMuonPlotter::cutMinPt_
private

Definition at line 130 of file HLTMuonPlotter.h.

Referenced by analyze(), and beginRun().

unsigned int HLTMuonPlotter::cutMotherId_
private

Definition at line 132 of file HLTMuonPlotter.h.

std::vector<double> HLTMuonPlotter::cutsDr_
private

Definition at line 133 of file HLTMuonPlotter.h.

Referenced by findMatches(), and HLTMuonPlotter().

std::map<std::string, MonitorElement *> HLTMuonPlotter::elements_
private

Definition at line 142 of file HLTMuonPlotter.h.

Referenced by analyze(), beginRun(), and bookHist().

std::string HLTMuonPlotter::genMuonCut_
private

Definition at line 134 of file HLTMuonPlotter.h.

Referenced by analyze(), and HLTMuonPlotter().

StringCutObjectSelector<reco::GenParticle>* HLTMuonPlotter::genMuonSelector_
private

Definition at line 137 of file HLTMuonPlotter.h.

Referenced by analyze(), HLTMuonPlotter(), and ~HLTMuonPlotter().

edm::EDGetTokenT<reco::GenParticleCollection> HLTMuonPlotter::genParticleLabel_
private

Definition at line 123 of file HLTMuonPlotter.h.

Referenced by analyze(), and HLTMuonPlotter().

std::string HLTMuonPlotter::hltPath_
private

Definition at line 116 of file HLTMuonPlotter.h.

Referenced by analyze(), beginRun(), and HLTMuonPlotter().

std::string HLTMuonPlotter::hltProcessName_
private

Definition at line 117 of file HLTMuonPlotter.h.

Referenced by analyze(), and HLTMuonPlotter().

edm::EDGetTokenT<trigger::TriggerEventWithRefs> HLTMuonPlotter::hltTriggerSummaryRAW_
private

Definition at line 122 of file HLTMuonPlotter.h.

Referenced by analyze(), and HLTMuonPlotter().

hltriggeroffline::L1MuonMatcherAlgo HLTMuonPlotter::l1Matcher_
private

Definition at line 140 of file HLTMuonPlotter.h.

Referenced by beginRun().

std::vector<std::string> HLTMuonPlotter::moduleLabels_
private

Definition at line 119 of file HLTMuonPlotter.h.

Referenced by analyze(), and HLTMuonPlotter().

std::vector<double> HLTMuonPlotter::parametersEta_
private

Definition at line 126 of file HLTMuonPlotter.h.

Referenced by bookHist(), and HLTMuonPlotter().

std::vector<double> HLTMuonPlotter::parametersPhi_
private

Definition at line 127 of file HLTMuonPlotter.h.

Referenced by bookHist(), and HLTMuonPlotter().

std::vector<double> HLTMuonPlotter::parametersTurnOn_
private

Definition at line 128 of file HLTMuonPlotter.h.

Referenced by bookHist(), and HLTMuonPlotter().

std::string HLTMuonPlotter::recMuonCut_
private

Definition at line 135 of file HLTMuonPlotter.h.

Referenced by analyze(), and HLTMuonPlotter().

edm::EDGetTokenT<reco::MuonCollection> HLTMuonPlotter::recMuonLabel_
private

Definition at line 124 of file HLTMuonPlotter.h.

Referenced by analyze(), and HLTMuonPlotter().

StringCutObjectSelector<reco::Muon>* HLTMuonPlotter::recMuonSelector_
private

Definition at line 138 of file HLTMuonPlotter.h.

Referenced by analyze(), HLTMuonPlotter(), and ~HLTMuonPlotter().

std::vector<std::string> HLTMuonPlotter::stepLabels_
private

Definition at line 120 of file HLTMuonPlotter.h.

Referenced by analyze(), beginRun(), and HLTMuonPlotter().