ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4ParticleHPProduct.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4ParticleHPProduct.hh
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 // P. Arce, June-2014 Conversion neutron_hp to particle_hp
28 //
29 #ifndef G4ParticleHPProduct_h
30 #define G4ParticleHPProduct_h 1
31 
32 #include "G4HadronicException.hh"
33 #include "globals.hh"
34 #include "G4ParticleHPVector.hh"
35 #include "Randomize.hh"
36 #include "G4ios.hh"
37 #include <fstream>
38 #include "globals.hh"
41 
44 #include "G4ParticleHPIsotropic.hh"
47 #include "G4Cache.hh"
49 
51 
53 {
54  struct toBeCached
55  {
61  };
62 
63 public:
64 
66  {
67  theDist = 0;
68  toBeCached val;
69  fCache.Put( val );
70 
71  char * method = std::getenv( "G4PHP_MULTIPLICITY_METHOD" );
72  if( method )
73  {
74  if( G4String(method) == "Poisson" ) {
76  } else if( G4String(method) == "BetweenInts" ) {
78  } else {
79  throw G4HadronicException(__FILE__, __LINE__, ("multiplicity method unknown to G4ParticleHPProduct" + G4String(method)).c_str());
80  }
81  }
82  else
83  {
85  }
86  theMassCode = 0.0;
87  theMass = 0.0;
88  theIsomerFlag = 0;
91  theDistLaw = -1;
92  }
93 
95  {
96  if(theDist != 0) delete theDist;
97  }
98 
99  inline void Init(std::istream & aDataFile, G4ParticleDefinition* projectile)
100  {
103  if( std::getenv("G4PHPTEST") )
104  G4cout << " G4ParticleHPProduct :: Init MassCode "
105  << theMassCode << " " << theMass << " theActualStateQValue "
106  << theActualStateQValue << G4endl;// GDEB
107  if( std::getenv("G4PHPTEST") )
108  G4cout << " G4ParticleHPProduct :: Init theActualStateQValue "
109  << theActualStateQValue << G4endl;// GDEB
111  theActualStateQValue*= CLHEP::eV;
112  theYield.Init(aDataFile, CLHEP::eV);
113  theYield.Hash();
114  if(theDistLaw==0)
115  {
116  // distribution not known, use E-independent, isotropic
117  // angular distribution
119  }
120  else if(theDistLaw == 1)
121  {
122  // Continuum energy-angular distribution
123  theDist = new G4ParticleHPContEnergyAngular(projectile);
124  }
125  else if(theDistLaw == 2)
126  {
127  // Discrete 2-body scattering
129  }
130  else if(theDistLaw == 3)
131  {
132  // Isotropic emission
134  }
135  else if(theDistLaw == 4)
136  {
137  // Discrete 2-body recoil modification
138  // not used for now. @@@@
140  // the above is only temporary;
141  // recoils need to be addressed
142  // properly
143  delete theDist;
144  theDist = 0;
145  }
146  // else if(theDistLaw == 5)
147  // {
148  // charged particles only, to be used in a later stage. @@@@
149  // }
150  else if(theDistLaw == 6)
151  {
152  // N-Body phase space
154  }
155  else if(theDistLaw == 7)
156  {
157  // Laboratory angular energy paraetrisation
159  }
160  else
161  {
162  throw G4HadronicException(__FILE__, __LINE__, "distribution law unknown to G4ParticleHPProduct");
163  }
164  if(theDist!=0)
165  {
166  theDist->SetQValue(theActualStateQValue);
167  theDist->Init(aDataFile);
168  }
169  }
170 
171  G4int GetMultiplicity(G4double anEnergy);
172  G4ReactionProductVector * Sample(G4double anEnergy, G4int nParticles);
173 
175  {
176  return theYield.GetY(anEnergy);
177  }
178 
179  void SetProjectileRP(G4ReactionProduct * aIncidentPart)
180  {
181  fCache.Get().theProjectileRP = aIncidentPart;
182  }
183 
184  void SetTarget(G4ReactionProduct * aTarget)
185  {
186  fCache.Get().theTarget = aTarget;
187  }
188 
190  {
191  return fCache.Get().theTarget;
192  }
193 
195  {
196  return fCache.Get().theProjectileRP;
197  }
198 
200  {
201  G4double result;
202  if(theDist == 0)
203  {
204  result = 0;
205  }
206  else
207  {
209  result *= fCache.Get().theCurrentMultiplicity;
210  }
211  return result;
212  }
213 
215  {
216  return theActualStateQValue;
217  }
218 
219  //TK120515 For migration of frameFlag (MF6 LCT) = 3 in
220  //G4ParticleHPEnAngCorrelation
223 
224 private:
225 
226  // data members
227 
233  G4int theDistLaw; // redundant
236 
237  // cashed values
238  //
240 
242 };
243 
244 #endif