GENIEGenerator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
genie::Decayer Class Referenceabstract

Base class for decayer classes. Implements common configuration, allowing users to toggle on/off flags for particles and decay channels. Is a concerete implementation of the EventRecordVisitorI interface. More...

#include <Decayer.h>

Inheritance diagram for genie::Decayer:
Inheritance graph
[legend]
Collaboration diagram for genie::Decayer:
Collaboration graph
[legend]

Public Member Functions

virtual ~Decayer ()
 
void Configure (const Registry &config)
 
void Configure (string config)
 
- Public Member Functions inherited from genie::EventRecordVisitorI
virtual ~EventRecordVisitorI ()
 
virtual void ProcessEventRecord (GHepRecord *event_rec) const =0
 
- Public Member Functions inherited from genie::Algorithm
virtual ~Algorithm ()
 
virtual void FindConfig (void)
 
virtual const RegistryGetConfig (void) const
 
RegistryGetOwnedConfig (void)
 
virtual const AlgIdId (void) const
 Get algorithm ID. More...
 
virtual AlgStatus_t GetStatus (void) const
 Get algorithm status. More...
 
virtual bool AllowReconfig (void) const
 
virtual AlgCmp_t Compare (const Algorithm *alg) const
 Compare with input algorithm. More...
 
virtual void SetId (const AlgId &id)
 Set algorithm ID. More...
 
virtual void SetId (string name, string config)
 
const AlgorithmSubAlg (const RgKey &registry_key) const
 
void AdoptConfig (void)
 
void AdoptSubstructure (void)
 
virtual void Print (ostream &stream) const
 Print algorithm info. More...
 

Protected Member Functions

 Decayer ()
 
 Decayer (string name)
 
 Decayer (string name, string config)
 
virtual void LoadConfig (void)
 
virtual bool ToBeDecayed (int pdgc, GHepStatus_t ist) const
 
virtual bool IsUnstable (int pdgc) const
 
virtual bool IsHandled (int pdgc) const =0
 
virtual void InhibitDecay (int pdgc, TDecayChannel *dc=0) const =0
 
virtual void UnInhibitDecay (int pdgc, TDecayChannel *dc=0) const =0
 
- Protected Member Functions inherited from genie::EventRecordVisitorI
 EventRecordVisitorI ()
 
 EventRecordVisitorI (string name)
 
 EventRecordVisitorI (string name, string config)
 
- Protected Member Functions inherited from genie::Algorithm
 Algorithm ()
 
 Algorithm (string name)
 
 Algorithm (string name, string config)
 
void Initialize (void)
 
void DeleteConfig (void)
 
void DeleteSubstructure (void)
 
RegistryExtractLocalConfig (const Registry &in) const
 
RegistryExtractLowerConfig (const Registry &in, const string &alg_key) const
 Split an incoming configuration Registry into a block valid for the sub-algo identified by alg_key. More...
 
template<class T >
bool GetParam (const RgKey &name, T &p, bool is_top_call=true) const
 
template<class T >
bool GetParamDef (const RgKey &name, T &p, const T &def) const
 
template<class T >
int GetParamVect (const std::string &comm_name, std::vector< T > &v, bool is_top_call=true) const
 Handle to load vectors of parameters. More...
 
int GetParamVectKeys (const std::string &comm_name, std::vector< RgKey > &k, bool is_top_call=true) const
 
template<class T >
int GetParamMat (const std::string &comm_name, TMatrixT< T > &mat, bool is_top_call=true) const
 Handle to load matrix of parameters. More...
 
template<class T >
int GetParamMatSym (const std::string &comm_name, TMatrixTSym< T > &mat, bool is_top_call=true) const
 
int GetParamMatKeys (const std::string &comm_name, std::vector< RgKey > &k, bool is_top_call=true) const
 
int AddTopRegistry (Registry *rp, bool owns=true)
 add registry with top priority, also update ownership More...
 
