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
 
- Public Member Functions inherited from edm::stream::EDFilterBase
 EDFilterBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDFilterBase ()
 
- 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 ()
 
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, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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::vector< ModuleDescription const * > &modules, 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
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
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
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::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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 ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
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)
 

Detailed Description

Definition at line 10 of file ZtoMMEventSelector.h.

Constructor & Destructor Documentation

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

Definition at line 19 of file ZtoMMEventSelector.cc.

19  :
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))
39 {
40 }
T getUntrackedParameter(std::string const &, T const &) const
const edm::InputTag muonTag_
const double maxNormChi2_
const double minInvMass_
const double minPtHighest_
const edm::EDGetTokenT< reco::MuonCollection > muonToken_
const edm::InputTag bsTag_
const edm::EDGetTokenT< reco::BeamSpot > bsToken_
const double maxInvMass_

Member Function Documentation

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

Implements edm::stream::EDFilterBase.

Definition at line 41 of file ZtoMMEventSelector.cc.

References ecalDrivenElectronSeedsParameters_cff::beamSpot, bsTag_, bsToken_, HiEvtPlane_cfi::chi2, DEFINE_FWK_MODULE, edm::Event::getByToken(), muon::GlobalMuonPromptTight, muon::isGoodMuon(), edm::HandleBase::isValid(), list(), ResonanceBuilder::mass, hpstanc_transforms::max, maxD0_, maxDz_, maxEta_, maxInvMass_, maxIso_, maxNormChi2_, minChambers_, minMatchedStations_, minMatches_, minPixelHits_, minPt_, minPtHighest_, minStripHits_, RPCpg::mu, muonTag_, muonToken_, ndof, reco::HitPattern::numberOfValidPixelHits(), reco::HitPattern::numberOfValidStripHits(), reco::BeamSpot::position(), reco::tau::disc::Pt(), reco::MuonPFIsolation::sumChargedParticlePt, reco::MuonPFIsolation::sumNeutralHadronEt, reco::MuonPFIsolation::sumPhotonEt, and reco::MuonPFIsolation::sumPUPt.

