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
HLTMuonMatchAndPlot Class Reference

#include <HLTMuonMatchAndPlot.h>

Public Types

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

Public Member Functions

void analyze (edm::Handle< reco::MuonCollection > &, edm::Handle< reco::BeamSpot > &, edm::Handle< reco::VertexCollection > &, edm::Handle< trigger::TriggerEvent > &, edm::Handle< edm::TriggerResults > &, const edm::TriggerNames &)
 
void beginRun (DQMStore::IBooker &, const edm::Run &, const edm::EventSetup &)
 
void endRun (const edm::Run &, const edm::EventSetup &)
 
void fillEdges (size_t &nBins, float *&edges, const std::vector< double > &binning)
 
template<class T >
void fillMapFromPSet (std::map< std::string, T > &, const edm::ParameterSet &, const std::string &)
 
template<class T >
void fillMapFromPSet (map< string, T > &m, const ParameterSet &pset, const string &target)
 
 HLTMuonMatchAndPlot (const edm::ParameterSet &, std::string, std::string, bool)
 Constructor. More...
 
template<class T1 , class T2 >
std::vector< size_t > matchByDeltaR (const std::vector< T1 > &, const std::vector< T2 > &, const double maxDeltaR=NOMATCH)
 
template<class T1 , class T2 >
vector< size_t > matchByDeltaR (const vector< T1 > &collection1, const vector< T2 > &collection2, const double maxDeltaR)
 

Private Member Functions

void book1D (DQMStore::IBooker &, std::string, const std::string &, std::string)
 
void book2D (DQMStore::IBooker &, const std::string &, const std::string &, const std::string &, const std::string &)
 
reco::MuonCollection selectedMuons (const reco::MuonCollection &, const reco::BeamSpot &, bool, const StringCutObjectSelector< reco::Muon > &, double, double)
 
trigger::TriggerObjectCollection selectedTriggerObjects (const trigger::TriggerObjectCollection &, const trigger::TriggerEvent &, bool hasTriggerCuts, const StringCutObjectSelector< trigger::TriggerObject > &triggerSelector)
 

Private Attributes

std::map< std::string,
std::vector< double > > 
binParams_
 
unsigned int cutMinPt_
 
std::string destination_
 
bool hasProbeRecoCuts
 
bool hasTargetRecoCuts
 
bool hasTriggerCuts_
 
std::map< std::string,
MonitorElement * > 
hists_
 
std::string hltPath_
 
std::string hltProcessName_
 
bool isLastFilter_
 
std::string moduleLabel_
 
std::map< std::string, double > plotCuts_
 
double probeD0Cut_
 
StringCutObjectSelector
< reco::Muon
probeMuonSelector_
 
edm::ParameterSet probeParams_
 
double probeZ0Cut_
 
std::vector< std::string > requiredTriggers_
 
double targetD0Cut_
 
StringCutObjectSelector
< reco::Muon
targetMuonSelector_
 
edm::ParameterSet targetParams_
 
double targetptCutJpsi_
 
double targetptCutZ_
 
double targetZ0Cut_
 
std::string triggerLevel_
 
StringCutObjectSelector
< trigger::TriggerObject
triggerSelector_
 

Detailed Description

Match reconstructed muons to HLT objects and plot efficiencies.

Note that this is not a true EDAnalyzer;

Documentation available on the CMS TWiki: https://twiki.cern.ch/twiki/bin/view/CMS/MuonHLTOfflinePerformance

Author
J. Slaunwhite, Jeff Klukas

Contanier class to handle vector of reconstructed muons matched to HLT objects used to plot efficiencies.

Note that this is not a true EDAnalyzer; rather, the intent is that one EDAnalyzer would call an instance of HLTMuonMatchAndPlotContainer

Documentation available on the CMS TWiki: https://twiki.cern.ch/twiki/bin/view/CMS/MuonHLTOfflinePerformance

Author
C. Battilana

Definition at line 57 of file HLTMuonMatchAndPlot.h.

Member Typedef Documentation

Definition at line 59 of file HLTMuonMatchAndPlot.h.

Definition at line 60 of file HLTMuonMatchAndPlot.h.

Constructor & Destructor Documentation

HLTMuonMatchAndPlot::HLTMuonMatchAndPlot ( const edm::ParameterSet ,
std::string  ,
std::string  ,
bool   
)

Constructor.

Definition at line 37 of file HLTMuonMatchAndPlot.cc.

References binParams_, reco::ceil(), cutMinPt_, fillMapFromPSet(), hltPath_, moduleLabel_, plotCuts_, and triggerLevel_.

38  : hltProcessName_(pset.getParameter<string>("hltProcessName")),
39  destination_(pset.getUntrackedParameter<string>("destination")),
40  requiredTriggers_(pset.getUntrackedParameter<vstring>("requiredTriggers")),
41  targetParams_(pset.getParameterSet("targetParams")),
42  probeParams_(pset.getParameterSet("probeParams")),
43  hltPath_(std::move(hltPath)),
44  moduleLabel_(std::move(moduleLabel)),
45  isLastFilter_(islastfilter),
49  targetZ0Cut_(targetParams_.getUntrackedParameter<double>("z0Cut", 0.)),
50  targetD0Cut_(targetParams_.getUntrackedParameter<double>("d0Cut", 0.)),
51  targetptCutZ_(targetParams_.getUntrackedParameter<double>("ptCut_Z", 20.)),
52  targetptCutJpsi_(targetParams_.getUntrackedParameter<double>("ptCut_Jpsi", 20.)),
53  probeMuonSelector_(probeParams_.getUntrackedParameter<string>("recoCuts", "")),
54  probeZ0Cut_(probeParams_.getUntrackedParameter<double>("z0Cut", 0.)),
55  probeD0Cut_(probeParams_.getUntrackedParameter<double>("d0Cut", 0.)),
58  // Create std::map<string, T> from ParameterSets.
59  fillMapFromPSet(binParams_, pset, "binParams");
60  fillMapFromPSet(plotCuts_, pset, "plotCuts");
61 
62  // Get the trigger level.
63  triggerLevel_ = "L3";
64  TPRegexp levelRegexp("L[1-3]");
65  // size_t nModules = moduleLabels_.size();
66  // cout << moduleLabel_ << " " << hltPath_ << endl;
67  TObjArray* levelArray = levelRegexp.MatchS(moduleLabel_);
68  if (levelArray->GetEntriesFast() > 0) {
69  triggerLevel_ = static_cast<const char*>(((TObjString*)levelArray->At(0))->GetString());
70  }
71  delete levelArray;
72 
73  // Get the pT cut by parsing the name of the HLT path.
74  cutMinPt_ = 3;
75  TPRegexp ptRegexp("Mu([0-9]*)");
76  TObjArray* objArray = ptRegexp.MatchS(hltPath_);
77  if (objArray->GetEntriesFast() >= 2) {
78  auto* ptCutString = (TObjString*)objArray->At(1);
79  cutMinPt_ = atoi(ptCutString->GetString());
80  cutMinPt_ = ceil(cutMinPt_ * plotCuts_["minPtFactor"]);
81  }
82  delete objArray;
83 }
constexpr int32_t ceil(float num)
T getUntrackedParameter(std::string const &, T const &) const
StringCutObjectSelector< reco::Muon > probeMuonSelector_
vector< string > vstring
Definition: ExoticaDQM.cc:8
edm::ParameterSet targetParams_
bool exists(std::string const &parameterName) const
checks if a parameter exists
std::map< std::string, std::vector< double > > binParams_
std::vector< std::string > requiredTriggers_
void fillMapFromPSet(std::map< std::string, T > &, const edm::ParameterSet &, const std::string &)
def move
Definition: eostools.py:511
StringCutObjectSelector< reco::Muon > targetMuonSelector_
edm::ParameterSet probeParams_
StringCutObjectSelector< trigger::TriggerObject > triggerSelector_
std::map< std::string, double > plotCuts_

