CMS 3D CMS Logo

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

#include <WtoLNuSelector.h>

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

Public Member Functions

 WtoLNuSelector (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::stream::EDFilter<>
 EDFilter ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 
- Public Member Functions inherited from edm::stream::EDFilterBase
 EDFilterBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~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
 
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)
 
 ~ProducerBase () 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
 
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
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

bool filter (edm::Event &, edm::EventSetup const &) override
 
double getMt (const TLorentzVector &vlep, const reco::PFMET &obj)
 

Private Attributes

const edm::InputTag bsTag_
 
const edm::EDGetTokenT< reco::BeamSpotbsToken_
 
const edm::InputTag electronTag_
 
const edm::EDGetTokenT< reco::GsfElectronCollectionelectronToken_
 
const edm::InputTag muonTag_
 
const edm::EDGetTokenT< reco::MuonCollectionmuonToken_
 
const edm::InputTag pfmetTag_
 
const edm::EDGetTokenT< reco::PFMETCollectionpfmetToken_
 

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::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 20 of file WtoLNuSelector.h.

Constructor & Destructor Documentation

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

Definition at line 25 of file WtoLNuSelector.cc.

25  :
26  electronTag_(ps.getUntrackedParameter<edm::InputTag>("electronInputTag", edm::InputTag("gedGsfElectrons"))),
27  bsTag_(ps.getUntrackedParameter<edm::InputTag>("offlineBeamSpot", edm::InputTag("offlineBeamSpot"))),
28  muonTag_(ps.getUntrackedParameter<edm::InputTag>("muonInputTag", edm::InputTag("muons"))),
29  //pfmetTag_(ps.getUntrackedParameter<edm::InputTag>("pfmetTag", edm::InputTag("pfMet"))),
30  pfmetTag_(ps.getUntrackedParameter<edm::InputTag>("pfmetTag", edm::InputTag("pfMetT1T2Txy"))),
31  electronToken_(consumes<reco::GsfElectronCollection>(electronTag_)),
32  bsToken_(consumes<reco::BeamSpot>(bsTag_)),
33  muonToken_(consumes<reco::MuonCollection>(muonTag_)),
34  pfmetToken_(consumes<reco::PFMETCollection>(pfmetTag_))
35 {
36 }
const edm::EDGetTokenT< reco::BeamSpot > bsToken_
T getUntrackedParameter(std::string const &, T const &) const
const edm::InputTag electronTag_
const edm::EDGetTokenT< reco::GsfElectronCollection > electronToken_
const edm::EDGetTokenT< reco::MuonCollection > muonToken_
const edm::InputTag bsTag_
const edm::InputTag muonTag_
const edm::InputTag pfmetTag_
const edm::EDGetTokenT< reco::PFMETCollection > pfmetToken_

Member Function Documentation

bool WtoLNuSelector::filter ( edm::Event iEvent,
edm::EventSetup const &  iSetup 
)
overrideprivatevirtual

Implements edm::stream::EDFilterBase.

Definition at line 38 of file WtoLNuSelector.cc.

References ecalDrivenElectronSeedsParameters_cff::beamSpot, bsTag_, bsToken_, vertices_cff::chi2, reco::TrackBase::chi2(), reco::TrackBase::d0(), electronIdCutBased_cfi::deltaEtaIn, electronIdCutBased_cfi::deltaPhiIn, reco::TrackBase::dxy(), reco::TrackBase::dz(), electronTag_, electronToken_, edm::Event::getByToken(), getMt(), reco::TrackBase::hitPattern(), electronIdCutBased_cfi::hOverE, edm::Ref< C, T, F >::isNonnull(), edm::HandleBase::isValid(), SiStripPI::max, TtSemiLepEvtBuilder_cfi::mt, RPCpg::mu, muonTag_, muonToken_, ndof, reco::TrackBase::ndof(), reco::HitPattern::numberOfValidPixelHits(), reco::HitPattern::numberOfValidStripHits(), pfmetTag_, pfmetToken_, reco::BeamSpot::position(), reco::GsfElectron::PflowIsolationVariables::sumChargedHadronPt, reco::MuonPFIsolation::sumChargedParticlePt, reco::MuonPFIsolation::sumNeutralHadronEt, reco::GsfElectron::PflowIsolationVariables::sumNeutralHadronEt, reco::MuonPFIsolation::sumPhotonEt, reco::GsfElectron::PflowIsolationVariables::sumPhotonEt, reco::MuonPFIsolation::sumPUPt, and reco::GsfElectron::PflowIsolationVariables::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().

