CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
ZtoMMMuonTrackProducer Class Reference

#include <ZtoMMMuonTrackProducer.h>

Inheritance diagram for ZtoMMMuonTrackProducer:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void produce (edm::StreamID streamID, edm::Event &iEvent, edm::EventSetup const &iSetup) const override
 
 ZtoMMMuonTrackProducer (const edm::ParameterSet &)
 
 ~ZtoMMMuonTrackProducer () override
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

const edm::InputTag bsTag_
 
const edm::EDGetTokenT< reco::BeamSpotbsToken_
 
const double maxD0_
 
const double maxDz_
 
const double maxEta_
 
const double maxInvMass_
 
const double maxIso_
 
const double maxNormChi2_
 
const int minChambers_
 
const double minInvMass_
 
const int minMatchedStations_
 
const int minMatches_
 
const int minPixelHits_
 
const double minPt_
 
const double minPtHighest_
 
const int minStripHits_
 
const edm::InputTag muonTag_
 
const edm::EDGetTokenT< reco::MuonCollectionmuonToken_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 17 of file ZtoMMMuonTrackProducer.h.

Constructor & Destructor Documentation

◆ ZtoMMMuonTrackProducer()

ZtoMMMuonTrackProducer::ZtoMMMuonTrackProducer ( const edm::ParameterSet ps)
explicit

Definition at line 15 of file ZtoMMMuonTrackProducer.cc.

16  : muonTag_(ps.getUntrackedParameter<edm::InputTag>("muonInputTag", edm::InputTag("muons"))),
17  bsTag_(ps.getUntrackedParameter<edm::InputTag>("offlineBeamSpot", edm::InputTag("offlineBeamSpot"))),
18  muonToken_(consumes<reco::MuonCollection>(muonTag_)),
19  bsToken_(consumes<reco::BeamSpot>(bsTag_)),
20  maxEta_(ps.getUntrackedParameter<double>("maxEta", 2.4)),
21  minPt_(ps.getUntrackedParameter<double>("minPt", 5)),
22  maxNormChi2_(ps.getUntrackedParameter<double>("maxNormChi2", 1000)),
23  maxD0_(ps.getUntrackedParameter<double>("maxD0", 0.02)),
24  maxDz_(ps.getUntrackedParameter<double>("maxDz", 20.)),
25  minPixelHits_(ps.getUntrackedParameter<uint32_t>("minPixelHits", 1)),
26  minStripHits_(ps.getUntrackedParameter<uint32_t>("minStripHits", 8)),
27  minChambers_(ps.getUntrackedParameter<uint32_t>("minChambers", 2)),
28  minMatches_(ps.getUntrackedParameter<uint32_t>("minMatches", 2)),
29  minMatchedStations_(ps.getUntrackedParameter<double>("minMatchedStations", 2)),
30  maxIso_(ps.getUntrackedParameter<double>("maxIso", 0.3)),
31  minPtHighest_(ps.getUntrackedParameter<double>("minPtHighest", 24)),
32  minInvMass_(ps.getUntrackedParameter<double>("minInvMass", 60)),
33  maxInvMass_(ps.getUntrackedParameter<double>("maxInvMass", 120)) {
34  produces<reco::TrackCollection>("");
35 }
const edm::InputTag bsTag_
const edm::EDGetTokenT< reco::MuonCollection > muonToken_
const edm::EDGetTokenT< reco::BeamSpot > bsToken_
T getUntrackedParameter(std::string const &, T const &) const
const edm::InputTag muonTag_

◆ ~ZtoMMMuonTrackProducer()

ZtoMMMuonTrackProducer::~ZtoMMMuonTrackProducer ( )
override

Definition at line 37 of file ZtoMMMuonTrackProducer.cc.

37 {}

Member Function Documentation

◆ produce()

void ZtoMMMuonTrackProducer::produce ( edm::StreamID  streamID,
edm::Event iEvent,
edm::EventSetup const &  iSetup 
) const
overridevirtual

