LDMX Software
Public Member Functions | Private Types | Private Attributes | List of all members
simcore::KaonPhysics Class Reference

Allows the configuration of properties of kaons produced in the simulation, in particular setting their lifetime and branching ratios. More...

#include <KaonPhysics.h>

Public Member Functions

 KaonPhysics (const G4String &name, const framework::config::Parameters &parameters)
 
void setDecayProperties (G4ParticleDefinition *kaon, const std::vector< double > &branching_ratios, double lifetime_factor) const
 Set the lifetime and branching ratios for one of the kaon species.
 
void ConstructParticle () override
 Construct/Update particles.
 
void DumpDecayDetails (const G4ParticleDefinition *kaon) const
 
void ConstructProcess () override
 Construct processes.
 

Private Types

enum  ChargedKaonDecayChannel {
  mu_nu = 0 , pi_pi0 = 1 , pi_pi_pi = 2 , pi0_e_nu = 3 ,
  pi0_mu_nu = 4 , pi_pi0_pi0 = 5
}
 Represents the 6 possible decay channels for charged kaons in Geant4 (See G4KaonMinus.cc and G4KaonPlus.cc in the Geant4 sources) in the order they appear in the decay table. More...
 
enum  KaonZeroLongDecayChannel {
  pim_e_nu = 0 , pip_e_nu = 1 , pi0_pi0_pi0 = 2 , pim_mu_nu = 3 ,
  pip_mu_nu = 4 , pi0_pip_pim = 5
}
 Corresponding entries for the K^0_L. More...
 
enum  KaonZeroShortDecayChannel { pip_pim = 0 , pi0_pi0 = 1 }
 

Private Attributes

double kplus_lifetime_factor {1}
 
double kminus_lifetime_factor {1}
 
double k0l_lifetime_factor {1}
 
double k0s_lifetime_factor {1}
 
std::vector< double > kplus_branching_ratios
 
std::vector< double > kminus_branching_ratios
 
std::vector< double > k0l_branching_ratios
 
std::vector< double > k0s_branching_ratios
 
int verbosity
 
framework::logging::logger theLog_
 

Detailed Description

Allows the configuration of properties of kaons produced in the simulation, in particular setting their lifetime and branching ratios.

Definition at line 32 of file KaonPhysics.h.

Member Enumeration Documentation

◆ ChargedKaonDecayChannel

Represents the 6 possible decay channels for charged kaons in Geant4 (See G4KaonMinus.cc and G4KaonPlus.cc in the Geant4 sources) in the order they appear in the decay table.

The processes are K^+ -> \mu^+ + \nu_\mu K^+ -> \pi^+ + \pi^0 K^+ -> \pi^+ + \pi^- + \pi^+ K^+ -> \pi^0 + e^+ + \nu_e K^+ -> \pi^0 + \mu^+ + \nu_\mu K^+ -> \pi^+ + \pi^0 + \pi^0

And vice versa for K^-. The indices here correspond to the position of the branching ratio for that process in the corresponding parameter as well as the position in the decay table.

Note
: The order in the the decay table is sorted by the branching ratios of the default physics settings since G4DecayTable::insert sorts its entries by branching ratio!

Definition at line 59 of file KaonPhysics.h.

59 {
60 mu_nu = 0,
61 pi_pi0 = 1,
62 pi_pi_pi = 2,
63 pi0_e_nu = 3,
64 pi0_mu_nu = 4,
65 pi_pi0_pi0 = 5,
66 };

◆ KaonZeroLongDecayChannel

Corresponding entries for the K^0_L.

Note that K^0_L and K^0_S decays are not symmetric like the charged ones so they need to be handled manually.

The processes are

K^0_L -> \pi^- + e^+ + \nu_e K^0_L -> \pi^+ + e^- + \nu_e K^0_L -> \pi^0 + \pi^0 + \pi^0 K^0_L -> \pi^- + \mu^+ + \nu_\mu K^0_L -> \pi^+ + \mu^- + \nu_\mu K^0_L -> \pi^0 + \pi^+ + \pi^-

and

K^0_S -> \pi^+ + \pi^- K^0_S -> \pi^0 + \pi^0

Note
: The order in the the decay table is sorted by the branching ratios of the default physics settings since G4DecayTable::insert sorts its entries by branching ratio!

Definition at line 91 of file KaonPhysics.h.

91 {
92 pim_e_nu = 0,
93 pip_e_nu = 1,
94 pi0_pi0_pi0 = 2,
95 pim_mu_nu = 3,
96 pip_mu_nu = 4,
97 pi0_pip_pim = 5,
98 };

◆ KaonZeroShortDecayChannel

enum simcore::KaonPhysics::KaonZeroShortDecayChannel
private

Definition at line 99 of file KaonPhysics.h.

99 {
100 pip_pim = 0,
101 pi0_pi0 = 1,
102 };

Constructor & Destructor Documentation

◆ KaonPhysics()

simcore::KaonPhysics::KaonPhysics ( const G4String &  name,
const framework::config::Parameters parameters 
)

