5 #include "fastjet/ClusterSequence.hh" 15 #include "fastjet/JetDefinition.hh" 32 std::auto_ptr<reco::GenParticleCollection>&
outColl)
const;
46 typedef fastjet::JetDefinition
JetDef;
58 minLeptonPt_(
pset.getParameter<double>(
"minLeptonPt")),
59 maxLeptonEta_(
pset.getParameter<double>(
"maxLeptonEta")),
60 minJetPt_(
pset.getParameter<double>(
"minJetPt")),
61 maxJetEta_(
pset.getParameter<double>(
"maxJetEta")),
62 wMass_(
pset.getParameter<double>(
"wMass")),
63 tMass_(
pset.getParameter<double>(
"tMass")),
64 minLeptonPtDilepton_(
pset.getParameter<double>(
"minLeptonPtDilepton")),
65 maxLeptonEtaDilepton_(
pset.getParameter<double>(
"maxLeptonEtaDilepton")),
66 minDileptonMassDilepton_(
pset.getParameter<double>(
"minDileptonMassDilepton")),
67 minLeptonPtSemilepton_(
pset.getParameter<double>(
"minLeptonPtSemilepton")),
68 maxLeptonEtaSemilepton_(
pset.getParameter<double>(
"maxLeptonEtaSemilepton")),
69 minVetoLeptonPtSemilepton_(
pset.getParameter<double>(
"minVetoLeptonPtSemilepton")),
70 maxVetoLeptonEtaSemilepton_(
pset.getParameter<double>(
"maxVetoLeptonEtaSemilepton")),
71 minMETSemiLepton_(
pset.getParameter<double>(
"minMETSemiLepton")),
72 minMtWSemiLepton_(
pset.getParameter<double>(
"minMtWSemiLepton")) {
80 produces<reco::GenParticleCollection>(
"neutrinos");
81 produces<reco::GenJetCollection>(
"leptons");
82 produces<reco::GenJetCollection>(
"jets");
84 produces<reco::GenParticleCollection>();
105 std::set<int> bHadronIdxs;
106 for (
size_t i = 0,
n = genParticleHandle->size();
i <
n; ++
i) {
114 bHadronIdxs.insert(-
i - 1);
119 std::vector<size_t> leptonIdxs;
120 for (
size_t i = 0,
n = finalStateHandle->size();
i <
n; ++
i) {
122 const int absPdgId =
abs(
p.pdgId());
127 if (
p.numberOfMothers() == 0)
129 if (
p.mother()->status() == 4)
137 leptonIdxs.push_back(
i);
152 std::vector<fastjet::PseudoJet> fjLepInputs;
153 fjLepInputs.reserve(leptonIdxs.size());
154 for (
auto index : leptonIdxs) {
159 fjLepInputs.push_back(fastjet::PseudoJet(
p.px(),
p.py(),
p.pz(),
p.energy()));
160 fjLepInputs.back().set_user_index(
index);
164 fastjet::ClusterSequence fjLepClusterSeq(fjLepInputs, *
fjLepDef_);
165 std::vector<fastjet::PseudoJet> fjLepJets = fastjet::sorted_by_pt(fjLepClusterSeq.inclusive_jets(
minLeptonPt_));
168 leptons->reserve(fjLepJets.size());
169 std::set<size_t> lepDauIdxs;
170 for (
auto& fjJet : fjLepJets) {
175 const std::vector<fastjet::PseudoJet> fjConstituents = fastjet::sorted_by_pt(fjJet.constituents());
177 std::vector<reco::CandidatePtr> constituents;
179 for (
auto& fjConstituent : fjConstituents) {
180 const size_t index = fjConstituent.user_index();
182 const int absPdgId =
abs(
cand->pdgId());
183 if (absPdgId == 11
or absPdgId == 13) {
188 constituents.push_back(
cand);
193 const LorentzVector jetP4(fjJet.px(), fjJet.py(), fjJet.pz(), fjJet.E());
197 lepJet.setPdgId(lepCand->
pdgId());
198 lepJet.setCharge(lepCand->
charge());
200 const double jetArea = fjJet.has_area() ? fjJet.area() : 0;
201 lepJet.setJetArea(jetArea);
206 for (
auto& fjConstituent : fjConstituents) {
207 lepDauIdxs.insert(fjConstituent.user_index());
214 std::vector<fastjet::PseudoJet> fjJetInputs;
215 fjJetInputs.reserve(nStables);
216 for (
size_t i = 0,
n = finalStateHandle->size();
i <
n; ++
i) {
224 if (absId == 12
or absId == 14
or absId == 16)
226 if (lepDauIdxs.find(
i) != lepDauIdxs.end())
229 fjJetInputs.push_back(fastjet::PseudoJet(
p.px(),
p.py(),
p.pz(),
p.energy()));
230 fjJetInputs.back().set_user_index(
i);
233 for (
auto index : bHadronIdxs) {
238 const double scale = 1
e-20 /
p.p();
240 fjJetInputs.back().set_user_index(
index);
244 fastjet::ClusterSequence fjJetClusterSeq(fjJetInputs, *
fjJetDef_);
245 std::vector<fastjet::PseudoJet> fjJets = fastjet::sorted_by_pt(fjJetClusterSeq.inclusive_jets(
minJetPt_));
248 jets->reserve(fjJets.size());
249 std::vector<size_t> bjetIdxs, ljetIdxs;
250 for (
auto& fjJet : fjJets) {
255 const std::vector<fastjet::PseudoJet> fjConstituents = fastjet::sorted_by_pt(fjJet.constituents());
257 std::vector<reco::CandidatePtr> constituents;
258 bool hasBHadron =
false;
259 for (
size_t j = 0,
m = fjConstituents.size();
j <
m; ++
j) {
260 const int index = fjConstituents[
j].user_index();
261 if (bHadronIdxs.find(
index) != bHadronIdxs.end()) {
266 constituents.push_back(
cand);
269 const LorentzVector jetP4(fjJet.px(), fjJet.py(), fjJet.pz(), fjJet.E());
273 const double jetArea = fjJet.has_area() ? fjJet.area() : 0;
274 genJet.setJetArea(jetArea);
277 bjetIdxs.push_back(
jets->size());
279 ljetIdxs.push_back(
jets->size());
282 jets->push_back(genJet);
288 if (bjetIdxs.size() < 2)
294 const int q1 =
leptons->at(0).charge();
295 const int q2 =
leptons->at(1).charge();
310 int selNu1 = -1, selNu2 = -1;
311 for (
int i = 0;
i < 2; ++
i) {
313 for (
int j = 0;
j < 2; ++
j) {
317 const double newDm = dm1 + dm2;
331 const auto w1LVec = lepton1.p4() + nu1.p4();
332 const auto w2LVec = lepton2.p4() + nu2.p4();
336 int selB1 = -1, selB2 = -1;
337 for (
auto i : bjetIdxs) {
339 for (
auto j : bjetIdxs) {
343 const double newDm = dm1 + dm2;
357 const auto t1LVec = w1LVec +
bJet1.p4();
358 const auto t2LVec = w2LVec +
bJet2.p4();
361 const int lepQ1 = lepton1.charge();
362 const int lepQ2 = lepton2.charge();
389 }
else if (!
leptons->empty() and !
neutrinos->empty() and ljetIdxs.size() >= 2) {
391 const auto& lepton =
leptons->at(0);
396 bool hasVetoLepton =
false;
397 for (
auto vetoLeptonItr =
next(
leptons->begin()); vetoLeptonItr !=
leptons->end(); ++vetoLeptonItr) {
400 hasVetoLepton =
true;
407 double metX = 0, metY = 0;
408 for (
const auto& neutrino : *
neutrinos) {
409 metX += neutrino.px();
410 metY += neutrino.py();
412 const double metPt = std::hypot(metX, metY);
416 const double mtW =
std::sqrt(2 * lepton.pt() * metPt *
cos(lepton.phi() - atan2(metX, metY)));
426 const double lpz = lepton.pz(), le = lepton.energy(), lpt = lepton.pt();
427 const double cf = (
wMass_ *
wMass_) / 2 + lepton.px() * metX + lepton.py() * metY;
428 const double det = cf * cf * lpz * lpz - lpt * lpt * (le * le * metPt * metPt - cf * cf);
429 const double pz = (cf * lpz + (cf < 0 ? -
sqrt(det) :
sqrt(det))) / lpt / lpt;
431 const auto w1LVec = lepton.p4() + nu1P4;
436 for (
auto b1Itr = bjetIdxs.begin(); b1Itr != bjetIdxs.end(); ++b1Itr) {
437 const double dR =
deltaR(
jets->at(*b1Itr).p4(), w1LVec);
446 const auto t1LVec = w1LVec +
bJet1.p4();
449 const auto& wJet1 =
jets->at(ljetIdxs[0]);
450 const auto& wJet2 =
jets->at(ljetIdxs[1]);
451 const auto w2LVec = wJet1.p4() + wJet2.p4();
456 for (
auto i : bjetIdxs) {
469 const auto t2LVec = w2LVec +
bJet2.p4();
471 const int q = lepton.charge();
535 for (
size_t i = 0,
n =
p->numberOfDaughters();
i <
n; ++
i) {
537 if (
p->pdgId() == dau->
pdgId())
544 for (
size_t i = 0,
n =
p->numberOfMothers();
i <
n; ++
i) {
561 const unsigned int absPdgId =
abs(
p->pdgId());
567 for (
int i = 0,
n =
p->numberOfDaughters();
i <
n; ++
i) {
579 if (absPdgId >= 1000000000)
585 const int nq3 = (absPdgId / 10) % 10;
586 const int nq2 = (absPdgId / 100) % 10;
587 const int nq1 = (absPdgId / 1000) % 10;
591 if (nq1 == 0 and nq2 == 5)
601 std::auto_ptr<reco::GenParticleCollection>&
outColl)
const {
const edm::EDGetTokenT< edm::View< reco::Candidate > > genParticleToken_
PseudoTopProducer(const edm::ParameterSet &pset)
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
reco::Particle::Point genVertex_
const double maxLeptonEtaSemilepton_
common ppss p3p6s2 common epss epspn46 common const1 w2
const double maxLeptonEta_
const double minVetoLeptonPtSemilepton_
fastjet::JetDefinition JetDef
const double maxLeptonEtaDilepton_
virtual double pt() const =0
transverse momentum
#define DEFINE_FWK_MODULE(type)
std::shared_ptr< JetDef > fjJetDef_
virtual int status() const =0
status word
edm::Ref< GenParticleCollection > GenParticleRef
persistent reference to a GenParticle
std::vector< GenJet > GenJetCollection
collection of GenJet objects
virtual size_type numberOfMothers() const =0
number of mothers (zero or one in most of but not all the cases)
reco::GenParticleRef buildGenParticle(const reco::Candidate *p, reco::GenParticleRefProd &refHandle, std::auto_ptr< reco::GenParticleCollection > &outColl) const
void writeSpecific(reco::CaloJet &jet, reco::Particle::LorentzVector const &p4, reco::Particle::Point const &point, std::vector< reco::CandidatePtr > const &constituents, CaloGeometry const &geometry, HcalTopology const &topology)
std::shared_ptr< JetDef > fjLepDef_
const double minMtWSemiLepton_
const double minMETSemiLepton_
reco::Particle::LorentzVector LorentzVector
void clearDaughters()
clear daughter references
void resetDaughters(const edm::ProductID &id)
set daughters product ID
const double minLeptonPtSemilepton_
bool isNull() const
Checks for null.
bJet1
do the razor with one or two b jets (medium CSV)
void insertAllDaughters(const reco::Candidate *p, std::set< const reco::Candidate *> &list) const
bool isNonnull() const
Checks for non-null.
const reco::Candidate * getLast(const reco::Candidate *p)
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Cos< T >::type cos(const T &t)
void produce(edm::Event &event, const edm::EventSetup &eventSetup) override
math::XYZPoint Point
point in the space
Abs< T >::type abs(const T &t)
Jets made from MC generator particles.
virtual int charge() const =0
electric charge
ProductID id() const
Accessor for product ID.
virtual int pdgId() const =0
PDG identifier.
math::XYZTLorentzVector LorentzVector
Lorentz vector.
bool isFromHadron(const reco::Candidate *p) const
const double maxVetoLeptonEtaSemilepton_
const double minLeptonPt_
const double minDileptonMassDilepton_
static constexpr float b2
void resetMothers(const edm::ProductID &id)
set mother product ID
const edm::EDGetTokenT< edm::View< reco::Candidate > > finalStateToken_
const double minLeptonPtDilepton_
math::XYZTLorentzVector LorentzVector
Lorentz vector.
void clearMothers()
clear mother references
static constexpr float b1
bool isBHadron(const reco::Candidate *p) const