38  {
39  // Read Electron Collection
41  iEvent.getByToken(electronToken_, electronColl);
42 
44  iEvent.getByToken(bsToken_, beamSpot);
45 
46  std::vector<TLorentzVector> eleList;
47  if (electronColl.isValid()) {
48  for (auto const& ele : *electronColl) {
49  if (!ele.ecalDriven() ) continue;
50 
51  double hOverE = ele.hadronicOverEm();
52  double sigmaee = ele.sigmaIetaIeta();
53  double deltaPhiIn = ele.deltaPhiSuperClusterTrackAtVtx();
54  double deltaEtaIn = ele.deltaEtaSuperClusterTrackAtVtx();
55 
56  // separate cut for barrel and endcap
57  if (ele.isEB()) {
58  if (std::fabs(deltaPhiIn) >= .15
59  && std::fabs(deltaEtaIn) >= .007
60  && hOverE >= .12
61  && sigmaee >= .01) continue;
62  }
63  else if (ele.isEE()) {
64  if (std::fabs(deltaPhiIn) >= .10
65  && std::fabs(deltaEtaIn) >= .009
66  && hOverE >= .10
67  && sigmaee >= .03) continue;
68  }
69 
70  reco::GsfTrackRef trk = ele.gsfTrack();
71  if (!trk.isNonnull() ) continue; // only electrons wd tracks
72  double chi2 = trk->chi2();
73  double ndof = trk->ndof();
74  double chbyndof = (ndof > 0) ? chi2/ndof : 0;
75  double trkd0 = trk->d0();
76  double trkdz = trk->dz();
77  if (beamSpot.isValid()) {
78  trkd0 = -(trk->dxy(beamSpot->position()));
79  trkdz = trk->dz(beamSpot->position());
80  }
81  else {
82  edm::LogError("WtoLNuSelector") << "Error >> Failed to get BeamSpot for label: "
83  << bsTag_;
84  }
85  if (chbyndof >= 10 || std::fabs(trkd0) >= 0.02 || std::fabs(trkdz) >= 20) continue;
86  const reco::HitPattern& hitp = trk->hitPattern();
87  int nPixelHits = hitp.numberOfValidPixelHits();
88  int nStripHits = hitp.numberOfValidStripHits();
89  if (nPixelHits < 1 || nStripHits < 8) continue;
90 
91  // PF Isolation
92  reco::GsfElectron::PflowIsolationVariables pfIso = ele.pfIsolationVariables();
93  float absiso = pfIso.sumChargedHadronPt
94  + std::max(0.0, pfIso.sumNeutralHadronEt + pfIso.sumPhotonEt - 0.5 * pfIso.sumPUPt);
95  float eiso = absiso/ele.pt();
96  if (eiso > 0.3) continue;
97 
98  TLorentzVector le;
99  le.SetPtEtaPhiE(ele.pt(), ele.eta(), ele.phi(), ele.energy());
100  eleList.push_back(le);
101  }
102  }
103  else {
104  edm::LogError("WtoLNuSelector") << "Error >> Failed to get ElectronCollection for label: "
105  << electronTag_;
106  }
107 
108  // Read Muon Collection
110  iEvent.getByToken(muonToken_, muonColl);
111 
112  std::vector<TLorentzVector> muList;
113  if (muonColl.isValid()) {
114  for (auto const& mu : *muonColl) {
115  if (!mu.isGlobalMuon()
116  || !mu.isPFMuon()
117  || std::fabs(mu.eta()) > 2.1
118  || mu.pt() <= 5) continue;
119 
120  reco::TrackRef gtrkref = mu.globalTrack();
121  if (!gtrkref.isNonnull()) continue;
122  const reco::Track* gtk = &(*gtrkref);
123  double chi2 = gtk->chi2();
124  double ndof = gtk->ndof();
125  double chbyndof = (ndof > 0) ? chi2/ndof : 0;
126 
127  const reco::HitPattern& hitp = gtk->hitPattern();
128  int nPixelHits = hitp.numberOfValidPixelHits();
129  int nStripHits = hitp.numberOfValidStripHits();
130 
131  reco::TrackRef itrkref = mu.innerTrack(); // tracker segment only
132  if (!itrkref.isNonnull()) continue;
133  const reco::Track* tk = &(*itrkref);
134  double trkd0 = tk->d0();
135  double trkdz = tk->dz();
136  if (beamSpot.isValid()) {
137  trkd0 = -(tk->dxy(beamSpot->position()));
138  trkdz = tk->dz(beamSpot->position());
139  }
140  // Hits/section in the muon chamber
141  int nChambers = mu.numberOfChambers();
142  int nMatches = mu.numberOfMatches();
143  int nMatchedStations = mu.numberOfMatchedStations();
144 
145  // PF Isolation
146  const reco::MuonPFIsolation& pfIso04 = mu.pfIsolationR04();
147  double absiso = pfIso04.sumChargedParticlePt + std::max(0.0, pfIso04.sumNeutralHadronEt + pfIso04.sumPhotonEt - 0.5 * pfIso04.sumPUPt);
148 
149  // Final selection
150  if (chbyndof < 10
151  && std::fabs(trkd0) < 0.02
152  && std::fabs(trkdz) < 20.0
153  && nPixelHits > 1
154  && nStripHits > 8
155  && nChambers > 2
156  && nMatches > 2
157  && nMatchedStations > 2
158  && absiso/mu.pt() < 0.3)
159  {
160  TLorentzVector lm;
161  lm.SetPtEtaPhiE(mu.pt(), mu.eta(), mu.phi(), mu.energy());
162  muList.push_back(lm);
163  }
164  }
165  }
166  else {
167  edm::LogError("WtoLNuSelector") << "Error >> Failed to get MuonCollection for label: " << muonTag_;
168  }
169 
170  // Require either a high pt electron or muon
171  if (eleList.empty() && muList.empty()) return false;
172 
173  // Both should not be present at the same time
174  if ((!eleList.empty() && eleList[0].Pt() > 20) &&
175  (!muList.empty() && muList[0].Pt() > 20)) return false;
176 
177  // find the high pt lepton
178  TLorentzVector vlep;
179  if (!eleList.empty() && !muList.empty()) {
180  vlep = (eleList[0].Pt() > muList[0].Pt()) ? eleList[0] : muList[0];
181  }
182  else if (!eleList.empty()) {
183  vlep = eleList[0];
184  }
185  else {
186  vlep = muList[0];
187  }
188  if (vlep.Pt() < 20) return false;
189 
191  iEvent.getByToken(pfmetToken_, pfColl);
192 
193  if (pfColl.isValid()) {
194  double mt = getMt(vlep, pfColl->front());
195  if (mt < 60 || mt > 80) return false;
196  }
197  else {
198  edm::LogError("WtoLNuSelector") << "Error >> Failed to get PFMETCollection for label: " << pfmetTag_;
199  return false;
200  }
201 
202  return true;
203 }
const edm::EDGetTokenT< reco::BeamSpot > bsToken_
double getMt(const TLorentzVector &vlep, const reco::PFMET &obj)
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:253
double d0() const
dxy parameter in perigee convention (d0 = -dxy)
Definition: TrackBase.h:597
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
float sumPUPt
sum pt of charged Particles not from PV (for Pu corrections)
Definition: GsfElectron.h:632
int numberOfValidStripHits() const
Definition: HitPattern.h:853
const edm::InputTag electronTag_
const edm::EDGetTokenT< reco::GsfElectronCollection > electronToken_
float sumPhotonEt
sum pt of PF photons
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_
double chi2() const
chi-squared of the fit
Definition: TrackBase.h:549
double ndof() const
number of degrees of freedom of the fit
Definition: TrackBase.h:555
float sumPhotonEt
sum pt of PF photons // old float photonIso ;
Definition: GsfElectron.h:627
float sumNeutralHadronEt
sum pt of neutral hadrons // old float neutralHadronIso ;
Definition: GsfElectron.h:626
const int mu
Definition: Constants.h:22
bool isValid() const
Definition: HandleBase.h:74
double dz() const
dz parameter (= dsz/cos(lambda)). This is the track z0 w.r.t (0,0,0) only if the refPoint is close to...
Definition: TrackBase.h:609
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
Definition: TrackBase.h:446
const edm::InputTag bsTag_
const edm::InputTag muonTag_
int numberOfValidPixelHits() const
Definition: HitPattern.h:838
const Point & position() const
position
Definition: BeamSpot.h:62
const edm::InputTag pfmetTag_
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...
Definition: TrackBase.h:591
float sumChargedHadronPt
sum-pt of charged Hadron // old float chargedHadronIso ;
Definition: GsfElectron.h:625
const edm::EDGetTokenT< reco::PFMETCollection > pfmetToken_
double WtoLNuSelector::getMt ( const TLorentzVector &  vlep,
const reco::PFMET obj 
)
private

