29 #include "TLorentzVector.h" 106 desc.addUntracked<
double>(
"maxEtaEle", 2.4);
107 desc.addUntracked<
double>(
"maxEtaMu", 2.4);
108 desc.addUntracked<
double>(
"minPt", 5);
109 desc.addUntracked<
double>(
"maxDeltaPhiInEB", .15);
110 desc.addUntracked<
double>(
"maxDeltaEtaInEB", .007);
111 desc.addUntracked<
double>(
"maxHOEEB", .12);
112 desc.addUntracked<
double>(
"maxSigmaiEiEEB", .01);
113 desc.addUntracked<
double>(
"maxDeltaPhiInEE", .1);
114 desc.addUntracked<
double>(
"maxDeltaEtaInEE", .009);
115 desc.addUntracked<
double>(
"maxHOEEB_", .10);
116 desc.addUntracked<
double>(
"maxSigmaiEiEEE", .03);
117 desc.addUntracked<uint32_t>(
"minChambers", 2);
118 desc.addUntracked<uint32_t>(
"minMatches", 2);
119 desc.addUntracked<
double>(
"minMatchedStations", 2);
120 desc.addUntracked<
double>(
"maxEtaHighest_Jets", 2.4);
121 desc.addUntracked<
double>(
"maxEta_Jets", 3.0);
122 desc.addUntracked<
double>(
"btagFactor", 0.6);
123 desc.addUntracked<
double>(
"maxNormChi2", 10);
124 desc.addUntracked<
double>(
"maxD0", 0.02);
125 desc.addUntracked<
double>(
"maxDz", 20.);
126 desc.addUntracked<uint32_t>(
"minPixelHits", 1);
127 desc.addUntracked<uint32_t>(
"minStripHits", 8);
128 desc.addUntracked<
double>(
"maxIsoEle", 0.5);
129 desc.addUntracked<
double>(
"maxIsoMu", 0.3);
130 desc.addUntracked<
double>(
"minPtHighestMu", 24);
131 desc.addUntracked<
double>(
"minPtHighestEle", 32);
132 desc.addUntracked<
double>(
"minPtHighest_Jets", 30);
133 desc.addUntracked<
double>(
"minPt_Jets", 20);
134 desc.addUntracked<
double>(
"minInvMass", 140);
135 desc.addUntracked<
double>(
"maxInvMass", 200);
136 desc.addUntracked<
double>(
"minMet", 50);
137 desc.addUntracked<
double>(
"maxMet", 80);
138 desc.addUntracked<
double>(
"minWmass", 50);
139 desc.addUntracked<
double>(
"maxWmass", 130);
144 : electronTag_(ps.getUntrackedParameter<
edm::
InputTag>(
"electronInputTag",
edm::
InputTag(
"gedGsfElectrons"))),
146 bjetsTag_(ps.getUntrackedParameter<
edm::
InputTag>(
"bjetsInputTag",
edm::
InputTag(
"pfDeepCSVJetTags",
"probb"))),
156 maxEtaEle_(ps.getUntrackedParameter<double>(
"maxEtaEle", 2.4)),
157 maxEtaMu_(ps.getUntrackedParameter<double>(
"maxEtaMu", 2.4)),
158 minPt_(ps.getUntrackedParameter<double>(
"minPt", 5)),
161 maxDeltaPhiInEB_(ps.getUntrackedParameter<double>(
"maxDeltaPhiInEB", .15)),
162 maxDeltaEtaInEB_(ps.getUntrackedParameter<double>(
"maxDeltaEtaInEB", .007)),
163 maxHOEEB_(ps.getUntrackedParameter<double>(
"maxHOEEB", .12)),
164 maxSigmaiEiEEB_(ps.getUntrackedParameter<double>(
"maxSigmaiEiEEB", .01)),
165 maxDeltaPhiInEE_(ps.getUntrackedParameter<double>(
"maxDeltaPhiInEE", .1)),
166 maxDeltaEtaInEE_(ps.getUntrackedParameter<double>(
"maxDeltaEtaInEE", .009)),
167 maxHOEEE_(ps.getUntrackedParameter<double>(
"maxHOEEB_", .10)),
168 maxSigmaiEiEEE_(ps.getUntrackedParameter<double>(
"maxSigmaiEiEEE", .03)),
171 minChambers_(ps.getUntrackedParameter<uint32_t>(
"minChambers", 2)),
172 minMatches_(ps.getUntrackedParameter<uint32_t>(
"minMatches", 2)),
173 minMatchedStations_(ps.getUntrackedParameter<double>(
"minMatchedStations", 2)),
176 maxEtaHighest_Jets_(ps.getUntrackedParameter<double>(
"maxEtaHighest_Jets", 2.4)),
177 maxEta_Jets_(ps.getUntrackedParameter<double>(
"maxEta_Jets", 3.0)),
180 btagFactor_(ps.getUntrackedParameter<double>(
"btagFactor", 0.6)),
182 maxNormChi2_(ps.getUntrackedParameter<double>(
"maxNormChi2", 10)),
183 maxD0_(ps.getUntrackedParameter<double>(
"maxD0", 0.02)),
184 maxDz_(ps.getUntrackedParameter<double>(
"maxDz", 20.)),
185 minPixelHits_(ps.getUntrackedParameter<uint32_t>(
"minPixelHits", 1)),
186 minStripHits_(ps.getUntrackedParameter<uint32_t>(
"minStripHits", 8)),
187 maxIsoEle_(ps.getUntrackedParameter<double>(
"maxIsoEle", 0.5)),
188 maxIsoMu_(ps.getUntrackedParameter<double>(
"maxIsoMu", 0.3)),
189 minPtHighestMu_(ps.getUntrackedParameter<double>(
"minPtHighestMu", 24)),
190 minPtHighestEle_(ps.getUntrackedParameter<double>(
"minPtHighestEle", 32)),
191 minPtHighest_Jets_(ps.getUntrackedParameter<double>(
"minPtHighest_Jets", 30)),
192 minPt_Jets_(ps.getUntrackedParameter<double>(
"minPt_Jets", 20)),
193 minInvMass_(ps.getUntrackedParameter<double>(
"minInvMass", 140)),
194 maxInvMass_(ps.getUntrackedParameter<double>(
"maxInvMass", 200)),
195 minMet_(ps.getUntrackedParameter<double>(
"minMet", 50)),
196 maxMet_(ps.getUntrackedParameter<double>(
"maxMet", 80)),
197 minWmass_(ps.getUntrackedParameter<double>(
"minWmass", 50)),
198 maxWmass_(ps.getUntrackedParameter<double>(
"maxWmass", 130)) {}
205 int le = 0, lm = 0, lj = 0, lbj = 0;
210 std::vector<TLorentzVector> list_ele;
211 std::vector<int> chrgeList_ele;
214 for (
auto const& ele : *electronColl) {
215 if (!ele.ecalDriven())
220 if (!(ele.isEB() || ele.isEE()))
223 double hOverE = ele.hadronicOverEm();
224 double sigmaee = ele.sigmaIetaIeta();
225 double deltaPhiIn = ele.deltaPhiSuperClusterTrackAtVtx();
226 double deltaEtaIn = ele.deltaEtaSuperClusterTrackAtVtx();
233 }
else if (ele.isEE()) {
242 double chi2 = trk->chi2();
243 double ndof = trk->ndof();
248 double trkd0 = trk->d0();
250 trkd0 = -(trk->dxy(
beamSpot->position()));
252 edm::LogError(
"ElectronSelector") <<
"Error >> Failed to get BeamSpot for label: " <<
bsTag_;
254 if (std::fabs(trkd0) >=
maxD0_)
273 TLorentzVector lv_ele;
274 lv_ele.SetPtEtaPhiE(ele.pt(), ele.eta(), ele.phi(), ele.energy());
275 list_ele.push_back(lv_ele);
276 chrgeList_ele.push_back(ele.charge());
278 le = list_ele.size();
287 std::vector<TLorentzVector> list_mu;
288 std::vector<int> chrgeList_mu;
290 for (
auto const&
mu : *muonColl) {
291 if (!
mu.isGlobalMuon())
301 double chi2 = gtk->chi2();
302 double ndof = gtk->ndof();
309 double trkd0 = -(tk->dxy(
beamSpot->position()));
310 if (std::fabs(trkd0) >=
maxD0_)
312 double trkdz = tk->dz(
beamSpot->position());
313 if (std::fabs(trkdz) >=
maxDz_)
337 double absiso =
pfIso04.sumChargedHadronPt +
342 TLorentzVector lv_mu;
343 lv_mu.SetPtEtaPhiE(
mu.pt(),
mu.eta(),
mu.phi(),
mu.energy());
344 list_mu.push_back(lv_mu);
345 chrgeList_mu.push_back(
mu.charge());
356 std::vector<TLorentzVector> list_jets;
359 for (
const auto&
jets : *jetColl) {
364 TLorentzVector lv_jets;
366 list_jets.push_back(lv_jets);
368 lj = list_jets.size();
374 std::vector<TLorentzVector> list_bjets;
376 if (!
bTags.empty()) {
377 for (
unsigned bj = 0; bj !=
bTags.size(); ++bj) {
378 TLorentzVector lv_bjets;
379 lv_bjets.SetPtEtaPhiE(
382 list_bjets.push_back(lv_bjets);
384 lbj = list_bjets.size();
393 if ((list_ele[0].Pt() < list_mu[0].Pt()) || (list_ele[1].Pt() < list_mu[0].Pt()))
395 if (chrgeList_ele[0] + chrgeList_ele[1] != 0)
398 double mt1 =
getMt(list_ele[0], pfColl->front());
399 double mt2 =
getMt(list_ele[1], pfColl->front());
400 double mt = mt1 +
mt2;
401 if (mt < 2 * minMet_ || mt > 2 *
maxMet_)
405 <<
"Error >> Failed to get PFMETCollection in dilepton ele-ele channel for label: " <<
pfmetTag_;
411 if ((list_mu[0].Pt() < list_ele[0].Pt()) || (list_mu[1].Pt() < list_ele[0].Pt()))
413 if (chrgeList_mu[0] + chrgeList_mu[1] != 0)
416 double mt1 =
getMt(list_mu[0], pfColl->front());
417 double mt2 =
getMt(list_mu[1], pfColl->front());
418 double mt = mt1 +
mt2;
419 if (mt < 2 * minMet_ || mt > 2 *
maxMet_)
423 <<
"Error >> Failed to get PFMETCollection in dilepton mu-mu channel for label: " <<
pfmetTag_;
427 if ((list_mu[0].Pt() < list_ele[1].Pt()) || (list_ele[0].Pt() < list_mu[1].Pt()))
431 if (chrgeList_mu[0] + chrgeList_ele[0] != 0)
434 double mt1 =
getMt(list_mu[0], pfColl->front());
435 double mt2 =
getMt(list_ele[0], pfColl->front());
436 double mt = mt1 +
mt2;
437 if (mt < 2 * minMet_ || mt > 2 *
maxMet_)
441 <<
"Error >> Failed to get PFMETCollection in dilepton ele-mu channel for label: " <<
pfmetTag_;
473 for (
int i = 0;
i < 4;
i++) {
474 TLorentzVector vjet1;
475 for (
int j =
i + 1;
j < 4;
j++) {
476 TLorentzVector vjet2;
477 vjet1 = list_jets[
i];
478 vjet2 = list_jets[
j];
479 TLorentzVector vjet = vjet1 + vjet2;
492 if ((nEle >= 2 ||
nMu >= 2) &&
nJets > 1 && nbJets > 1) {
493 if (nEle >= 2 &&
nJets < 2)
497 else if (nEle >= 1 &&
nMu >= 1 &&
nJets < 2)
499 }
else if ((nEle >= 1 ||
nMu >= 1) &&
nJets > 3 && nbJets > 2) {
500 if (nEle >= 1 &&
nJets > 1)
504 }
else if ((nEle < 1 &&
nMu < 1) &&
nJets > 5 && nbJets > 1)
518 vmet.SetPxPyPzE(metx, mety, 0.0,
met);
521 TLorentzVector vw = vlep + vmet;
const edm::InputTag pfmetTag_
int numberOfValidPixelHits() const
const edm::EDGetTokenT< reco::MuonCollection > muonToken_
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
const edm::EDGetTokenT< reco::JetTagCollection > bjetsToken_
bool filter(edm::Event &, edm::EventSetup const &) override
Sin< T >::type sin(const T &t)
const edm::EDGetTokenT< reco::PFJetCollection > jetsToken_
T const * product() const
const edm::EDGetTokenT< reco::PFMETCollection > pfmetToken_
float sumPUPt
sum pt of charged Particles not from PV (for Pu corrections)
const double minPtHighestMu_
const edm::InputTag electronTag_
bool isNonnull() const
Checks for non-null.
const edm::InputTag bjetsTag_
JetFloatAssociation::Container JetTagCollection
Log< level::Error, false > LogError
static constexpr int nJets
int EventCategory(int &nEle, int &nMu, int &nJets, int &nbJets)
const edm::InputTag jetsTag_
const double maxEta_Jets_
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
std::vector< Muon > MuonCollection
collection of Muon objects
const double maxSigmaiEiEEE_
int numberOfValidStripHits() const
const double maxDeltaPhiInEB_
const edm::InputTag bsTag_
U second(std::pair< T, U > const &p)
const edm::EDGetTokenT< reco::GsfElectronCollection > electronToken_
const double minMatchedStations_
const edm::InputTag muonTag_
const double maxDeltaEtaInEB_
const double maxSigmaiEiEEB_
float sumPhotonEt
sum pt of PF photons // old float photonIso ;
Cos< T >::type cos(const T &t)
#define DEFINE_FWK_MODULE(type)
float sumNeutralHadronEt
sum pt of neutral hadrons // old float neutralHadronIso ;
bool isGoodMuon(const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
main GoodMuon wrapper call
const edm::EDGetTokenT< reco::BeamSpot > bsToken_
const double maxEtaHighest_Jets_
double getMt(const TLorentzVector &vlep, const reco::PFMET &obj)
const double minPtHighest_Jets_
const double maxNormChi2_
std::vector< PFJet > PFJetCollection
collection of PFJet objects
const double minChambers_
float sumChargedHadronPt
sum-pt of charged Hadron // old float chargedHadronIso ;
ttbarEventSelector(const edm::ParameterSet &)
const double minPtHighestEle_
const double maxDeltaPhiInEE_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const double maxDeltaEtaInEE_