int AddLowRegistry (Registry *rp, bool owns=true)
 add registry with lowest priority, also update ownership More...
 
int MergeTopRegistry (const Registry &r)
 
int AddTopRegisties (const vector< Registry * > &rs, bool owns=false)
 Add registries with top priority, also udated Ownerships. More...
 

Protected Attributes

bool fGenerateWeighted
 generate weighted or unweighted decays? More...
 
bool fRunBefHadroTransp
 is invoked before or after FSI? More...
 
PDGCodeList fParticlesToDecay
 list of particles to be decayed More...
 
PDGCodeList fParticlesNotToDecay
 list of particles for which decay is inhibited More...
 
- Protected Attributes inherited from genie::Algorithm
bool fAllowReconfig
 
bool fOwnsSubstruc
 true if it owns its substructure (sub-algs,...) More...
 
AlgId fID
 algorithm name and configuration set More...
 
vector< Registry * > fConfVect
 
vector< bool > fOwnerships
 ownership for every registry in fConfVect More...
 
AlgStatus_t fStatus
 algorithm execution status More...
 
AlgMapfOwnedSubAlgMp
 local pool for owned sub-algs (taken out of the factory pool) More...
 

Additional Inherited Members

- Static Public Member Functions inherited from genie::Algorithm
static string BuildParamVectKey (const std::string &comm_name, unsigned int i)
 
static string BuildParamVectSizeKey (const std::string &comm_name)
 
static string BuildParamMatKey (const std::string &comm_name, unsigned int i, unsigned int j)
 
static string BuildParamMatRowSizeKey (const std::string &comm_name)
 
static string BuildParamMatColSizeKey (const std::string &comm_name)
 

Detailed Description

Base class for decayer classes. Implements common configuration, allowing users to toggle on/off flags for particles and decay channels. Is a concerete implementation of the EventRecordVisitorI interface.

Author
Costas Andreopoulos <c.andreopoulos cern.ch> University of Liverpool
Created:
November 14, 2018
License:
Copyright (c) 2003-2024, The GENIE Collaboration For the full text of the license visit http://copyright.genie-mc.org

Definition at line 34 of file Decayer.h.

Constructor & Destructor Documentation

Decayer::~Decayer ( )
virtual

Definition at line 46 of file Decayer.cxx.

47 {
48 
49 }
Decayer::Decayer ( )
protected

Definition at line 28 of file Decayer.cxx.

28  :
30 {
31 
32 }
Decayer::Decayer ( string  name)
protected

Definition at line 34 of file Decayer.cxx.

34  :
36 {
37 
38 }
const char * name
Decayer::Decayer ( string  name,
string  config 
)
protected

Definition at line 40 of file Decayer.cxx.

40  :
42 {
43 
44 }
const char * name

Member Function Documentation

void Decayer::Configure ( const Registry config)
virtual

Configure the algorithm with an external registry The registry is merged with the top level registry if it is owned, Otherwise a copy of it is added with the highest priority

Reimplemented from genie::Algorithm.

Definition at line 119 of file Decayer.cxx.

References genie::Algorithm::Configure(), genie::Algorithm::fAllowReconfig, and LoadConfig().

120 {
121  Algorithm::Configure(config);
122  this->LoadConfig();
123 
124  fAllowReconfig = false;
125 }
virtual void Configure(const Registry &config)
Definition: Algorithm.cxx:62
virtual void LoadConfig(void)
Definition: Decayer.cxx:135
void Decayer::Configure ( string  config)
virtual

Configure the algorithm from the AlgoConfigPool based on param_set string given in input An algorithm contains a vector of registries coming from different xml configuration files, which are loaded according a very precise prioriy This methods will load a number registries in order of priority: 1) "Tunable" parameter set from CommonParametes. This is loaded with the highest prioriry and it is designed to be used for tuning procedure Usage not expected from the user. 2) For every string defined in "CommonParame" the corresponding parameter set will be loaded from CommonParameter.xml 3) parameter set specified by the config string and defined in the xml file of the algorithm 4) if config is not "Default" also the Default parameter set from the same xml file will be loaded Effectively this avoids the repetion of a parameter when it is not changed in the requested configuration