Definition at line 4 of file KaonPhysics.cxx.

6 : G4VPhysicsConstructor(name) {
7 kplus_branching_ratios =
8 parameters.getParameter<std::vector<double>>("kplus_branching_ratios");
9 kminus_branching_ratios =
10 parameters.getParameter<std::vector<double>>("kminus_branching_ratios");
11 k0l_branching_ratios =
12 parameters.getParameter<std::vector<double>>("k0l_branching_ratios");
13 k0s_branching_ratios =
14 parameters.getParameter<std::vector<double>>("k0s_branching_ratios");
15 kplus_lifetime_factor =
16 parameters.getParameter<double>("kplus_lifetime_factor");
17 kminus_lifetime_factor =
18 parameters.getParameter<double>("kminus_lifetime_factor");
19 k0l_lifetime_factor = parameters.getParameter<double>("k0l_lifetime_factor");
20 k0s_lifetime_factor = parameters.getParameter<double>("k0s_lifetime_factor");
21 verbosity = parameters.getParameter<int>("verbosity");
22}
T getParameter(const std::string &name) const
Retrieve the parameter of the given name.
Definition Parameters.h:89

Member Function Documentation

◆ ConstructParticle()

void simcore::KaonPhysics::ConstructParticle ( )
override

Construct/Update particles.

Update the particle definitions for charged kaons

  1. Scale their lifetime by the corresponding lifetime factor
  2. Set their branching ratios to those in the corresponding branching raito parameter

Definition at line 77 of file KaonPhysics.cxx.

77 {
78 auto kaonPlus{G4KaonPlus::Definition()};
79 auto kaonMinus{G4KaonMinus::Definition()};
80 auto kaonLong{G4KaonZeroLong::Definition()};
81 auto kaonShort{G4KaonZeroShort::Definition()};
82
83 if (!kaonPlus || !kaonMinus || !kaonLong || !kaonShort) {
84 EXCEPTION_RAISE("KaonPhysics",
85 "Unable to get the charged kaon particle definitions, "
86 "something is very wrong with the configuration.");
87 }
88 setDecayProperties(kaonPlus, kplus_branching_ratios, kplus_lifetime_factor);
89 setDecayProperties(kaonMinus, kminus_branching_ratios,
90 kminus_lifetime_factor);
91 setDecayProperties(kaonLong, k0l_branching_ratios, k0l_lifetime_factor);
92 setDecayProperties(kaonShort, k0s_branching_ratios, k0s_lifetime_factor);
93}
void setDecayProperties(G4ParticleDefinition *kaon, const std::vector< double > &branching_ratios, double lifetime_factor) const
Set the lifetime and branching ratios for one of the kaon species.

◆ ConstructProcess()

void simcore::KaonPhysics::ConstructProcess ( )
inlineoverride

Construct processes.

We don't do anything here since we are just attaching/updating the kaon particle definitions.

Definition at line 155 of file KaonPhysics.h.

155{};

◆ DumpDecayDetails()

void simcore::KaonPhysics::DumpDecayDetails ( const G4ParticleDefinition *  kaon) const

Definition at line 95 of file KaonPhysics.cxx.

95 {
96 ldmx_log(info) << "Decay table details for " << kaon->GetParticleName()
97 << std::scientific << std::setprecision(15)
98 << " (PDG Lifetime " << kaon->GetPDGLifeTime() << ")"
99 << std::endl;
100 const auto table{kaon->GetDecayTable()};
101 const int entries{table->entries()};
102 for (auto i{0}; i < entries; ++i) {
103 const auto channel{(*table)[i]};
104 const auto daughters{channel->GetNumberOfDaughters()};
105 std::string products{};
106 // N-1 to avoid extra " + "
107 for (auto j{0}; j < daughters - 1; ++j) {
108 products += channel->GetDaughter(j)->GetParticleName();
109 products += " + ";
110 }
111 // Special formatting for last one :)
112 products += channel->GetDaughter(daughters - 1)->GetParticleName();
113 ldmx_log(info) << "Channel " << i << " (" << kaon->GetParticleName()
114 << " -> " << products << ") Kinematics type "
115 << channel->GetKinematicsName() << " with BR "
116 << channel->GetBR() << std::endl;
117 }
118}

◆ setDecayProperties()

void simcore::KaonPhysics::setDecayProperties ( G4ParticleDefinition *  kaon,
const std::vector< double > &  branching_ratios,
double  lifetime_factor 
) const

Set the lifetime and branching ratios for one of the kaon species.

Definition at line 23 of file KaonPhysics.cxx.

