10#include <analysis/variables/MCParticleTag.h>
13#include <analysis/VariableManager/Manager.h>
16#include <analysis/dataobjects/Particle.h>
19#include <analysis/utility/GenBplusTag.h>
20#include <analysis/utility/GenB0Tag.h>
21#include <analysis/utility/GenBsTag.h>
22#include <analysis/utility/GenDTag.h>
23#include <analysis/utility/GenTauTag.h>
26#include <mdst/dataobjects/MCParticle.h>
29#include <framework/datastore/StoreArray.h>
30#include <framework/gearbox/Const.h>
31#include <framework/logging/Logger.h>
45 double BplusMode(
const Particle*)
48 StoreArray<MCParticle> MC_Particle_list;
49 if (!MC_Particle_list) {
50 B2WARNING(
"GenMCTagTool::eval - missing MCParticles array");
55 for (
const auto& iMCParticle : MC_Particle_list) {
56 if (iMCParticle.getPDG() != 521)
continue;
58 std::vector<int> DauPDG;
59 for (
auto const& mcDaughter : iMCParticle.getDaughters()) {
60 DauPDG.push_back(mcDaughter->getPDG());
62 modeB = gBtag.Mode_B_plus(DauPDG);
69 double BminusMode(
const Particle*)
72 StoreArray<MCParticle> MC_Particle_list;
73 if (!MC_Particle_list) {
74 B2WARNING(
"GenMCTagTool::eval - missing MCParticles array");
79 for (
const auto& iMCParticle : MC_Particle_list) {
80 if (iMCParticle.getPDG() != -521)
continue;
82 std::vector<int> DauPDG;
83 for (
auto const& mcDaughter : iMCParticle.getDaughters()) {
84 DauPDG.push_back(mcDaughter->getPDG());
86 modeB = gBtag.Mode_B_minus(DauPDG);
93 double B0Mode(
const Particle*)
96 StoreArray<MCParticle> MC_Particle_list;
97 if (!MC_Particle_list) {
98 B2WARNING(
"GenMCTagTool::eval - missing MCParticles array");
101 int modeB1 = -99, modeB2 = -99, modeB = -99, nb1 = 0, nb2 = 0;
103 for (
const auto& iMCParticle : MC_Particle_list) {
104 if (iMCParticle.getPDG() == 511) {
107 std::vector<int> DauPDG1;
108 for (
auto const& mcDaughter : iMCParticle.getDaughters()) {
109 DauPDG1.push_back(mcDaughter->getPDG());
111 modeB1 = gBtag.Mode_B0(DauPDG1);
115 if (iMCParticle.getPDG() == -511) {
118 std::vector<int> DauPDG2;
119 for (
auto const& mcDaughter : iMCParticle.getDaughters()) {
120 DauPDG2.push_back(mcDaughter->getPDG());
122 modeB2 = gBtag.Mode_anti_B0(DauPDG2);
128 if (modeB1 != -99) { modeB = modeB1;}
129 else if (modeB2 != -99) { modeB = modeB2;}
134 double Bbar0Mode(
const Particle*)
137 StoreArray<MCParticle> MC_Particle_list;
138 if (!MC_Particle_list) {
139 B2WARNING(
"GenMCTagTool::eval - missing MCParticles array");
142 int modeB1 = -99, modeB2 = -99, modeB = -99, nb1 = 0, nb2 = 0;
144 for (
const auto& iMCParticle : MC_Particle_list) {
145 if (iMCParticle.getPDG() == -511) {
148 std::vector<int> DauPDG1;
149 for (
auto const& mcDaughter : iMCParticle.getDaughters()) {
150 DauPDG1.push_back(mcDaughter->getPDG());
152 modeB1 = gBtag.Mode_anti_B0(DauPDG1);
156 if (iMCParticle.getPDG() == 511) {
159 std::vector<int> DauPDG2;
160 for (
auto const& mcDaughter : iMCParticle.getDaughters()) {
161 DauPDG2.push_back(mcDaughter->getPDG());
163 modeB2 = gBtag.Mode_B0(DauPDG2);
169 if (modeB1 != -99) { modeB = modeB1;}
170 else if (modeB2 != -99) { modeB = modeB2;}
175 double Bs0Mode(
const Particle*)
178 StoreArray<MCParticle> MC_Particle_list;
179 if (!MC_Particle_list) {
180 B2WARNING(
"GenMCTagTool::eval - missing MCParticles array");
183 int modeB1 = -99, modeB2 = -99, modeB = -99, nb1 = 0, nb2 = 0;
185 for (
const auto& iMCParticle : MC_Particle_list) {
186 if (iMCParticle.getPDG() == 531) {
189 std::vector<int> DauPDG1;
190 for (
auto const& mcDaughter : iMCParticle.getDaughters()) {
191 DauPDG1.push_back(mcDaughter->getPDG());
193 modeB1 = gBtag.Mode_Bs0(DauPDG1);
197 if (iMCParticle.getPDG() == -531) {
200 std::vector<int> DauPDG2;
201 for (
auto const& mcDaughter : iMCParticle.getDaughters()) {
202 DauPDG2.push_back(mcDaughter->getPDG());
204 modeB2 = gBtag.Mode_anti_Bs0(DauPDG2);
210 if (modeB1 != -99) { modeB = modeB1;}
211 else if (modeB2 != -99) { modeB = modeB2;}
216 double Bsbar0Mode(
const Particle*)
219 StoreArray<MCParticle> MC_Particle_list;
220 if (!MC_Particle_list) {
221 B2WARNING(
"GenMCTagTool::eval - missing MCParticles array");
224 int modeB1 = -99, modeB2 = -99, modeB = -99, nb1 = 0, nb2 = 0;
226 for (
const auto& iMCParticle : MC_Particle_list) {
227 if (iMCParticle.getPDG() == -531) {
230 std::vector<int> DauPDG1;
231 for (
auto const& mcDaughter : iMCParticle.getDaughters()) {
232 DauPDG1.push_back(mcDaughter->getPDG());
234 modeB1 = gBtag.Mode_anti_Bs0(DauPDG1);
238 if (iMCParticle.getPDG() == 531) {
241 std::vector<int> DauPDG2;
242 for (
auto const& mcDaughter : iMCParticle.getDaughters()) {
243 DauPDG2.push_back(mcDaughter->getPDG());
245 modeB2 = gBtag.Mode_Bs0(DauPDG2);
251 if (modeB1 != -99) { modeB = modeB1;}
252 else if (modeB2 != -99) { modeB = modeB2;}
257 double DstplusMode(
const Particle*)
260 StoreArray<MCParticle> MC_Particle_list;
261 if (!MC_Particle_list) {
262 B2WARNING(
"GenMCTagTool::eval - missing MCParticles array");
267 for (
const auto& iMCParticle : MC_Particle_list) {
268 if (iMCParticle.getPDG() != 413)
continue;
270 std::vector<int> DauPDG;
271 for (
auto const& mcDaughter : iMCParticle.getDaughters()) {
272 DauPDG.push_back(mcDaughter->getPDG());
274 modeD = gDtag.Mode_Dst_plus(DauPDG);
281 double DstminusMode(
const Particle*)
284 StoreArray<MCParticle> MC_Particle_list;
285 if (!MC_Particle_list) {
286 B2WARNING(
"GenMCTagTool::eval - missing MCParticles array");
291 for (
const auto& iMCParticle : MC_Particle_list) {
292 if (iMCParticle.getPDG() != -413)
continue;
294 std::vector<int> DauPDG;
295 for (
auto const& mcDaughter : iMCParticle.getDaughters()) {
296 DauPDG.push_back(mcDaughter->getPDG());
298 modeD = gDtag.Mode_Dst_minus(DauPDG);
305 double DsplusMode(
const Particle*)
308 StoreArray<MCParticle> MC_Particle_list;
309 if (!MC_Particle_list) {
310 B2WARNING(
"GenMCTagTool::eval - missing MCParticles array");
315 for (
const auto& iMCParticle : MC_Particle_list) {
316 if (iMCParticle.getPDG() != 431)
continue;
318 std::vector<int> DauPDG;
319 for (
auto const& mcDaughter : iMCParticle.getDaughters()) {
320 DauPDG.push_back(mcDaughter->getPDG());
322 modeD = gDtag.Mode_Ds_plus(DauPDG);
329 double DsminusMode(
const Particle*)
332 StoreArray<MCParticle> MC_Particle_list;
333 if (!MC_Particle_list) {
334 B2WARNING(
"GenMCTagTool::eval - missing MCParticles array");
339 for (
const auto& iMCParticle : MC_Particle_list) {
340 if (iMCParticle.getPDG() != -431)
continue;
342 std::vector<int> DauPDG;
343 for (
auto const& mcDaughter : iMCParticle.getDaughters()) {
344 DauPDG.push_back(mcDaughter->getPDG());
346 modeD = gDtag.Mode_Ds_minus(DauPDG);
353 double DplusMode(
const Particle*)
356 StoreArray<MCParticle> MC_Particle_list;
357 if (!MC_Particle_list) {
358 B2WARNING(
"GenMCTagTool::eval - missing MCParticles array");
363 for (
const auto& iMCParticle : MC_Particle_list) {
364 if (iMCParticle.getPDG() != 411)
continue;
366 std::vector<int> DauPDG;
367 for (
auto const& mcDaughter : iMCParticle.getDaughters()) {
368 DauPDG.push_back(mcDaughter->getPDG());
370 modeD = gDtag.Mode_D_plus(DauPDG);
377 double DminusMode(
const Particle*)
380 StoreArray<MCParticle> MC_Particle_list;
381 if (!MC_Particle_list) {
382 B2WARNING(
"GenMCTagTool::eval - missing MCParticles array");
387 for (
const auto& iMCParticle : MC_Particle_list) {
388 if (iMCParticle.getPDG() != -411)
continue;
390 std::vector<int> DauPDG;
391 for (
auto const& mcDaughter : iMCParticle.getDaughters()) {
392 DauPDG.push_back(mcDaughter->getPDG());
394 modeD = gDtag.Mode_D_minus(DauPDG);
401 double D0Mode(
const Particle*)
404 StoreArray<MCParticle> MC_Particle_list;
405 if (!MC_Particle_list) {
406 B2WARNING(
"GenMCTagTool::eval - missing MCParticles array");
411 for (
const auto& iMCParticle : MC_Particle_list) {
412 if (iMCParticle.getPDG() != 421)
continue;
414 std::vector<int> DauPDG;
415 for (
auto const& mcDaughter : iMCParticle.getDaughters()) {
416 DauPDG.push_back(mcDaughter->getPDG());
418 modeD = gDtag.Mode_D0(DauPDG);
425 double Dbar0Mode(
const Particle*)
428 StoreArray<MCParticle> MC_Particle_list;
429 if (!MC_Particle_list) {
430 B2WARNING(
"GenMCTagTool::eval - missing MCParticles array");
435 for (
const auto& iMCParticle : MC_Particle_list) {
436 if (iMCParticle.getPDG() != -421)
continue;
438 std::vector<int> DauPDG;
439 for (
auto const& mcDaughter : iMCParticle.getDaughters()) {
440 DauPDG.push_back(mcDaughter->getPDG());
442 modeD = gDtag.Mode_anti_D0(DauPDG);
449 double TauplusMode(
const Particle*)
452 StoreArray<MCParticle> MC_Particle_list;
453 if (!MC_Particle_list) {
454 B2WARNING(
"GenMCTagTool::eval - missing MCParticles array");
459 for (
const auto& iMCParticle : MC_Particle_list) {
460 if (iMCParticle.getPDG() != -15)
continue;
462 std::vector<int> DauPDG;
463 for (
auto const& mcDaughter : iMCParticle.getDaughters()) {
464 if (mcDaughter->getPDG() == 24) {
465 for (
auto const& WDaughter : mcDaughter->getDaughters()) {
466 DauPDG.push_back(WDaughter->getPDG());
468 }
else DauPDG.push_back(mcDaughter->getPDG());
470 modeTau = gTKtag.Mode_tau_plus(DauPDG);
477 double TauminusMode(
const Particle*)
480 StoreArray<MCParticle> MC_Particle_list;
481 if (!MC_Particle_list) {
482 B2WARNING(
"GenMCTagTool::eval - missing MCParticles array");
487 for (
const auto& iMCParticle : MC_Particle_list) {
488 if (iMCParticle.getPDG() != 15)
continue;
490 std::vector<int> DauPDG;
491 for (
auto const& mcDaughter : iMCParticle.getDaughters()) {
492 if (mcDaughter->getPDG() == -24) {
493 for (
auto const& WDaughter : mcDaughter->getDaughters()) {
494 DauPDG.push_back(WDaughter->getPDG());
496 }
else DauPDG.push_back(mcDaughter->getPDG());
498 modeTau = gTKtag.Mode_tau_minus(DauPDG);
505 VARIABLE_GROUP(
"MCParticle tag variables");
506 REGISTER_VARIABLE(
"BplusMode", BplusMode,
"[Eventbased] It will return the decays mode of B+ particles");
507 REGISTER_VARIABLE(
"BminusMode", BminusMode,
"[Eventbased] It will return the decays mode of B- particles");
508 REGISTER_VARIABLE(
"B0Mode", B0Mode,
"[Eventbased] It will return the decays mode of B0 particles");
509 REGISTER_VARIABLE(
"Bbar0Mode", Bbar0Mode,
"[Eventbased] It will return the decays mode of anti-B0 particles");
510 REGISTER_VARIABLE(
"Bs0Mode", Bs0Mode,
"[Eventbased] It will return the decays mode of B_s0 particles");
511 REGISTER_VARIABLE(
"Bsbar0Mode", Bsbar0Mode,
"[Eventbased] It will return the decays mode of anti-B_s0 particles");
512 REGISTER_VARIABLE(
"DstplusMode", DstplusMode,
"[Eventbased] It will return the decays mode of D*+ particles");
513 REGISTER_VARIABLE(
"DstminusMode", DstminusMode,
"[Eventbased] It will return the decays mode of D*- particles");
514 REGISTER_VARIABLE(
"DsplusMode", DsplusMode,
"[Eventbased] It will return the decays mode of D_s+ particles");
515 REGISTER_VARIABLE(
"DsminusMode", DsminusMode,
"[Eventbased] It will return the decays mode of D_s- particles");
516 REGISTER_VARIABLE(
"DplusMode", DplusMode,
"[Eventbased] It will return the decays mode of D+ particles");
517 REGISTER_VARIABLE(
"DminusMode", DminusMode,
"[Eventbased] It will return the decays mode of D- particles");
518 REGISTER_VARIABLE(
"D0Mode", D0Mode,
"[Eventbased] It will return the decays mode of D0 particles");
519 REGISTER_VARIABLE(
"Dbar0Mode", Dbar0Mode,
"[Eventbased] It will return the decays mode of anti-D0 particles");
520 REGISTER_VARIABLE(
"TauplusMode", TauplusMode,
"[Eventbased] It will return the decays mode of tau+ particles");
521 REGISTER_VARIABLE(
"TauminusMode", TauminusMode,
"[Eventbased] It will return the decays mode of tau- particles");
static const double doubleNaN
quiet_NaN
Abstract base class for different kinds of events.