Definition at line 204 of file WtoLNuSelector.cc.

References funct::cos(), DEFINE_FWK_MODULE, hiPixelPairStep_cff::deltaPhi, reco::LeafCandidate::et(), RazorAnalyzer::met, phi, reco::LeafCandidate::phi(), funct::sin(), and mathSSE::sqrt().

Referenced by filter().

204  {
205  double met = obj.et();
206  double phi = obj.phi();
207 
208  TLorentzVector vmet;
209  double metx = met * std::cos(phi);
210  double mety = met * std::sin(phi);
211  vmet.SetPxPyPzE(metx, mety, 0.0, met);
212 
213  // transverse mass
214  TLorentzVector vw = vlep + vmet;
215 
216  return std::sqrt(2 * vlep.Et() * met * (1 - std::cos(deltaPhi(vlep.Phi(), phi))));
217 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
double et() const final
transverse energy
T sqrt(T t)
Definition: SSEVec.h:18
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
met
===> hadronic RAZOR
double phi() const final
momentum azimuthal angle

Member Data Documentation

const edm::InputTag WtoLNuSelector::bsTag_
private

Definition at line 31 of file WtoLNuSelector.h.

Referenced by filter().

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

Definition at line 35 of file WtoLNuSelector.h.

Referenced by filter().

const edm::InputTag WtoLNuSelector::electronTag_
private

Definition at line 30 of file WtoLNuSelector.h.

Referenced by filter().

const edm::EDGetTokenT<reco::GsfElectronCollection> WtoLNuSelector::electronToken_
private

Definition at line 34 of file WtoLNuSelector.h.

Referenced by filter().

const edm::InputTag WtoLNuSelector::muonTag_
private

Definition at line 32 of file WtoLNuSelector.h.

Referenced by filter().

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

Definition at line 36 of file WtoLNuSelector.h.

Referenced by filter().

const edm::InputTag WtoLNuSelector::pfmetTag_
private

Definition at line 33 of file WtoLNuSelector.h.

Referenced by filter().

const edm::EDGetTokenT<reco::PFMETCollection> WtoLNuSelector::pfmetToken_
private

Definition at line 37 of file WtoLNuSelector.h.

Referenced by filter().