Member Function Documentation

void HLTMuonMatchAndPlot::analyze ( edm::Handle< reco::MuonCollection > &  allMuons,
edm::Handle< reco::BeamSpot > &  beamSpot,
edm::Handle< reco::VertexCollection > &  vertices,
edm::Handle< trigger::TriggerEvent > &  triggerSummary,
edm::Handle< edm::TriggerResults > &  triggerResults,
const edm::TriggerNames trigNames 
)

Definition at line 203 of file HLTMuonMatchAndPlot.cc.

References RecoTauCleanerPlugins::charge, reco::LeafCandidate::charge(), cutMinPt_, d0, HLT_FULL_cff::deltaR, reco::TrackBase::dxy(), reco::TrackBase::dz(), EFFICIENCY_SUFFIXES, trigger::TriggerObject::eta(), PVValHelper::eta, reco::LeafCandidate::eta(), hasProbeRecoCuts, hasTargetRecoCuts, hasTriggerCuts_, hists_, hltPath_, mps_fire::i, reco::Muon::innerTrack(), isLastFilter_, reco::Muon::isStandAloneMuon(), reco::Muon::isTrackerMuon(), isotrackApplyRegressor::k, ResonanceBuilder::mass, matchByDeltaR(), HLT_FULL_cff::muon, reco::Muon::outerTrack(), reco::RecoCandidate::p4, trigger::TriggerObject::phi(), reco::LeafCandidate::phi(), plotCuts_, probeD0Cut_, probeMuonSelector_, probeZ0Cut_, DiDispStaMuonMonitor_cfi::pt, trigger::TriggerObject::pt(), reco::LeafCandidate::pt(), requiredTriggers_, selectedMuons(), selectedTriggerObjects(), edm::TriggerNames::size(), createPayload::suffix, targetD0Cut_, targetMuonSelector_, targetptCutJpsi_, targetptCutZ_, targetZ0Cut_, HLT_FULL_cff::track, triggerLevel_, edm::TriggerNames::triggerName(), and triggerSelector_.