25 {
26 auto table{kaon->GetDecayTable()};
27 if (!table) {
28 EXCEPTION_RAISE("KaonPhysics", "Unable to get the decay table from " +
29 kaon->GetParticleName());
30 }
31 if (verbosity > 1) {
32 ldmx_log(info) << "Decay details (" << kaon->GetParticleName()
33 << ") before setting branching ratios and lifetimes"
34 << std::endl;
35 DumpDecayDetails(kaon);
36 }
37 kaon->SetPDGLifeTime(kaon->GetPDGLifeTime() * lifetime_factor);
38 if (kaon == G4KaonZeroLong::Definition()) {
39 (*table)[KaonZeroLongDecayChannel::pi0_pi0_pi0]->SetBR(
40 branching_ratios[KaonZeroLongDecayChannel::pi0_pi0_pi0]);
41 (*table)[KaonZeroLongDecayChannel::pi0_pip_pim]->SetBR(
42 branching_ratios[KaonZeroLongDecayChannel::pi0_pip_pim]);
43 (*table)[KaonZeroLongDecayChannel::pip_e_nu]->SetBR(
44 branching_ratios[KaonZeroLongDecayChannel::pip_e_nu]);
45 (*table)[KaonZeroLongDecayChannel::pim_e_nu]->SetBR(
46 branching_ratios[KaonZeroLongDecayChannel::pim_e_nu]);
47 (*table)[KaonZeroLongDecayChannel::pim_mu_nu]->SetBR(
48 branching_ratios[KaonZeroLongDecayChannel::pim_mu_nu]);
49 (*table)[KaonZeroLongDecayChannel::pip_mu_nu]->SetBR(
50 branching_ratios[KaonZeroLongDecayChannel::pip_mu_nu]);
51 } else if (kaon == G4KaonZeroShort::Definition()) {
52 (*table)[KaonZeroShortDecayChannel::pip_pim]->SetBR(
53 branching_ratios[KaonZeroShortDecayChannel::pip_pim]);
54 (*table)[KaonZeroShortDecayChannel::pi0_pi0]->SetBR(
55 branching_ratios[KaonZeroShortDecayChannel::pi0_pi0]);
56 } else {
57 (*table)[ChargedKaonDecayChannel::mu_nu]->SetBR(
58 branching_ratios[ChargedKaonDecayChannel::mu_nu]);
59 (*table)[ChargedKaonDecayChannel::pi_pi0]->SetBR(
60 branching_ratios[ChargedKaonDecayChannel::pi_pi0]);
61 (*table)[ChargedKaonDecayChannel::pi_pi_pi]->SetBR(
62 branching_ratios[ChargedKaonDecayChannel::pi_pi_pi]);
63 (*table)[ChargedKaonDecayChannel::pi_pi0_pi0]->SetBR(
64 branching_ratios[ChargedKaonDecayChannel::pi_pi0_pi0]);
65 (*table)[ChargedKaonDecayChannel::pi0_e_nu]->SetBR(
66 branching_ratios[ChargedKaonDecayChannel::pi0_e_nu]);
67 (*table)[ChargedKaonDecayChannel::pi0_mu_nu]->SetBR(
68 branching_ratios[ChargedKaonDecayChannel::pi0_mu_nu]);
69 }
70 if (verbosity > 0) {
71 ldmx_log(info) << "Decay details (" << kaon->GetParticleName()
72 << ") after setting branching ratios and lifetimes"
73 << std::endl;
74 DumpDecayDetails(kaon);
75 }
76}

Member Data Documentation

◆ k0l_branching_ratios

std::vector<double> simcore::KaonPhysics::k0l_branching_ratios
private

Definition at line 115 of file KaonPhysics.h.

◆ k0l_lifetime_factor

double simcore::KaonPhysics::k0l_lifetime_factor {1}
private

Definition at line 108 of file KaonPhysics.h.

108{1};

◆ k0s_branching_ratios

std::vector<double> simcore::KaonPhysics::k0s_branching_ratios
private

Definition at line 116 of file KaonPhysics.h.

◆ k0s_lifetime_factor

double simcore::KaonPhysics::k0s_lifetime_factor {1}
private

Definition at line 109 of file KaonPhysics.h.

109{1};

◆ kminus_branching_ratios

std::vector<double> simcore::KaonPhysics::kminus_branching_ratios
private

Definition at line 114 of file KaonPhysics.h.

◆ kminus_lifetime_factor

double simcore::KaonPhysics::kminus_lifetime_factor {1}
private

Definition at line 107 of file KaonPhysics.h.

107{1};

◆ kplus_branching_ratios

std::vector<double> simcore::KaonPhysics::kplus_branching_ratios
private

Definition at line 113 of file KaonPhysics.h.

◆ kplus_lifetime_factor

double simcore::KaonPhysics::kplus_lifetime_factor {1}
private

Definition at line 106 of file KaonPhysics.h.

106{1};

◆ theLog_

framework::logging::logger simcore::KaonPhysics::theLog_
mutableprivate
Initial value:
{
framework::logging::makeLogger("KaonPhysics")}

Definition at line 158 of file KaonPhysics.h.

158 {
159 framework::logging::makeLogger("KaonPhysics")};

◆ verbosity

int simcore::KaonPhysics::verbosity
private

Definition at line 120 of file KaonPhysics.h.


The documentation for this class was generated from the following files: