104 static constexpr std::array<int, 33> one_b_Ids = {
106 -511, -521, -10511, -10521, -513, -523, -10513, -10523, -20513, -20523,
107 -515, -525, -531, -10531, -533, -10533, -20533,
110 5122, 5112, 5212, 5222, 5114, 5214, 5224, 5132, 5232, 5312, 5322, 5314,
113 static constexpr std::array<int,33> one_antib_Ids =
negateID(one_b_Ids);
114 static constexpr std::array<int,6> one_b_one_antic_Ids = {
116 -541, -10541, -543, -10543, -20543, -545
118 static constexpr std::array<int,6> one_antib_one_c_Ids =
negateID(one_b_one_antic_Ids);
119 static constexpr std::array<int,9> one_b_one_c_Ids = {
121 5142, 5242, 5412, 5422, 5414, 5424, 5342, 5432, 5434
123 static constexpr std::array<int,9> one_antib_one_antic_Ids =
negateID(one_b_one_c_Ids);
124 static constexpr std::array<int,2> one_b_two_cs_Ids = {
128 static constexpr std::array<int,2> one_antib_two_antics_Ids =
negateID(one_b_two_cs_Ids);
129 static constexpr std::array<int,6> two_bs_Ids = {
131 5512, 5522, 5514, 5524, 5532, 5534
133 static constexpr std::array<int,6> two_antibs_Ids =
negateID(two_bs_Ids);
134 static constexpr std::array<int,2> two_bs_one_c_Ids = {
138 static constexpr std::array<int,2> two_antibs_one_antic_Ids =
negateID(two_bs_one_c_Ids);
139 static constexpr std::array<int,1> three_bs = {
143 static constexpr std::array<int,1> three_antibs =
negateID(three_bs);
145 static constexpr std::array<int,33> one_c_Ids = {
147 411, 421, 10411, 10421, 413, 423, 10413, 10423, 20413, 20423,
148 415, 425, 431, 10431, 433, 10433, 20433, 435,
150 4122, 4222, 4212, 4112, 4224, 4214, 4114, 4232, 4132, 4322, 4312, 4324,
153 static constexpr std::array<int,33> one_antic_Ids =
negateID(one_c_Ids);
154 static constexpr std::array<int,6> two_c_Ids = {
156 4412, 4422, 4414, 4424, 4432, 4434
158 static constexpr std::array<int,6> two_antic_Ids =
negateID(two_c_Ids);
159 static constexpr std::array<int,1> three_c_Ids = {
162 static constexpr std::array<int,1> three_antic_Ids =
negateID(three_c_Ids);
168 if (
hit(three_bs, pdgId)) { nb = 3; }
169 else if (
hit(three_antibs, pdgId)) { nb = -3; }
170 else if (
hit(two_bs_one_c_Ids, pdgId)) { nb = 2; nc = 1; }
171 else if (
hit(two_antibs_one_antic_Ids, pdgId)) { nb = -2; nc = -1; }
172 else if (
hit(two_bs_Ids, pdgId)) { nb = 2; }
173 else if (
hit(two_antibs_Ids, pdgId)) { nb = -2; }
174 else if (
hit(one_b_two_cs_Ids, pdgId)) { nb = 1; nc = 2; }
175 else if (
hit(one_antib_two_antics_Ids, pdgId)) { nb = -1; nc = -2; }
176 else if (
hit(one_b_one_c_Ids, pdgId)) { nb = 1; nc = 1; }
177 else if (
hit(one_antib_one_antic_Ids, pdgId)) { nb = -1; nc = -1; }
178 else if (
hit(one_b_one_antic_Ids, pdgId)) { nb = 1; nc = -1; }
179 else if (
hit(one_antib_one_c_Ids, pdgId)) { nb = -1; nc = 1; }
181 else if (
hit(one_b_Ids, pdgId)) { nb = 1; }
182 else if (
hit(one_antib_Ids, pdgId)) { nb = -1; }
183 else if (
hit(three_c_Ids, pdgId)) { nc = 3; }
184 else if (
hit(three_antic_Ids, pdgId)) { nc = -3; }
185 else if (
hit(two_c_Ids, pdgId)) { nc = 2; }
186 else if (
hit(two_antic_Ids, pdgId)) { nc = -2; }
187 else if (
hit(one_c_Ids, pdgId)) { nc = 1; }
188 else if (
hit(one_antic_Ids, pdgId)) { nc = -1; }
190 return FlavInfo(0,0,0,nc,nb,0,0);
202 std::vector<const TruthParticle*> truthparts(parts.begin(), parts.end());
203 std::vector<const TruthParticle*> bs(label_bs.
begin(), label_bs.
end());
204 std::vector<const TruthParticle*> cs(label_cs.
begin(), label_cs.
end());
208 childrenRemoved(bs, bs);
209 childrenRemoved(bs, cs);
210 childrenRemoved(bs, truthparts);
211 childrenRemoved(cs, cs);
212 childrenRemoved(cs, truthparts);
215 truthparts.insert(truthparts.end(), bs.begin(), bs.end());
216 truthparts.insert(truthparts.end(), cs.begin(), cs.end());
219 std::vector<PseudoJet> fullevent(truthparts.size());
220 for (
unsigned int ip = 0; ip < truthparts.size(); ip++) {
222 double px = part->px();
223 double py = part->py();
224 double pz = part->pz();
225 double E = part->e();
226 fullevent[ip] = PseudoJet(px,
py,pz,E);
230 fullevent[ip].set_user_info(
new FlavInfo(partFlavInfo));
233 std::array< std::vector<PseudoJet>,
N_ALGOS > all_pseudojets_array{};
242 if (!(doIFN || doCMP || doGHS || doSDF || doAKT)) {
243 std::vector<std::vector<PseudoJet>> empty_result;
254 all_pseudojets_array[
static_cast<std::size_t
>(
Algo::IFN)] = selectpt(ifn_jet_def(fullevent));
259 all_pseudojets_array[
static_cast<std::size_t
>(
Algo::CMP)] = selectpt(cmp_jet_def(fullevent));
262 std::vector<PseudoJet> base_jets;
263 if (doAKT || doGHS || doSDF) {
264 base_jets = selectpt(akt_jet_def(fullevent));
269 all_pseudojets_array[
static_cast<std::size_t
>(
Algo::GHS)] =
274 SDFlavourCalc sdFlavCalc;
275 std::vector<PseudoJet> SDF_jets = base_jets;
276 sdFlavCalc(SDF_jets);
277 all_pseudojets_array[
static_cast<std::size_t
>(
Algo::SDF)] = std::move(SDF_jets);
282 all_pseudojets_array[
static_cast<std::size_t
>(
Algo::AKT)] = std::move(base_jets);
285 std::vector<std::vector<PseudoJet>> all_pseudojets;
286 all_pseudojets.reserve(
N_ALGOS);
287 for (std::size_t i = 0; i <
N_ALGOS; ++i) {
288 all_pseudojets.push_back(std::move(all_pseudojets_array[i]));
291 return all_pseudojets;
457 if (!truthPartReadHandle.
isValid()) {
458 ATH_MSG_ERROR(
"Invalid ReadHandle for TruthParticleCollection with key: " << truthPartReadHandle.
key());
459 return StatusCode::FAILURE;
461 if (!bottomReadHandle.
isValid()) {
462 ATH_MSG_ERROR(
"Invalid ReadHandle for bottomPartCollection with key: " << bottomReadHandle.
key());
463 return StatusCode::FAILURE;
465 if (!charmReadHandle.
isValid()) {
466 ATH_MSG_ERROR(
"Invalid ReadHandle for charmPartCollection with key: " << charmReadHandle.
key());
467 return StatusCode::FAILURE;
478 std::vector<std::vector<PseudoJet>> all_pseudojets =
479 getJetInputs(*truthPartReadHandle, *bottomReadHandle, *charmReadHandle);
482 std::vector<PseudoJet> btagged_pseudojetsIFN, ctagged_pseudojetsIFN;
483 std::vector<PseudoJet> btagged_pseudojetsCMP, ctagged_pseudojetsCMP;
484 std::vector<PseudoJet> btagged_pseudojetsGHS, ctagged_pseudojetsGHS;
485 std::vector<PseudoJet> btagged_pseudojetsSDF, ctagged_pseudojetsSDF;
486 std::vector<PseudoJet> btagged_pseudojetsAKT, ctagged_pseudojetsAKT;
489 if (doIFN && all_pseudojets.size() >
static_cast<std::size_t
>(
Algo::IFN)) {
491 btagged_pseudojetsIFN, ctagged_pseudojetsIFN);
495 if (doCMP && all_pseudojets.size() >
static_cast<std::size_t
>(
Algo::CMP)) {
497 btagged_pseudojetsCMP, ctagged_pseudojetsCMP);
501 if (doGHS && all_pseudojets.size() >
static_cast<std::size_t
>(
Algo::GHS)) {
503 btagged_pseudojetsGHS, ctagged_pseudojetsGHS);
507 if (doSDF && all_pseudojets.size() >
static_cast<std::size_t
>(
Algo::SDF)) {
509 btagged_pseudojetsSDF, ctagged_pseudojetsSDF);
513 if (doAKT && all_pseudojets.size() >
static_cast<std::size_t
>(
Algo::AKT)) {
515 btagged_pseudojetsAKT, ctagged_pseudojetsAKT);
519 std::vector<std::vector<const PseudoJet*>> jetlabelIFN_b = doIFN ?
match(btagged_pseudojetsIFN, jets) : std::vector<std::vector<const PseudoJet*>>(jets.size());
520 std::vector<std::vector<const PseudoJet*>> jetlabelIFN_c = doIFN ?
match(ctagged_pseudojetsIFN, jets) : std::vector<std::vector<const PseudoJet*>>(jets.size());
521 std::vector<std::vector<const PseudoJet*>> jetlabelCMP_b = doCMP ?
match(btagged_pseudojetsCMP, jets) : std::vector<std::vector<const PseudoJet*>>(jets.size());
522 std::vector<std::vector<const PseudoJet*>> jetlabelCMP_c = doCMP ?
match(ctagged_pseudojetsCMP, jets) : std::vector<std::vector<const PseudoJet*>>(jets.size());
523 std::vector<std::vector<const PseudoJet*>> jetlabelGHS_b = doGHS ?
match(btagged_pseudojetsGHS, jets) : std::vector<std::vector<const PseudoJet*>>(jets.size());
524 std::vector<std::vector<const PseudoJet*>> jetlabelGHS_c = doGHS ?
match(ctagged_pseudojetsGHS, jets) : std::vector<std::vector<const PseudoJet*>>(jets.size());
525 std::vector<std::vector<const PseudoJet*>> jetlabelSDF_b = doSDF ?
match(btagged_pseudojetsSDF, jets) : std::vector<std::vector<const PseudoJet*>>(jets.size());
526 std::vector<std::vector<const PseudoJet*>> jetlabelSDF_c = doSDF ?
match(ctagged_pseudojetsSDF, jets) : std::vector<std::vector<const PseudoJet*>>(jets.size());
527 std::vector<std::vector<const PseudoJet*>> jetlabelAKT_b = doAKT ?
match(btagged_pseudojetsAKT, jets) : std::vector<std::vector<const PseudoJet*>>(jets.size());
528 std::vector<std::vector<const PseudoJet*>> jetlabelAKT_c = doAKT ?
match(ctagged_pseudojetsAKT, jets) : std::vector<std::vector<const PseudoJet*>>(jets.size());
530 for (
unsigned int iJet = 0; iJet < jets.size(); iJet++) {
531 const Jet&
jet = *jets[iJet];
542 tag_pjet.
IFN_b = jetlabelIFN_b[iJet];
543 tag_pjet.
IFN_c = jetlabelIFN_c[iJet];
544 tag_pjet.
CMP_b = jetlabelCMP_b[iJet];
545 tag_pjet.
CMP_c = jetlabelCMP_c[iJet];
546 tag_pjet.
GHS_b = jetlabelGHS_b[iJet];
547 tag_pjet.
GHS_c = jetlabelGHS_c[iJet];
548 tag_pjet.
SDF_b = jetlabelSDF_b[iJet];
549 tag_pjet.
SDF_c = jetlabelSDF_c[iJet];
550 tag_pjet.
AKT_b = jetlabelAKT_b[iJet];
551 tag_pjet.
AKT_c = jetlabelAKT_c[iJet];
556 return StatusCode::SUCCESS;