208  {
209  /*
210  if(gen != 0) {
211  for(g_part = gen->begin(); g_part != gen->end(); g_part++){
212  if( abs(g_part->pdgId()) == 13) {
213  if(!( g_part->status() ==1 || (g_part->status() ==2 && abs(g_part->pdgId())==5))) continue;
214  bool GenMomExists (true);
215  bool GenGrMomExists(true);
216  if( g_part->pt() < 10.0 ) continue;
217  if( fabs(g_part->eta()) > 2.4 ) continue;
218  int gen_id= g_part->pdgId();
219  const GenParticle* gen_lept = &(*g_part);
220  // get mother of gen_lept
221  const GenParticle* gen_mom = static_cast<const GenParticle*> (gen_lept->mother());
222  if(gen_mom==NULL) GenMomExists=false;
223  int m_id=-999;
224  if(GenMomExists) m_id = gen_mom->pdgId();
225  if(m_id != gen_id || !GenMomExists);
226  else{
227  int id= m_id;
228  while(id == gen_id && GenMomExists){
229  gen_mom = static_cast<const GenParticle*> (gen_mom->mother());
230  if(gen_mom==NULL){
231  GenMomExists=false;
232  }
233  if(GenMomExists) id=gen_mom->pdgId();
234  }
235  }
236  if(GenMomExists) m_id = gen_mom->pdgId();
237  gen_leptsp.push_back(gen_lept);
238  gen_momsp.push_back(gen_mom);
239  }
240  }
241  }
242 
243 
244  std::vector<GenParticle> gen_lepts;
245  for(size_t i = 0; i < gen_leptsp.size(); i++) {
246  gen_lepts.push_back(*gen_leptsp[i]);
247  }
248 
249 
250  */
251 
252  // Select objects based on the configuration.
253  MuonCollection targetMuons =
255  MuonCollection probeMuons =
257  TriggerObjectCollection allTriggerObjects = triggerSummary->getObjects();
258  TriggerObjectCollection hltMuons =
259  selectedTriggerObjects(allTriggerObjects, *triggerSummary, hasTriggerCuts_, triggerSelector_);
260  // Fill plots for HLT muons.
261  if (isLastFilter_) {
262  for (auto& hltMuon : hltMuons) {
263  hists_["hltPt"]->Fill(hltMuon.pt());
264  hists_["hltEta"]->Fill(hltMuon.eta());
265  hists_["hltPhi"]->Fill(hltMuon.phi());
266  }
267  }
268  // Find the best trigger object matches for the targetMuons.
269  vector<size_t> matches = matchByDeltaR(targetMuons, hltMuons, plotCuts_[triggerLevel_ + "DeltaR"]);
270 
271  // Fill plots for matched muons.
272  bool pairalreadyconsidered = false;
273  for (size_t i = 0; i < targetMuons.size(); i++) {
274  Muon& muon = targetMuons[i];
275 
276  // Fill plots which are not efficiencies.
277  if (matches[i] < targetMuons.size()) {
278  TriggerObject& hltMuon = hltMuons[matches[i]];
279  double ptRes = (muon.pt() - hltMuon.pt()) / muon.pt();
280  hists_["resolutionPt"]->Fill(ptRes);
281  hists_["deltaR"]->Fill(deltaR(muon, hltMuon));
282 
283  if (isLastFilter_) {
284  double etaRes = muon.eta() - hltMuon.eta();
285  double phiRes = muon.phi() - hltMuon.phi();
286  hists_["resolutionEta"]->Fill(etaRes);
287  hists_["resolutionPhi"]->Fill(phiRes);
288  }
289  }
290 
291  // Fill numerators and denominators for efficiency plots.
292  for (const auto& suffix : EFFICIENCY_SUFFIXES) {
293  // If no match was found, then the numerator plots don't get filled.
294  if (suffix == "numer" && matches[i] >= targetMuons.size())
295  continue;
296 
297  if (muon.pt() > cutMinPt_) {
298  hists_["efficiencyEta_" + suffix]->Fill(muon.eta());
299  hists_["efficiencyPhiVsEta_" + suffix]->Fill(muon.eta(), muon.phi());
300  hists_["MR_efficiencyPhiVsEta_" + suffix]->Fill(muon.eta(), muon.phi());
301  }
302 
303  if (fabs(muon.eta()) < plotCuts_["maxEta"]) {
304  hists_["efficiencyTurnOn_" + suffix]->Fill(muon.pt());
305  }
306 
307  if (muon.pt() > cutMinPt_ && fabs(muon.eta()) < plotCuts_["maxEta"]) {
308  const Track* track = nullptr;
309  if (muon.isTrackerMuon())
310  track = &*muon.innerTrack();
311  else if (muon.isStandAloneMuon())
312  track = &*muon.outerTrack();
313  if (track) {
314  hists_["efficiencyVertex_" + suffix]->Fill(vertices->size());
315  hists_["efficiencyPhi_" + suffix]->Fill(muon.phi());
316 
317  if (isLastFilter_) {
318  double d0 = track->dxy(beamSpot->position());
319  double z0 = track->dz(beamSpot->position());
320  hists_["efficiencyD0_" + suffix]->Fill(d0);
321  hists_["efficiencyZ0_" + suffix]->Fill(z0);
322  hists_["efficiencyCharge_" + suffix]->Fill(muon.charge());
323  }
324  }
325  }
326  } // finish loop numerator / denominator...
327 
328  if (!isLastFilter_)
329  continue;
330  // Fill plots for tag and probe
331  // Muon cannot be a tag because doesn't match an hlt muon
332  if (matches[i] >= targetMuons.size())
333  continue;
334  for (size_t k = 0; k < targetMuons.size(); k++) {
335  if (k == i)
336  continue;
337  Muon& theProbe = targetMuons[k];
338  if (muon.charge() != theProbe.charge() && !pairalreadyconsidered) {
339  double mass = (muon.p4() + theProbe.p4()).M();
340 
341  if (mass > 60 && mass < 120) {
342  if (muon.pt() < targetptCutZ_)
343  continue;
344  hists_["massVsPtZ_denom"]->Fill(theProbe.pt());
345  hists_["massVsEtaZ_denom"]->Fill(theProbe.eta());
346  if (theProbe.pt() > cutMinPt_) {
347  hists_["MR_massVsEtaZ_denom"]->Fill(theProbe.eta());
348  hists_["MR_massVsPhiZ_denom"]->Fill(theProbe.phi());
349  hists_["MR_massVsPtZ_denom"]->Fill(theProbe.pt());
350  hists_["massVsVertexZ_denom"]->Fill(vertices->size());
351  hists_["MR_massVsVertexZ_denom"]->Fill(vertices->size());
352  }
353  const Track* track = nullptr;
354  if (theProbe.isTrackerMuon())
355  track = &*theProbe.innerTrack();
356  else if (theProbe.isStandAloneMuon())
357  track = &*theProbe.outerTrack();
358  if (track) {
359  hists_["massVsDZZ_denom"]->Fill(track->dz(beamSpot->position()));
360  hists_["MR_massVsDZZ_denom"]->Fill(track->dz(beamSpot->position()));
361  }
362  hists_["efficiencyDeltaR_denom"]->Fill(deltaR(theProbe, muon));
363  if (matches[k] < targetMuons.size()) {
364  hists_["massVsPtZ_numer"]->Fill(theProbe.pt());
365  hists_["MR_massVsPtZ_numer"]->Fill(theProbe.pt());
366  if (theProbe.pt() > cutMinPt_) {
367  hists_["MR_massVsPhiZ_numer"]->Fill(theProbe.phi());
368  hists_["massVsEtaZ_numer"]->Fill(theProbe.eta());
369  hists_["MR_massVsEtaZ_numer"]->Fill(theProbe.eta());
370  hists_["massVsVertexZ_numer"]->Fill(vertices->size());
371  hists_["MR_massVsVertexZ_numer"]->Fill(vertices->size());
372  }
373  if (track) {
374  hists_["massVsDZZ_numer"]->Fill(track->dz(beamSpot->position()));
375  hists_["MR_massVsDZZ_numer"]->Fill(track->dz(beamSpot->position()));
376  }
377  hists_["efficiencyDeltaR_numer"]->Fill(deltaR(theProbe, muon));
378  }
379  pairalreadyconsidered = true;
380  }
381  if (mass > 1 && mass < 4) {
382  if (muon.pt() < targetptCutJpsi_)
383  continue;
384  hists_["massVsEtaJpsi_denom"]->Fill(theProbe.eta());
385  hists_["MR_massVsEtaJpsi_denom"]->Fill(theProbe.eta());
386  hists_["massVsPtJpsi_denom"]->Fill(theProbe.pt());
387  hists_["MR_massVsPtJpsi_denom"]->Fill(theProbe.pt());
388  hists_["massVsVertexJpsi_denom"]->Fill(vertices->size());
389  hists_["MR_massVsVertexJpsi_denom"]->Fill(vertices->size());
390  if (matches[k] < targetMuons.size()) {
391  hists_["massVsEtaJpsi_numer"]->Fill(theProbe.eta());
392  hists_["MR_massVsEtaJpsi_numer"]->Fill(theProbe.eta());
393  hists_["massVsPtJpsi_numer"]->Fill(theProbe.pt());
394  hists_["MR_massVsPtJpsi_numer"]->Fill(theProbe.pt());
395  hists_["massVsVertexJpsi_numer"]->Fill(vertices->size());
396  hists_["MR_massVsVertexJpsi_numer"]->Fill(vertices->size());
397  }
398  pairalreadyconsidered = true;
399  }
400  }
401  } // End loop over denominator and numerator.
402  } // End loop over targetMuons.
403 
404  // fill eff histograms for reference trigger method
405  // Denominator: events passing reference trigger and two target muons
406  // Numerator: events in the denominator with two target muons
407  // matched to hlt muons
408  if (!isLastFilter_)
409  return;
410  unsigned int numTriggers = trigNames.size();
411  bool passTrigger = false;
412  if (requiredTriggers_.empty())
413  passTrigger = true;
414  for (auto const& requiredTrigger : requiredTriggers_) {
415  for (unsigned int hltIndex = 0; hltIndex < numTriggers; ++hltIndex) {
416  passTrigger = (trigNames.triggerName(hltIndex).find(requiredTrigger) != std::string::npos &&
417  triggerResults->wasrun(hltIndex) && triggerResults->accept(hltIndex));
418  if (passTrigger)
419  break;
420  }
421  }
422 
423  int nMatched = 0;
424  for (unsigned long matche : matches) {
425  if (matche < targetMuons.size())
426  nMatched++;
427  }
428  if (!requiredTriggers_.empty() && targetMuons.size() > 1 && passTrigger) {
429  // denominator:
430  hists_["Refefficiency_Eta_Mu1_denom"]->Fill(targetMuons.at(0).eta());
431  hists_["Refefficiency_Eta_Mu2_denom"]->Fill(targetMuons.at(1).eta());
432  hists_["Refefficiency_TurnOn_Mu1_denom"]->Fill(targetMuons.at(0).pt());
433  hists_["MR_Refefficiency_TurnOn_Mu1_denom"]->Fill(targetMuons.at(0).pt());
434  hists_["Refefficiency_TurnOn_Mu2_denom"]->Fill(targetMuons.at(1).pt());
435  hists_["MR_Refefficiency_TurnOn_Mu2_denom"]->Fill(targetMuons.at(1).pt());
436  hists_["Refefficiency_Vertex_denom"]->Fill(vertices->size());
437  hists_["MR_Refefficiency_Vertex_denom"]->Fill(vertices->size());
438  hists_["MR_Refefficiency_Pt_denom"]->Fill(targetMuons.at(0).pt(), targetMuons.at(1).pt());
439  hists_["Refefficiency_Pt_denom"]->Fill(targetMuons.at(0).pt(), targetMuons.at(1).pt());
440  hists_["Refefficiency_Eta_denom"]->Fill(targetMuons.at(0).eta(), targetMuons.at(1).eta());
441 
442  // if (track0){
443  // hists_["Refefficiency_DZ_Mu1_denom"]->Fill(track0->dz(beamSpot->position()));
444  // hists_["MR_Refefficiency_DZ_Mu1_denom"]->Fill(track0->dz(beamSpot->position()));
445  // }
446 
447  // if (track1){
448  // hists_["Refefficiency_DZ_Mu2_denom"]->Fill(track1->dz(beamSpot->position()));
449  // hists_["MR_Refefficiency_DZ_Mu2_denom"]->Fill(track1->dz(beamSpot->position()));
450  // }
451 
452  // numerator:
453  if (nMatched > 1) {
454  hists_["Refefficiency_Eta_Mu1_numer"]->Fill(targetMuons.at(0).eta());
455  hists_["Refefficiency_Eta_Mu2_numer"]->Fill(targetMuons.at(1).eta());
456  hists_["Refefficiency_TurnOn_Mu1_numer"]->Fill(targetMuons.at(0).pt());
457  hists_["MR_Refefficiency_TurnOn_Mu1_numer"]->Fill(targetMuons.at(0).pt());
458  hists_["Refefficiency_TurnOn_Mu2_numer"]->Fill(targetMuons.at(1).pt());
459  hists_["MR_Refefficiency_TurnOn_Mu2_numer"]->Fill(targetMuons.at(1).pt());
460  hists_["Refefficiency_Vertex_numer"]->Fill(vertices->size());
461  hists_["MR_Refefficiency_Vertex_numer"]->Fill(vertices->size());
462  hists_["MR_Refefficiency_Pt_numer"]->Fill(targetMuons.at(0).pt(), targetMuons.at(1).pt());
463  hists_["Refefficiency_Pt_numer"]->Fill(targetMuons.at(0).pt(), targetMuons.at(1).pt());
464  hists_["Refefficiency_Eta_numer"]->Fill(targetMuons.at(0).eta(), targetMuons.at(1).eta());
465 
466  // if (track0){
467  // hists_["Refefficiency_DZ_Mu1_numer"]->Fill(track0->dz(beamSpot->position()));
468  // hists_["MR_Refefficiency_DZ_Mu1_numer"]->Fill(track0->dz(beamSpot->position()));
469  // }
470  // if (track1){
471  // hists_["Refefficiency_DZ_Mu2_numer"]->Fill(track1->dz(beamSpot->position()));
472  // hists_["MR_Refefficiency_DZ_Mu2_numer"]->Fill(track1->dz(beamSpot->position()));
473  // }
474  }
475  }
476 
477  string nonSameSignPath = hltPath_;
478  bool ssPath = false;
479  if (nonSameSignPath.rfind("_SameSign") < nonSameSignPath.length()) {
480  ssPath = true;
481  nonSameSignPath = boost::replace_all_copy<string>(nonSameSignPath, "_SameSign", "");
482  nonSameSignPath = nonSameSignPath.substr(0, nonSameSignPath.rfind("_v") + 2);
483  }
484  bool passTriggerSS = false;
485  if (ssPath) {
486  for (unsigned int hltIndex = 0; hltIndex < numTriggers; ++hltIndex) {
487  passTriggerSS =
488  passTriggerSS || (trigNames.triggerName(hltIndex).substr(0, nonSameSignPath.size()) == nonSameSignPath &&
489  triggerResults->wasrun(hltIndex) && triggerResults->accept(hltIndex));
490  }
491 
492  if (ssPath && targetMuons.size() > 1 && passTriggerSS) {
493  if (targetMuons[0].charge() * targetMuons[1].charge() > 0) {
494  hists_["Ref_SS_pt1_denom"]->Fill(targetMuons[0].pt());
495  hists_["Ref_SS_pt2_denom"]->Fill(targetMuons[1].pt());
496  hists_["Ref_SS_eta1_denom"]->Fill(targetMuons[0].eta());
497  hists_["Ref_SS_eta2_denom"]->Fill(targetMuons[1].eta());
498  if (nMatched > 1) {
499  hists_["Ref_SS_pt1_numer"]->Fill(targetMuons[0].pt());
500  hists_["Ref_SS_pt2_numer"]->Fill(targetMuons[1].pt());
501  hists_["Ref_SS_eta1_numer"]->Fill(targetMuons[0].eta());
502  hists_["Ref_SS_eta2_numer"]->Fill(targetMuons[1].eta());
503  }
504  }
505  }
506  }
507 
508  string nonDZPath = hltPath_;
509  bool dzPath = false;
510  if (nonDZPath.rfind("_DZ") < nonDZPath.length()) {
511  dzPath = true;
512  nonDZPath = boost::replace_all_copy<string>(nonDZPath, "_DZ", "");
513  nonDZPath = nonDZPath.substr(0, nonDZPath.rfind("_v") + 2);
514  }
515  bool passTriggerDZ = false;
516  if (dzPath) {
517  for (unsigned int hltIndex = 0; hltIndex < numTriggers; ++hltIndex) {
518  passTriggerDZ = passTriggerDZ || (trigNames.triggerName(hltIndex).find(nonDZPath) != std::string::npos &&
519  triggerResults->wasrun(hltIndex) && triggerResults->accept(hltIndex));
520  }
521  }
522 
523  if (dzPath && targetMuons.size() > 1 && passTriggerDZ) {
524  const Track* track0 = nullptr;
525  const Track* track1 = nullptr;
526  if (targetMuons.at(0).isTrackerMuon())
527  track0 = &*targetMuons.at(0).innerTrack();
528  else if (targetMuons.at(0).isTrackerMuon())
529  track0 = &*targetMuons.at(0).outerTrack();
530  if (targetMuons.at(1).isTrackerMuon())
531  track1 = &*targetMuons.at(1).innerTrack();
532  else if (targetMuons.at(1).isTrackerMuon())
533  track1 = &*targetMuons.at(1).outerTrack();
534 
535  if (track0 && track1) {
536  hists_["Refefficiency_DZ_Mu_denom"]->Fill(track0->dz(beamSpot->position()) - track1->dz(beamSpot->position()));
537  hists_["MR_Refefficiency_DZ_Mu_denom"]->Fill(track0->dz(beamSpot->position()) - track1->dz(beamSpot->position()));
538  }
539  hists_["Refefficiency_DZ_Vertex_denom"]->Fill(vertices->size());
540  hists_["MR_Refefficiency_DZ_Vertex_denom"]->Fill(vertices->size());
541  if (nMatched > 1) {
542  if (track0 && track1) {
543  hists_["Refefficiency_DZ_Mu_numer"]->Fill(track0->dz(beamSpot->position()) - track1->dz(beamSpot->position()));
544  hists_["MR_Refefficiency_DZ_Mu_numer"]->Fill(track0->dz(beamSpot->position()) -
545  track1->dz(beamSpot->position()));
546  hists_["Refefficiency_DZ_Vertex_numer"]->Fill(vertices->size());
547  hists_["MR_Refefficiency_DZ_Vertex_numer"]->Fill(vertices->size());
548  }
549  }
550  }
551 
552  // Plot fake rates (efficiency for HLT objects to not get matched to RECO).
553  vector<size_t> hltMatches = matchByDeltaR(hltMuons, targetMuons, plotCuts_[triggerLevel_ + "DeltaR"]);
554  for (size_t i = 0; i < hltMuons.size(); i++) {
555  TriggerObject& hltMuon = hltMuons[i];
556  bool isFake = hltMatches[i] > hltMuons.size();
557  for (const auto& suffix : EFFICIENCY_SUFFIXES) {
558  // If match is found, then numerator plots should not get filled
559  if (suffix == "numer" && !isFake)
560  continue;
561  hists_["fakerateVertex_" + suffix]->Fill(vertices->size());
562  hists_["fakerateEta_" + suffix]->Fill(hltMuon.eta());
563  hists_["fakeratePhi_" + suffix]->Fill(hltMuon.phi());
564  hists_["fakerateTurnOn_" + suffix]->Fill(hltMuon.pt());
565  } // End loop over numerator and denominator.
566  } // End loop over hltMuons.
567 
568 } // End analyze() method.
std::size_t size() const
Definition: TriggerNames.cc:59
reco::MuonCollection selectedMuons(const reco::MuonCollection &, const reco::BeamSpot &, bool, const StringCutObjectSelector< reco::Muon > &, double, double)
StringCutObjectSelector< reco::Muon > probeMuonSelector_
double pt() const final
transverse momentum
const std::string EFFICIENCY_SUFFIXES[2]
virtual TrackRef innerTrack() const
Definition: Muon.h:45
float phi() const
Definition: TriggerObject.h:54
std::map< std::string, MonitorElement * > hists_
float eta() const
Definition: TriggerObject.h:53
bool isTrackerMuon() const override
Definition: Muon.h:300
std::vector< Muon > MuonCollection
collection of Muon objects
Definition: MuonFwd.h:9
std::vector< std::string > requiredTriggers_
Single trigger physics object (e.g., an isolated muon)
Definition: TriggerObject.h:21
std::vector< size_t > matchByDeltaR(const std::vector< T1 > &, const std::vector< T2 > &, const double maxDeltaR=NOMATCH)
trigger::TriggerObjectCollection selectedTriggerObjects(const trigger::TriggerObjectCollection &, const trigger::TriggerEvent &, bool hasTriggerCuts, const StringCutObjectSelector< trigger::TriggerObject > &triggerSelector)
virtual TrackRef outerTrack() const
reference to Track reconstructed in the muon detector only
Definition: Muon.h:48
double dz() const
dz parameter (= dsz/cos(lambda)). This is the track z0 w.r.t (0,0,0) only if the refPoint is close to...
Definition: TrackBase.h:622
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:75
static constexpr float d0
StringCutObjectSelector< reco::Muon > targetMuonSelector_
std::string const & triggerName(unsigned int index) const
Definition: TriggerNames.cc:50
StringCutObjectSelector< trigger::TriggerObject > triggerSelector_
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...
Definition: TrackBase.h:608
double phi() const final
momentum azimuthal angle
std::map< std::string, double > plotCuts_
int charge() const final
electric charge
bool isStandAloneMuon() const override
Definition: Muon.h:301
double eta() const final
momentum pseudorapidity
void HLTMuonMatchAndPlot::beginRun ( DQMStore::IBooker iBooker,
const edm::Run iRun,
const edm::EventSetup iSetup 
)

Definition at line 85 of file HLTMuonMatchAndPlot.cc.

References book1D(), book2D(), destination_, EFFICIENCY_SUFFIXES, hltPath_, isLastFilter_, moduleLabel_, requiredTriggers_, dqm::implementation::NavigatorBase::setCurrentFolder(), and createPayload::suffix.

85  {
86  TPRegexp suffixPtCut("Mu[0-9]+$");
87 
88  string baseDir = destination_;
89  if (baseDir[baseDir.size() - 1] != '/')
90  baseDir += '/';
91  string pathSansSuffix = hltPath_;
92  if (hltPath_.rfind("_v") < hltPath_.length())
93  pathSansSuffix = hltPath_.substr(0, hltPath_.rfind("_v"));
94 
95  if (isLastFilter_)
96  iBooker.setCurrentFolder(baseDir + pathSansSuffix);
97  else
98  iBooker.setCurrentFolder(baseDir + pathSansSuffix + "/" + moduleLabel_);
99 
100  // Form is book1D(name, binningType, title) where 'binningType' is used
101  // to fetch the bin settings from binParams_.
102  if (isLastFilter_) {
103  book1D(iBooker, "hltPt", "pt", ";p_{T} of HLT object");
104  book1D(iBooker, "hltEta", "eta", ";#eta of HLT object");
105  book1D(iBooker, "hltPhi", "phi", ";#phi of HLT object");
106  book1D(iBooker, "resolutionEta", "resolutionEta", ";#eta^{reco}-#eta^{HLT};");
107  book1D(iBooker, "resolutionPhi", "resolutionPhi", ";#phi^{reco}-#phi^{HLT};");
108  }
109  book1D(iBooker, "deltaR", "deltaR", ";#Deltar(reco, HLT);");
110 
111  book1D(iBooker, "resolutionPt", "resolutionRel", ";(p_{T}^{reco}-p_{T}^{HLT})/|p_{T}^{reco}|;");
112 
113  for (const auto& suffix : EFFICIENCY_SUFFIXES) {
114  if (isLastFilter_)
115  iBooker.setCurrentFolder(baseDir + pathSansSuffix);
116  else
117  iBooker.setCurrentFolder(baseDir + pathSansSuffix + "/" + moduleLabel_);
118 
119  book1D(iBooker, "efficiencyEta_" + suffix, "eta", ";#eta;");
120  book1D(iBooker, "efficiencyPhi_" + suffix, "phi", ";#phi;");
121  book1D(iBooker, "efficiencyTurnOn_" + suffix, "pt", ";p_{T};");
122  book1D(iBooker, "efficiencyVertex_" + suffix, "NVertex", ";NVertex;");
123  book1D(iBooker, "efficiencyDeltaR_" + suffix, "deltaR2", ";#Delta R;");
124 
125  book2D(iBooker, "efficiencyPhiVsEta_" + suffix, "etaCoarse", "phiCoarse", ";#eta;#phi");
126 
127  auto MRbaseDir = boost::replace_all_copy<string>(baseDir, "HLT/Muon", "HLT/Muon/MR");
128  if (isLastFilter_)
129  iBooker.setCurrentFolder(MRbaseDir + pathSansSuffix);
130  else
131  iBooker.setCurrentFolder(MRbaseDir + pathSansSuffix + "/" + moduleLabel_);
132 
133  book2D(iBooker, "MR_efficiencyPhiVsEta_" + suffix, "etaCoarse", "phiHEP17", ";#eta;#phi");
134 
135  if (isLastFilter_)
136  iBooker.setCurrentFolder(baseDir + pathSansSuffix);
137  else
138  iBooker.setCurrentFolder(baseDir + pathSansSuffix + "/" + moduleLabel_);
139 
140  if (!isLastFilter_)
141  continue; //this will be plotted only for the last filter
142 
143  book1D(iBooker, "efficiencyD0_" + suffix, "d0", ";d0;");
144  book1D(iBooker, "efficiencyZ0_" + suffix, "z0", ";z0;");
145  book1D(iBooker, "efficiencyCharge_" + suffix, "charge", ";charge;");
146 
147  book1D(iBooker, "fakerateEta_" + suffix, "eta", ";#eta;");
148  book1D(iBooker, "fakerateVertex_" + suffix, "NVertex", ";NVertex;");
149  book1D(iBooker, "fakeratePhi_" + suffix, "phi", ";#phi;");
150  book1D(iBooker, "fakerateTurnOn_" + suffix, "pt", ";p_{T};");
151 
152  book1D(iBooker, "massVsEtaZ_" + suffix, "etaCoarse", ";#eta");
153  book1D(iBooker, "massVsEtaJpsi_" + suffix, "etaCoarse", ";#eta");
154  book1D(iBooker, "massVsPtZ_" + suffix, "ptCoarse", ";p_{T}");
155  book1D(iBooker, "massVsPtJpsi_" + suffix, "ptCoarse", ";p_{T}");
156  book1D(iBooker, "massVsVertexZ_" + suffix, "NVertex", ";NVertex");
157  book1D(iBooker, "massVsVertexJpsi_" + suffix, "NVertex", ";NVertex");
158  book1D(iBooker, "massVsDZZ_" + suffix, "z0", ";z0;");
159 
160  if (!requiredTriggers_.empty()) {
161  book1D(iBooker, "Refefficiency_Eta_Mu1_" + suffix, "etaCoarse", ";#eta;");
162  book1D(iBooker, "Refefficiency_Eta_Mu2_" + suffix, "etaCoarse", ";#eta;");
163  book1D(iBooker, "Refefficiency_TurnOn_Mu1_" + suffix, "ptCoarse", ";p_{T};");
164  book1D(iBooker, "Refefficiency_TurnOn_Mu2_" + suffix, "ptCoarse", ";p_{T};");
165  book1D(iBooker, "Refefficiency_Vertex_" + suffix, "NVertex", ";NVertex;");
166  book1D(iBooker, "Refefficiency_DZ_Mu_" + suffix, "z0", ";z0;");
167 
168  book2D(iBooker, "Refefficiency_Eta_" + suffix, "etaCoarse", "etaCoarse", ";#eta;#eta");
169  book2D(iBooker, "Refefficiency_Pt_" + suffix, "ptCoarse", "ptCoarse", ";p_{T};p_{T}");
170  book1D(iBooker, "Refefficiency_DZ_Vertex_" + suffix, "NVertex", ";NVertex;");
171  book1D(iBooker, "Ref_SS_pt1_" + suffix, "ptCoarse", ";p_{T}");
172  book1D(iBooker, "Ref_SS_pt2_" + suffix, "ptCoarse", ";p_{T}");
173  book1D(iBooker, "Ref_SS_eta1_" + suffix, "etaCoarse", ";#eta;");
174  book1D(iBooker, "Ref_SS_eta2_" + suffix, "etaCoarse", ";#eta;");
175  // book1D(iBooker, "Refefficiency_DZ_Mu2_" + suffix, "z0", ";z0;");
176  }
177  // string MRbaseDir = boost::replace_all_copy<string>(baseDir, "HLT/Muon","HLT/Muon/MR");
178  iBooker.setCurrentFolder(MRbaseDir + pathSansSuffix + "/");
179 
180  if (!requiredTriggers_.empty()) {
181  book1D(iBooker, "MR_Refefficiency_TurnOn_Mu1_" + suffix, "pt", ";p_{T};");
182  book1D(iBooker, "MR_Refefficiency_TurnOn_Mu2_" + suffix, "pt", ";p_{T};");
183  book1D(iBooker, "MR_Refefficiency_Vertex_" + suffix, "NVertexFine", ";NVertex;");
184  book1D(iBooker, "MR_Refefficiency_DZ_Mu_" + suffix, "z0Fine", ";z0;");
185  // book1D(iBooker, "MR_Refefficiency_DZ_Mu2_" + suffix, "z0Fine", ";z0;");
186  book2D(iBooker, "MR_Refefficiency_Pt_" + suffix, "pt", "pt", ";p_{T};p_{T}");
187  book1D(iBooker, "MR_Refefficiency_DZ_Vertex_" + suffix, "NVertexFine", ";NVertex;");
188  }
189  book1D(iBooker, "MR_massVsPtZ_" + suffix, "pt", ";p_{T}");
190  book1D(iBooker, "MR_massVsPtJpsi_" + suffix, "pt", ";p_{T}");
191  book1D(iBooker, "MR_massVsVertexZ_" + suffix, "NVertex", ";NVertex");
192  book1D(iBooker, "MR_massVsVertexJpsi_" + suffix, "NVertexFine", ";NVertex");
193  book1D(iBooker, "MR_massVsDZZ_" + suffix, "z0Fine", ";z0;");
194  book1D(iBooker, "MR_massVsEtaZ_" + suffix, "etaFine", ";#eta");
195  book1D(iBooker, "MR_massVsEtaJpsi_" + suffix, "etaFine", ";#eta");
196  book1D(iBooker, "MR_massVsPhiZ_" + suffix, "phiFine", ";#phi");
197  book1D(iBooker, "MR_massVsPhiJpsi_" + suffix, "phiFine", ";#phi");
198  }
199 }
const std::string EFFICIENCY_SUFFIXES[2]
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
std::vector< std::string > requiredTriggers_
void book2D(DQMStore::IBooker &, const std::string &, const std::string &, const std::string &, const std::string &)
void book1D(DQMStore::IBooker &, std::string, const std::string &, std::string)
void HLTMuonMatchAndPlot::book1D ( DQMStore::IBooker ,
std::string  ,
const std::string &  ,
std::string   
)
private

