CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
PATMuonMerger Class Reference
Inheritance diagram for PATMuonMerger:
edm::stream::EDProducer<>

Public Member Functions

 PATMuonMerger (const edm::ParameterSet &iConfig)
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 ~PATMuonMerger () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Attributes

edm::InputTag lostTrack_
 
StringCutObjectSelector< pat::PackedCandidate, false > lostTrackCut_
 
edm::EDGetTokenT< std::vector< pat::PackedCandidate > > lostTrackToken_
 
edm::InputTag muons_
 
StringCutObjectSelector< pat::Muon, false > muonsCut_
 
edm::EDGetTokenT< std::vector< pat::Muon > > muonToken_
 
edm::InputTag pfCandidate_
 
StringCutObjectSelector< pat::PackedCandidate, false > pfCandidateCut_
 
edm::EDGetTokenT< std::vector< pat::PackedCandidate > > pfCandToken_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Definition at line 21 of file PATMuonMerger.cc.

Constructor & Destructor Documentation

◆ PATMuonMerger()

PATMuonMerger::PATMuonMerger ( const edm::ParameterSet iConfig)
explicit

Definition at line 42 of file PATMuonMerger.cc.

43  : muons_(iConfig.getParameter<edm::InputTag>("muons")),
44  muonsCut_(iConfig.getParameter<std::string>("muonCut")),
45  pfCandidate_(iConfig.getParameter<edm::InputTag>("pfCandidates")),
46  pfCandidateCut_(iConfig.getParameter<std::string>("pfCandidatesCut")),
47  lostTrack_(iConfig.getParameter<edm::InputTag>("otherTracks")),
48  lostTrackCut_(iConfig.getParameter<std::string>("lostTrackCut")) {
49  muonToken_ = consumes<std::vector<pat::Muon>>(muons_);
50  pfCandToken_ = consumes<std::vector<pat::PackedCandidate>>(pfCandidate_);
51  lostTrackToken_ = consumes<std::vector<pat::PackedCandidate>>(lostTrack_);
52  produces<std::vector<pat::Muon>>();
53 }

References lostTrack_, lostTrackToken_, muons_, muonToken_, pfCandidate_, and pfCandToken_.

◆ ~PATMuonMerger()

PATMuonMerger::~PATMuonMerger ( )
inlineoverride

Definition at line 24 of file PATMuonMerger.cc.

24 {}

Member Function Documentation

◆ fillDescriptions()

void PATMuonMerger::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 55 of file PATMuonMerger.cc.

55  {
56  // mergedMuons
58  desc.add<std::string>("muonCut", "");
59  desc.add<edm::InputTag>("otherTracks", edm::InputTag("lostTracks"));
60  desc.add<edm::InputTag>("pfCandidates", edm::InputTag("packedPFCandidates"));
61  desc.add<std::string>("pfCandidatesCut", "");
62  desc.add<edm::InputTag>("muons", edm::InputTag("slimmedMuons"));
63  desc.add<std::string>("lostTrackCut", "");
64  descriptions.add("mergedMuonsNoCuts", desc);
65 }

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, HLT_FULL_cff::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ produce()

void PATMuonMerger::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 67 of file PATMuonMerger.cc.

67  {
71 
72  iEvent.getByToken(muonToken_, muons);
73  iEvent.getByToken(pfCandToken_, pfCands);
74  iEvent.getByToken(lostTrackToken_, lostTracks);
75 
76  auto out = std::make_unique<std::vector<pat::Muon>>();
77  out->reserve(muons->size() + pfCands->size() + lostTracks->size());
78 
79  // copy all muons
80  for (auto& muon : *muons) {
81  if (!muonsCut_(muon))
82  continue;
83  out->push_back(muon);
84  }
85 
86  // add other pfCandidates, removing duplicates
87  for (unsigned int pf = 0; pf < pfCands->size(); ++pf) {
88  auto pfCand = pfCands->at(pf);
89  if (!pfCandidateCut_(pfCand))
90  continue;
91  reco::CandidatePtr pfCandPtr(pfCands, pf);
92  bool isPFMuon = false;
93  for (auto& muon : *muons) {
94  for (unsigned int i = 0, n = muon.numberOfSourceCandidatePtrs(); i < n; ++i) {
95  reco::CandidatePtr ptr = muon.sourceCandidatePtr(i);
96  if (ptr.isNonnull() && ptr == pfCandPtr) {
97  isPFMuon = true;
98  break;
99  }
100  }
101  if (isPFMuon)
102  break;
103  }
104  if (isPFMuon) {
105  continue;
106  }
107 
108  // now make a reco::Muon and recast to pat::Muon
109  double energy = sqrt(pfCand.p() * pfCand.p() + 0.011163691);
110  math::XYZTLorentzVector p4(pfCand.px(), pfCand.py(), pfCand.pz(), energy);
111  reco::Muon mu(pfCand.charge(), p4, pfCand.vertex());
112  pat::Muon aMu(mu);
113  out->push_back(aMu);
114  }
115 
116  // adding now lost tracks, removing duplicates
117  for (auto& lostTrack : *lostTracks) {
118  if (!lostTrackCut_(lostTrack))
119  continue;
120  if (std::abs(lostTrack.pdgId()) == 13)
121  continue;
122 
123  // now make a reco::Muon and recast to pat::Muon
124  double energy = sqrt(lostTrack.p() * lostTrack.p() + 0.011163691);
125  math::XYZTLorentzVector p4(lostTrack.px(), lostTrack.py(), lostTrack.pz(), energy);
126  reco::Muon mu(lostTrack.charge(), p4, lostTrack.vertex());
127  pat::Muon aMu(mu);
128  out->push_back(aMu);
129  }
130  iEvent.put(std::move(out));
131 }

