CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
ZtoMMEventSelector Class Reference
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
 
 EDFilter (const EDFilter &)=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
 
const EDFilteroperator= (const EDFilter &)=delete
 
- 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 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)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::stream::EDFilterBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

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<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 
- Public Types inherited from edm::stream::EDFilterBase
typedef EDFilterAdaptorBase 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
 
- 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 20 of file ZtoMMEventSelector.cc.

Constructor & Destructor Documentation

◆ ZtoMMEventSelector()

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

Definition at line 74 of file ZtoMMEventSelector.cc.

75  : verbose_(ps.getUntrackedParameter<bool>("verbose", false)),
76  muonTag_(ps.getUntrackedParameter<edm::InputTag>("muonInputTag", edm::InputTag("muons"))),
77  bsTag_(ps.getUntrackedParameter<edm::InputTag>("offlineBeamSpot", edm::InputTag("offlineBeamSpot"))),
78  muonToken_(consumes<reco::MuonCollection>(muonTag_)),
79  bsToken_(consumes<reco::BeamSpot>(bsTag_)),
80  maxEta_(ps.getUntrackedParameter<double>("maxEta", 2.4)),
81  minPt_(ps.getUntrackedParameter<double>("minPt", 5)),
82  maxNormChi2_(ps.getUntrackedParameter<double>("maxNormChi2", 1000)),
83  maxD0_(ps.getUntrackedParameter<double>("maxD0", 0.02)),
84  maxDz_(ps.getUntrackedParameter<double>("maxDz", 20.)),
85  minPixelHits_(ps.getUntrackedParameter<uint32_t>("minPixelHits", 1)),
86  minStripHits_(ps.getUntrackedParameter<uint32_t>("minStripHits", 8)),
87  minChambers_(ps.getUntrackedParameter<uint32_t>("minChambers", 2)),
88  minMatches_(ps.getUntrackedParameter<uint32_t>("minMatches", 2)),
89  minMatchedStations_(ps.getUntrackedParameter<double>("minMatchedStations", 2)),
90  maxIso_(ps.getUntrackedParameter<double>("maxIso", 0.3)),
91  minPtHighest_(ps.getUntrackedParameter<double>("minPtHighest", 24)),
92  minInvMass_(ps.getUntrackedParameter<double>("minInvMass", 75)),
93  maxInvMass_(ps.getUntrackedParameter<double>("maxInvMass", 105)) {}
const edm::InputTag muonTag_
const double minPtHighest_
T getUntrackedParameter(std::string const &, T const &) const
const edm::EDGetTokenT< reco::MuonCollection > muonToken_
const edm::InputTag bsTag_
const edm::EDGetTokenT< reco::BeamSpot > bsToken_

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 52 of file ZtoMMEventSelector.cc.

References edm::ConfigurationDescriptions::addWithDefaultLabel(), submitPVResolutionJobs::desc, and ProducerED_cfi::InputTag.

52  {
54  desc.addUntracked<bool>("verbose", false);
55  desc.addUntracked<edm::InputTag>("muonInputTag", edm::InputTag("muons"));
56  desc.addUntracked<edm::InputTag>("offlineBeamSpot", edm::InputTag("offlineBeamSpot"));
57  desc.addUntracked<double>("maxEta", 2.4);
58  desc.addUntracked<double>("minPt", 5);
59  desc.addUntracked<double>("maxNormChi2", 1000);
60  desc.addUntracked<double>("maxD0", 0.02);
61  desc.addUntracked<double>("maxDz", 20.);
62  desc.addUntracked<uint32_t>("minPixelHits", 1);
63  desc.addUntracked<uint32_t>("minStripHits", 8);
64  desc.addUntracked<uint32_t>("minChambers", 2);
65  desc.addUntracked<uint32_t>("minMatches", 2);
66  desc.addUntracked<double>("minMatchedStations", 2);
67  desc.addUntracked<double>("maxIso", 0.3);
68  desc.addUntracked<double>("minPtHighest", 24);
69  desc.addUntracked<double>("minInvMass", 75);
70  desc.addUntracked<double>("maxInvMass", 105);
71  descriptions.addWithDefaultLabel(desc);
72 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)

◆ filter()

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

Implements edm::stream::EDFilterBase.

Definition at line 95 of file ZtoMMEventSelector.cc.

References funct::abs(), pwdgSkimBPark_cfi::beamSpot, bsTag_, bsToken_, nano_mu_local_reco_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_, PixelVertexMonitor_cff::ndof, reco::HitPattern::numberOfValidPixelHits(), reco::HitPattern::numberOfValidStripHits(), nano_mu_reco_cff::pfIso04, and ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::zv.