Reimplemented from genie::Algorithm.

Definition at line 127 of file Decayer.cxx.

References genie::Algorithm::Configure(), genie::Algorithm::fAllowReconfig, and LoadConfig().

128 {
129  Algorithm::Configure(config);
130  this->LoadConfig();
131 
132  fAllowReconfig = false;
133 }
virtual void Configure(const Registry &config)
Definition: Algorithm.cxx:62
virtual void LoadConfig(void)
Definition: Decayer.cxx:135
virtual void genie::Decayer::InhibitDecay ( int  pdgc,
TDecayChannel *  dc = 0 
) const
protectedpure virtual
virtual bool genie::Decayer::IsHandled ( int  pdgc) const
protectedpure virtual
bool Decayer::IsUnstable ( int  pdgc) const
protectedvirtual

Definition at line 87 of file Decayer.cxx.

References genie::PDGCodeList::ExistsInPDGCodeList(), fParticlesToDecay, fRunBefHadroTransp, and genie::utils::res::IsBaryonResonance().

Referenced by ToBeDecayed().

88 {
89  // ROOT's TParticlepdg::Lifetime() does not work properly
90  // do something else instead (temporarily)
91  //
92  // TParticlePDG * ppdg = PDGLibrary::Instance()->Find(pdg_code);
93  //if( ppdg->Lifetime() < fMaxLifetime ) { /* ... */ };
94  //
95 
96  // <temp/>
97  if( fRunBefHadroTransp ) {
98  //
99  // Run *before* the hadron transport MC
100  // At this point we decay only baryon resonances
101  //
102  bool decay = utils::res::IsBaryonResonance(pdg_code);
103  return decay;
104  }
105  else {
106  //
107  // Run *after* the hadron transport MC
108  // At this point we decay only particles in the fParticlesToDecay
109  // PDGCodeList (filled in from config inputs)
110  //
111  bool decay = fParticlesToDecay.ExistsInPDGCodeList(pdg_code);
112  return decay;
113  }
114  // </temp>
115 
116  return false;
117 }
bool ExistsInPDGCodeList(int pdg_code) const
bool fRunBefHadroTransp
is invoked before or after FSI?
Definition: Decayer.h:57
PDGCodeList fParticlesToDecay
list of particles to be decayed
Definition: Decayer.h:58
bool IsBaryonResonance(int pdgc)
is input a baryon resonance?
void Decayer::LoadConfig ( void  )
protectedvirtual

Reimplemented in genie::BaryonResonanceDecayer.

Definition at line 135 of file Decayer.cxx.

References fGenerateWeighted, genie::utils::str::FilterString(), genie::PDGLibrary::Find(), genie::Registry::FindKeys(), fParticlesNotToDecay, fParticlesToDecay, fRunBefHadroTransp, genie::Registry::GetBool(), genie::Algorithm::GetConfig(), genie::Algorithm::GetParam(), InhibitDecay(), genie::PDGLibrary::Instance(), LOG, pDEBUG, pFATAL, pINFO, pNOTICE, genie::PDGCodeList::push_back(), genie::utils::str::Split(), and UnInhibitDecay().

Referenced by Configure(), and genie::BaryonResonanceDecayer::LoadConfig().

