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

Intranuclear hadronic transport module. It is being used to transfer all hadrons outside the nucleus without rescattering -if rescattering is switched off- or to call one of the supported hadron transport MCs -if rescattering is switched on-. More...

#include <HadronTransporter.h>

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

Public Member Functions

 HadronTransporter ()
 
 HadronTransporter (string config)
 
 ~HadronTransporter ()
 
void ProcessEventRecord (GHepRecord *event_rec) const
 
void Configure (const Registry &config)
 
void Configure (string param_set)
 
- Public Member Functions inherited from genie::EventRecordVisitorI
virtual ~EventRecordVisitorI ()
 
- 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...
 

Private Member Functions

void LoadConfig (void)
 
void TransportInTransparentNuc (GHepRecord *ev) const
 

Private Attributes

bool fEnabled
 hadron transport enabled? More...
 
const EventRecordVisitorIfHadTranspModel
 hadron transport MC to use More...
 
const EventRecordVisitorIfCascadeReweight
 Cascade reweight member. 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)
 
- 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 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...
 

Detailed Description

Intranuclear hadronic transport module. It is being used to transfer all hadrons outside the nucleus without rescattering -if rescattering is switched off- or to call one of the supported hadron transport MCs -if rescattering is switched on-.

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

Definition at line 28 of file HadronTransporter.h.

Constructor & Destructor Documentation

HadronTransporter::HadronTransporter ( )

Definition at line 43 of file HadronTransporter.cxx.

43  :
44 EventRecordVisitorI("genie::HadronTransporter")
45 {
46 
47 }
HadronTransporter::HadronTransporter ( string  config)

Definition at line 49 of file HadronTransporter.cxx.

49  :
50 EventRecordVisitorI("genie::HadronTransporter", config)
51 {
52 
53 }
HadronTransporter::~HadronTransporter ( )

Definition at line 55 of file HadronTransporter.cxx.

56 {
57 
58 }

Member Function Documentation

void HadronTransporter::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 127 of file HadronTransporter.cxx.

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

128 {
129  Algorithm::Configure(config);
130  this->LoadConfig();
131 }
virtual void Configure(const Registry &config)
Definition: Algorithm.cxx:62
void HadronTransporter::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 133 of file HadronTransporter.cxx.

References genie::Algorithm::Configure(), genie::Registry::Exists(), genie::utils::xml::GetBool(), genie::AlgConfigPool::Instance(), LoadConfig(), and genie::Registry::Set().

134 {
135  Algorithm::Configure(param_set);
136 
137  Registry * algos = AlgConfigPool::Instance() -> GlobalParameterList() ;
138  Registry r( "HadronTransporter_specific", false ) ;
139 
140  r.Set("HadronTransp-Enable", algos -> GetBool("HadronTransp-Enable") ) ;
141  r.Set("HadronTransp-Model", algos -> GetAlg("HadronTransp-Model") ) ;
142  if( algos->Exists("CascadeReweightAlg") ) {
143  r.Set("CascadeReweightAlg", algos -> GetAlg("CascadeReweightAlg") ) ;
144  }
145 
147 
148  this->LoadConfig();
149 }
virtual void Configure(const Registry &config)
Definition: Algorithm.cxx:62
A registry. Provides the container for algorithm configuration parameters.
Definition: Registry.h:65
bool Exists(RgKey key) const
item with input key exists?
Definition: Registry.cxx:563
bool GetBool(xmlDocPtr xml_doc, string node_path)
static AlgConfigPool * Instance()
void HadronTransporter::LoadConfig ( void  )
private

Definition at line 151 of file HadronTransporter.cxx.

References fCascadeReweight, fEnabled, fHadTranspModel, genie::Algorithm::GetConfig(), genie::Algorithm::GetParam(), genie::Algorithm::Id(), LOG, pDEBUG, pERROR, and genie::Algorithm::SubAlg().

Referenced by Configure().

152 {
153  bool good_config = true ;
154 
155  fHadTranspModel = 0;
156  GetParam("HadronTransp-Enable", fEnabled ) ;
157 
158  LOG("HadTransp", pDEBUG)
159  << "Hadron transport was " << ((fEnabled) ? "" : "not ") << " enabled";
160  if(fEnabled) {
161  RgAlg hadtransp_model ;
162  GetParam( "HadronTransp-Model", hadtransp_model ) ;
163  LOG("HadTransp", pDEBUG)
164  << "Loading the hadron transport model: " << hadtransp_model;
165 
166  fHadTranspModel =
167  dynamic_cast<const EventRecordVisitorI *> ( this -> SubAlg("HadronTransp-Model") );
168 
169  if(!fHadTranspModel){
170  good_config = false ;
171  LOG("HadronTransporter", pERROR) << "The SubAlg HadronTransp-Model is not a XSecAlgorithmI";
172  }
173 
174  // Read optional CascadeReweight EventRecordVisitorI
175  fCascadeReweight = nullptr;
176  if( GetConfig().Exists("CascadeReweightAlg") ) {
177  fCascadeReweight = dynamic_cast<const CascadeReweight *> ( this->SubAlg("CascadeReweightAlg") );
178  if( !fCascadeReweight ) {
179  good_config = false ;
180  LOG("HadronTransporter", pERROR) << "The required CascadeReweightAlg does not exist. AlgID is : " << SubAlg("CascadeReweightAlg")->Id() ;
181  }
182  }
183 
184  if( ! good_config ) {
185  LOG("HadronTransporter", pERROR) << "Configuration has failed.";
186  exit(78) ;
187  }
188  }
189 }
bool fEnabled
hadron transport enabled?
#define pERROR
Definition: Messenger.h:59
Defines the EventRecordVisitorI interface. Concrete implementations of this interface use the &#39;Visito...
virtual const Registry & GetConfig(void) const
Definition: Algorithm.cxx:246
const EventRecordVisitorI * fHadTranspModel
hadron transport MC to use
const EventRecordVisitorI * fCascadeReweight
Cascade reweight member.
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
virtual const AlgId & Id(void) const
Get algorithm ID.
Definition: Algorithm.h:98
In this module, the event weight is set depending on the FSI fate. The weights are set depending on t...
bool GetParam(const RgKey &name, T &p, bool is_top_call=true) const
#define pDEBUG
Definition: Messenger.h:63
const Algorithm * SubAlg(const RgKey &registry_key) const
Definition: Algorithm.cxx:345
void HadronTransporter::ProcessEventRecord ( GHepRecord event_rec) const
virtual

