19 #include "TLorentzVector.h" 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"))),
30 pfmetTag_(ps.getUntrackedParameter<
edm::InputTag>(
"pfmetTag",
edm::InputTag(
"pfMetT1T2Txy"))),
46 std::vector<TLorentzVector> eleList;
48 for (
auto const& ele : *electronColl) {
49 if (!ele.ecalDriven() )
continue;
51 double hOverE = ele.hadronicOverEm();
52 double sigmaee = ele.sigmaIetaIeta();
53 double deltaPhiIn = ele.deltaPhiSuperClusterTrackAtVtx();
54 double deltaEtaIn = ele.deltaEtaSuperClusterTrackAtVtx();
58 if (std::fabs(deltaPhiIn) >= .15
59 && std::fabs(deltaEtaIn) >= .007
61 && sigmaee >= .01)
continue;
63 else if (ele.isEE()) {
64 if (std::fabs(deltaPhiIn) >= .10
65 && std::fabs(deltaEtaIn) >= .009
67 && sigmaee >= .03)
continue;
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();
78 trkd0 = -(trk->dxy(beamSpot->
position()));
79 trkdz = trk->dz(beamSpot->
position());
82 edm::LogError(
"WtoLNuSelector") <<
"Error >> Failed to get BeamSpot for label: " 85 if (chbyndof >= 10 || std::fabs(trkd0) >= 0.02 || std::fabs(trkdz) >= 20)
continue;
89 if (nPixelHits < 1 || nStripHits < 8)
continue;
95 float eiso = absiso/ele.pt();
96 if (eiso > 0.3)
continue;
99 le.SetPtEtaPhiE(ele.pt(), ele.eta(), ele.phi(), ele.energy());
100 eleList.push_back(le);
104 edm::LogError(
"WtoLNuSelector") <<
"Error >> Failed to get ElectronCollection for label: " 112 std::vector<TLorentzVector> muList;
114 for (
auto const&
mu : *muonColl) {
115 if (!
mu.isGlobalMuon()
117 || std::fabs(
mu.eta()) > 2.1
118 ||
mu.pt() <= 5)
continue;
125 double chbyndof = (ndof > 0) ? chi2/ndof : 0;
134 double trkd0 = tk->
d0();
135 double trkdz = tk->
dz();
141 int nChambers =
mu.numberOfChambers();
142 int nMatches =
mu.numberOfMatches();
143 int nMatchedStations =
mu.numberOfMatchedStations();
151 && std::fabs(trkd0) < 0.02
152 && std::fabs(trkdz) < 20.0
157 && nMatchedStations > 2
158 && absiso/
mu.pt() < 0.3)
161 lm.SetPtEtaPhiE(
mu.pt(),
mu.eta(),
mu.phi(),
mu.energy());
162 muList.push_back(lm);
171 if (eleList.size() < 1 && muList.size() < 1)
return false;
174 if ((eleList.size() > 0 && eleList[0].Pt() > 20) &&
175 (muList.size() > 0 && muList[0].Pt() > 20))
return false;
179 if (eleList.size() > 0 && muList.size() > 0) {
180 vlep = (eleList[0].Pt() > muList[0].Pt()) ? eleList[0] : muList[0];
182 else if (eleList.size() > 0) {
188 if (vlep.Pt() < 20)
return false;
194 double mt =
getMt(vlep, pfColl->front());
195 if (mt < 60 || mt > 80)
return false;
205 double met = obj.
et();
211 vmet.SetPxPyPzE(metx, mety, 0.0, met);
214 TLorentzVector vw = vlep + vmet;
const edm::EDGetTokenT< reco::BeamSpot > bsToken_
double getMt(const TLorentzVector &vlep, const reco::PFMET &obj)
bool isNonnull() const
Checks for non-null.
double d0() const
dxy parameter in perigee convention (d0 = -dxy)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
Sin< T >::type sin(const T &t)
float sumPUPt
sum pt of charged Particles not from PV (for Pu corrections)
int numberOfValidStripHits() const
const edm::InputTag electronTag_
const edm::EDGetTokenT< reco::GsfElectronCollection > electronToken_
float sumPhotonEt
sum pt of PF photons
WtoLNuSelector(const edm::ParameterSet &)
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
std::vector< Muon > MuonCollection
collection of Muon objects
float sumNeutralHadronEt
sum pt of neutral hadrons
float sumChargedParticlePt
sum-pt of charged Particles(inludes e/mu)
virtual double phi() const final
momentum azimuthal angle
virtual double et() const final
transverse energy
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
double ndof() const
number of degrees of freedom of the fit
float sumPhotonEt
sum pt of PF photons // old float photonIso ;
Cos< T >::type cos(const T &t)
float sumNeutralHadronEt
sum pt of neutral hadrons // old float neutralHadronIso ;
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...
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
const edm::InputTag bsTag_
bool filter(edm::Event &, edm::EventSetup const &) override
const edm::InputTag muonTag_
int numberOfValidPixelHits() const
const Point & position() const
position
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...
float sumChargedHadronPt
sum-pt of charged Hadron // old float chargedHadronIso ;
const edm::EDGetTokenT< reco::PFMETCollection > pfmetToken_