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