95  {
96  // Read Muon Collection
98  iEvent.getByToken(muonToken_, muonColl);
99 
100  // and the beamspot
102  iEvent.getByToken(bsToken_, beamSpot);
103 
104  std::vector<TLorentzVector> list;
105  if (muonColl.isValid()) {
106  for (auto const& mu : *muonColl) {
107  if (!mu.isGlobalMuon())
108  continue;
109  if (!mu.isPFMuon())
110  continue;
111  if (std::fabs(mu.eta()) >= maxEta_)
112  continue;
113  if (mu.pt() < minPt_)
114  continue;
115 
116  reco::TrackRef gtk = mu.globalTrack();
117  double chi2 = gtk->chi2();
118  double ndof = gtk->ndof();
119  double chbyndof = (ndof > 0) ? chi2 / ndof : 0;
120  if (chbyndof >= maxNormChi2_)
121  continue;
122 
123  if (beamSpot.isValid()) {
124  reco::TrackRef tk = mu.innerTrack();
125  double abstrkd0 = std::abs(tk->dxy(beamSpot->position()));
126  if (abstrkd0 >= maxD0_)
127  continue;
128  double abstrkdz = std::abs(tk->dz(beamSpot->position()));
129  if (abstrkdz >= maxDz_)
130  continue;
131  } else {
132  edm::LogError("ZtoMMEventSelector") << "Error >> Failed to get BeamSpot for label: " << bsTag_;
133  }
134 
135  const reco::HitPattern& hitp = gtk->hitPattern();
137  continue;
139  continue;
140 
141  // Hits/section in the muon chamber
142  if (mu.numberOfChambers() < minChambers_)
143  continue;
144  if (mu.numberOfMatches() < minMatches_)
145  continue;
146  if (mu.numberOfMatchedStations() < minMatchedStations_)
147  continue;
149  continue;
150 
151  // PF Isolation
152  const reco::MuonPFIsolation& pfIso04 = mu.pfIsolationR04();
153  double absiso = pfIso04.sumChargedParticlePt +
154  std::max(0.0, pfIso04.sumNeutralHadronEt + pfIso04.sumPhotonEt - 0.5 * pfIso04.sumPUPt);
155  if (absiso / mu.pt() > maxIso_)
156  continue;
157 
158  TLorentzVector lv;
159  lv.SetPtEtaPhiE(mu.pt(), mu.eta(), mu.phi(), mu.energy());
160  list.push_back(lv);
161  }
162  } else {
163  edm::LogError("ZtoMMEventSelector") << "Error >> Failed to get MuonCollection for label: " << muonTag_;
164  return false;
165  }
166 
167  if (list.size() < 2)
168  return false;
169  if (list[0].Pt() < minPtHighest_)
170  return false;
171  TLorentzVector zv = list[0] + list[1];
172  double mass = zv.M();
173  if (mass < minInvMass_ || mass > maxInvMass_)
174  return false;
175 
176  return true;
177 }
int numberOfValidPixelHits() const
Definition: HitPattern.h:831
const edm::InputTag muonTag_
Log< level::Error, false > LogError
const double minPtHighest_
int numberOfValidStripHits() const
Definition: HitPattern.h:843
int iEvent
Definition: GenABIO.cc:224
const edm::EDGetTokenT< reco::MuonCollection > muonToken_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool isGoodMuon(const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
main GoodMuon wrapper call
const edm::InputTag bsTag_
bool isValid() const
Definition: HandleBase.h:70
const edm::EDGetTokenT< reco::BeamSpot > bsToken_

Member Data Documentation

◆ bsTag_

const edm::InputTag ZtoMMEventSelector::bsTag_
private

Definition at line 29 of file ZtoMMEventSelector.cc.

Referenced by filter().

◆ bsToken_

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

Definition at line 31 of file ZtoMMEventSelector.cc.

Referenced by filter().

◆ maxD0_

const double ZtoMMEventSelector::maxD0_
private

Definition at line 36 of file ZtoMMEventSelector.cc.

Referenced by filter().

◆ maxDz_

const double ZtoMMEventSelector::maxDz_
private

Definition at line 37 of file ZtoMMEventSelector.cc.

Referenced by filter().

◆ maxEta_

const double ZtoMMEventSelector::maxEta_
private

Definition at line 33 of file ZtoMMEventSelector.cc.

Referenced by filter().

◆ maxInvMass_

const double ZtoMMEventSelector::maxInvMass_
private

Definition at line 46 of file ZtoMMEventSelector.cc.

Referenced by filter().

◆ maxIso_

const double ZtoMMEventSelector::maxIso_
private

Definition at line 43 of file ZtoMMEventSelector.cc.

Referenced by filter().

◆ maxNormChi2_

const double ZtoMMEventSelector::maxNormChi2_
private

Definition at line 35 of file ZtoMMEventSelector.cc.

Referenced by filter().

◆ minChambers_

const int ZtoMMEventSelector::minChambers_
private

Definition at line 40 of file ZtoMMEventSelector.cc.

Referenced by filter().

◆ minInvMass_

const double ZtoMMEventSelector::minInvMass_
private

Definition at line 45 of file ZtoMMEventSelector.cc.

◆ minMatchedStations_

const int ZtoMMEventSelector::minMatchedStations_
private

Definition at line 42 of file ZtoMMEventSelector.cc.

Referenced by filter().

◆ minMatches_

const int ZtoMMEventSelector::minMatches_
private

Definition at line 41 of file ZtoMMEventSelector.cc.

Referenced by filter().

◆ minPixelHits_

const int ZtoMMEventSelector::minPixelHits_
private

Definition at line 38 of file ZtoMMEventSelector.cc.

Referenced by filter().

◆ minPt_

const double ZtoMMEventSelector::minPt_
private

Definition at line 34 of file ZtoMMEventSelector.cc.

Referenced by filter().

◆ minPtHighest_

const double ZtoMMEventSelector::minPtHighest_
private

Definition at line 44 of file ZtoMMEventSelector.cc.

Referenced by filter().

◆ minStripHits_

const int ZtoMMEventSelector::minStripHits_
private

Definition at line 39 of file ZtoMMEventSelector.cc.

Referenced by filter().

◆ muonTag_

const edm::InputTag ZtoMMEventSelector::muonTag_
private

Definition at line 28 of file ZtoMMEventSelector.cc.

Referenced by filter().

◆ muonToken_

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

Definition at line 30 of file ZtoMMEventSelector.cc.

Referenced by filter().

◆ verbose_

bool ZtoMMEventSelector::verbose_
private

Definition at line 27 of file ZtoMMEventSelector.cc.