GENIEGenerator
Loading...
Searching...
No Matches
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:
[legend]
Collaboration diagram for genie::HadronTransporter:
[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.
virtual AlgStatus_t GetStatus (void) const
 Get algorithm status.
virtual bool AllowReconfig (void) const
virtual AlgCmp_t Compare (const Algorithm *alg) const
 Compare with input algorithm.
virtual void SetId (const AlgId &id)
 Set algorithm ID.
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.

Private Member Functions

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

Private Attributes

bool fEnabled
 hadron transport enabled?
const EventRecordVisitorIfHadTranspModel
 hadron transport MC to use
const EventRecordVisitorIfCascadeReweight
 Cascade reweight member.

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.
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.
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.
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
int AddLowRegistry (Registry *rp, bool owns=true)
 add registry with lowest priority, also update ownership
int MergeTopRegistry (const Registry &r)
int AddTopRegisties (const vector< Registry * > &rs, bool owns=false)
 Add registries with top priority, also udated Ownerships.
Protected Attributes inherited from genie::Algorithm
bool fAllowReconfig
bool fOwnsSubstruc
 true if it owns its substructure (sub-algs,...)
AlgId fID
 algorithm name and configuration set
vector< Registry * > fConfVect
vector< bool > fOwnerships
 ownership for every registry in fConfVect
AlgStatus_t fStatus
 algorithm execution status
AlgMapfOwnedSubAlgMp
 local pool for owned sub-algs (taken out of the factory pool)

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 \at cern.ch> STFC, Rutherford Lab
Created:\n September 14, 2006
License:\n Copyright (c) 2003-2025, 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() [1/2]

HadronTransporter::HadronTransporter ( )

Definition at line 43 of file HadronTransporter.cxx.

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

References genie::EventRecordVisitorI::EventRecordVisitorI().

◆ HadronTransporter() [2/2]

HadronTransporter::HadronTransporter ( string config)

Definition at line 49 of file HadronTransporter.cxx.

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

References genie::EventRecordVisitorI::EventRecordVisitorI().

◆ ~HadronTransporter()

HadronTransporter::~HadronTransporter ( )

Definition at line 55 of file HadronTransporter.cxx.

56{
57
58}

Member Function Documentation

◆ Configure() [1/2]

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.

128{
129 Algorithm::Configure(config);
130 this->LoadConfig();
131}
virtual void Configure(const Registry &config)
Definition Algorithm.cxx:62

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

◆ Configure() [2/2]

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.

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}
static AlgConfigPool * Instance()
bool Exists(RgKey key) const
item with input key exists?
Definition Registry.cxx:563
bool GetBool(xmlDocPtr xml_doc, string node_path)

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

◆ LoadConfig()

void HadronTransporter::LoadConfig ( void )
private

Definition at line 151 of file HadronTransporter.cxx.

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
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}
#define pERROR
Definition Messenger.h:59
#define pDEBUG
Definition Messenger.h:63
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE,...
Definition Messenger.h:96
virtual const Registry & GetConfig(void) const
bool GetParam(const RgKey &name, T &p, bool is_top_call=true) const
const Algorithm * SubAlg(const RgKey &registry_key) const
virtual const AlgId & Id(void) const
Get algorithm ID.
Definition Algorithm.h:98
const EventRecordVisitorI * fCascadeReweight
Cascade reweight member.
bool fEnabled
hadron transport enabled?
const EventRecordVisitorI * fHadTranspModel
hadron transport MC to use

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

Referenced by Configure(), and Configure().

◆ ProcessEventRecord()

void HadronTransporter::ProcessEventRecord ( GHepRecord * event_rec) const
virtual

Implements genie::EventRecordVisitorI.

Definition at line 60 of file HadronTransporter.cxx.

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";
82 fHadTranspModel->ProcessEventRecord(evrec);
83
84 // Process Event record for the cascade reweight if required:
85 if(fCascadeReweight) fCascadeReweight->ProcessEventRecord(evrec);
86
87 return ;
88}
#define pNOTICE
Definition Messenger.h:61
#define pINFO
Definition Messenger.h:62
void TransportInTransparentNuc(GHepRecord *ev) const

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

◆ TransportInTransparentNuc()

void HadronTransporter::TransportInTransparentNuc ( GHepRecord * ev) const
private

Definition at line 90 of file HadronTransporter.cxx.

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}
string Name(void) const
Name that corresponds to the PDG code.
void SetFirstMother(int m)
void SetStatus(GHepStatus_t s)
GHepStatus_t Status(void) const
@ kIStHadronInTheNucleus
Definition GHepStatus.h:37
@ kIStStableFinalState
Definition GHepStatus.h:30

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().

Member Data Documentation

◆ fCascadeReweight

const EventRecordVisitorI* genie::HadronTransporter::fCascadeReweight
private

Cascade reweight member.

Definition at line 49 of file HadronTransporter.h.

Referenced by LoadConfig(), and ProcessEventRecord().

◆ fEnabled

bool genie::HadronTransporter::fEnabled
private

hadron transport enabled?

Definition at line 47 of file HadronTransporter.h.

Referenced by LoadConfig(), and ProcessEventRecord().

◆ fHadTranspModel

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: