CMS 3D CMS Logo

PATMuonProducer.cc
Go to the documentation of this file.
1 
54 
55 namespace pat {
56 
58  public:
60 
64 
65  private:
66  std::unique_ptr<const pat::CalculatePtRatioRel> calculatePtRatioRel_;
67  std::unique_ptr<const pat::MuonMvaIDEstimator> muonMvaIDEstimator_;
68  std::unique_ptr<const pat::SoftMuonMvaEstimator> softMuonMvaEstimator_;
69  };
70 
72  class TrackerIsolationPt;
73  class CaloIsolationEnergy;
74 
76  class PATMuonProducer : public edm::stream::EDProducer<edm::GlobalCache<PATMuonHeavyObjectCache>> {
77  public:
79  explicit PATMuonProducer(const edm::ParameterSet& iConfig, PATMuonHeavyObjectCache const*);
81  ~PATMuonProducer() override;
82 
83  static std::unique_ptr<PATMuonHeavyObjectCache> initializeGlobalCache(const edm::ParameterSet& iConfig) {
84  return std::make_unique<PATMuonHeavyObjectCache>(iConfig);
85  }
86 
88 
90  void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) override;
92  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
93 
94  private:
97  typedef std::vector<edm::Handle<edm::Association<reco::GenParticleCollection>>> GenAssociations;
98  typedef std::vector<edm::Handle<edm::ValueMap<IsoDeposit>>> IsoDepositMaps;
99  typedef std::vector<edm::Handle<edm::ValueMap<double>>> IsolationValueMaps;
100  typedef std::pair<pat::IsolationKeys, edm::InputTag> IsolationLabel;
101  typedef std::vector<IsolationLabel> IsolationLabels;
102 
104  void fillMuon(Muon& aMuon,
105  const MuonBaseRef& muonRef,
106  const reco::CandidateBaseRef& baseRef,
107  const GenAssociations& genMatches,
108  const IsoDepositMaps& deposits,
109  const IsolationValueMaps& isolationValues) const;
112  template <typename T>
113  void readIsolationLabels(const edm::ParameterSet& iConfig,
114  const char* psetName,
117 
119  double getRelMiniIsoPUCorrected(const pat::Muon& muon, double rho, const std::vector<double>& area);
120 
122  bool isNeutralHadron(long pdgid);
123  bool isChargedHadron(long pdgid);
124  bool isPhoton(long pdgid);
125 
126  // embed various impact parameters with errors
127  // embed high level selection
128  void embedHighLevel(pat::Muon& aMuon,
132  bool primaryVertexIsValid,
134  bool beamspotIsValid);
135  double relMiniIsoPUCorrected(const pat::Muon& aMuon, double rho);
136  std::optional<GlobalPoint> getMuonDirection(const reco::MuonChamberMatch& chamberMatch,
138  const DetId& chamberId);
140  edm::Handle<std::vector<pat::TriggerObjectStandAlone>>& triggerObjects,
141  const edm::TriggerNames& names,
144  edm::Handle<std::vector<pat::TriggerObjectStandAlone>>& triggerObjects,
145  const edm::TriggerNames& names,
146  const std::vector<std::string>& collection_names);
147 
148  private:
151 
152  // for mini-iso calculation
156  std::vector<double> effectiveAreaVec_;
157  std::vector<double> miniIsoParams_;
159 
193  std::vector<edm::EDGetTokenT<edm::Association<reco::GenParticleCollection>>> genMatchTokens_;
214  std::vector<edm::EDGetTokenT<edm::ValueMap<IsoDeposit>>> isoDepositTokens_;
217  std::vector<edm::EDGetTokenT<edm::ValueMap<double>>> isolationValueTokens_;
226  //PUPPI isolation tokens
230  //PUPPINoLeptons isolation tokens
238  bool useJec_;
243 
253 
256 
261  std::vector<std::string> hltCollectionFilters_;
262 
265 
267  };
268 
269 } // namespace pat
270 
271 template <typename T>
273  const char* psetName,
276  labels.clear();
277 
278  if (iConfig.exists(psetName)) {
280 
281  if (depconf.exists("tracker"))
282  labels.emplace_back(pat::TrackIso, depconf.getParameter<edm::InputTag>("tracker"));
283  if (depconf.exists("ecal"))
284  labels.emplace_back(pat::EcalIso, depconf.getParameter<edm::InputTag>("ecal"));
285  if (depconf.exists("hcal"))
286  labels.emplace_back(pat::HcalIso, depconf.getParameter<edm::InputTag>("hcal"));
287  if (depconf.exists("pfAllParticles")) {
288  labels.emplace_back(pat::PfAllParticleIso, depconf.getParameter<edm::InputTag>("pfAllParticles"));
289  }
290  if (depconf.exists("pfChargedHadrons")) {
291  labels.emplace_back(pat::PfChargedHadronIso, depconf.getParameter<edm::InputTag>("pfChargedHadrons"));
292  }
293  if (depconf.exists("pfChargedAll")) {
294  labels.emplace_back(pat::PfChargedAllIso, depconf.getParameter<edm::InputTag>("pfChargedAll"));
295  }
296  if (depconf.exists("pfPUChargedHadrons")) {
297  labels.emplace_back(pat::PfPUChargedHadronIso, depconf.getParameter<edm::InputTag>("pfPUChargedHadrons"));
298  }
299  if (depconf.exists("pfNeutralHadrons")) {
300  labels.emplace_back(pat::PfNeutralHadronIso, depconf.getParameter<edm::InputTag>("pfNeutralHadrons"));
301  }
302  if (depconf.exists("pfPhotons")) {
303  labels.emplace_back(pat::PfGammaIso, depconf.getParameter<edm::InputTag>("pfPhotons"));
304  }
305  if (depconf.exists("user")) {
306  std::vector<edm::InputTag> userdeps = depconf.getParameter<std::vector<edm::InputTag>>("user");
307  std::vector<edm::InputTag>::const_iterator it = userdeps.begin(), ed = userdeps.end();
309  for (; it != ed; ++it, ++key) {
310  labels.push_back(std::make_pair(pat::IsolationKeys(key), *it));
311  }
312  }
313  }
315  return consumes<edm::ValueMap<T>>(label.second);
316  });
317 }
318 
319 using namespace pat;
320 using namespace std;
321 
323  if (iConfig.getParameter<bool>("computeMiniIso")) {
324  float mvaDrMax = iConfig.getParameter<double>("mvaDrMax");
325  calculatePtRatioRel_ = std::make_unique<CalculatePtRatioRel>(mvaDrMax * mvaDrMax);
326  }
327 
328  if (iConfig.getParameter<bool>("computeMuonIDMVA")) {
329  edm::FileInPath mvaIDTrainingFile = iConfig.getParameter<edm::FileInPath>("mvaIDTrainingFile");
330  muonMvaIDEstimator_ = std::make_unique<MuonMvaIDEstimator>(mvaIDTrainingFile);
331  }
332 
333  if (iConfig.getParameter<bool>("computeSoftMuonMVA")) {
334  edm::FileInPath softMvaTrainingFile = iConfig.getParameter<edm::FileInPath>("softMvaTrainingFile");
335  softMuonMvaEstimator_ = std::make_unique<SoftMuonMvaEstimator>(softMvaTrainingFile);
336  }
337 }
338 
340  : relMiniIsoPUCorrected_(0),
341  useUserData_(iConfig.exists("userData")),
342  computeMuonIDMVA_(false),
343  computeSoftMuonMVA_(false),
344  recomputeBasicSelectors_(false),
345  useJec_(false),
346  isolator_(iConfig.getParameter<edm::ParameterSet>("userIsolation"), consumesCollector(), false),
347  geometryToken_{esConsumes()},
348  transientTrackBuilderToken_{esConsumes(edm::ESInputTag("", "TransientTrackBuilder"))},
349  patMuonPutToken_{produces<std::vector<Muon>>()} {
350  // input source
351  muonToken_ = consumes<edm::View<reco::Muon>>(iConfig.getParameter<edm::InputTag>("muonSource"));
352  // embedding of tracks
353  embedBestTrack_ = iConfig.getParameter<bool>("embedMuonBestTrack");
354  embedTunePBestTrack_ = iConfig.getParameter<bool>("embedTunePMuonBestTrack");
355  forceEmbedBestTrack_ = iConfig.getParameter<bool>("forceBestTrackEmbedding");
356  embedTrack_ = iConfig.getParameter<bool>("embedTrack");
357  embedCombinedMuon_ = iConfig.getParameter<bool>("embedCombinedMuon");
358  embedStandAloneMuon_ = iConfig.getParameter<bool>("embedStandAloneMuon");
359  // embedding of muon MET correction information
360  embedCaloMETMuonCorrs_ = iConfig.getParameter<bool>("embedCaloMETMuonCorrs");
361  embedTcMETMuonCorrs_ = iConfig.getParameter<bool>("embedTcMETMuonCorrs");
362  caloMETMuonCorrsToken_ =
363  mayConsume<edm::ValueMap<reco::MuonMETCorrectionData>>(iConfig.getParameter<edm::InputTag>("caloMETMuonCorrs"));
364  tcMETMuonCorrsToken_ =
365  mayConsume<edm::ValueMap<reco::MuonMETCorrectionData>>(iConfig.getParameter<edm::InputTag>("tcMETMuonCorrs"));
366  // pflow specific configurables
367  useParticleFlow_ = iConfig.getParameter<bool>("useParticleFlow");
368  embedPFCandidate_ = iConfig.getParameter<bool>("embedPFCandidate");
369  pfMuonToken_ = mayConsume<reco::PFCandidateCollection>(iConfig.getParameter<edm::InputTag>("pfMuonSource"));
370  embedPfEcalEnergy_ = iConfig.getParameter<bool>("embedPfEcalEnergy");
371  // embedding of tracks from TeV refit
372  embedPickyMuon_ = iConfig.getParameter<bool>("embedPickyMuon");
373  embedTpfmsMuon_ = iConfig.getParameter<bool>("embedTpfmsMuon");
374  embedDytMuon_ = iConfig.getParameter<bool>("embedDytMuon");
375  // embedding of inverse beta variable information
376  addInverseBeta_ = iConfig.getParameter<bool>("addInverseBeta");
377  if (addInverseBeta_) {
378  muonTimeExtraToken_ =
379  consumes<edm::ValueMap<reco::MuonTimeExtra>>(iConfig.getParameter<edm::InputTag>("sourceMuonTimeExtra"));
380  }
381  // Monte Carlo matching
382  addGenMatch_ = iConfig.getParameter<bool>("addGenMatch");
383  if (addGenMatch_) {
384  embedGenMatch_ = iConfig.getParameter<bool>("embedGenMatch");
385  if (iConfig.existsAs<edm::InputTag>("genParticleMatch")) {
386  genMatchTokens_.push_back(consumes<edm::Association<reco::GenParticleCollection>>(
387  iConfig.getParameter<edm::InputTag>("genParticleMatch")));
388  } else {
389  genMatchTokens_ = edm::vector_transform(
390  iConfig.getParameter<std::vector<edm::InputTag>>("genParticleMatch"),
391  [this](edm::InputTag const& tag) { return consumes<edm::Association<reco::GenParticleCollection>>(tag); });
392  }
393  }
394  // efficiencies
395  addEfficiencies_ = iConfig.getParameter<bool>("addEfficiencies");
396  if (addEfficiencies_) {
397  efficiencyLoader_ =
398  pat::helper::EfficiencyLoader(iConfig.getParameter<edm::ParameterSet>("efficiencies"), consumesCollector());
399  }
400  // resolutions
401  addResolutions_ = iConfig.getParameter<bool>("addResolutions");
402  if (addResolutions_) {
403  resolutionLoader_ =
404  pat::helper::KinResolutionsLoader(iConfig.getParameter<edm::ParameterSet>("resolutions"), consumesCollector());
405  }
406  // puppi
407  addPuppiIsolation_ = iConfig.getParameter<bool>("addPuppiIsolation");
408  if (addPuppiIsolation_) {
409  PUPPIIsolation_charged_hadrons_ =
410  consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("puppiIsolationChargedHadrons"));
411  PUPPIIsolation_neutral_hadrons_ =
412  consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("puppiIsolationNeutralHadrons"));
413  PUPPIIsolation_photons_ =
414  consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("puppiIsolationPhotons"));
415  //puppiNoLeptons
416  PUPPINoLeptonsIsolation_charged_hadrons_ =
417  consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("puppiNoLeptonsIsolationChargedHadrons"));
418  PUPPINoLeptonsIsolation_neutral_hadrons_ =
419  consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("puppiNoLeptonsIsolationNeutralHadrons"));
420  PUPPINoLeptonsIsolation_photons_ =
421  consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("puppiNoLeptonsIsolationPhotons"));
422  }
423  // read isoDeposit labels, for direct embedding
424  readIsolationLabels(iConfig, "isoDeposits", isoDepositLabels_, isoDepositTokens_);
425  // read isolation value labels, for direct embedding
426  readIsolationLabels(iConfig, "isolationValues", isolationValueLabels_, isolationValueTokens_);
427  // check to see if the user wants to add user data
428  if (useUserData_) {
429  userDataHelper_ = PATUserDataHelper<Muon>(iConfig.getParameter<edm::ParameterSet>("userData"), consumesCollector());
430  }
431  // embed high level selection variables
432  embedHighLevelSelection_ = iConfig.getParameter<bool>("embedHighLevelSelection");
433  if (embedHighLevelSelection_) {
434  beamLineToken_ = consumes<reco::BeamSpot>(iConfig.getParameter<edm::InputTag>("beamLineSrc"));
435  pvToken_ = consumes<std::vector<reco::Vertex>>(iConfig.getParameter<edm::InputTag>("pvSrc"));
436  }
437 
438  //for mini-isolation calculation
439  computeMiniIso_ = iConfig.getParameter<bool>("computeMiniIso");
440 
441  computePuppiCombinedIso_ = iConfig.getParameter<bool>("computePuppiCombinedIso");
442 
443  effectiveAreaVec_ = iConfig.getParameter<std::vector<double>>("effectiveAreaVec");
444 
445  miniIsoParams_ = iConfig.getParameter<std::vector<double>>("miniIsoParams");
446  if (computeMiniIso_ && miniIsoParams_.size() != 9) {
447  throw cms::Exception("ParameterError") << "miniIsoParams must have exactly 9 elements.\n";
448  }
449  if (computeMiniIso_ || computePuppiCombinedIso_)
450  pcToken_ = consumes<pat::PackedCandidateCollection>(iConfig.getParameter<edm::InputTag>("pfCandsForMiniIso"));
451 
452  // standard selectors
453  recomputeBasicSelectors_ = iConfig.getParameter<bool>("recomputeBasicSelectors");
454  computeMuonIDMVA_ = iConfig.getParameter<bool>("computeMuonIDMVA");
455 
456  if (computeMiniIso_) {
457  // pfCombinedInclusiveSecondaryVertexV2BJetTags
458  mvaBTagCollectionTag_ = consumes<reco::JetTagCollection>(iConfig.getParameter<edm::InputTag>("mvaJetTag"));
459  mvaL1Corrector_ = consumes<reco::JetCorrector>(iConfig.getParameter<edm::InputTag>("mvaL1Corrector"));
460  mvaL1L2L3ResCorrector_ = consumes<reco::JetCorrector>(iConfig.getParameter<edm::InputTag>("mvaL1L2L3ResCorrector"));
461  rho_ = consumes<double>(iConfig.getParameter<edm::InputTag>("rho"));
462  useJec_ = iConfig.getParameter<bool>("useJec");
463  }
464 
465  computeSoftMuonMVA_ = iConfig.getParameter<bool>("computeSoftMuonMVA");
466 
467  // MC info
468  simInfo_ = consumes<edm::ValueMap<reco::MuonSimInfo>>(iConfig.getParameter<edm::InputTag>("muonSimInfo"));
469 
470  addTriggerMatching_ = iConfig.getParameter<bool>("addTriggerMatching");
471  if (addTriggerMatching_) {
472  triggerObjects_ =
473  consumes<std::vector<pat::TriggerObjectStandAlone>>(iConfig.getParameter<edm::InputTag>("triggerObjects"));
474  triggerResults_ = consumes<edm::TriggerResults>(iConfig.getParameter<edm::InputTag>("triggerResults"));
475  }
476  hltCollectionFilters_ = iConfig.getParameter<std::vector<std::string>>("hltCollectionFilters");
477 }
478 
480 
481 std::optional<GlobalPoint> PATMuonProducer::getMuonDirection(const reco::MuonChamberMatch& chamberMatch,
483  const DetId& chamberId) {
484  const GeomDet* chamberGeometry = geometry->idToDet(chamberId);
485  if (chamberGeometry) {
486  LocalPoint localPosition(chamberMatch.x, chamberMatch.y, 0);
487  return std::optional<GlobalPoint>(std::in_place, chamberGeometry->toGlobal(localPosition));
488  }
489  return std::optional<GlobalPoint>();
490 }
491 
493  edm::Handle<std::vector<pat::TriggerObjectStandAlone>>& triggerObjects,
494  const edm::TriggerNames& names,
496  // L1 trigger object parameters are defined at MB2/ME2. Use the muon
497  // chamber matching information to get the local direction of the
498  // muon trajectory and convert it to a global direction to match the
499  // trigger objects
500 
501  std::optional<GlobalPoint> muonPosition;
502  // Loop over chambers
503  // initialize muonPosition with any available match, just in case
504  // the second station is missing - it's better folling back to
505  // dR matching at IP
506  for (const auto& chamberMatch : aMuon.matches()) {
507  if (chamberMatch.id.subdetId() == MuonSubdetId::DT) {
508  DTChamberId detId(chamberMatch.id.rawId());
509  if (abs(detId.station()) > 3)
510  continue;
511  muonPosition = getMuonDirection(chamberMatch, geometry, detId);
512  if (abs(detId.station()) == 2)
513  break;
514  }
515  if (chamberMatch.id.subdetId() == MuonSubdetId::CSC) {
516  CSCDetId detId(chamberMatch.id.rawId());
517  if (abs(detId.station()) > 3)
518  continue;
519  muonPosition = getMuonDirection(chamberMatch, geometry, detId);
520  if (abs(detId.station()) == 2)
521  break;
522  }
523  }
524  if (not muonPosition)
525  return;
526  for (const auto& triggerObject : *triggerObjects) {
527  if (triggerObject.hasTriggerObjectType(trigger::TriggerL1Mu)) {
528  if (std::abs(triggerObject.eta()) < 0.001) {
529  // L1 is defined in X-Y plain
530  if (deltaPhi(triggerObject.phi(), muonPosition->phi()) > 0.1)
531  continue;
532  } else {
533  // 3D L1
534  if (deltaR(triggerObject.p4(), *muonPosition) > 0.15)
535  continue;
536  }
537  pat::TriggerObjectStandAlone obj(triggerObject);
538  obj.unpackPathNames(names);
539  aMuon.addTriggerObjectMatch(obj);
540  }
541  }
542 }
543 
545  edm::Handle<std::vector<pat::TriggerObjectStandAlone>>& triggerObjects,
546  const edm::TriggerNames& names,
547  const std::vector<std::string>& collection_filter_names) {
548  // WARNING: in a case of close-by muons the dR matching may select both muons.
549  // It's better to select the best match for a given collection.
550  for (const auto& triggerObject : *triggerObjects) {
551  if (triggerObject.hasTriggerObjectType(trigger::TriggerMuon)) {
552  bool keepIt = false;
553  for (const auto& name : collection_filter_names) {
554  if (triggerObject.hasCollection(name)) {
555  keepIt = true;
556  break;
557  }
558  }
559  if (not keepIt)
560  continue;
561  if (deltaR(triggerObject.p4(), muon) > 0.1)
562  continue;
563  pat::TriggerObjectStandAlone obj(triggerObject);
564  obj.unpackPathNames(names);
565  muon.addTriggerObjectMatch(obj);
566  }
567  }
568 }
569 
571  // get the tracking Geometry
572  auto geometry = iSetup.getHandle(geometryToken_);
573  if (!geometry.isValid())
574  throw cms::Exception("FatalError") << "Unable to find GlobalTrackingGeometryRecord in event!\n";
575 
576  // switch off embedding (in unschedules mode)
577  if (iEvent.isRealData()) {
578  addGenMatch_ = false;
579  embedGenMatch_ = false;
580  }
581 
583  iEvent.getByToken(muonToken_, muons);
584 
587  iEvent.getByToken(pcToken_, pc);
588 
589  // get the ESHandle for the transient track builder,
590  // if needed for high level selection embedding
591  TransientTrackBuilder const* trackBuilder = nullptr;
592 
593  if (isolator_.enabled())
594  isolator_.beginEvent(iEvent, iSetup);
599 
601  for (size_t j = 0; j < isoDepositTokens_.size(); ++j) {
602  iEvent.getByToken(isoDepositTokens_[j], deposits[j]);
603  }
604 
606  for (size_t j = 0; j < isolationValueTokens_.size(); ++j) {
608  }
609 
610  //value maps for puppi isolation
611  edm::Handle<edm::ValueMap<float>> PUPPIIsolation_charged_hadrons;
612  edm::Handle<edm::ValueMap<float>> PUPPIIsolation_neutral_hadrons;
613  edm::Handle<edm::ValueMap<float>> PUPPIIsolation_photons;
614  //value maps for puppiNoLeptons isolation
615  edm::Handle<edm::ValueMap<float>> PUPPINoLeptonsIsolation_charged_hadrons;
616  edm::Handle<edm::ValueMap<float>> PUPPINoLeptonsIsolation_neutral_hadrons;
617  edm::Handle<edm::ValueMap<float>> PUPPINoLeptonsIsolation_photons;
618  if (addPuppiIsolation_) {
619  //puppi
620  iEvent.getByToken(PUPPIIsolation_charged_hadrons_, PUPPIIsolation_charged_hadrons);
621  iEvent.getByToken(PUPPIIsolation_neutral_hadrons_, PUPPIIsolation_neutral_hadrons);
622  iEvent.getByToken(PUPPIIsolation_photons_, PUPPIIsolation_photons);
623  //puppiNoLeptons
624  iEvent.getByToken(PUPPINoLeptonsIsolation_charged_hadrons_, PUPPINoLeptonsIsolation_charged_hadrons);
625  iEvent.getByToken(PUPPINoLeptonsIsolation_neutral_hadrons_, PUPPINoLeptonsIsolation_neutral_hadrons);
626  iEvent.getByToken(PUPPINoLeptonsIsolation_photons_, PUPPINoLeptonsIsolation_photons);
627  }
628 
629  // inputs for muon mva
630  edm::Handle<reco::JetTagCollection> mvaBTagCollectionTag;
633  if (computeMiniIso_) {
634  iEvent.getByToken(mvaBTagCollectionTag_, mvaBTagCollectionTag);
637  }
638 
639  // prepare the MC genMatchTokens_
640  GenAssociations genMatches(genMatchTokens_.size());
641  if (addGenMatch_) {
642  for (size_t j = 0, nd = genMatchTokens_.size(); j < nd; ++j) {
643  iEvent.getByToken(genMatchTokens_[j], genMatches[j]);
644  }
645  }
646 
647  // prepare the high level selection: needs beamline
648  // OR primary vertex, depending on user selection
651  bool beamSpotIsValid = false;
652  bool primaryVertexIsValid = false;
654  // get the beamspot
655  edm::Handle<reco::BeamSpot> beamSpotHandle;
656  iEvent.getByToken(beamLineToken_, beamSpotHandle);
657 
658  // get the primary vertex
660  iEvent.getByToken(pvToken_, pvHandle);
661 
662  if (beamSpotHandle.isValid()) {
663  beamSpot = *beamSpotHandle;
664  beamSpotIsValid = true;
665  } else {
666  edm::LogError("DataNotAvailable") << "No beam spot available from EventSetup, not adding high level selection \n";
667  }
668  if (pvHandle.isValid() && !pvHandle->empty()) {
669  primaryVertex = pvHandle->at(0);
670  primaryVertexIsValid = true;
671  } else {
672  edm::LogError("DataNotAvailable")
673  << "No primary vertex available from EventSetup, not adding high level selection \n";
674  }
675  // this is needed by the IPTools methods from the tracking group
676  trackBuilder = &iSetup.getData(transientTrackBuilderToken_);
677  }
678 
679  // MC info
681  bool simInfoIsAvailalbe = iEvent.getByToken(simInfo_, simInfo);
682 
683  // this will be the new object collection
684  std::vector<Muon> patMuons;
685 
687  if (useParticleFlow_) {
688  // get the PFCandidates of type muons
689  iEvent.getByToken(pfMuonToken_, pfMuons);
690 
691  unsigned index = 0;
692  for (reco::PFCandidateConstIterator i = pfMuons->begin(); i != pfMuons->end(); ++i, ++index) {
693  const reco::PFCandidate& pfmu = *i;
694  //const reco::IsolaPFCandidate& pfmu = *i;
695  const reco::MuonRef& muonRef = pfmu.muonRef();
696  assert(muonRef.isNonnull());
697 
698  MuonBaseRef muonBaseRef(muonRef);
699  Muon aMuon(muonBaseRef);
700 
701  if (useUserData_) {
702  userDataHelper_.add(aMuon, iEvent, iSetup);
703  }
704 
705  // embed high level selection
707  // get the tracks
708  reco::TrackRef innerTrack = muonBaseRef->innerTrack();
709  reco::TrackRef globalTrack = muonBaseRef->globalTrack();
710  reco::TrackRef bestTrack = muonBaseRef->muonBestTrack();
711  reco::TrackRef chosenTrack = innerTrack;
712  // Make sure the collection it points to is there
713  if (bestTrack.isNonnull() && bestTrack.isAvailable())
714  chosenTrack = bestTrack;
715 
716  if (chosenTrack.isNonnull() && chosenTrack.isAvailable()) {
717  unsigned int nhits = chosenTrack->numberOfValidHits(); // ????
719 
720  reco::TransientTrack tt = trackBuilder->build(chosenTrack);
721  embedHighLevel(aMuon, chosenTrack, tt, primaryVertex, primaryVertexIsValid, beamSpot, beamSpotIsValid);
722  }
723 
724  if (globalTrack.isNonnull() && globalTrack.isAvailable() && !embedCombinedMuon_) {
725  double norm_chi2 = globalTrack->chi2() / globalTrack->ndof();
726  aMuon.setNormChi2(norm_chi2);
727  }
728  }
729  reco::PFCandidateRef pfRef(pfMuons, index);
730  //reco::PFCandidatePtr ptrToMother(pfMuons,index);
731  reco::CandidateBaseRef pfBaseRef(pfRef);
732 
733  aMuon.setPFCandidateRef(pfRef);
734  if (embedPFCandidate_)
735  aMuon.embedPFCandidate();
736  fillMuon(aMuon, muonBaseRef, pfBaseRef, genMatches, deposits, isolationValues);
737 
738  if (computeMiniIso_)
739  setMuonMiniIso(aMuon, pc.product());
740 
741  if (addPuppiIsolation_) {
742  aMuon.setIsolationPUPPI((*PUPPIIsolation_charged_hadrons)[muonBaseRef],
743  (*PUPPIIsolation_neutral_hadrons)[muonBaseRef],
744  (*PUPPIIsolation_photons)[muonBaseRef]);
745 
746  aMuon.setIsolationPUPPINoLeptons((*PUPPINoLeptonsIsolation_charged_hadrons)[muonBaseRef],
747  (*PUPPINoLeptonsIsolation_neutral_hadrons)[muonBaseRef],
748  (*PUPPINoLeptonsIsolation_photons)[muonBaseRef]);
749  } else {
750  aMuon.setIsolationPUPPI(-999., -999., -999.);
751  aMuon.setIsolationPUPPINoLeptons(-999., -999., -999.);
752  }
753 
754  if (embedPfEcalEnergy_) {
755  aMuon.setPfEcalEnergy(pfmu.ecalEnergy());
756  }
757 
758  patMuons.push_back(aMuon);
759  }
760  } else {
762  iEvent.getByToken(muonToken_, muons);
763 
764  // embedding of muon MET corrections
766  //edm::ValueMap<reco::MuonMETCorrectionData> caloMETmuCorValueMap;
769  //caloMETmuCorValueMap = *caloMETmuCorValueMap_h;
770  }
772  //edm::ValueMap<reco::MuonMETCorrectionData> tcMETmuCorValueMap;
773  if (embedTcMETMuonCorrs_) {
775  //tcMETmuCorValueMap = *tcMETmuCorValueMap_h;
776  }
777 
779  // get the PFCandidates of type muons
780  iEvent.getByToken(pfMuonToken_, pfMuons);
781  }
782 
784  if (addInverseBeta_) {
785  // get MuonTimerExtra value map
786  iEvent.getByToken(muonTimeExtraToken_, muonsTimeExtra);
787  }
788 
789  for (edm::View<reco::Muon>::const_iterator itMuon = muons->begin(); itMuon != muons->end(); ++itMuon) {
790  // construct the Muon from the ref -> save ref to original object
791  unsigned int idx = itMuon - muons->begin();
792  MuonBaseRef muonRef = muons->refAt(idx);
793  reco::CandidateBaseRef muonBaseRef(muonRef);
794 
795  Muon aMuon(muonRef);
796  fillMuon(aMuon, muonRef, muonBaseRef, genMatches, deposits, isolationValues);
797  if (computeMiniIso_)
798  setMuonMiniIso(aMuon, pc.product());
799  if (addPuppiIsolation_) {
800  aMuon.setIsolationPUPPI((*PUPPIIsolation_charged_hadrons)[muonRef],
801  (*PUPPIIsolation_neutral_hadrons)[muonRef],
802  (*PUPPIIsolation_photons)[muonRef]);
803  aMuon.setIsolationPUPPINoLeptons((*PUPPINoLeptonsIsolation_charged_hadrons)[muonRef],
804  (*PUPPINoLeptonsIsolation_neutral_hadrons)[muonRef],
805  (*PUPPINoLeptonsIsolation_photons)[muonRef]);
806  } else {
807  aMuon.setIsolationPUPPI(-999., -999., -999.);
808  aMuon.setIsolationPUPPINoLeptons(-999., -999., -999.);
809  }
810 
811  // Isolation
812  if (isolator_.enabled()) {
813  //reco::CandidatePtr mother = ptrToMother->sourceCandidatePtr(0);
815  typedef pat::helper::MultiIsolator::IsolationValuePairs IsolationValuePairs;
816  // better to loop backwards, so the vector is resized less times
817  for (IsolationValuePairs::const_reverse_iterator it = isolatorTmpStorage_.rbegin(),
818  ed = isolatorTmpStorage_.rend();
819  it != ed;
820  ++it) {
821  aMuon.setIsolation(it->first, it->second);
822  }
823  }
824 
825  // for (size_t j = 0, nd = deposits.size(); j < nd; ++j) {
826  // aMuon.setIsoDeposit(isoDepositLabels_[j].first,
827  // (*deposits[j])[muonRef]);
828  // }
829 
830  // add sel to selected
831  edm::Ptr<reco::Muon> muonsPtr = muons->ptrAt(idx);
832  if (useUserData_) {
833  userDataHelper_.add(aMuon, iEvent, iSetup);
834  }
835 
836  // embed high level selection
838  // get the tracks
839  reco::TrackRef innerTrack = itMuon->innerTrack();
840  reco::TrackRef globalTrack = itMuon->globalTrack();
841  reco::TrackRef bestTrack = itMuon->muonBestTrack();
842  reco::TrackRef chosenTrack = innerTrack;
843  // Make sure the collection it points to is there
844  if (bestTrack.isNonnull() && bestTrack.isAvailable())
845  chosenTrack = bestTrack;
846  if (chosenTrack.isNonnull() && chosenTrack.isAvailable()) {
847  unsigned int nhits = chosenTrack->numberOfValidHits(); // ????
849 
850  reco::TransientTrack tt = trackBuilder->build(chosenTrack);
851  embedHighLevel(aMuon, chosenTrack, tt, primaryVertex, primaryVertexIsValid, beamSpot, beamSpotIsValid);
852  }
853 
854  if (globalTrack.isNonnull() && globalTrack.isAvailable()) {
855  double norm_chi2 = globalTrack->chi2() / globalTrack->ndof();
856  aMuon.setNormChi2(norm_chi2);
857  }
858  }
859 
860  // embed MET muon corrections
862  aMuon.embedCaloMETMuonCorrs((*caloMETMuonCorrs)[muonRef]);
864  aMuon.embedTcMETMuonCorrs((*tcMETMuonCorrs)[muonRef]);
865 
867  if (embedPfEcalEnergy_)
868  aMuon.setPfEcalEnergy(-99.0);
869  unsigned index = 0;
870  for (const reco::PFCandidate& pfmu : *pfMuons) {
871  if (pfmu.muonRef().isNonnull()) {
872  if (pfmu.muonRef().id() != muonRef.id())
873  throw cms::Exception("Configuration")
874  << "Muon reference within PF candidates does not point to the muon collection." << std::endl;
875  if (pfmu.muonRef().key() == muonRef.key()) {
876  reco::PFCandidateRef pfRef(pfMuons, index);
877  aMuon.setPFCandidateRef(pfRef);
878  if (embedPfEcalEnergy_)
879  aMuon.setPfEcalEnergy(pfmu.ecalEnergy());
880  if (embedPFCandidate_)
881  aMuon.embedPFCandidate();
882  break;
883  }
884  }
885  index++;
886  }
887  }
888 
889  if (addInverseBeta_) {
890  aMuon.readTimeExtra((*muonsTimeExtra)[muonRef]);
891  }
892  // MC info
893  aMuon.initSimInfo();
894  if (simInfoIsAvailalbe) {
895  const auto& msi = (*simInfo)[muonBaseRef];
896  aMuon.setSimType(msi.primaryClass);
897  aMuon.setExtSimType(msi.extendedClass);
898  aMuon.setSimFlavour(msi.flavour);
899  aMuon.setSimHeaviestMotherFlavour(msi.heaviestMotherFlavour);
900  aMuon.setSimPdgId(msi.pdgId);
901  aMuon.setSimMotherPdgId(msi.motherPdgId);
902  aMuon.setSimBX(msi.tpBX);
903  aMuon.setSimTpEvent(msi.tpEvent);
904  aMuon.setSimProdRho(msi.vertex.Rho());
905  aMuon.setSimProdZ(msi.vertex.Z());
906  aMuon.setSimPt(msi.p4.pt());
907  aMuon.setSimEta(msi.p4.eta());
908  aMuon.setSimPhi(msi.p4.phi());
909  aMuon.setSimMatchQuality(msi.tpAssoQuality);
910  }
911  patMuons.push_back(aMuon);
912  }
913  }
914 
915  // sort muons in pt
916  std::sort(patMuons.begin(), patMuons.end(), [](auto const& t1, auto const& t2) { return t1.pt() > t2.pt(); });
917 
918  // Store standard muon selection decisions and jet related
919  // quantaties.
920  // Need a separate loop over muons to have all inputs properly
921  // computed and stored in the object.
923  if (computeMiniIso_)
924  iEvent.getByToken(rho_, rho);
925  const reco::Vertex* pv(nullptr);
926  if (primaryVertexIsValid)
927  pv = &primaryVertex;
928 
931  bool triggerObjectsAvailable = false;
932  bool triggerResultsAvailable = false;
933  if (addTriggerMatching_) {
934  triggerObjectsAvailable = iEvent.getByToken(triggerObjects_, triggerObjects);
935  triggerResultsAvailable = iEvent.getByToken(triggerResults_, triggerResults);
936  }
937 
938  for (auto& muon : patMuons) {
939  // trigger info
940  if (addTriggerMatching_ and triggerObjectsAvailable and triggerResultsAvailable) {
941  const edm::TriggerNames& triggerNames(iEvent.triggerNames(*triggerResults));
944  }
945 
947  muon.setSelectors(0);
948  bool isRun2016BCDEF = (272728 <= iEvent.run() && iEvent.run() <= 278808);
949  muon.setSelectors(muon::makeSelectorBitset(muon, pv, isRun2016BCDEF));
950  }
951  float miniIsoValue = -1;
952  if (computeMiniIso_) {
953  // MiniIsolation working points
954 
955  miniIsoValue = getRelMiniIsoPUCorrected(muon, *rho, effectiveAreaVec_);
956 
957  muon.setSelector(reco::Muon::MiniIsoLoose, miniIsoValue < 0.40);
958  muon.setSelector(reco::Muon::MiniIsoMedium, miniIsoValue < 0.20);
959  muon.setSelector(reco::Muon::MiniIsoTight, miniIsoValue < 0.10);
960  muon.setSelector(reco::Muon::MiniIsoVeryTight, miniIsoValue < 0.05);
961  }
962 
963  double puppiCombinedIsolationPAT = -1;
965  puppiCombinedIsolationPAT = puppiCombinedIsolation(muon, pc.product());
966  muon.setSelector(reco::Muon::PuppiIsoLoose, puppiCombinedIsolationPAT < 0.27);
967  muon.setSelector(reco::Muon::PuppiIsoMedium, puppiCombinedIsolationPAT < 0.22);
968  muon.setSelector(reco::Muon::PuppiIsoTight, puppiCombinedIsolationPAT < 0.12);
969  }
970 
971  std::array<float, 2> jetPtRatioRel = {{0.0, 0.0}};
972  if (primaryVertexIsValid && computeMiniIso_) {
973  if (useJec_) {
974  jetPtRatioRel = globalCache()->calculatePtRatioRel().computePtRatioRel(
975  muon, *(mvaBTagCollectionTag.product()), mvaL1Corrector.product(), mvaL1L2L3ResCorrector.product());
976  } else {
977  jetPtRatioRel = globalCache()->calculatePtRatioRel().computePtRatioRel(muon, *mvaBTagCollectionTag);
978  }
979 
980  muon.setJetPtRatio(jetPtRatioRel[0]);
981  muon.setJetPtRel(jetPtRatioRel[1]);
982 
983  // multi-isolation
984  if (computeMiniIso_) {
985  muon.setSelector(reco::Muon::MultiIsoMedium,
986  miniIsoValue < 0.11 && (muon.jetPtRatio() > 0.74 || muon.jetPtRel() > 6.8));
987  }
988  }
989 
990  // MVA ID
991  float mvaID = 0.0;
992  constexpr int MVAsentinelValue = -99;
993  constexpr float mvaIDmediumCut = 0.08;
994  constexpr float mvaIDtightCut = 0.12;
995  if (computeMuonIDMVA_) {
996  const double dz = std::abs(muon.muonBestTrack()->dz(primaryVertex.position()));
997  const double dxy = std::abs(muon.muonBestTrack()->dxy(primaryVertex.position()));
998  if (muon.isLooseMuon()) {
999  mvaID = globalCache()->muonMvaIDEstimator().computeMVAID(muon)[1];
1000  } else {
1001  mvaID = MVAsentinelValue;
1002  }
1003  muon.setMvaIDValue(mvaID);
1004  muon.setSelector(reco::Muon::MvaIDwpMedium, muon.mvaIDValue() > mvaIDmediumCut);
1005  muon.setSelector(reco::Muon::MvaIDwpTight, muon.mvaIDValue() > mvaIDtightCut and dz < 0.5 and dxy < 0.2);
1006  }
1007 
1008  //SOFT MVA
1009  if (computeSoftMuonMVA_) {
1010  float mva = globalCache()->softMuonMvaEstimator().computeMva(muon);
1011  muon.setSoftMvaValue(mva);
1012  //preselection in SoftMuonMvaEstimator.cc
1013  muon.setSelector(reco::Muon::SoftMvaId, muon.softMvaValue() > 0.58); //WP choose for bmm4
1014  }
1015  }
1016 
1017  // put products in Event
1019 
1020  if (isolator_.enabled())
1021  isolator_.endEvent();
1022 }
1023 
1025  const MuonBaseRef& muonRef,
1026  const reco::CandidateBaseRef& baseRef,
1027  const GenAssociations& genMatches,
1028  const IsoDepositMaps& deposits,
1029  const IsolationValueMaps& isolationValues) const {
1030  // in the particle flow algorithm,
1031  // the muon momentum is recomputed.
1032  // the new value is stored as the momentum of the
1033  // resulting PFCandidate of type Muon, and choosen
1034  // as the pat::Muon momentum
1035  if (useParticleFlow_)
1036  aMuon.setP4(aMuon.pfCandidateRef()->p4());
1037  if (embedTrack_)
1038  aMuon.embedTrack();
1040  aMuon.embedStandAloneMuon();
1041  if (embedCombinedMuon_)
1042  aMuon.embedCombinedMuon();
1043 
1044  // embed the TeV refit track refs (only available for globalMuons)
1045  if (aMuon.isGlobalMuon()) {
1047  aMuon.embedPickyMuon();
1049  aMuon.embedTpfmsMuon();
1051  aMuon.embedDytMuon();
1052  }
1053 
1054  // embed best tracks (at the end, so unless forceEmbedBestTrack_ is true we can save some space not embedding them twice)
1055  if (embedBestTrack_)
1059 
1060  // store the match to the generated final state muons
1061  if (addGenMatch_) {
1062  for (auto const& genMatch : genMatches) {
1063  reco::GenParticleRef genMuon = (*genMatch)[baseRef];
1064  aMuon.addGenParticleRef(genMuon);
1065  }
1066  if (embedGenMatch_)
1067  aMuon.embedGenParticle();
1068  }
1069  if (efficiencyLoader_.enabled()) {
1070  efficiencyLoader_.setEfficiencies(aMuon, muonRef);
1071  }
1072 
1073  for (size_t j = 0, nd = deposits.size(); j < nd; ++j) {
1074  if (useParticleFlow_) {
1075  if (deposits[j]->contains(baseRef.id())) {
1076  aMuon.setIsoDeposit(isoDepositLabels_[j].first, (*deposits[j])[baseRef]);
1077  } else if (deposits[j]->contains(muonRef.id())) {
1078  aMuon.setIsoDeposit(isoDepositLabels_[j].first, (*deposits[j])[muonRef]);
1079  } else {
1080  reco::CandidatePtr source = aMuon.pfCandidateRef()->sourceCandidatePtr(0);
1082  }
1083  } else {
1084  aMuon.setIsoDeposit(isoDepositLabels_[j].first, (*deposits[j])[muonRef]);
1085  }
1086  }
1087 
1088  for (size_t j = 0; j < isolationValues.size(); ++j) {
1089  if (useParticleFlow_) {
1090  if (isolationValues[j]->contains(baseRef.id())) {
1092  } else if (isolationValues[j]->contains(muonRef.id())) {
1094  } else {
1095  reco::CandidatePtr source = aMuon.pfCandidateRef()->sourceCandidatePtr(0);
1097  }
1098  } else {
1100  }
1101  }
1102 
1103  if (resolutionLoader_.enabled()) {
1105  }
1106 }
1107 
1110  aMuon.polarP4(),
1111  miniIsoParams_[0],
1112  miniIsoParams_[1],
1113  miniIsoParams_[2],
1114  miniIsoParams_[3],
1115  miniIsoParams_[4],
1116  miniIsoParams_[5],
1117  miniIsoParams_[6],
1118  miniIsoParams_[7],
1119  miniIsoParams_[8]);
1120  aMuon.setMiniPFIsolation(miniiso);
1121 }
1122 
1123 double PATMuonProducer::getRelMiniIsoPUCorrected(const pat::Muon& muon, double rho, const std::vector<double>& area) {
1124  double mindr(miniIsoParams_[0]);
1125  double maxdr(miniIsoParams_[1]);
1126  double kt_scale(miniIsoParams_[2]);
1127  double drcut = pat::miniIsoDr(muon.polarP4(), mindr, maxdr, kt_scale);
1128  return pat::muonRelMiniIsoPUCorrected(muon.miniPFIsolation(), muon.polarP4(), drcut, rho, area);
1129 }
1130 
1132  constexpr double dR_threshold = 0.4;
1133  constexpr double dR2_threshold = dR_threshold * dR_threshold;
1134  constexpr double mix_fraction = 0.5;
1135  enum particleType { CH = 0, NH = 1, PH = 2, OTHER = 100000 };
1136  double val_PuppiWithLep = 0.0;
1137  double val_PuppiWithoutLep = 0.0;
1138 
1139  for (const auto& cand : *pc) { //pat::pat::PackedCandidate loop start
1140 
1141  const particleType pType = isChargedHadron(cand.pdgId()) ? CH
1142  : isNeutralHadron(cand.pdgId()) ? NH
1143  : isPhoton(cand.pdgId()) ? PH
1144  : OTHER;
1145  if (pType == OTHER) {
1146  if (cand.pdgId() != 1 && cand.pdgId() != 2 && abs(cand.pdgId()) != 11 && abs(cand.pdgId()) != 13) {
1147  LogTrace("PATMuonProducer") << "candidate with PDGID = " << cand.pdgId()
1148  << " is not CH/NH/PH/e/mu or 1/2 (and this is removed from isolation calculation)"
1149  << std::endl;
1150  }
1151  continue;
1152  }
1153  double d_eta = std::abs(cand.eta() - muon.eta());
1154  if (d_eta > dR_threshold)
1155  continue;
1156 
1157  double d_phi = std::abs(reco::deltaPhi(cand.phi(), muon.phi()));
1158  if (d_phi > dR_threshold)
1159  continue;
1160 
1161  double dR2 = reco::deltaR2(cand, muon);
1162  if (dR2 > dR2_threshold)
1163  continue;
1164  if (pType == CH && dR2 < 0.0001 * 0.0001)
1165  continue;
1166  if (pType == NH && dR2 < 0.01 * 0.01)
1167  continue;
1168  if (pType == PH && dR2 < 0.01 * 0.01)
1169  continue;
1170  val_PuppiWithLep += cand.pt() * cand.puppiWeight();
1171  val_PuppiWithoutLep += cand.pt() * cand.puppiWeightNoLep();
1172 
1173  } //pat::pat::PackedCandidate loop end
1174 
1175  double reliso_Puppi_withLep = val_PuppiWithLep / muon.pt();
1176  double reliso_Puppi_withoutlep = val_PuppiWithoutLep / muon.pt();
1177  double reliso_Puppi_combined = mix_fraction * reliso_Puppi_withLep + (1.0 - mix_fraction) * reliso_Puppi_withoutlep;
1178  return reliso_Puppi_combined;
1179 }
1180 
1182 
1184 
1185 bool PATMuonProducer::isPhoton(long pdgid) { return pdgid == 22; }
1186 
1187 // ParameterSet description for module
1190  iDesc.setComment("PAT muon producer module");
1191 
1192  // input source
1193  iDesc.add<edm::InputTag>("muonSource", edm::InputTag("no default"))->setComment("input collection");
1194 
1195  // embedding
1196  iDesc.add<bool>("embedMuonBestTrack", true)->setComment("embed muon best track (global pflow)");
1197  iDesc.add<bool>("embedTunePMuonBestTrack", true)->setComment("embed muon best track (muon only)");
1198  iDesc.add<bool>("forceBestTrackEmbedding", true)
1199  ->setComment(
1200  "force embedding separately the best tracks even if they're already embedded e.g. as tracker or global "
1201  "tracks");
1202  iDesc.add<bool>("embedTrack", true)->setComment("embed external track");
1203  iDesc.add<bool>("embedStandAloneMuon", true)->setComment("embed external stand-alone muon");
1204  iDesc.add<bool>("embedCombinedMuon", false)->setComment("embed external combined muon");
1205  iDesc.add<bool>("embedPickyMuon", false)->setComment("embed external picky track");
1206  iDesc.add<bool>("embedTpfmsMuon", false)->setComment("embed external tpfms track");
1207  iDesc.add<bool>("embedDytMuon", false)->setComment("embed external dyt track ");
1208 
1209  // embedding of MET muon corrections
1210  iDesc.add<bool>("embedCaloMETMuonCorrs", true)->setComment("whether to add MET muon correction for caloMET or not");
1211  iDesc.add<edm::InputTag>("caloMETMuonCorrs", edm::InputTag("muonMETValueMapProducer", "muCorrData"))
1212  ->setComment("source of MET muon corrections for caloMET");
1213  iDesc.add<bool>("embedTcMETMuonCorrs", true)->setComment("whether to add MET muon correction for tcMET or not");
1214  iDesc.add<edm::InputTag>("tcMETMuonCorrs", edm::InputTag("muonTCMETValueMapProducer", "muCorrData"))
1215  ->setComment("source of MET muon corrections for tcMET");
1216 
1217  // pf specific parameters
1218  iDesc.add<edm::InputTag>("pfMuonSource", edm::InputTag("pfMuons"))->setComment("particle flow input collection");
1219  iDesc.add<bool>("useParticleFlow", false)->setComment("whether to use particle flow or not");
1220  iDesc.add<bool>("embedPFCandidate", false)->setComment("embed external particle flow object");
1221  iDesc.add<bool>("embedPfEcalEnergy", true)->setComment("add ecal energy as reconstructed by PF");
1222 
1223  // inverse beta computation
1224  iDesc.add<bool>("addInverseBeta", true)->setComment("add combined inverse beta");
1225  iDesc.add<edm::InputTag>("sourceInverseBeta", edm::InputTag("muons", "combined"))
1226  ->setComment("source of inverse beta values");
1227 
1228  // MC matching configurables
1229  iDesc.add<bool>("addGenMatch", true)->setComment("add MC matching");
1230  iDesc.add<bool>("embedGenMatch", false)->setComment("embed MC matched MC information");
1231  std::vector<edm::InputTag> emptySourceVector;
1232  iDesc
1233  .addNode(edm::ParameterDescription<edm::InputTag>("genParticleMatch", edm::InputTag(), true) xor
1234  edm::ParameterDescription<std::vector<edm::InputTag>>("genParticleMatch", emptySourceVector, true))
1235  ->setComment("input with MC match information");
1236 
1237  // mini-iso
1238  iDesc.add<bool>("computeMiniIso", false)->setComment("whether or not to compute and store electron mini-isolation");
1239  iDesc.add<bool>("computePuppiCombinedIso", false)
1240  ->setComment("whether or not to compute and store puppi combined isolation");
1241 
1242  iDesc.add<edm::InputTag>("pfCandsForMiniIso", edm::InputTag("packedPFCandidates"))
1243  ->setComment("collection to use to compute mini-iso");
1244  iDesc.add<std::vector<double>>("miniIsoParams", std::vector<double>())
1245  ->setComment("mini-iso parameters to use for muons");
1246 
1247  iDesc.add<bool>("addTriggerMatching", false)->setComment("add L1 and HLT matching to offline muon");
1248 
1250 
1251  // IsoDeposit configurables
1252  edm::ParameterSetDescription isoDepositsPSet;
1253  isoDepositsPSet.addOptional<edm::InputTag>("tracker");
1254  isoDepositsPSet.addOptional<edm::InputTag>("ecal");
1255  isoDepositsPSet.addOptional<edm::InputTag>("hcal");
1256  isoDepositsPSet.addOptional<edm::InputTag>("particle");
1257  isoDepositsPSet.addOptional<edm::InputTag>("pfChargedHadrons");
1258  isoDepositsPSet.addOptional<edm::InputTag>("pfChargedAll");
1259  isoDepositsPSet.addOptional<edm::InputTag>("pfPUChargedHadrons");
1260  isoDepositsPSet.addOptional<edm::InputTag>("pfNeutralHadrons");
1261  isoDepositsPSet.addOptional<edm::InputTag>("pfPhotons");
1262  isoDepositsPSet.addOptional<std::vector<edm::InputTag>>("user");
1263  iDesc.addOptional("isoDeposits", isoDepositsPSet);
1264 
1265  // isolation values configurables
1266  edm::ParameterSetDescription isolationValuesPSet;
1267  isolationValuesPSet.addOptional<edm::InputTag>("tracker");
1268  isolationValuesPSet.addOptional<edm::InputTag>("ecal");
1269  isolationValuesPSet.addOptional<edm::InputTag>("hcal");
1270  isolationValuesPSet.addOptional<edm::InputTag>("particle");
1271  isolationValuesPSet.addOptional<edm::InputTag>("pfChargedHadrons");
1272  isolationValuesPSet.addOptional<edm::InputTag>("pfChargedAll");
1273  isolationValuesPSet.addOptional<edm::InputTag>("pfPUChargedHadrons");
1274  isolationValuesPSet.addOptional<edm::InputTag>("pfNeutralHadrons");
1275  isolationValuesPSet.addOptional<edm::InputTag>("pfPhotons");
1276  iDesc.addOptional("isolationValues", isolationValuesPSet);
1277 
1278  iDesc.ifValue(edm::ParameterDescription<bool>("addPuppiIsolation", false, true),
1280  "puppiIsolationChargedHadrons",
1281  edm::InputTag("muonPUPPIIsolation", "h+-DR030-ThresholdVeto000-ConeVeto000"),
1282  true) and
1284  "puppiIsolationNeutralHadrons",
1285  edm::InputTag("muonPUPPIIsolation", "h0-DR030-ThresholdVeto000-ConeVeto001"),
1286  true) and
1288  "puppiIsolationPhotons",
1289  edm::InputTag("muonPUPPIIsolation", "gamma-DR030-ThresholdVeto000-ConeVeto001"),
1290  true) and
1292  "puppiNoLeptonsIsolationChargedHadrons",
1293  edm::InputTag("muonPUPPINoLeptonsIsolation", "h+-DR030-ThresholdVeto000-ConeVeto000"),
1294  true) and
1296  "puppiNoLeptonsIsolationNeutralHadrons",
1297  edm::InputTag("muonPUPPINoLeptonsIsolation", "h0-DR030-ThresholdVeto000-ConeVeto001"),
1298  true) and
1300  "puppiNoLeptonsIsolationPhotons",
1301  edm::InputTag("muonPUPPINoLeptonsIsolation", "gamma-DR030-ThresholdVeto000-ConeVeto001"),
1302  true)) or
1303  false >> edm::EmptyGroupDescription());
1304 
1305  // Efficiency configurables
1306  edm::ParameterSetDescription efficienciesPSet;
1307  efficienciesPSet.setAllowAnything(); // TODO: the pat helper needs to implement a description.
1308  iDesc.add("efficiencies", efficienciesPSet);
1309  iDesc.add<bool>("addEfficiencies", false);
1310 
1311  // Check to see if the user wants to add user data
1312  edm::ParameterSetDescription userDataPSet;
1314  iDesc.addOptional("userData", userDataPSet);
1315 
1316  edm::ParameterSetDescription isolationPSet;
1317  isolationPSet.setAllowAnything(); // TODO: the pat helper needs to implement a description.
1318  iDesc.add("userIsolation", isolationPSet);
1319 
1320  iDesc.add<bool>("embedHighLevelSelection", true)->setComment("embed high level selection");
1321  edm::ParameterSetDescription highLevelPSet;
1322  highLevelPSet.setAllowAnything();
1323  iDesc.addNode(edm::ParameterDescription<edm::InputTag>("beamLineSrc", edm::InputTag(), true))
1324  ->setComment("input with high level selection");
1326  ->setComment("input with high level selection");
1327 
1328  //descriptions.add("PATMuonProducer", iDesc);
1329 }
1330 
1331 // embed various impact parameters with errors
1332 // embed high level selection
1337  bool primaryVertexIsValid,
1339  bool beamspotIsValid) {
1340  // Correct to PV
1341 
1342  // PV2D
1343  aMuon.setDB(track->dxy(primaryVertex.position()),
1344  track->dxyError(primaryVertex.position(), primaryVertex.covariance()),
1345  pat::Muon::PV2D);
1346 
1347  // PV3D
1348  std::pair<bool, Measurement1D> result =
1350  double d0_corr = result.second.value();
1351  double d0_err = primaryVertexIsValid ? result.second.error() : -1.0;
1352  aMuon.setDB(d0_corr, d0_err, pat::Muon::PV3D);
1353 
1354  // Correct to beam spot
1355 
1356  // BS2D
1357  aMuon.setDB(track->dxy(beamspot), track->dxyError(beamspot), pat::Muon::BS2D);
1358 
1359  // make a fake vertex out of beam spot
1360  reco::Vertex vBeamspot(beamspot.position(), beamspot.rotatedCovariance3D());
1361 
1362  // BS3D
1363  result = IPTools::signedImpactParameter3D(tt, GlobalVector(track->px(), track->py(), track->pz()), vBeamspot);
1364  d0_corr = result.second.value();
1365  d0_err = beamspotIsValid ? result.second.error() : -1.0;
1366  aMuon.setDB(d0_corr, d0_err, pat::Muon::BS3D);
1367 
1368  // PVDZ
1369  aMuon.setDB(
1370  track->dz(primaryVertex.position()), std::hypot(track->dzError(), primaryVertex.zError()), pat::Muon::PVDZ);
1371 }
1372 
1374 
bool embedTpfmsMuon_
embed track from tpfms muon fit into the muon
edm::EDGetTokenT< edm::ValueMap< float > > PUPPIIsolation_charged_hadrons_
bool useUserData_
add user data to the muon (this will be data members of th muon even w/o embedding) ...
void readIsolationLabels(const edm::ParameterSet &iConfig, const char *psetName, IsolationLabels &labels, std::vector< edm::EDGetTokenT< edm::ValueMap< T >>> &tokens)
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:26
edm::EDGetTokenT< edm::ValueMap< float > > PUPPIIsolation_photons_
bool enabled() const
&#39;true&#39; if this there is at least one efficiency configured
void setComment(std::string const &value)
ParameterDescriptionNode * ifValue(ParameterDescription< T > const &switchParameter, std::unique_ptr< ParameterDescriptionCases< T >> cases)
void newEvent(const edm::Event &event)
To be called for each new event, reads in the ValueMaps for efficiencies.
bool addPuppiIsolation_
add puppi isolation
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
void embedDytMuon()
embed reference to the above dyt Track
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
void embedTpfmsMuon()
embed reference to the above tpfms Track
edm::EDGetTokenT< edm::ValueMap< reco::MuonMETCorrectionData > > tcMETMuonCorrsToken_
source of tcMET muon corrections
void setIsolation(IsolationKeys key, float value)
Definition: Lepton.h:115
bool embedTcMETMuonCorrs_
embed muon MET correction info for tcMET into the muon
class definition
void embedTcMETMuonCorrs(const reco::MuonMETCorrectionData &t)
edm::EDGetTokenT< std::vector< reco::Vertex > > pvToken_
input source of the primary vertex
bool contains(EventRange const &lh, EventID const &rh)
Definition: EventRange.cc:37
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
bool enabled() const
True if it has a non null configuration.
Definition: MultiIsolator.h:55
static const int OTHER
edm::EDGetTokenT< edm::ValueMap< reco::MuonTimeExtra > > muonTimeExtraToken_
input tag for reading inverse beta
edm::EDGetTokenT< edm::ValueMap< float > > PUPPINoLeptonsIsolation_photons_
void embedCombinedMuon()
set reference to Track reconstructed in both tracked and muon detector (reimplemented from reco::Muon...
edm::EDGetTokenT< double > rho_
edm::EDGetTokenT< edm::View< reco::Muon > > muonToken_
input source
void embedTunePMuonBestTrack(bool force=false)
bool addEfficiencies_
add efficiencies to the muon (this will be data members of th muon even w/o embedding) ...
edm::EDGetTokenT< edm::ValueMap< reco::MuonMETCorrectionData > > caloMETMuonCorrsToken_
source of caloMET muon corrections
void setEfficiencies(pat::PATObject< T > &obj, const R &originalRef) const
Sets the efficiencies for this object, using the reference to the original objects.
enum start value shifted to 81 so as to avoid clashes with PDG codes
void setAllowAnything()
allow any parameter label/value pairs
void setSimFlavour(int f)
Definition: Muon.h:321
bool isAValidMuonTrack(const MuonTrackType &type) const
bool embedCaloMETMuonCorrs_
embed muon MET correction info for caloMET into the muon
bool isChargedHadron(long pdgid)
bool exists(std::string const &parameterName) const
checks if a parameter exists
~PATMuonProducer() override
default destructur
edm::EDGetTokenT< edm::ValueMap< reco::MuonSimInfo > > simInfo_
MC info.
T const * product() const
Definition: Handle.h:70
void embedMuonBestTrack(bool force=false)
std::vector< pat::PackedCandidate > PackedCandidateCollection
void setIsolationPUPPINoLeptons(float chargedhadrons, float neutralhadrons, float photons)
sets PUPPINoLeptons isolations
Definition: Muon.h:207
void setMuonMiniIso(pat::Muon &aMuon, const pat::PackedCandidateCollection *pc)
PATMuonProducer(const edm::ParameterSet &iConfig, PATMuonHeavyObjectCache const *)
default constructir
bool addTriggerMatching_
Trigger.
void setSimBX(int bx)
Definition: Muon.h:325
ParameterDescriptionNode * addNode(ParameterDescriptionNode const &node)
bool embedBestTrack_
embed the track from best muon measurement (global pflow)
CH
LTS and SET for low trigger suppression.
edm::EDGetTokenT< reco::JetCorrector > mvaL1Corrector_
std::pair< bool, Measurement1D > signedImpactParameter3D(const reco::TransientTrack &track, const GlobalVector &direction, const reco::Vertex &vertex)
Definition: IPTools.cc:81
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
const edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > transientTrackBuilderToken_
bool addResolutions_
add resolutions to the muon (this will be data members of th muon even w/o embedding) ...
void setResolutions(pat::PATObject< T > &obj) const
Sets the efficiencies for this object, using the reference to the original objects.
IsolationKeys
Enum defining isolation keys.
Definition: Isolation.h:9
edm::EDGetTokenT< edm::ValueMap< float > > PUPPINoLeptonsIsolation_charged_hadrons_
std::vector< double > miniIsoParams_
void setSimPhi(float phi)
Definition: Muon.h:331
Log< level::Error, false > LogError
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
Definition: transform.h:11
PFCandidateCollection::const_iterator PFCandidateConstIterator
iterator
void setSimProdRho(float rho)
Definition: Muon.h:327
void setSimHeaviestMotherFlavour(int id)
Definition: Muon.h:322
reco::Muon::Selector makeSelectorBitset(reco::Muon const &muon, reco::Vertex const *vertex=nullptr, bool run2016_hip_mitigation=false)
assert(be >=bs)
void setPFCandidateRef(const reco::PFCandidateRef &ref)
add a reference to the source IsolatedPFCandidate
Definition: Muon.h:141
void embedHighLevel(pat::Muon &aMuon, reco::TrackRef track, reco::TransientTrack &tt, reco::Vertex &primaryVertex, bool primaryVertexIsValid, reco::BeamSpot &beamspot, bool beamspotIsValid)
std::vector< double > effectiveAreaVec_
const std::string names[nVars_]
edm::EDGetTokenT< edm::ValueMap< float > > PUPPINoLeptonsIsolation_neutral_hadrons_
void setSimType(reco::MuonSimType type)
Definition: Muon.h:319
void embedStandAloneMuon()
set reference to Track reconstructed in the muon detector only (reimplemented from reco::Muon) ...
#define LogTrace(id)
edm::EDGetTokenT< reco::JetTagCollection > mvaBTagCollectionTag_
edm::EDGetTokenT< reco::PFCandidateCollection > pfMuonToken_
input source pfCandidates that will be to be transformed into pat::Muons, when using PF2PAT ...
void setIsolationPUPPI(float chargedhadrons, float neutralhadrons, float photons)
sets PUPPI isolations
Definition: Muon.h:201
ProductID id() const
Definition: RefToBase.h:216
pat::helper::MultiIsolator isolator_
std::vector< edm::EDGetTokenT< edm::ValueMap< IsoDeposit > > > isoDepositTokens_
void fill(const edm::View< T > &coll, int idx, IsolationValuePairs &isolations) const
Definition: MultiIsolator.h:84
void setIsoDeposit(IsolationKeys key, const IsoDeposit &dep)
Sets the IsoDeposit associated with some key; if it is already existent, it is overwritten.
Definition: Lepton.h:191
Definition: HeavyIon.h:7
void embedTrack()
set reference to Track reconstructed in the tracker only (reimplemented from reco::Muon) ...
static void fillDescription(edm::ParameterSetDescription &iDesc)
pat::MuonMvaIDEstimator const & muonMvaIDEstimator() const
reco::TransientTrack build(const reco::Track *p) const
std::vector< IsolationLabel > IsolationLabels
edm::EDGetTokenT< reco::BeamSpot > beamLineToken_
input source of the primary vertex/beamspot
bool addInverseBeta_
add combined inverse beta measurement into the muon
bool useParticleFlow_
switch to use particle flow (PF2PAT) or not
pat::PATUserDataHelper< pat::Muon > userDataHelper_
helper class to add userData to the muon
std::vector< edm::Handle< edm::ValueMap< IsoDeposit > > > IsoDepositMaps
char const * label
bool embedStandAloneMuon_
embed track from muon system into the muon
void setComment(std::string const &value)
edm::EDGetTokenT< edm::TriggerResults > triggerResults_
int iEvent
Definition: GenABIO.cc:224
Definition: TTTypes.h:54
void beginEvent(const edm::Event &event, const edm::EventSetup &eventSetup)
bool embedTrack_
embed the track from inner tracker into the muon
void setDB(double dB, double edB, IPTYPE type=PV2D)
Definition: Muon.h:247
bool addGenMatch_
add generator match information
PATMuonHeavyObjectCache(const edm::ParameterSet &)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
description of config file parameters
Definition: Muon.py:1
void fillL1TriggerInfo(pat::Muon &muon, edm::Handle< std::vector< pat::TriggerObjectStandAlone >> &triggerObjects, const edm::TriggerNames &names, const edm::ESHandle< GlobalTrackingGeometry > &geometry)
double muonRelMiniIsoPUCorrected(const PFIsolation &iso, const reco::Candidate::PolarLorentzVector &p4, double dr, double rho, const std::vector< double > &area)
const edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecord > geometryToken_
bool embedPfEcalEnergy_
add ecal PF energy
void embedGenParticle()
Definition: PATObject.h:768
void newEvent(const edm::Event &event, const edm::EventSetup &setup)
To be called for each new event, reads in the EventSetup object.
void embedPFCandidate()
embed the IsolatedPFCandidate pointed to by pfCandidateRef_
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
bool isAvailable() const
Definition: Ref.h:541
bool enabled() const
&#39;true&#39; if this there is at least one efficiency configured
const PolarLorentzVector & polarP4() const final
four-momentum Lorentz vector
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
everything that needs to be done during the event loop
bool computeMuonIDMVA_
standard muon selectors
def pv(vc)
Definition: MetAnalyzer.py:7
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double relMiniIsoPUCorrected(const pat::Muon &aMuon, double rho)
edm::EDGetTokenT< pat::PackedCandidateCollection > pcToken_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
std::pair< pat::IsolationKeys, edm::InputTag > IsolationLabel
static void globalEndJob(PATMuonHeavyObjectCache *)
static std::string const triggerResults
Definition: EdmProvDump.cc:47
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void fillMuon(Muon &aMuon, const MuonBaseRef &muonRef, const reco::CandidateBaseRef &baseRef, const GenAssociations &genMatches, const IsoDepositMaps &deposits, const IsolationValueMaps &isolationValues) const
common muon filling, for both the standard and PF2PAT case
double puppiCombinedIsolation(const pat::Muon &muon, const pat::PackedCandidateCollection *pc)
double ecalEnergy() const
return corrected Ecal energy
Definition: PFCandidate.h:221
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
reco::MuonRef muonRef() const
Definition: PFCandidate.cc:450
void readTimeExtra(const reco::MuonTimeExtra &t)
std::vector< std::string > hltCollectionFilters_
void add(ObjectType &patObject, edm::Event const &iEvent, edm::EventSetup const &iSetup)
float miniIsoDr(const reco::Candidate::PolarLorentzVector &p4, float mindr, float maxdr, float kt_scale)
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
void fillHltTriggerInfo(pat::Muon &muon, edm::Handle< std::vector< pat::TriggerObjectStandAlone >> &triggerObjects, const edm::TriggerNames &names, const std::vector< std::string > &collection_names)
static std::unique_ptr< PATMuonHeavyObjectCache > initializeGlobalCache(const edm::ParameterSet &iConfig)
Definition: DetId.h:17
std::vector< std::pair< pat::IsolationKeys, float > > IsolationValuePairs
Definition: MultiIsolator.h:17
void initSimInfo(void)
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16
void addGenParticleRef(const reco::GenParticleRef &ref)
Definition: PATObject.h:751
void setPfEcalEnergy(float pfEcalEnergy)
Definition: Muon.h:277
bool embedTunePBestTrack_
embed the track from best muon measurement (muon only)
static void fillDescription(edm::ParameterSetDescription &iDesc)
Method for documentation and validation of PSet.
double getRelMiniIsoPUCorrected(const pat::Muon &muon, double rho, const std::vector< double > &area)
void setSimMotherPdgId(int id)
Definition: Muon.h:324
void addTriggerObjectMatch(const TriggerObjectStandAlone &trigObj)
add a trigger match
Definition: PATObject.h:238
void setExtSimType(reco::ExtendedMuonSimType type)
Definition: Muon.h:320
std::vector< MuonChamberMatch > & matches()
get muon matching information
Definition: Muon.h:145
std::unique_ptr< const pat::MuonMvaIDEstimator > muonMvaIDEstimator_
void setMiniPFIsolation(PFIsolation const &iso)
Definition: Lepton.h:217
std::unique_ptr< const pat::SoftMuonMvaEstimator > softMuonMvaEstimator_
bool isValid() const
Definition: HandleBase.h:70
std::vector< edm::Handle< edm::Association< reco::GenParticleCollection > > > GenAssociations
edm::EDGetTokenT< reco::JetCorrector > mvaL1L2L3ResCorrector_
void setSimProdZ(float z)
Definition: Muon.h:328
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:41
std::vector< edm::Handle< edm::ValueMap< double > > > IsolationValueMaps
pat::helper::EfficiencyLoader efficiencyLoader_
helper class to add efficiencies to the muon
HLT enums.
bool embedPickyMuon_
embed track from picky muon fit into the muon
void setNormChi2(double normChi2)
Definition: Muon.h:262
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
bool embedDytMuon_
embed track from DYT muon fit into the muon
void embedCaloMETMuonCorrs(const reco::MuonMETCorrectionData &t)
pat::CalculatePtRatioRel const & calculatePtRatioRel() const
void setSimPdgId(int id)
Definition: Muon.h:323
const edm::EDPutTokenT< std::vector< Muon > > patMuonPutToken_
void setSimPt(float pt)
Definition: Muon.h:329
reco::PFCandidateRef pfCandidateRef() const
Calculates a lepton&#39;s calorimetric isolation energy.
bool isPhoton(long pdgid)
pat::helper::MultiIsolator::IsolationValuePairs isolatorTmpStorage_
isolation value pair for temporary storage before being folded into the muon
edm::EDGetTokenT< std::vector< pat::TriggerObjectStandAlone > > triggerObjects_
bool embedGenMatch_
embed the gen match information into the muon
IsolationLabels isoDepositLabels_
input source for isoDeposits
std::vector< edm::EDGetTokenT< edm::Association< reco::GenParticleCollection > > > genMatchTokens_
input tags for generator match information
PFIsolation getMiniPFIsolation(const pat::PackedCandidateCollection *pfcands, const reco::Candidate::PolarLorentzVector &p4, float mindr=0.05, float maxdr=0.2, float kt_scale=10.0, float ptthresh=0.5, float deadcone_ch=0.0001, float deadcone_pu=0.01, float deadcone_ph=0.01, float deadcone_nh=0.01, float dZ_cut=0.0)
std::unique_ptr< const pat::CalculatePtRatioRel > calculatePtRatioRel_
static constexpr int DT
Definition: MuonSubdetId.h:11
IsolationLabels isolationValueLabels_
input source isolation value maps
void embedPickyMuon()
embed reference to the above picky Track
static constexpr int CSC
Definition: MuonSubdetId.h:12
primaryVertex
hltOfflineBeamSpot for HLTMON
bool forceEmbedBestTrack_
force separate embed of the best track even if already embedded
edm::RefToBase< reco::Muon > MuonBaseRef
typedefs for convenience
bool embedPFCandidate_
embed pfCandidates into the muon
std::vector< edm::EDGetTokenT< edm::ValueMap< double > > > isolationValueTokens_
void setNumberOfValidHits(unsigned int numberOfValidHits)
Definition: Muon.h:255
void setSimEta(float eta)
Definition: Muon.h:330
bool embedCombinedMuon_
embed track of the combined fit into the muon
Analysis-level muon class.
Definition: Muon.h:51
pat::helper::KinResolutionsLoader resolutionLoader_
helper class to add resolutions to the muon
static std::string const source
Definition: EdmProvDump.cc:49
bool isGlobalMuon() const override
Definition: Muon.h:303
void setP4(const LorentzVector &p4) final
set 4-momentum
pat::SoftMuonMvaEstimator const & softMuonMvaEstimator() const
edm::EDGetTokenT< edm::ValueMap< float > > PUPPIIsolation_neutral_hadrons_
def move(src, dest)
Definition: eostools.py:511
std::optional< GlobalPoint > getMuonDirection(const reco::MuonChamberMatch &chamberMatch, const edm::ESHandle< GlobalTrackingGeometry > &geometry, const DetId &chamberId)
bool isNeutralHadron(long pdgid)
genMatch
add extra information on genMatch
Global3DVector GlobalVector
Definition: GlobalVector.h:10
Calculates a lepton&#39;s tracker isolation pt.
Analysis-level trigger object class (stand-alone)
void setSimMatchQuality(float quality)
Definition: Muon.h:332
void setSimTpEvent(int tpEvent)
Definition: Muon.h:326
bool embedHighLevelSelection_
embed high level selection variables