30void KaonPhysics::setDecayProperties(
31 G4ParticleDefinition* kaon,
const std::vector<double>& branching_ratios,
32 double lifetime_factor)
const {
33 auto table{kaon->GetDecayTable()};
35 EXCEPTION_RAISE(
"KaonPhysics",
"Unable to get the decay table from " +
36 kaon->GetParticleName());
38 ldmx_log(trace) <<
"Decay details (" << kaon->GetParticleName()
39 <<
") before setting branching ratios and lifetimes";
40 dumpDecayDetails(kaon);
41 kaon->SetPDGLifeTime(kaon->GetPDGLifeTime() * lifetime_factor);
42 if (kaon == G4KaonZeroLong::Definition()) {
43 (*table)[KaonZeroLongDecayChannel::pi0_pi0_pi0]->SetBR(
44 branching_ratios[KaonZeroLongDecayChannel::pi0_pi0_pi0]);
45 (*table)[KaonZeroLongDecayChannel::pi0_pip_pim]->SetBR(
46 branching_ratios[KaonZeroLongDecayChannel::pi0_pip_pim]);
47 (*table)[KaonZeroLongDecayChannel::pip_e_nu]->SetBR(
48 branching_ratios[KaonZeroLongDecayChannel::pip_e_nu]);
49 (*table)[KaonZeroLongDecayChannel::pim_e_nu]->SetBR(
50 branching_ratios[KaonZeroLongDecayChannel::pim_e_nu]);
51 (*table)[KaonZeroLongDecayChannel::pim_mu_nu]->SetBR(
52 branching_ratios[KaonZeroLongDecayChannel::pim_mu_nu]);
53 (*table)[KaonZeroLongDecayChannel::pip_mu_nu]->SetBR(
54 branching_ratios[KaonZeroLongDecayChannel::pip_mu_nu]);
55 }
else if (kaon == G4KaonZeroShort::Definition()) {
56 (*table)[KaonZeroShortDecayChannel::pip_pim]->SetBR(
57 branching_ratios[KaonZeroShortDecayChannel::pip_pim]);
58 (*table)[KaonZeroShortDecayChannel::pi0_pi0]->SetBR(
59 branching_ratios[KaonZeroShortDecayChannel::pi0_pi0]);
61 (*table)[ChargedKaonDecayChannel::mu_nu]->SetBR(
62 branching_ratios[ChargedKaonDecayChannel::mu_nu]);
63 (*table)[ChargedKaonDecayChannel::pi_pi0]->SetBR(
64 branching_ratios[ChargedKaonDecayChannel::pi_pi0]);
65 (*table)[ChargedKaonDecayChannel::pi_pi_pi]->SetBR(
66 branching_ratios[ChargedKaonDecayChannel::pi_pi_pi]);
67 (*table)[ChargedKaonDecayChannel::pi_pi0_pi0]->SetBR(
68 branching_ratios[ChargedKaonDecayChannel::pi_pi0_pi0]);
69 (*table)[ChargedKaonDecayChannel::pi0_e_nu]->SetBR(
70 branching_ratios[ChargedKaonDecayChannel::pi0_e_nu]);
71 (*table)[ChargedKaonDecayChannel::pi0_mu_nu]->SetBR(
72 branching_ratios[ChargedKaonDecayChannel::pi0_mu_nu]);
74 ldmx_log(trace) <<
"Decay details (" << kaon->GetParticleName()
75 <<
") after setting branching ratios and lifetimes"
77 dumpDecayDetails(kaon);
79void KaonPhysics::ConstructParticle() {
80 auto kaon_plus{G4KaonPlus::Definition()};
81 auto kaon_minus{G4KaonMinus::Definition()};
82 auto kaon_long{G4KaonZeroLong::Definition()};
83 auto kaon_short{G4KaonZeroShort::Definition()};
85 if (!kaon_plus || !kaon_minus || !kaon_long || !kaon_short) {
86 EXCEPTION_RAISE(
"KaonPhysics",
87 "Unable to get the charged kaon particle definitions, "
88 "something is very wrong with the configuration.");
90 setDecayProperties(kaon_plus, kplus_branching_ratios_,
91 kplus_lifetime_factor_);
92 setDecayProperties(kaon_minus, kminus_branching_ratios_,
93 kminus_lifetime_factor_);
94 setDecayProperties(kaon_long, k0l_branching_ratios_, k0l_lifetime_factor_);
95 setDecayProperties(kaon_short, k0s_branching_ratios_, k0s_lifetime_factor_);