Referenced by Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::filter(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::find(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::setDataAccessor(), and Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::switchCenterView().

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()) continue;
54  if (!mu.isPFMuon()) continue;
55  if (std::fabs(mu.eta()) >= maxEta_) continue;
56  if (mu.pt() < minPt_) continue;
57 
58  reco::TrackRef gtk = mu.globalTrack();
59  double chi2 = gtk->chi2();
60  double ndof = gtk->ndof();
61  double chbyndof = (ndof > 0) ? chi2/ndof : 0;
62  if (chbyndof >= maxNormChi2_) continue;
63 
64  reco::TrackRef tk = mu.innerTrack();
65  double trkd0 = tk->d0();
66  double trkdz = tk->dz();
67  if (beamSpot.isValid()) {
68  trkd0 = -(tk->dxy(beamSpot->position()));
69  if (std::fabs(trkd0) >= maxD0_) continue;
70  trkdz = tk->dz(beamSpot->position());
71  if (std::fabs(trkdz) >= maxDz_) continue;
72  }
73  else {
74  edm::LogError("ZtoMMEventSelector") << "Error >> Failed to get BeamSpot for label: "
75  << bsTag_;
76  }
77 
78  const reco::HitPattern& hitp = gtk->hitPattern();
79  if (hitp.numberOfValidPixelHits() < minPixelHits_) continue;
80  if (hitp.numberOfValidStripHits() < minStripHits_) continue;
81 
82  // Hits/section in the muon chamber
83  if (mu.numberOfChambers() < minChambers_) continue;
84  if (mu.numberOfMatches() < minMatches_) continue;
85  if (mu.numberOfMatchedStations() < minMatchedStations_) continue;
87 
88  // PF Isolation
89  const reco::MuonPFIsolation& pfIso04 = mu.pfIsolationR04();
90  double absiso = pfIso04.sumChargedParticlePt + std::max(0.0, pfIso04.sumNeutralHadronEt + pfIso04.sumPhotonEt - 0.5 * pfIso04.sumPUPt);
91  if (absiso/mu.pt() > maxIso_) continue;
92 
93  TLorentzVector lv;
94  lv.SetPtEtaPhiE(mu.pt(), mu.eta(), mu.phi(), mu.energy());
95  list.push_back(lv);
96  }
97  }
98  else {
99  edm::LogError("ZtoMMEventSelector") << "Error >> Failed to get MuonCollection for label: " << muonTag_;
100  return false;
101  }
102 
103  if (list.size() < 2) return false;
104  if (list[0].Pt() < minPtHighest_) return false;
105  TLorentzVector zv = list[0] + list[1];
106  double mass = zv.M();
107  if (mass < minInvMass_ || mass > maxInvMass_) return false;
108 
109  return true;
110 }
const edm::InputTag muonTag_
const double maxNormChi2_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
int numberOfValidStripHits() const
Definition: HitPattern.h:853
float sumPhotonEt
sum pt of PF photons
const double minPtHighest_
float sumNeutralHadronEt
sum pt of neutral hadrons
float sumChargedParticlePt
sum-pt of charged Particles(inludes e/mu)
float sumPUPt
sum pt of charged Particles not from PV (for Pu corrections)
const edm::EDGetTokenT< reco::MuonCollection > muonToken_
const int mu
Definition: Constants.h:22
bool isValid() const
Definition: HandleBase.h:74
bool isGoodMuon(const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
main GoodMuon wrapper call
const edm::InputTag bsTag_
const edm::EDGetTokenT< reco::BeamSpot > bsToken_
int numberOfValidPixelHits() const
Definition: HitPattern.h:838
const Point & position() const
position
Definition: BeamSpot.h:62
const double maxInvMass_
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run

Member Data Documentation

const edm::InputTag ZtoMMEventSelector::bsTag_
private

Definition at line 19 of file ZtoMMEventSelector.h.

Referenced by filter().

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

Definition at line 21 of file ZtoMMEventSelector.h.

Referenced by filter().

const double ZtoMMEventSelector::maxD0_
private

Definition at line 26 of file ZtoMMEventSelector.h.

Referenced by filter().

const double ZtoMMEventSelector::maxDz_
private

Definition at line 27 of file ZtoMMEventSelector.h.

Referenced by filter().

const double ZtoMMEventSelector::maxEta_
private

Definition at line 23 of file ZtoMMEventSelector.h.

Referenced by filter().

const double ZtoMMEventSelector::maxInvMass_
private

Definition at line 36 of file ZtoMMEventSelector.h.

Referenced by filter().

const double ZtoMMEventSelector::maxIso_
private

Definition at line 33 of file ZtoMMEventSelector.h.

Referenced by filter().

const double ZtoMMEventSelector::maxNormChi2_
private

Definition at line 25 of file ZtoMMEventSelector.h.

Referenced by filter().

const int ZtoMMEventSelector::minChambers_
private

Definition at line 30 of file ZtoMMEventSelector.h.

Referenced by filter().

const double ZtoMMEventSelector::minInvMass_
private

Definition at line 35 of file ZtoMMEventSelector.h.

const int ZtoMMEventSelector::minMatchedStations_
private

Definition at line 32 of file ZtoMMEventSelector.h.

Referenced by filter().

const int ZtoMMEventSelector::minMatches_
private

Definition at line 31 of file ZtoMMEventSelector.h.

Referenced by filter().

const int ZtoMMEventSelector::minPixelHits_
private

Definition at line 28 of file ZtoMMEventSelector.h.

Referenced by filter().

const double ZtoMMEventSelector::minPt_
private

Definition at line 24 of file ZtoMMEventSelector.h.

Referenced by filter().

const double ZtoMMEventSelector::minPtHighest_
private

Definition at line 34 of file ZtoMMEventSelector.h.

Referenced by filter().

const int ZtoMMEventSelector::minStripHits_
private

Definition at line 29 of file ZtoMMEventSelector.h.

Referenced by filter().

const edm::InputTag ZtoMMEventSelector::muonTag_
private

Definition at line 18 of file ZtoMMEventSelector.h.

Referenced by filter().

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

Definition at line 20 of file ZtoMMEventSelector.h.

Referenced by filter().

bool ZtoMMEventSelector::verbose_
private

Definition at line 17 of file ZtoMMEventSelector.h.