136 {
137  // Get the specified maximum lifetime tmax (decay with lifetime < tmax)
138  //
139  //fMaxLifetime = fConfig->GetDoubleDef("MaxLifetime", 1e-9);
140 
141  // Check whether to generate weighted or unweighted particle decays
142  fGenerateWeighted = false ;
143  //this->GetParam("GenerateWeighted", fGenerateWeighted, false);
144 
145  // Check whether the module is being run before or after the hadron
146  // transport (intranuclear rescattering) module.
147  //
148  // If it is run before the hadron transport (and after the hadronization)
149  // step it should decay only "unstable" particles (marked as hadrons in
150  // the nucleus) which would typically decay within the time required to
151  // exit the nucleus - so, the algorithm wouldn't decay particles that
152  // have to be rescattered first. In case that the generated event is off
153  // a free nucleon target, thi instance of the algorithm should do nothing.
154  //
155  // If it is run after the hadon transport, then it should decay all the
156  // 'unstable' particles marked as 'present in the final state' and which
157  // should be decay before the event is passed to the detector particle
158  // transport MC.
159  //
160 
161  this->GetParam("RunBeforeHadronTransport", fRunBefHadroTransp) ;
162 
163  // Allow user to specify a list of particles to be decayed
164  //
165  RgKeyList klist = GetConfig().FindKeys("DecayParticleWithCode=");
166  RgKeyList::const_iterator kiter = klist.begin();
167  for( ; kiter != klist.end(); ++kiter) {
168  RgKey key = *kiter;
169  bool decay = GetConfig().GetBool(key);
170  vector<string> kv = utils::str::Split(key,"=");
171  assert(kv.size()==2);
172  int pdgc = atoi(kv[1].c_str());
173  TParticlePDG * p = PDGLibrary::Instance()->Find(pdgc);
174  if ( ! p ) {
175  LOG("Decay",pFATAL) << "No PDGLibrary entry for pdgc=" << pdgc
176  << " (" << kv[1].c_str()
177  << "), check CommonDecay.xml";
178  continue;
179  }
180  if(decay) {
181  LOG("Decay", pDEBUG)
182  << "Configured to decay " << p->GetName();
184  this->UnInhibitDecay(pdgc);
185  }
186  else {
187  LOG("Decay", pDEBUG)
188  << "Configured to inhibit decays for " << p->GetName();
190  this->InhibitDecay(pdgc);
191  }// decay?
192  }// key iterator
193 
194  // Allow user to inhibit certain decay channels
195  //
196  klist = GetConfig().FindKeys("InhibitDecay/");
197  kiter = klist.begin();
198  for( ; kiter != klist.end(); ++kiter) {
199  RgKey key = *kiter;
200  if(GetConfig().GetBool(key)) {
201  string filtkey = utils::str::FilterString("InhibitDecay/", key);
202  vector<string> kv = utils::str::Split(filtkey,",");
203  assert(kv.size()==2);
204  int pdgc = atoi(utils::str::FilterString("Particle=",kv[0]).c_str());
205  int dc = atoi(utils::str::FilterString("Channel=", kv[1]).c_str());
206  TParticlePDG * p = PDGLibrary::Instance()->Find(pdgc);
207  if(!p) continue;
208  LOG("Decay", pINFO)
209  << "Configured to inhibit " << p->GetName()
210  << "'s decay channel " << dc;
211  this->InhibitDecay(pdgc, p->DecayChannel(dc));
212  }//val[key]=true?
213  }//key iterator
214 
215 
216  sort(fParticlesToDecay.begin(), fParticlesToDecay.end());
217  sort(fParticlesNotToDecay.begin(), fParticlesNotToDecay.end());
218 
219  // Print-out for only one of the two instances of this module
220  if(!fRunBefHadroTransp) {
221  LOG("Decay", pNOTICE)
222  << "\nConfigured to decay: " << fParticlesToDecay
223  << "\nConfigured to inhibit decays of: " << fParticlesNotToDecay
224  << "\n";
225  }
226 }
#define pFATAL
Definition: Messenger.h:56
virtual void UnInhibitDecay(int pdgc, TDecayChannel *dc=0) const =0
virtual const Registry & GetConfig(void) const
Definition: Algorithm.cxx:246
RgKeyList FindKeys(RgKey key_part) const
create list with all keys containing &#39;key_part&#39;
Definition: Registry.cxx:840
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
bool fRunBefHadroTransp
is invoked before or after FSI?
Definition: Decayer.h:57
#define pINFO
Definition: Messenger.h:62
bool fGenerateWeighted
generate weighted or unweighted decays?
Definition: Decayer.h:56
PDGCodeList fParticlesNotToDecay
list of particles for which decay is inhibited
Definition: Decayer.h:59
vector< RgKey > RgKeyList
Definition: Registry.h:50
PDGCodeList fParticlesToDecay
list of particles to be decayed
Definition: Decayer.h:58
virtual void InhibitDecay(int pdgc, TDecayChannel *dc=0) const =0
string FilterString(string filt, string input)
Definition: StringUtils.cxx:79
static PDGLibrary * Instance(void)
Definition: PDGLibrary.cxx:68
vector< string > Split(string input, string delim)
Definition: StringUtils.cxx:36
string RgKey
RgBool GetBool(RgKey key) const
Definition: Registry.cxx:460
TParticlePDG * Find(int pdgc, bool must_exist=true)
Definition: PDGLibrary.cxx:86
#define pNOTICE
Definition: Messenger.h:61
bool GetParam(const RgKey &name, T &p, bool is_top_call=true) const
void push_back(int pdg_code)
Definition: PDGCodeList.cxx:58
#define pDEBUG
Definition: Messenger.h:63
bool Decayer::ToBeDecayed ( int  pdgc,
GHepStatus_t  ist 
) const
protectedvirtual