Implements genie::EventRecordVisitorI.

Definition at line 60 of file HadronTransporter.cxx.

References fCascadeReweight, fEnabled, fHadTranspModel, LOG, pINFO, pNOTICE, genie::EventRecordVisitorI::ProcessEventRecord(), return, genie::GHepRecord::TargetNucleus(), and TransportInTransparentNuc().

61 {
62  // Return if the neutrino was not scatterred off a nuclear target
63  GHepParticle * nucltgt = evrec->TargetNucleus();
64  if (!nucltgt) {
65  LOG("HadTransp", pINFO)
66  << "No nuclear target found - Hadron transporter exits";
67  return;
68  }
69 
70  // If rescattering is turned off but the interaction was on a nuclear
71  // target then simply transfer the hadrons outside the nucleus inhibiting
72  // any rescattering
73  if(!fEnabled) {
74  LOG("HadTransp", pNOTICE)
75  << "*** Intranuclear rescattering has been turned off";
76  this->TransportInTransparentNuc(evrec);
77  return;
78  }
79 
80  // Use the specified intrsnuclear rescattering model
81  LOG("HadTransp", pINFO) << "Calling the selected hadron transport MC";
83 
84  // Process Event record for the cascade reweight if required:
86 
87  return ;
88 }
bool fEnabled
hadron transport enabled?
void TransportInTransparentNuc(GHepRecord *ev) const
const EventRecordVisitorI * fHadTranspModel
hadron transport MC to use
const EventRecordVisitorI * fCascadeReweight
Cascade reweight member.
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
virtual void ProcessEventRecord(GHepRecord *event_rec) const =0
#define pINFO
Definition: Messenger.h:62
#define pNOTICE
Definition: Messenger.h:61
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:39
void HadronTransporter::TransportInTransparentNuc ( GHepRecord ev) const
private

Definition at line 90 of file HadronTransporter.cxx.

References genie::GHepRecord::AddParticle(), genie::kIStHadronInTheNucleus, genie::kIStStableFinalState, LOG, genie::GHepParticle::Name(), pINFO, pNOTICE, genie::GHepParticle::SetFirstMother(), genie::GHepParticle::SetStatus(), and genie::GHepParticle::Status().

Referenced by ProcessEventRecord().

91 {
92 // Transport all hadrons assuming a transparent nucleus - used when the
93 // realistic hadron transport is tuned off.
94 
95  LOG("HadTransp", pNOTICE)
96  << "Getting the nucleons out of the nucleus as if it was transparent";
97 
98  TObjArrayIter piter(evrec);
99  GHepParticle * p = 0;
100  int icurr=-1;
101 
102  while( (p = (GHepParticle *) piter.Next()) )
103  {
104  icurr++;
105  assert(p);
106 
107  // Check whether the particle needs rescattering, otherwise skip it
108 
109  bool had_in_nuc = (p->Status() == kIStHadronInTheNucleus);
110  if(!had_in_nuc) continue;
111 
112  LOG("HadTransp", pINFO)
113  << "Transporting " << p->Name() << " out of the nuclear target";
114 
115  // move it outside the nucleus
116  GHepParticle * cp = new GHepParticle(*p); // create a clone
117 
118  cp->SetFirstMother(icurr); // clone's mother
119  cp->SetStatus(kIStStableFinalState); // mark it & done with it
120 
121  evrec->AddParticle(*cp); // add it at the event record
122 
123  //LOG("HadronTransporter", pDEBUG) << *evrec;
124  }
125 }
void SetFirstMother(int m)
Definition: GHepParticle.h:132
GHepStatus_t Status(void) const
Definition: GHepParticle.h:64
string Name(void) const
Name that corresponds to the PDG code.
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
#define pINFO
Definition: Messenger.h:62
void SetStatus(GHepStatus_t s)
Definition: GHepParticle.h:126
#define pNOTICE
Definition: Messenger.h:61
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:39

Member Data Documentation

const EventRecordVisitorI* genie::HadronTransporter::fCascadeReweight
private

Cascade reweight member.

Definition at line 49 of file HadronTransporter.h.

Referenced by LoadConfig(), and ProcessEventRecord().

bool genie::HadronTransporter::fEnabled
private

hadron transport enabled?

Definition at line 47 of file HadronTransporter.h.

Referenced by LoadConfig(), and ProcessEventRecord().

const EventRecordVisitorI* genie::HadronTransporter::fHadTranspModel
private

hadron transport MC to use

Definition at line 48 of file HadronTransporter.h.

Referenced by LoadConfig(), and ProcessEventRecord().


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