References funct::abs(), HCALHighEnergyHPDFilter_cfi::energy, mps_fire::i, iEvent, edm::Ptr< T >::isNonnull(), lostTrackCut_, isotracks_cff::lostTracks, lostTrackToken_, eostools::move(), amptDefaultParameters_cff::mu, PDWG_BPHSkim_cff::muons, muonsCut_, muonToken_, dqmiodumpmetadata::n, MillePedeFileConverter_cfg::out, p4, packedPFCandidateRefMixer_cfi::pf, pfCandidateCut_, pfCandToken_, and mathSSE::sqrt().

Member Data Documentation

◆ lostTrack_

edm::InputTag PATMuonMerger::lostTrack_
private

Definition at line 34 of file PATMuonMerger.cc.

Referenced by PATMuonMerger().

◆ lostTrackCut_

StringCutObjectSelector<pat::PackedCandidate, false> PATMuonMerger::lostTrackCut_
private

Definition at line 35 of file PATMuonMerger.cc.

Referenced by produce().

◆ lostTrackToken_

edm::EDGetTokenT<std::vector<pat::PackedCandidate> > PATMuonMerger::lostTrackToken_
private

Definition at line 39 of file PATMuonMerger.cc.

Referenced by PATMuonMerger(), and produce().

◆ muons_

edm::InputTag PATMuonMerger::muons_
private

Definition at line 30 of file PATMuonMerger.cc.

Referenced by PATMuonMerger().

◆ muonsCut_

StringCutObjectSelector<pat::Muon, false> PATMuonMerger::muonsCut_
private

Definition at line 31 of file PATMuonMerger.cc.

Referenced by produce().

◆ muonToken_

edm::EDGetTokenT<std::vector<pat::Muon> > PATMuonMerger::muonToken_
private

Definition at line 37 of file PATMuonMerger.cc.

Referenced by PATMuonMerger(), and produce().

◆ pfCandidate_

edm::InputTag PATMuonMerger::pfCandidate_
private

Definition at line 32 of file PATMuonMerger.cc.

Referenced by PATMuonMerger().

◆ pfCandidateCut_

StringCutObjectSelector<pat::PackedCandidate, false> PATMuonMerger::pfCandidateCut_
private

Definition at line 33 of file PATMuonMerger.cc.

Referenced by produce().

◆ pfCandToken_

edm::EDGetTokenT<std::vector<pat::PackedCandidate> > PATMuonMerger::pfCandToken_
private

Definition at line 38 of file PATMuonMerger.cc.

Referenced by PATMuonMerger(), and produce().

PDWG_BPHSkim_cff.muons
muons
Definition: PDWG_BPHSkim_cff.py:47
mps_fire.i
i
Definition: mps_fire.py:428
isotracks_cff.lostTracks
lostTracks
Definition: isotracks_cff.py:23
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
muon
Definition: MuonCocktails.h:17
amptDefaultParameters_cff.mu
mu
Definition: amptDefaultParameters_cff.py:16
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:85964
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
PATMuonMerger::pfCandidate_
edm::InputTag pfCandidate_
Definition: PATMuonMerger.cc:32
pat::Muon
Analysis-level muon class.
Definition: Muon.h:51
edm::Handle
Definition: AssociativeIterator.h:50
reco::Muon
Definition: Muon.h:27
PATMuonMerger::lostTrack_
edm::InputTag lostTrack_
Definition: PATMuonMerger.cc:34
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
PATMuonMerger::muonsCut_
StringCutObjectSelector< pat::Muon, false > muonsCut_
Definition: PATMuonMerger.cc:31
PATMuonMerger::muonToken_
edm::EDGetTokenT< std::vector< pat::Muon > > muonToken_
Definition: PATMuonMerger.cc:37
iEvent
int iEvent
Definition: GenABIO.cc:224
p4
double p4[4]
Definition: TauolaWrapper.h:92
PATMuonMerger::lostTrackToken_
edm::EDGetTokenT< std::vector< pat::PackedCandidate > > lostTrackToken_
Definition: PATMuonMerger.cc:39
PATMuonMerger::pfCandToken_
edm::EDGetTokenT< std::vector< pat::PackedCandidate > > pfCandToken_
Definition: PATMuonMerger.cc:38
PATMuonMerger::muons_
edm::InputTag muons_
Definition: PATMuonMerger.cc:30
edm::Ptr< Candidate >
PATMuonMerger::pfCandidateCut_
StringCutObjectSelector< pat::PackedCandidate, false > pfCandidateCut_
Definition: PATMuonMerger.cc:33
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
PATMuonMerger::lostTrackCut_
StringCutObjectSelector< pat::PackedCandidate, false > lostTrackCut_
Definition: PATMuonMerger.cc:35
packedPFCandidateRefMixer_cfi.pf
pf
Definition: packedPFCandidateRefMixer_cfi.py:4
math::XYZTLorentzVector
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
edm::Ptr::isNonnull
bool isNonnull() const
Checks for non-null.
Definition: Ptr.h:146
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
edm::InputTag
Definition: InputTag.h:15