HadronTransporter.cxx
Go to the documentation of this file.
1 //____________________________________________________________________________
2 /*
3  Copyright (c) 2003-2019, The GENIE Collaboration
4  For the full text of the license visit http://copyright.genie-mc.org
5  or see $GENIE/LICENSE
6 
7  Author: Costas Andreopoulos <costas.andreopoulos \at stfc.ac.uk>
8  University of Liverpool & STFC Rutherford Appleton Lab
9 
10  For the class documentation see the corresponding header file.
11 
12  Important revisions after version 2.0.0 :
13  @ Sep 15, 2009 - CA
14  IsFake() is no longer available in GHepParticle.Use pdg::IsPseudoParticle()
15  @ Nov 17, 2011 - CA
16  Removed unused GenerateVertex() method. This is handled by another module.
17 
18 */
19 //____________________________________________________________________________
20 
21 #include <cstdlib>
22 
36 
37 using namespace genie;
38 using namespace genie::utils;
39 using namespace genie::constants;
40 
41 //___________________________________________________________________________
43 EventRecordVisitorI("genie::HadronTransporter")
44 {
45 
46 }
47 //___________________________________________________________________________
49 EventRecordVisitorI("genie::HadronTransporter", config)
50 {
51 
52 }
53 //___________________________________________________________________________
55 {
56 
57 }
58 //___________________________________________________________________________
60 {
61  // Return if the neutrino was not scatterred off a nuclear target
62  GHepParticle * nucltgt = evrec->TargetNucleus();
63  if (!nucltgt) {
64  LOG("HadTransp", pINFO)
65  << "No nuclear target found - Hadron transporter exits";
66  return;
67  }
68 
69  // If rescattering is turned off but the interaction was on a nuclear
70  // target then simply transfer the hadrons outside the nucleus inhibiting
71  // any rescattering
72  if(!fEnabled) {
73  LOG("HadTransp", pNOTICE)
74  << "*** Intranuclear rescattering has been turned off";
75  this->TransportInTransparentNuc(evrec);
76  return;
77  }
78 
79  // Use the specified intrsnuclear rescattering model
80  LOG("HadTransp", pINFO) << "Calling the selected hadron transport MC";
82 }
83 //___________________________________________________________________________
85 {
86 // Transport all hadrons assuming a transparent nucleus - used when the
87 // realistic hadron transport is tuned off.
88 
89  LOG("HadTransp", pNOTICE)
90  << "Getting the nucleons out of the nucleus as if it was transparent";
91 
92  TObjArrayIter piter(evrec);
93  GHepParticle * p = 0;
94  int icurr=-1;
95 
96  while( (p = (GHepParticle *) piter.Next()) )
97  {
98  icurr++;
99  assert(p);
100 
101  // Check whether the particle needs rescattering, otherwise skip it
102 
103  bool had_in_nuc = (p->Status() == kIStHadronInTheNucleus);
104  if(!had_in_nuc) continue;
105 
106  LOG("HadTransp", pINFO)
107  << "Transporting " << p->Name() << " out of the nuclear target";
108 
109  // move it outside the nucleus
110  GHepParticle * cp = new GHepParticle(*p); // create a clone
111 
112  cp->SetFirstMother(icurr); // clone's mother
113  cp->SetStatus(kIStStableFinalState); // mark it & done with it
114 
115  evrec->AddParticle(*cp); // add it at the event record
116 
117  //LOG("HadronTransporter", pDEBUG) << *evrec;
118  }
119 }
120 //___________________________________________________________________________
122 {
123  Algorithm::Configure(config);
124  this->LoadConfig();
125 }
126 //___________________________________________________________________________
127 void HadronTransporter::Configure(string param_set)
128 {
129  Algorithm::Configure(param_set);
130 
131  Registry * algos = AlgConfigPool::Instance() -> GlobalParameterList() ;
132  Registry r( "HadronTransporter_specific", false ) ;
133 
134  r.Set("HadronTransp-Enable", algos -> GetBool("HadronTransp-Enable") ) ;
135  r.Set("HadronTransp-Model", algos -> GetAlg("HadronTransp-Model") ) ;
136 
138 
139  this->LoadConfig();
140 }
141 //___________________________________________________________________________
143 {
144  fHadTranspModel = 0;
145  GetParam("HadronTransp-Enable", fEnabled ) ;
146 
147  LOG("HadTransp", pDEBUG)
148  << "Hadron transport was " << ((fEnabled) ? "" : "not ") << " enabled";
149  if(fEnabled) {
150  RgAlg hadtransp_model ;
151  GetParam( "HadronTransp-Model", hadtransp_model ) ;
152  LOG("HadTransp", pDEBUG)
153  << "Loading the hadron transport model: " << hadtransp_model;
154 
155  fHadTranspModel =
156  dynamic_cast<const EventRecordVisitorI *> ( this -> SubAlg("HadronTransp-Model") );
158  }
159 }
160 //___________________________________________________________________________
161 
162 
void SetFirstMother(int m)
Definition: GHepParticle.h:133
Basic constants.
void ProcessEventRecord(GHepRecord *event_rec) const
bool fEnabled
hadron transport enabled?
THE MAIN GENIE PROJECT NAMESPACE
Definition: GeneratorBase.h:8
virtual void ProcessEventRecord(GHepRecord *event_rec) const =0
void TransportInTransparentNuc(GHepRecord *ev) const
Defines the EventRecordVisitorI interface. Concrete implementations of this interface use the &#39;Visito...
const char * p
Definition: xmltok.h:285
Definition: config.py:1
GHepStatus_t Status(void) const
Definition: GHepParticle.h:65
const EventRecordVisitorI * fHadTranspModel
hadron transport MC to use
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:97
virtual void Configure(const Registry &config)
Definition: Algorithm.cxx:70
virtual GHepParticle * TargetNucleus(void) const
Definition: GHepRecord.cxx:330
#define pINFO
Definition: Messenger.h:63
void Configure(const Registry &config)
void SetStatus(GHepStatus_t s)
Definition: GHepParticle.h:127
A registry. Provides the container for algorithm configuration parameters.
Definition: Registry.h:66
assert(nhit_max >=nhit_nbins)
TRandom3 r(0)
virtual void AddParticle(const GHepParticle &p)
Definition: GHepRecord.cxx:535
#define pNOTICE
Definition: Messenger.h:62
bool GetParam(const RgKey &name, T &p, bool is_top_call=true) const
bool GetBool(xmlDocPtr xml_doc, string node_path)
void Set(RgIMapPair entry)
Definition: Registry.cxx:282
GENIE&#39;s GHEP MC event record.
Definition: GHepRecord.h:46
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:40
Root of GENIE utility namespaces.
static AlgConfigPool * Instance()
#define pDEBUG
Definition: Messenger.h:64
const Algorithm * SubAlg(const RgKey &registry_key) const
Definition: Algorithm.cxx:353