Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4ParticleHPProduct Class Reference

#include <G4ParticleHPProduct.hh>

Public Member Functions

 G4ParticleHPProduct ()
 
 ~G4ParticleHPProduct ()
 
void Init (std::istream &aDataFile, G4ParticleDefinition *projectile)
 
G4int GetMultiplicity (G4double anEnergy)
 
G4ReactionProductVectorSample (G4double anEnergy, G4int nParticles)
 
G4double GetMeanYield (G4double anEnergy)
 
void SetProjectileRP (G4ReactionProduct *aIncidentPart)
 
void SetTarget (G4ReactionProduct *aTarget)
 
G4ReactionProductGetTarget ()
 
G4ReactionProductGetProjectileRP ()
 
G4double MeanEnergyOfThisInteraction ()
 
G4double GetQValue ()
 
G4double GetMassCode ()
 
G4double GetMass ()
 

Detailed Description

Definition at line 52 of file G4ParticleHPProduct.hh.

Constructor & Destructor Documentation

G4ParticleHPProduct::G4ParticleHPProduct ( )
inline

Definition at line 63 of file G4ParticleHPProduct.hh.

64  {
65  theDist = 0;
66  toBeCached val;
67  fCache.Put( val );
68 
69  char * method = getenv( "G4PHP_MULTIPLICITY_METHOD" );
70  if( method ) {
71  if( G4String(method) == "Poisson" ) {
72  theMultiplicityMethod = G4HPMultiPoisson;
73  } else if( G4String(method) == "BetweenInts" ) {
74  theMultiplicityMethod = G4HPMultiBetweenInts;
75  } else {
76  throw G4HadronicException(__FILE__, __LINE__, ("multiplicity method unknown to G4ParticleHPProduct" + G4String(method)).c_str());
77  }
78  } else {
79  theMultiplicityMethod = G4HPMultiPoisson;
80  }
81  theMassCode = 0.0;
82  theMass = 0.0;
83  theIsomerFlag = 0;
84  theGroundStateQValue = 0.0;
85  theActualStateQValue = 0.0;
86  theDistLaw = -1;
87  }
void Put(const value_type &val) const
Definition: G4Cache.hh:286

Here is the call graph for this function:

G4ParticleHPProduct::~G4ParticleHPProduct ( )
inline

Definition at line 88 of file G4ParticleHPProduct.hh.

89  {
90  if(theDist != 0) delete theDist;
91  }

Member Function Documentation

G4double G4ParticleHPProduct::GetMass ( )
inline

Definition at line 201 of file G4ParticleHPProduct.hh.

201 {return theMass;};
G4double G4ParticleHPProduct::GetMassCode ( )
inline

Definition at line 200 of file G4ParticleHPProduct.hh.

200 {return theMassCode;};
G4double G4ParticleHPProduct::GetMeanYield ( G4double  anEnergy)
inline

Definition at line 162 of file G4ParticleHPProduct.hh.

163  {
164  return theYield.GetY(anEnergy);
165  }
G4double GetY(G4double x)

Here is the call graph for this function:

G4int G4ParticleHPProduct::GetMultiplicity ( G4double  anEnergy)

Definition at line 44 of file G4ParticleHPProduct.cc.

45 {
46  //if(theDist == 0) { return 0; }
47  //151120 TK Modified for solving reproducibility problem
48  if ( theDist == 0 ) {
49  fCache.Get().theCurrentMultiplicity = 0;
50  return 0;
51  }
52 
53  G4double mean = theYield.GetY(anEnergy);
54  //g G4cout << "G4ParticleHPProduct MEAN NUMBER OF PARTICLES " << mean << " for " << theMass << G4endl;
55  //if( mean <= 0. ) return 0;
56  //151120 TK Modified for solving reproducibility problem
57  //This is also a real fix
58  if ( mean <= 0. ) {
59  fCache.Get().theCurrentMultiplicity = 0;
60  return 0;
61  }
62 
63  G4int multi;
64  multi = G4int(mean+0.0001);
65  //if(theMassCode==0) multi = G4Poisson(mean); // @@@@gammas. please X-check this
66  //080718
67 #ifdef PHP_AS_HP
68  if ( theMassCode == 0 ) // DELETE THIS: IT MUST BE DONE FOR ALL PARTICLES
69 #endif
70  {
71  if ( G4int ( mean ) == mean )
72  {
73  multi = (G4int) mean;
74  }
75  else
76  {
77 #ifdef PHP_AS_HP
78  multi = G4Poisson ( mean );
79 #else
80  if( theMultiplicityMethod == G4HPMultiPoisson ) {
81  multi = G4Poisson ( mean );
82  if( getenv("G4PHPTEST") ) G4cout << " MULTIPLICITY MULTIPLIED " << multi << " " << theMassCode << G4endl;
83  } else { // if( theMultiplicityMethod == G4HPMultiBetweenInts ) {
85  G4int imulti = G4int(mean);
86  multi = imulti + G4int(radnf < mean-imulti);
87  // G4cout << theMass << " multi " << multi << " mean " << mean
88  // << " radnf " << radnf << " mean-imulti " << mean-imulti << G4endl;
89  }
90 #endif
91  // multi = int(mean);
92  // if( CLHEP::RandFlat::shoot() > mean-multi ) multi++;
93  }
94 #ifdef G4PHPDEBUG
95  if( getenv("G4ParticleHPDebug") ) G4cout << "G4ParticleHPProduct::GetMultiplicity " << theMassCode << " " << theMass << " multi " << multi << " mean " << mean << G4endl;
96 #endif
97  }
98 
99  fCache.Get().theCurrentMultiplicity = static_cast<G4int>(mean);
100 
101  return multi;
102 }
G4long G4Poisson(G4double mean)
Definition: G4Poisson.hh:51
value_type & Get() const
Definition: G4Cache.hh:282
int G4int
Definition: G4Types.hh:78
static double shoot()
Definition: RandFlat.cc:59
G4GLOB_DLL std::ostream G4cout
G4double GetY(G4double x)
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

