29 produces<nanoaod::FlatTable>();
34 const std::vector<reco::GenParticle>& gToBB,
35 const std::vector<reco::GenParticle>& gToCC,
36 const std::vector<reco::GenParticle>& neutrinosLepB,
37 const std::vector<reco::GenParticle>& neutrinosLepB_C,
38 const std::vector<reco::GenParticle>& alltaus,
40 int hflav =
abs(
jet.hadronFlavour());
41 int pflav =
abs(
jet.partonFlavour());
43 if (!(
jet.genJet())) {
50 physflav =
abs(
jet.genParton()->pdgId());
51 std::size_t nbs =
jet.jetFlavourInfo().getbHadrons().size();
52 std::size_t ncs =
jet.jetFlavourInfo().getcHadrons().size();
54 unsigned int nbFromGSP(0);
61 unsigned int ncFromGSP(0);
77 }
else if (nbs == 1) {
78 for (std::vector<reco::GenParticle>::const_iterator
it = neutrinosLepB.begin();
it != neutrinosLepB.end();
84 for (std::vector<reco::GenParticle>::const_iterator
it = neutrinosLepB_C.begin();
it != neutrinosLepB_C.end();
95 else if (physflav == 3)
97 else if (physflav == 2 || physflav == 1)
104 }
else if (hflav == 4) {
113 if (!alltaus.empty()) {
114 bool ishadrtaucontained =
true;
115 for (
const auto&
p : alltaus) {
116 size_t ndau =
p.numberOfDaughters();
117 for (
size_t i = 0;
i < ndau;
i++) {
120 if (daupid == 13 || daupid == 11) {
121 ishadrtaucontained =
false;
125 ishadrtaucontained =
false;
130 if (ishadrtaucontained)
137 else if (physflav == 3)
139 else if (physflav == 2 || physflav == 1)
148 else if (physflav == 3)
150 else if (physflav == 2 || physflav == 1)
159 else if (pflav == 2 || pflav == 1)
170 desc.add<
edm::InputTag>(
"genparticles")->setComment(
"input genparticles info collection");
171 desc.add<
std::string>(
"name")->setComment(
"name of the genJet FlatTable we are extending with flavour information");
172 descriptions.
add(
"btvMCTable",
desc);
193 std::vector<reco::GenParticle> neutrinosLepB;
194 std::vector<reco::GenParticle> neutrinosLepB_C;
196 std::vector<reco::GenParticle> gToBB;
197 std::vector<reco::GenParticle> gToCC;
198 std::vector<reco::GenParticle> alltaus;
202 std::vector<unsigned> jet_FlavSplit(
nJets);
207 if (mother !=
nullptr) {
210 neutrinosLepB.emplace_back(
gen);
214 neutrinosLepB_C.emplace_back(
gen);
225 if (
gen.numberOfDaughters() == 2) {
230 gToBB.push_back(
gen);
233 gToCC.push_back(
gen);
237 if (
id == 15 &&
false) {
238 alltaus.push_back(
gen);
241 for (
unsigned i_jet = 0; i_jet <
nJets; ++i_jet) {
243 const auto&
jet =
jets->at(i_jet);
245 jet_FlavSplit[i_jet] =
248 auto newtab = std::make_unique<nanoaod::FlatTable>(
nJets,
name_,
false,
true);
249 newtab->addColumn<
int>(
"FlavSplit",
251 "Flavour of the jet, numerical codes: " 262 "isLeptonicB_C: 521, " 265 "isUndefined: 1000. " 266 "May be combined to form coarse labels for tagger training and flavour dependent attacks " 267 "using the loss surface.");
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
BTVMCFlavourTableProducer(const edm::ParameterSet &iConfig)
~BTVMCFlavourTableProducer() override
edm::EDGetTokenT< std::vector< pat::Jet > > src_
static constexpr bool usePhysForLightAndUndefined
static constexpr int nJets
edm::EDGetTokenT< reco::GenParticleCollection > genParticlesToken_
int pdgId() const final
PDG identifier.
Abs< T >::type abs(const T &t)
#define DEFINE_FWK_MODULE(type)
static constexpr double jetR_
virtual int pdgId() const =0
PDG identifier.
static constexpr float d0
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Analysis-level calorimeter jet class.
void add(std::string const &label, ParameterSetDescription const &psetDescription)
int jet_flavour(const pat::Jet &jet, const std::vector< reco::GenParticle > &gToBB, const std::vector< reco::GenParticle > &gToCC, const std::vector< reco::GenParticle > &neutrinosLepB, const std::vector< reco::GenParticle > &neutrinosLepB_C, const std::vector< reco::GenParticle > &alltaus, bool usePhysForLightAndUndefined)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
static constexpr float d1
void produce(edm::Event &, edm::EventSetup const &) override