Implements edm::global::EDProducerBase.

Definition at line 39 of file ZtoMMMuonTrackProducer.cc.

References pwdgSkimBPark_cfi::beamSpot, bsTag_, bsToken_, nano_mu_local_reco_cff::chi2, muon::GlobalMuonPromptTight, iEvent, muon::isGoodMuon(), edm::HandleBase::isValid(), SiStripPI::max, maxD0_, maxDz_, maxEta_, maxIso_, maxNormChi2_, minChambers_, minMatchedStations_, minMatches_, minPixelHits_, minPt_, minStripHits_, eostools::move(), amptDefaultParameters_cff::mu, muonTag_, muonToken_, ndof, reco::HitPattern::numberOfValidPixelHits(), reco::HitPattern::numberOfValidStripHits(), and nano_mu_reco_cff::pfIso04.

39  {
40  std::unique_ptr<reco::TrackCollection> outputTColl(new reco::TrackCollection());
41 
42  // Read Muon Collection
44  iEvent.getByToken(muonToken_, muonColl);
45 
46  // and the beamspot
48  iEvent.getByToken(bsToken_, beamSpot);
49 
50  std::vector<TLorentzVector> list;
51  if (muonColl.isValid()) {
52  for (auto const& mu : *muonColl) {
53  if (!mu.isGlobalMuon())
54  continue;
55  if (!mu.isPFMuon())
56  continue;
57  if (std::fabs(mu.eta()) >= maxEta_)
58  continue;
59  if (mu.pt() < minPt_)
60  continue;
61 
62  reco::TrackRef gtk = mu.globalTrack();
63  double chi2 = gtk->chi2();
64  double ndof = gtk->ndof();
65  double chbyndof = (ndof > 0) ? chi2 / ndof : 0;
66  if (chbyndof >= maxNormChi2_)
67  continue;
68 
69  reco::TrackRef tk = mu.innerTrack();
70  if (beamSpot.isValid()) {
71  double trkd0 = -(tk->dxy(beamSpot->position()));
72  if (std::fabs(trkd0) >= maxD0_)
73  continue;
74  double trkdz = tk->dz(beamSpot->position());
75  if (std::fabs(trkdz) >= maxDz_)
76  continue;
77  } else {
78  edm::LogError("ZtoMMMuonTrackProducer") << "Error >> Failed to get BeamSpot for label: " << bsTag_;
79  }
80  const reco::HitPattern& hitp = gtk->hitPattern();
82  continue;
84  continue;
85  // Hits/section in the muon chamber
86  if (mu.numberOfChambers() < minChambers_)
87  continue;
88  if (mu.numberOfMatches() < minMatches_)
89  continue;
90  if (mu.numberOfMatchedStations() < minMatchedStations_)
91  continue;
93  continue;
94 
95  //if (!muon::isMediumMuon(mu)) continue;
96 
97  // PF Isolation
98  const reco::MuonPFIsolation& pfIso04 = mu.pfIsolationR04();
99  double absiso = pfIso04.sumChargedHadronPt +
100  std::max(0.0, pfIso04.sumNeutralHadronEt + pfIso04.sumPhotonEt - 0.5 * pfIso04.sumPUPt);
101  if (absiso / mu.pt() > maxIso_)
102  continue;
103 
104  TLorentzVector lv;
105  lv.SetPtEtaPhiE(mu.pt(), mu.eta(), mu.phi(), mu.energy());
106  list.push_back(lv);
107 
108  outputTColl->push_back(*tk);
109  }
110  } else {
111  edm::LogError("ZtoMMMuonTrackProducer") << "Error >> Failed to get MuonCollection for label: " << muonTag_;
112  }
113 
114  iEvent.put(std::move(outputTColl));
115 }
int numberOfValidPixelHits() const
Definition: HitPattern.h:831
const edm::InputTag bsTag_
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
const edm::EDGetTokenT< reco::MuonCollection > muonToken_
Log< level::Error, false > LogError
const edm::EDGetTokenT< reco::BeamSpot > bsToken_
int numberOfValidStripHits() const
Definition: HitPattern.h:843
int iEvent
Definition: GenABIO.cc:224
bool isGoodMuon(const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
main GoodMuon wrapper call
bool isValid() const
Definition: HandleBase.h:70
const edm::InputTag muonTag_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ bsTag_

const edm::InputTag ZtoMMMuonTrackProducer::bsTag_
private

Definition at line 28 of file ZtoMMMuonTrackProducer.h.

Referenced by produce().

◆ bsToken_

const edm::EDGetTokenT<reco::BeamSpot> ZtoMMMuonTrackProducer::bsToken_
private

Definition at line 30 of file ZtoMMMuonTrackProducer.h.

Referenced by produce().

◆ maxD0_

const double ZtoMMMuonTrackProducer::maxD0_
private

Definition at line 35 of file ZtoMMMuonTrackProducer.h.

Referenced by produce().

◆ maxDz_

const double ZtoMMMuonTrackProducer::maxDz_
private

Definition at line 36 of file ZtoMMMuonTrackProducer.h.

Referenced by produce().

◆ maxEta_

const double ZtoMMMuonTrackProducer::maxEta_
private

Definition at line 32 of file ZtoMMMuonTrackProducer.h.

Referenced by produce().

◆ maxInvMass_

const double ZtoMMMuonTrackProducer::maxInvMass_
private

Definition at line 45 of file ZtoMMMuonTrackProducer.h.

◆ maxIso_

const double ZtoMMMuonTrackProducer::maxIso_
private

Definition at line 42 of file ZtoMMMuonTrackProducer.h.

Referenced by produce().

◆ maxNormChi2_

const double ZtoMMMuonTrackProducer::maxNormChi2_
private

Definition at line 34 of file ZtoMMMuonTrackProducer.h.

Referenced by produce().

◆ minChambers_

const int ZtoMMMuonTrackProducer::minChambers_
private

Definition at line 39 of file ZtoMMMuonTrackProducer.h.

Referenced by produce().

◆ minInvMass_

const double ZtoMMMuonTrackProducer::minInvMass_
private

Definition at line 44 of file ZtoMMMuonTrackProducer.h.

◆ minMatchedStations_

const int ZtoMMMuonTrackProducer::minMatchedStations_
private

Definition at line 41 of file ZtoMMMuonTrackProducer.h.

Referenced by produce().

◆ minMatches_

const int ZtoMMMuonTrackProducer::minMatches_
private

Definition at line 40 of file ZtoMMMuonTrackProducer.h.

Referenced by produce().

◆ minPixelHits_

const int ZtoMMMuonTrackProducer::minPixelHits_
private

Definition at line 37 of file ZtoMMMuonTrackProducer.h.

Referenced by produce().

◆ minPt_

const double ZtoMMMuonTrackProducer::minPt_
private

Definition at line 33 of file ZtoMMMuonTrackProducer.h.

Referenced by produce().

◆ minPtHighest_

const double ZtoMMMuonTrackProducer::minPtHighest_
private

Definition at line 43 of file ZtoMMMuonTrackProducer.h.

◆ minStripHits_

const int ZtoMMMuonTrackProducer::minStripHits_
private

Definition at line 38 of file ZtoMMMuonTrackProducer.h.

Referenced by produce().

◆ muonTag_

const edm::InputTag ZtoMMMuonTrackProducer::muonTag_
private

Definition at line 27 of file ZtoMMMuonTrackProducer.h.

Referenced by produce().

◆ muonToken_

const edm::EDGetTokenT<reco::MuonCollection> ZtoMMMuonTrackProducer::muonToken_
private

Definition at line 29 of file ZtoMMMuonTrackProducer.h.

Referenced by produce().