Here is the caller graph for this function:

G4ReactionProduct* G4ParticleHPProduct::GetProjectileRP ( )
inline

Definition at line 179 of file G4ParticleHPProduct.hh.

179 { return fCache.Get().theProjectileRP; }
value_type & Get() const
Definition: G4Cache.hh:282

Here is the call graph for this function:

G4double G4ParticleHPProduct::GetQValue ( )
inline

Definition at line 196 of file G4ParticleHPProduct.hh.

196 { return theActualStateQValue; }

Here is the caller graph for this function:

G4ReactionProduct* G4ParticleHPProduct::GetTarget ( void  )
inline

Definition at line 177 of file G4ParticleHPProduct.hh.

177 { return fCache.Get().theTarget; }
value_type & Get() const
Definition: G4Cache.hh:282

Here is the call graph for this function:

void G4ParticleHPProduct::Init ( std::istream &  aDataFile,
G4ParticleDefinition projectile 
)
inline

Definition at line 93 of file G4ParticleHPProduct.hh.

94  {
95  aDataFile >> theMassCode>>theMass>>theIsomerFlag>>theDistLaw
96  >> theGroundStateQValue>>theActualStateQValue;
97  if( getenv("G4PHPTEST") ) G4cout << " G4ParticleHPProduct :: Init MassCode " << theMassCode << " " << theMass << " theActualStateQValue " << theActualStateQValue << G4endl;// GDEB
98  if( getenv("G4PHPTEST") ) G4cout << " G4ParticleHPProduct :: Init theActualStateQValue " << theActualStateQValue << G4endl;// GDEB
99  theGroundStateQValue*= CLHEP::eV;
100  theActualStateQValue*= CLHEP::eV;
101  theYield.Init(aDataFile, CLHEP::eV);
102  theYield.Hash();
103  if(theDistLaw==0)
104  {
105  // distribution not known, use E-independent, isotropic angular distribution
106  theDist = new G4ParticleHPIsotropic;
107  }
108  else if(theDistLaw == 1)
109  {
110  // Continuum energy-angular distribution
111  theDist = new G4ParticleHPContEnergyAngular(projectile);
112  }
113  else if(theDistLaw == 2)
114  {
115  // Discrete 2-body scattering
116  theDist = new G4ParticleHPDiscreteTwoBody;
117  }
118  else if(theDistLaw == 3)
119  {
120  // Isotropic emission
121  theDist = new G4ParticleHPIsotropic;
122  }
123  else if(theDistLaw == 4)
124  {
125  // Discrete 2-body recoil modification
126  // not used for now. @@@@
127  theDist = new G4ParticleHPDiscreteTwoBody;
128  // the above is only temporary;
129  // recoils need to be addressed
130  // properly
131  delete theDist;
132  theDist = 0;
133  }
134  // else if(theDistLaw == 5)
135  // {
136  // charged particles only, to be used in a later stage. @@@@
137  // }
138  else if(theDistLaw == 6)
139  {
140  // N-Body phase space
141  theDist = new G4ParticleHPNBodyPhaseSpace;
142  }
143  else if(theDistLaw == 7)
144  {
145  // Laboratory angular energy paraetrisation
146  theDist = new G4ParticleHPLabAngularEnergy;
147  }
148  else
149  {
150  throw G4HadronicException(__FILE__, __LINE__, "distribution law unknown to G4ParticleHPProduct");
151  }
152  if(theDist!=0)
153  {
154  theDist->SetQValue(theActualStateQValue);
155  theDist->Init(aDataFile);
156  }
157  }
virtual void Init(std::istream &aDataFile)=0
void Init(std::istream &aDataFile, G4int total, G4double ux=1., G4double uy=1.)
G4GLOB_DLL std::ostream G4cout
static constexpr double eV
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

Here is the caller graph for this function:

G4double G4ParticleHPProduct::MeanEnergyOfThisInteraction ( )
inline

Definition at line 181 of file G4ParticleHPProduct.hh.

182  {
184  if(theDist == 0)
185  {
186  result = 0;
187  }
188  else
189  {
190  result=theDist->MeanEnergyOfThisInteraction();
191  result *= fCache.Get().theCurrentMultiplicity;
192  }
193  return result;
194  }
G4double G4ParticleHPJENDLHEData::G4double result
value_type & Get() const
Definition: G4Cache.hh:282
virtual G4double MeanEnergyOfThisInteraction()=0
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

Here is the caller graph for this function:

G4ReactionProductVector * G4ParticleHPProduct::Sample ( G4double  anEnergy,
G4int  nParticles 
)

Definition at line 105 of file G4ParticleHPProduct.cc.

106 {
107  if(theDist == 0) { return 0; }
109 
110  theDist->SetTarget(fCache.Get().theTarget);
111  theDist->SetProjectileRP(fCache.Get().theProjectileRP);
112  G4int i;
113 // G4double eMax = GetTarget()->GetMass()+GetNeutron()->GetMass()
114 // - theActualStateQValue;
115  G4ReactionProduct * tmp;
116  theDist->ClearHistories();
117 
118  for(i=0;i<multi;i++)
119  {
120 #ifdef G4PHPDEBUG
121  if( getenv("G4PHPTEST") )
122  if( getenv("G4ParticleHPDebug") && tmp != 0 ) G4cout << multi << " " << i << " @@@ G4ParticleHPProduct::Sample " << anEnergy << " Mass " << theMassCode << " " << theMass << G4endl;
123 #endif
124  tmp = theDist->Sample(anEnergy, theMassCode, theMass);
125  if(tmp != 0) { result->push_back(tmp); }
126 #ifndef G4PHPDEBUG //GDEB
127  if( getenv("G4ParticleHPDebug") && tmp != 0 ) G4cout << multi << " " << i << " @@@ G4ParticleHPProduct::Sample " << tmp->GetDefinition()->GetParticleName() << " E= " << tmp->GetKineticEnergy() << G4endl;
128 #endif
129  }
130  if(multi == 0)
131  {
132  tmp = theDist->Sample(anEnergy, theMassCode, theMass);
133  delete tmp;
134  }
135  /*
136  //080901 TK Comment out, too many secondaries are produced in deuteron reactions
137  if(theTarget->GetMass()<2*GeV) // @@@ take care of residuals in all cases
138  {
139  tmp = theDist->Sample(anEnergy, theMassCode, theMass);
140  tmp->SetDefinition(G4Proton::Proton());
141  if(tmp != 0) { result->push_back(tmp); }
142  }
143  */
144 
145  return result;
146 }
G4double G4ParticleHPJENDLHEData::G4double result
value_type & Get() const
Definition: G4Cache.hh:282
int G4int
Definition: G4Types.hh:78
const G4String & GetParticleName() const
std::vector< G4ReactionProduct * > G4ReactionProductVector
const G4ParticleDefinition * GetDefinition() const
G4GLOB_DLL std::ostream G4cout
void SetProjectileRP(G4ReactionProduct *aIncidentParticleRP)
G4double GetKineticEnergy() const
void SetTarget(G4ReactionProduct *aTarget)
virtual G4ReactionProduct * Sample(G4double anEnergy, G4double massCode, G4double mass)=0
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

Here is the caller graph for this function:

void G4ParticleHPProduct::SetProjectileRP ( G4ReactionProduct aIncidentPart)
inline

Definition at line 167 of file G4ParticleHPProduct.hh.

168  {
169  fCache.Get().theProjectileRP = aIncidentPart;
170  }
value_type & Get() const
Definition: G4Cache.hh:282

Here is the call graph for this function:

void G4ParticleHPProduct::SetTarget ( G4ReactionProduct aTarget)
inline

Definition at line 172 of file G4ParticleHPProduct.hh.

173  {
174  fCache.Get().theTarget = aTarget;
175  }
value_type & Get() const
Definition: G4Cache.hh:282

Here is the call graph for this function:


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