Definition at line 711 of file HLTMuonMatchAndPlot.cc.

References binParams_, dqm::implementation::IBooker::book1D(), fillEdges(), hists_, and mergeVDriftHistosByStation::name.

Referenced by beginRun().

711  {
712  /* Properly delete the array of floats that has been allocated on
713  * the heap by fillEdges. Avoid multiple copies and internal ROOT
714  * clones by simply creating the histograms directly in the DQMStore
715  * using the appropriate book1D method to handle the variable bins
716  * case. */
717 
718  size_t nBins;
719  float* edges = nullptr;
720  fillEdges(nBins, edges, binParams_[binningType]);
721  hists_[name] = iBooker.book1D(name, title, nBins, edges);
722  if (hists_[name])
723  if (hists_[name]->getTH1F()->GetSumw2N())
724  hists_[name]->enableSumw2();
725 
726  if (edges)
727  delete[] edges;
728 }
std::map< std::string, std::vector< double > > binParams_
std::map< std::string, MonitorElement * > hists_
void fillEdges(size_t &nBins, float *&edges, const std::vector< double > &binning)
void HLTMuonMatchAndPlot::book2D ( DQMStore::IBooker ,
const std::string &  ,
const std::string &  ,
const std::string &  ,
const std::string &   
)
private

Definition at line 730 of file HLTMuonMatchAndPlot.cc.

