CMS 3D CMS Logo

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

#include <ZtoMMEventSelector.h>

Inheritance diagram for ZtoMMEventSelector:
edm::stream::EDFilter<> edm::stream::EDFilterBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

bool filter (edm::Event &, edm::EventSetup const &) override
 
 ZtoMMEventSelector (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::stream::EDFilter<>
 EDFilter ()=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
 
- Public Member Functions inherited from edm::stream::EDFilterBase
 EDFilterBase ()
 
 EDFilterBase (const EDFilterBase &)=delete
 
ModuleDescription const & moduleDescription () const
 
const EDFilterBaseoperator= (const EDFilterBase &)=delete
 
 ~EDFilterBase () 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > 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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices 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_
 
bool verbose_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDFilter<>
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
 
- Public Types inherited from edm::stream::EDFilterBase
typedef EDFilterAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
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::stream::EDFilterBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
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)
 
template<Transition B>
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 (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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 ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 12 of file ZtoMMEventSelector.h.

Constructor & Destructor Documentation

◆ ZtoMMEventSelector()

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

Definition at line 19 of file ZtoMMEventSelector.cc.

20  : verbose_(ps.getUntrackedParameter<bool>("verbose", false)),
21  muonTag_(ps.getUntrackedParameter<edm::InputTag>("muonInputTag", edm::InputTag("muons"))),
22  bsTag_(ps.getUntrackedParameter<edm::InputTag>("offlineBeamSpot", edm::InputTag("offlineBeamSpot"))),
23  muonToken_(consumes<reco::MuonCollection>(muonTag_)),
24  bsToken_(consumes<reco::BeamSpot>(bsTag_)),
25  maxEta_(ps.getUntrackedParameter<double>("maxEta", 2.1)),
26  minPt_(ps.getUntrackedParameter<double>("minPt", 5)),
27  maxNormChi2_(ps.getUntrackedParameter<double>("maxNormChi2", 10)),
28  maxD0_(ps.getUntrackedParameter<double>("maxD0", 0.02)),
29  maxDz_(ps.getUntrackedParameter<double>("maxDz", 20.)),
30  minPixelHits_(ps.getUntrackedParameter<uint32_t>("minPixelHits", 1)),
31  minStripHits_(ps.getUntrackedParameter<uint32_t>("minStripHits", 8)),
32  minChambers_(ps.getUntrackedParameter<uint32_t>("minChambers", 2)),
33  minMatches_(ps.getUntrackedParameter<uint32_t>("minMatches", 2)),
34  minMatchedStations_(ps.getUntrackedParameter<double>("minMatchedStations", 2)),
35  maxIso_(ps.getUntrackedParameter<double>("maxIso", 0.3)),
36  minPtHighest_(ps.getUntrackedParameter<double>("minPtHighest", 24)),
37  minInvMass_(ps.getUntrackedParameter<double>("minInvMass", 60)),
38  maxInvMass_(ps.getUntrackedParameter<double>("maxInvMass", 120)) {}

Member Function Documentation

◆ filter()

bool ZtoMMEventSelector::filter ( edm::Event iEvent,
edm::EventSetup const &  iSetup 
)
overridevirtual

Implements edm::stream::EDFilterBase.

Definition at line 39 of file ZtoMMEventSelector.cc.

39  {
40  // Read Muon Collection
42  iEvent.getByToken(muonToken_, muonColl);
43 
44  // and the beamspot
46  iEvent.getByToken(bsToken_, beamSpot);
47 
48  std::vector<TLorentzVector> list;
49  if (muonColl.isValid()) {
50  for (auto const& mu : *muonColl) {
51  if (!mu.isGlobalMuon())
52  continue;
53  if (!mu.isPFMuon())
54  continue;
55  if (std::fabs(mu.eta()) >= maxEta_)
56  continue;
57  if (mu.pt() < minPt_)
58  continue;
59 
60  reco::TrackRef gtk = mu.globalTrack();
61  double chi2 = gtk->chi2();
62  double ndof = gtk->ndof();
63  double chbyndof = (ndof > 0) ? chi2 / ndof : 0;
64  if (chbyndof >= maxNormChi2_)
65  continue;
66 
67  reco::TrackRef tk = mu.innerTrack();
68  double trkd0 = tk->d0();
69  double trkdz = tk->dz();
70  if (beamSpot.isValid()) {
71  trkd0 = -(tk->dxy(beamSpot->position()));
72  if (std::fabs(trkd0) >= maxD0_)
73  continue;
74  trkdz = tk->dz(beamSpot->position());
75  if (std::fabs(trkdz) >= maxDz_)
76  continue;
77  } else {
78  edm::LogError("ZtoMMEventSelector") << "Error >> Failed to get BeamSpot for label: " << bsTag_;
79  }
80 
81  const reco::HitPattern& hitp = gtk->hitPattern();
83  continue;
85  continue;
86 
87  // Hits/section in the muon chamber
88  if (mu.numberOfChambers() < minChambers_)
89  continue;
90  if (mu.numberOfMatches() < minMatches_)
91  continue;
92  if (mu.numberOfMatchedStations() < minMatchedStations_)
93  continue;
95  continue;
96 
97  // PF Isolation
98  const reco::MuonPFIsolation& pfIso04 = mu.pfIsolationR04();
99  double absiso = pfIso04.sumChargedParticlePt +
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  } else {
109  edm::LogError("ZtoMMEventSelector") << "Error >> Failed to get MuonCollection for label: " << muonTag_;
110  return false;
111  }
112 
113  if (list.size() < 2)
114  return false;
115  if (list[0].Pt() < minPtHighest_)
116  return false;
117  TLorentzVector zv = list[0] + list[1];
118  double mass = zv.M();
119  if (mass < minInvMass_ || mass > maxInvMass_)
120  return false;
121 
122  return true;
123 }

References pwdgSkimBPark_cfi::beamSpot, bsTag_, bsToken_, hltPixelTracks_cff::chi2, muon::GlobalMuonPromptTight, iEvent, muon::isGoodMuon(), edm::HandleBase::isValid(), EgHLTOffHistBins_cfi::mass, SiStripPI::max, maxD0_, maxDz_, maxEta_, maxInvMass_, maxIso_, maxNormChi2_, minChambers_, minMatchedStations_, minMatches_, minPixelHits_, minPt_, minPtHighest_, minStripHits_, amptDefaultParameters_cff::mu, muonTag_, muonToken_, ndof, reco::HitPattern::numberOfValidPixelHits(), reco::HitPattern::numberOfValidStripHits(), reco::MuonPFIsolation::sumChargedParticlePt, reco::MuonPFIsolation::sumNeutralHadronEt, reco::MuonPFIsolation::sumPhotonEt, reco::MuonPFIsolation::sumPUPt, and gpuVertexFinder::zv.

Member Data Documentation

◆ bsTag_

const edm::InputTag ZtoMMEventSelector::bsTag_
private

Definition at line 21 of file ZtoMMEventSelector.h.

Referenced by filter().

◆ bsToken_

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

Definition at line 23 of file ZtoMMEventSelector.h.

Referenced by filter().

◆ maxD0_

const double ZtoMMEventSelector::maxD0_
private

Definition at line 28 of file ZtoMMEventSelector.h.

Referenced by filter().

◆ maxDz_

const double ZtoMMEventSelector::maxDz_
private

Definition at line 29 of file ZtoMMEventSelector.h.

Referenced by filter().

◆ maxEta_

const double ZtoMMEventSelector::maxEta_
private

Definition at line 25 of file ZtoMMEventSelector.h.

Referenced by filter().

◆ maxInvMass_

const double ZtoMMEventSelector::maxInvMass_
private

Definition at line 38 of file ZtoMMEventSelector.h.

Referenced by filter().

◆ maxIso_

const double ZtoMMEventSelector::maxIso_
private

Definition at line 35 of file ZtoMMEventSelector.h.

Referenced by filter().

◆ maxNormChi2_

const double ZtoMMEventSelector::maxNormChi2_
private

Definition at line 27 of file ZtoMMEventSelector.h.

Referenced by filter().

◆ minChambers_

const int ZtoMMEventSelector::minChambers_
private

Definition at line 32 of file ZtoMMEventSelector.h.

Referenced by filter().

◆ minInvMass_

const double ZtoMMEventSelector::minInvMass_
private

Definition at line 37 of file ZtoMMEventSelector.h.

◆ minMatchedStations_

const int ZtoMMEventSelector::minMatchedStations_
private

Definition at line 34 of file ZtoMMEventSelector.h.

Referenced by filter().

◆ minMatches_

const int ZtoMMEventSelector::minMatches_
private

Definition at line 33 of file ZtoMMEventSelector.h.

Referenced by filter().

◆ minPixelHits_

const int ZtoMMEventSelector::minPixelHits_
private

Definition at line 30 of file ZtoMMEventSelector.h.

Referenced by filter().

◆ minPt_

const double ZtoMMEventSelector::minPt_
private

Definition at line 26 of file ZtoMMEventSelector.h.

Referenced by filter().

◆ minPtHighest_

const double ZtoMMEventSelector::minPtHighest_
private

Definition at line 36 of file ZtoMMEventSelector.h.

Referenced by filter().

◆ minStripHits_

const int ZtoMMEventSelector::minStripHits_
private

Definition at line 31 of file ZtoMMEventSelector.h.

Referenced by filter().

◆ muonTag_

const edm::InputTag ZtoMMEventSelector::muonTag_
private

Definition at line 20 of file ZtoMMEventSelector.h.

Referenced by filter().

◆ muonToken_

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

Definition at line 22 of file ZtoMMEventSelector.h.

Referenced by filter().

◆ verbose_

bool ZtoMMEventSelector::verbose_
private

Definition at line 19 of file ZtoMMEventSelector.h.

pwdgSkimBPark_cfi.beamSpot
beamSpot
Definition: pwdgSkimBPark_cfi.py:5
reco::MuonPFIsolation::sumNeutralHadronEt
float sumNeutralHadronEt
sum pt of neutral hadrons
Definition: MuonPFIsolation.h:8
amptDefaultParameters_cff.mu
mu
Definition: amptDefaultParameters_cff.py:16
ZtoMMEventSelector::maxInvMass_
const double maxInvMass_
Definition: ZtoMMEventSelector.h:38
muon::GlobalMuonPromptTight
Definition: MuonSelectors.h:25
ZtoMMEventSelector::maxEta_
const double maxEta_
Definition: ZtoMMEventSelector.h:25
gpuVertexFinder::zv
float *__restrict__ zv
Definition: gpuFitVertices.h:26
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
ZtoMMEventSelector::muonToken_
const edm::EDGetTokenT< reco::MuonCollection > muonToken_
Definition: ZtoMMEventSelector.h:22
hltPixelTracks_cff.chi2
chi2
Definition: hltPixelTracks_cff.py:25
edm::Handle< reco::MuonCollection >
edm::Ref< TrackCollection >
ZtoMMEventSelector::minInvMass_
const double minInvMass_
Definition: ZtoMMEventSelector.h:37
ndof
Definition: HIMultiTrackSelector.h:49
reco::HitPattern
Definition: HitPattern.h:147
muon::isGoodMuon
bool isGoodMuon(const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
main GoodMuon wrapper call
Definition: MuonSelectors.cc:649
ZtoMMEventSelector::minChambers_
const int minChambers_
Definition: ZtoMMEventSelector.h:32
ZtoMMEventSelector::minPixelHits_
const int minPixelHits_
Definition: ZtoMMEventSelector.h:30
ZtoMMEventSelector::maxDz_
const double maxDz_
Definition: ZtoMMEventSelector.h:29
ZtoMMEventSelector::minStripHits_
const int minStripHits_
Definition: ZtoMMEventSelector.h:31
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
ZtoMMEventSelector::maxIso_
const double maxIso_
Definition: ZtoMMEventSelector.h:35
ZtoMMEventSelector::bsToken_
const edm::EDGetTokenT< reco::BeamSpot > bsToken_
Definition: ZtoMMEventSelector.h:23
ZtoMMEventSelector::muonTag_
const edm::InputTag muonTag_
Definition: ZtoMMEventSelector.h:20
iEvent
int iEvent
Definition: GenABIO.cc:224
reco::MuonPFIsolation::sumChargedParticlePt
float sumChargedParticlePt
sum-pt of charged Particles(inludes e/mu)
Definition: MuonPFIsolation.h:7
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
ZtoMMEventSelector::maxNormChi2_
const double maxNormChi2_
Definition: ZtoMMEventSelector.h:27
ZtoMMEventSelector::maxD0_
const double maxD0_
Definition: ZtoMMEventSelector.h:28
reco::MuonPFIsolation
Definition: MuonPFIsolation.h:5
reco::MuonPFIsolation::sumPUPt
float sumPUPt
sum pt of charged Particles not from PV (for Pu corrections)
Definition: MuonPFIsolation.h:12
ZtoMMEventSelector::minMatches_
const int minMatches_
Definition: ZtoMMEventSelector.h:33
reco::HitPattern::numberOfValidStripHits
int numberOfValidStripHits() const
Definition: HitPattern.h:812
ZtoMMEventSelector::minPtHighest_
const double minPtHighest_
Definition: ZtoMMEventSelector.h:36
EgHLTOffHistBins_cfi.mass
mass
Definition: EgHLTOffHistBins_cfi.py:34
ZtoMMEventSelector::minMatchedStations_
const int minMatchedStations_
Definition: ZtoMMEventSelector.h:34
reco::HitPattern::numberOfValidPixelHits
int numberOfValidPixelHits() const
Definition: HitPattern.h:800
reco::MuonPFIsolation::sumPhotonEt
float sumPhotonEt
sum pt of PF photons
Definition: MuonPFIsolation.h:9
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
edm::InputTag
Definition: InputTag.h:15
ZtoMMEventSelector::bsTag_
const edm::InputTag bsTag_
Definition: ZtoMMEventSelector.h:21
ZtoMMEventSelector::verbose_
bool verbose_
Definition: ZtoMMEventSelector.h:19
ZtoMMEventSelector::minPt_
const double minPt_
Definition: ZtoMMEventSelector.h:26