Definition at line 51 of file Decayer.cxx.

References fRunBefHadroTransp, IsUnstable(), genie::kIStHadronInTheNucleus, genie::kIStPreDecayResonantState, genie::kIStStableFinalState, LOG, and pDEBUG.

Referenced by genie::PythiaDecayer::ProcessEventRecord(), and genie::BaryonResonanceDecayer::ProcessEventRecord().

52 {
53  // Check whether it is "unstable" (definition can vary)
54 
55  bool is_unstable = this->IsUnstable(pdg_code);
56 
57  LOG("Decay", pDEBUG)
58  << "Particle is unstable? "
59  << ((is_unstable) ? "Yes" : "No");
60 
61  if(!is_unstable) return false;
62 
63  // Check whether the given unstable particle
64  // has the appropriate status code to be decayed
65 
66  bool to_be_decayed = false;
67 
68  if(fRunBefHadroTransp) {
69  to_be_decayed =
70  (status_code == kIStHadronInTheNucleus ||
71  status_code == kIStPreDecayResonantState ||
72  status_code == kIStStableFinalState);
73  }
74  else {
75  to_be_decayed =
76  (status_code == kIStStableFinalState);
77  }
78 
79  LOG("Decay", pDEBUG)
80  << "Particle to be decayed "
81  << "[" << ((fRunBefHadroTransp) ? "Before" : "After") << " FSI]? "
82  << ((to_be_decayed) ? "Yes" : "No");
83 
84  return to_be_decayed;
85 }
virtual bool IsUnstable(int pdgc) const
Definition: Decayer.cxx:87
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
bool fRunBefHadroTransp
is invoked before or after FSI?
Definition: Decayer.h:57
#define pDEBUG
Definition: Messenger.h:63
virtual void genie::Decayer::UnInhibitDecay ( int  pdgc,
TDecayChannel *  dc = 0 
) const
protectedpure virtual

Member Data Documentation

bool genie::Decayer::fGenerateWeighted
protected

generate weighted or unweighted decays?

Definition at line 56 of file Decayer.h.

Referenced by genie::BaryonResonanceDecayer::DecayExclusive(), and LoadConfig().

PDGCodeList genie::Decayer::fParticlesNotToDecay
protected

list of particles for which decay is inhibited

Definition at line 59 of file Decayer.h.

Referenced by LoadConfig().

PDGCodeList genie::Decayer::fParticlesToDecay
protected

list of particles to be decayed

Definition at line 58 of file Decayer.h.

Referenced by IsUnstable(), and LoadConfig().

bool genie::Decayer::fRunBefHadroTransp
protected

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