References binParams_, dqm::implementation::IBooker::book2D(), fillEdges(), hists_, and mergeVDriftHistosByStation::name.

Referenced by beginRun().

734  {
735  /* Properly delete the arrays of floats that have been allocated on
736  * the heap by fillEdges. Avoid multiple copies and internal ROOT
737  * clones by simply creating the histograms directly in the DQMStore
738  * using the appropriate book2D method to handle the variable bins
739  * case. */
740 
741  size_t nBinsX;
742  float* edgesX = nullptr;
743  fillEdges(nBinsX, edgesX, binParams_[binningTypeX]);
744 
745  size_t nBinsY;
746  float* edgesY = nullptr;
747  fillEdges(nBinsY, edgesY, binParams_[binningTypeY]);
748 
749  hists_[name] = iBooker.book2D(name.c_str(), title.c_str(), nBinsX, edgesX, nBinsY, edgesY);
750  if (hists_[name])
751  if (hists_[name]->getTH2F()->GetSumw2N())
752  hists_[name]->enableSumw2();
753 
754  if (edgesX)
755  delete[] edgesX;
756  if (edgesY)
757  delete[] edgesY;
758 }
std::map< std::string, std::vector< double > > binParams_
std::map< std::string, MonitorElement * > hists_
void fillEdges(size_t &nBins, float *&edges, const std::vector< double > &binning)
void HLTMuonMatchAndPlot::endRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)

Definition at line 201 of file HLTMuonMatchAndPlot.cc.

201 {}
void HLTMuonMatchAndPlot::fillEdges ( size_t &  nBins,
float *&  edges,
const std::vector< double > &  binning 
)

Definition at line 571 of file HLTMuonMatchAndPlot.cc.

References mps_fire::i, and min().

Referenced by book1D(), and book2D().

571  {
572  if (binning.size() < 3) {
573  LogWarning("HLTMuonVal") << "Invalid binning parameters!";
574  return;
575  }
576 
577  // Fixed-width binning.
578  if (binning.size() == 3) {
579  nBins = binning[0];
580  edges = new float[nBins + 1];
581  const double min = binning[1];
582  const double binwidth = (binning[2] - binning[1]) / nBins;
583  for (size_t i = 0; i <= nBins; i++)
584  edges[i] = min + (binwidth * i);
585  }
586 
587  // Variable-width binning.
588  else {
589  nBins = binning.size() - 1;
590  edges = new float[nBins + 1];
591  for (size_t i = 0; i <= nBins; i++)
592  edges[i] = binning[i];
593  }
594 }
T min(T a, T b)
Definition: MathUtil.h:58
tuple binning
Definition: pileupCalc.py:163
Log< level::Warning, false > LogWarning
template<class T >
void HLTMuonMatchAndPlot::fillMapFromPSet ( std::map< std::string, T > &  ,
const edm::ParameterSet ,
const std::string &   
)

Referenced by HLTMuonMatchAndPlot().

template<class T >
void HLTMuonMatchAndPlot::fillMapFromPSet ( map< string, T > &  m,
const ParameterSet pset,
const string &  target 
)

Definition at line 600 of file HLTMuonMatchAndPlot.cc.

References edm::ParameterSet::existsAs(), edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNames(), edm::ParameterSet::getParameterSet(), edm::ParameterSet::getUntrackedParameter(), edm::ParameterSet::getUntrackedParameterSet(), and names.

600  {
601  // Get the ParameterSet with name 'target' from 'pset'
602  ParameterSet targetPset;
603  if (pset.existsAs<ParameterSet>(target, true)) // target is tracked
604  targetPset = pset.getParameterSet(target);
605  else if (pset.existsAs<ParameterSet>(target, false)) // target is untracked
606  targetPset = pset.getUntrackedParameterSet(target);
607 
608  // Get the parameter names from targetPset
609  vector<string> names = targetPset.getParameterNames();
610  vector<string>::const_iterator iter;
611 
612  for (iter = names.begin(); iter != names.end(); ++iter) {
613  if (targetPset.existsAs<T>(*iter, true)) // target is tracked
614  m[*iter] = targetPset.getParameter<T>(*iter);
615  else if (targetPset.existsAs<T>(*iter, false)) // target is untracked
616  m[*iter] = targetPset.getUntrackedParameter<T>(*iter);
617  }
618 }
T getUntrackedParameter(std::string const &, T const &) const
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:171
ParameterSet getUntrackedParameterSet(std::string const &name, ParameterSet const &defaultValue) const
const std::string names[nVars_]
std::vector< std::string > getParameterNames() const
ParameterSet const & getParameterSet(std::string const &) const
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
long double T
template<class T1 , class T2 >
std::vector<size_t> HLTMuonMatchAndPlot::matchByDeltaR ( const std::vector< T1 > &  ,
const std::vector< T2 > &  ,
const double  maxDeltaR = NOMATCH 
)

Referenced by analyze().

template<class T1 , class T2 >
vector<size_t> HLTMuonMatchAndPlot::matchByDeltaR ( const vector< T1 > &  collection1,
const vector< T2 > &  collection2,
const double  maxDeltaR 
)

Definition at line 622 of file HLTMuonMatchAndPlot.cc.

References HLT_FULL_cff::deltaR, mps_fire::i, dqmiolumiharvest::j, isotrackApplyRegressor::k, HLT_FULL_cff::maxDeltaR, HLT_FULL_cff::minDeltaR, NOMATCH, and mps_fire::result.

624  {
625  const size_t n1 = collection1.size();
626  const size_t n2 = collection2.size();
627 
628  vector<size_t> result(n1, -1);
629  vector<vector<double> > deltaRMatrix(n1, vector<double>(n2, NOMATCH));
630 
631  for (size_t i = 0; i < n1; i++)
632  for (size_t j = 0; j < n2; j++) {
633  deltaRMatrix[i][j] = deltaR(collection1[i], collection2[j]);
634  }
635 
636  // Run through the matrix n1 times to make sure we've found all matches.
637  for (size_t k = 0; k < n1; k++) {
638  size_t i_min = -1;
639  size_t j_min = -1;
640  double minDeltaR = maxDeltaR;
641  // find the smallest deltaR
642  for (size_t i = 0; i < n1; i++)
643  for (size_t j = 0; j < n2; j++)
644  if (deltaRMatrix[i][j] < minDeltaR) {
645  i_min = i;
646  j_min = j;
647  minDeltaR = deltaRMatrix[i][j];
648  }
649  // If a match has been made, save it and make those candidates unavailable.
650  if (minDeltaR < maxDeltaR) {
651  result[i_min] = j_min;
652  deltaRMatrix[i_min] = vector<double>(n2, NOMATCH);
653  for (size_t i = 0; i < n1; i++)
654  deltaRMatrix[i][j_min] = NOMATCH;
655  }
656  }
657 
658  return result;
659 }
tuple result
Definition: mps_fire.py:311
const double NOMATCH
MuonCollection HLTMuonMatchAndPlot::selectedMuons ( const reco::MuonCollection allMuons,
const reco::BeamSpot beamSpot,
bool  hasRecoCuts,
const StringCutObjectSelector< reco::Muon > &  selector,
double  d0Cut,
double  z0Cut 
)
private

Definition at line 661 of file HLTMuonMatchAndPlot.cc.

References reco::TrackBase::dxy(), reco::TrackBase::dz(), RPCpg::mu, reco::BeamSpot::position(), and HLT_FULL_cff::track.

Referenced by analyze().

666  {
667  // If there is no selector (recoCuts does not exists), return an empty collection.
668  if (!hasRecoCuts)
669  return MuonCollection();
670 
671  MuonCollection reducedMuons;
672  for (auto const& mu : allMuons) {
673  const Track* track = nullptr;
674  if (mu.isTrackerMuon())
675  track = &*mu.innerTrack();
676  else if (mu.isStandAloneMuon())
677  track = &*mu.outerTrack();
678  if (track && selector(mu) && fabs(track->dxy(beamSpot.position())) < d0Cut &&
679  fabs(track->dz(beamSpot.position())) < z0Cut)
680  reducedMuons.push_back(mu);
681  }
682 
683  return reducedMuons;
684 }
std::vector< Muon > MuonCollection
collection of Muon objects
Definition: MuonFwd.h:9
tuple allMuons
Definition: allMuons_cfi.py:3
const int mu
Definition: Constants.h:22
double dz() const
dz parameter (= dsz/cos(lambda)). This is the track z0 w.r.t (0,0,0) only if the refPoint is close to...
Definition: TrackBase.h:622
const Point & position() const
position
Definition: BeamSpot.h:59
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...
Definition: TrackBase.h:608
TriggerObjectCollection HLTMuonMatchAndPlot::selectedTriggerObjects ( const trigger::TriggerObjectCollection triggerObjects,
const trigger::TriggerEvent triggerSummary,
bool  hasTriggerCuts,
const StringCutObjectSelector< trigger::TriggerObject > &  triggerSelector 
)
private

Definition at line 686 of file HLTMuonMatchAndPlot.cc.

References trigger::TriggerEvent::filterIndex(), trigger::TriggerEvent::filterKeys(), hltProcessName_, submitPVResolutionJobs::key, relativeConstraints::keys, moduleLabel_, and trigger::TriggerEvent::sizeFilters().

Referenced by analyze().

690  {
691  if (!hasTriggerCuts)
692  return TriggerObjectCollection();
693 
694  InputTag filterTag(moduleLabel_, "", hltProcessName_);
695  size_t filterIndex = triggerSummary.filterIndex(filterTag);
696 
697  TriggerObjectCollection selectedObjects;
698 
699  if (filterIndex < triggerSummary.sizeFilters()) {
700  const Keys& keys = triggerSummary.filterKeys(filterIndex);
701  for (unsigned short key : keys) {
702  TriggerObject foundObject = triggerObjects[key];
703  if (triggerSelector(foundObject))
704  selectedObjects.push_back(foundObject);
705  }
706  }
707 
708  return selectedObjects;
709 }
trigger::size_type sizeFilters() const
Definition: TriggerEvent.h:146
const Keys & filterKeys(trigger::size_type index) const
Definition: TriggerEvent.h:118
trigger::size_type filterIndex(const edm::InputTag &filterTag) const
find index of filter in data-member vector from filter tag
Definition: TriggerEvent.h:132
Single trigger physics object (e.g., an isolated muon)
Definition: TriggerObject.h:21
tuple key
prepare the HTCondor submission files and eventually submit them
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:75
std::vector< size_type > Keys

Member Data Documentation

std::map<std::string, std::vector<double> > HLTMuonMatchAndPlot::binParams_
private

Definition at line 103 of file HLTMuonMatchAndPlot.h.

Referenced by book1D(), book2D(), and HLTMuonMatchAndPlot().

unsigned int HLTMuonMatchAndPlot::cutMinPt_
private

Definition at line 110 of file HLTMuonMatchAndPlot.h.

Referenced by analyze(), and HLTMuonMatchAndPlot().

std::string HLTMuonMatchAndPlot::destination_
private

Definition at line 101 of file HLTMuonMatchAndPlot.h.

Referenced by beginRun().

bool HLTMuonMatchAndPlot::hasProbeRecoCuts
private

Definition at line 118 of file HLTMuonMatchAndPlot.h.

Referenced by analyze().

bool HLTMuonMatchAndPlot::hasTargetRecoCuts
private

Definition at line 117 of file HLTMuonMatchAndPlot.h.

Referenced by analyze().

bool HLTMuonMatchAndPlot::hasTriggerCuts_
private

Definition at line 130 of file HLTMuonMatchAndPlot.h.

Referenced by analyze().

std::map<std::string, MonitorElement *> HLTMuonMatchAndPlot::hists_
private

Definition at line 114 of file HLTMuonMatchAndPlot.h.

Referenced by analyze(), book1D(), and book2D().

std::string HLTMuonMatchAndPlot::hltPath_
private

Definition at line 111 of file HLTMuonMatchAndPlot.h.

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

std::string HLTMuonMatchAndPlot::hltProcessName_
private

Definition at line 100 of file HLTMuonMatchAndPlot.h.

Referenced by selectedTriggerObjects().

bool HLTMuonMatchAndPlot::isLastFilter_
private

Definition at line 113 of file HLTMuonMatchAndPlot.h.

Referenced by analyze(), and beginRun().

std::string HLTMuonMatchAndPlot::moduleLabel_
private
std::map<std::string, double> HLTMuonMatchAndPlot::plotCuts_
private

Definition at line 104 of file HLTMuonMatchAndPlot.h.

Referenced by analyze(), and HLTMuonMatchAndPlot().

double HLTMuonMatchAndPlot::probeD0Cut_
private

Definition at line 127 of file HLTMuonMatchAndPlot.h.

Referenced by analyze().

StringCutObjectSelector<reco::Muon> HLTMuonMatchAndPlot::probeMuonSelector_
private

Definition at line 125 of file HLTMuonMatchAndPlot.h.

Referenced by analyze().

edm::ParameterSet HLTMuonMatchAndPlot::probeParams_
private

Definition at line 106 of file HLTMuonMatchAndPlot.h.

double HLTMuonMatchAndPlot::probeZ0Cut_
private

Definition at line 126 of file HLTMuonMatchAndPlot.h.

Referenced by analyze().

std::vector<std::string> HLTMuonMatchAndPlot::requiredTriggers_
private

Definition at line 102 of file HLTMuonMatchAndPlot.h.

Referenced by analyze(), and beginRun().

double HLTMuonMatchAndPlot::targetD0Cut_
private

Definition at line 122 of file HLTMuonMatchAndPlot.h.

Referenced by analyze().

StringCutObjectSelector<reco::Muon> HLTMuonMatchAndPlot::targetMuonSelector_
private

Definition at line 120 of file HLTMuonMatchAndPlot.h.

Referenced by analyze().

edm::ParameterSet HLTMuonMatchAndPlot::targetParams_
private

Definition at line 105 of file HLTMuonMatchAndPlot.h.

double HLTMuonMatchAndPlot::targetptCutJpsi_
private

Definition at line 124 of file HLTMuonMatchAndPlot.h.

Referenced by analyze().

double HLTMuonMatchAndPlot::targetptCutZ_
private

Definition at line 123 of file HLTMuonMatchAndPlot.h.

Referenced by analyze().

double HLTMuonMatchAndPlot::targetZ0Cut_
private

Definition at line 121 of file HLTMuonMatchAndPlot.h.

Referenced by analyze().

std::string HLTMuonMatchAndPlot::triggerLevel_
private

Definition at line 109 of file HLTMuonMatchAndPlot.h.

Referenced by analyze(), and HLTMuonMatchAndPlot().

StringCutObjectSelector<trigger::TriggerObject> HLTMuonMatchAndPlot::triggerSelector_
private

Definition at line 129 of file HLTMuonMatchAndPlot.h.

Referenced by analyze().