Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ParticleHPContEnergyAngular Class Reference

#include <G4ParticleHPContEnergyAngular.hh>

+ Inheritance diagram for G4ParticleHPContEnergyAngular:

Public Member Functions

 G4ParticleHPContEnergyAngular (const G4ParticleDefinition *proj)
 
 ~G4ParticleHPContEnergyAngular () override
 
void Init (std::istream &aDataFile) override
 
G4double MeanEnergyOfThisInteraction () override
 
G4ReactionProductSample (G4double anEnergy, G4double massCode, G4double mass) override
 
void ClearHistories () override
 
 G4ParticleHPContEnergyAngular (G4ParticleHPContEnergyAngular &)=delete
 
G4ParticleHPContEnergyAngularoperator= (const G4ParticleHPContEnergyAngular &right)=delete
 
- Public Member Functions inherited from G4VParticleHPEnergyAngular
 G4VParticleHPEnergyAngular ()
 
virtual ~G4VParticleHPEnergyAngular ()=default
 
void SetProjectileRP (G4ReactionProduct *aIncidentParticleRP)
 
void SetTarget (G4ReactionProduct *aTarget)
 
G4ReactionProductGetTarget () const
 
G4ReactionProductGetProjectileRP () const
 
G4ReactionProductGetCMS ()
 
void SetQValue (G4double aValue)
 
 G4VParticleHPEnergyAngular (G4VParticleHPEnergyAngular &)=delete
 
G4VParticleHPEnergyAngularoperator= (const G4VParticleHPEnergyAngular &right)=delete
 

Additional Inherited Members

- Protected Member Functions inherited from G4VParticleHPEnergyAngular
G4double GetQValue () const
 

Detailed Description

Definition at line 47 of file G4ParticleHPContEnergyAngular.hh.

Constructor & Destructor Documentation

◆ G4ParticleHPContEnergyAngular() [1/2]

G4ParticleHPContEnergyAngular::G4ParticleHPContEnergyAngular ( const G4ParticleDefinition * proj)

Definition at line 41 of file G4ParticleHPContEnergyAngular.cc.

42{
43 theProjectile = (nullptr == proj) ? G4Neutron::Neutron() : proj;
44 currentMeanEnergy.Put(-2);
45 fCacheAngular.Put(nullptr);
46}
void Put(const value_type &val) const
Definition G4Cache.hh:321
static G4Neutron * Neutron()
Definition G4Neutron.cc:101

◆ ~G4ParticleHPContEnergyAngular()

G4ParticleHPContEnergyAngular::~G4ParticleHPContEnergyAngular ( )
override

Definition at line 48 of file G4ParticleHPContEnergyAngular.cc.

49{
50 delete[] theAngular;
51 delete fCacheAngular.Get();
52}
value_type & Get() const
Definition G4Cache.hh:315

◆ G4ParticleHPContEnergyAngular() [2/2]

G4ParticleHPContEnergyAngular::G4ParticleHPContEnergyAngular ( G4ParticleHPContEnergyAngular & )
delete

Member Function Documentation

◆ ClearHistories()

void G4ParticleHPContEnergyAngular::ClearHistories ( )
overridevirtual

Reimplemented from G4VParticleHPEnergyAngular.

Definition at line 148 of file G4ParticleHPContEnergyAngular.cc.

149{
150 if (theAngular != nullptr) {
151 for (G4int i = 0; i < nEnergy; ++i)
152 theAngular[i].ClearHistories();
153 }
154
155 // Added fCacheAngular ClearHistories() - this is the one actually used!
156 // Maybe theAngular does not even need ClearHistories()?
157 if (fCacheAngular.Get() != nullptr) fCacheAngular.Get()->ClearHistories();
158}
int G4int
Definition G4Types.hh:85

Referenced by ClearHistories().

◆ Init()

void G4ParticleHPContEnergyAngular::Init ( std::istream & aDataFile)
overridevirtual

Implements G4VParticleHPEnergyAngular.

Definition at line 54 of file G4ParticleHPContEnergyAngular.cc.

55{
56 aDataFile >> theTargetCode >> theAngularRep >> theInterpolation >> nEnergy;
57 const std::size_t esize = nEnergy > 0 ? nEnergy : 1;
58 theAngular = new G4ParticleHPContAngularPar[esize];
59 theManager.Init(aDataFile);
60 for (G4int i = 0; i < nEnergy; ++i) {
61 theAngular[i].Init(aDataFile, theProjectile);
62 theAngular[i].SetInterpolation(theInterpolation);
63#ifndef PHP_AS_HP
64 theAngular[i].PrepareTableInterpolation();
65#endif
66 }
67}
void Init(G4int aScheme, G4int aRange)
void Init(std::istream &aDataFile, const G4ParticleDefinition *projectile)
void SetInterpolation(G4int theInterpolation)

◆ MeanEnergyOfThisInteraction()

G4double G4ParticleHPContEnergyAngular::MeanEnergyOfThisInteraction ( )
overridevirtual

Implements G4VParticleHPEnergyAngular.

Definition at line 134 of file G4ParticleHPContEnergyAngular.cc.

135{
136 //G4cout << "+++ Emin=" << currentMeanEnergy.Get() << G4endl;
137 G4double result(0);
138 if (currentMeanEnergy.Get() < -1.0) {
139 throw G4HadronicException(__FILE__, __LINE__,
140 "G4ParticleHPContEnergyAngular: Logical error in Product class");
141 }
142 result = currentMeanEnergy.Get();
143
144 currentMeanEnergy.Put(-2.0);
145 return result;
146}
double G4double
Definition G4Types.hh:83

Referenced by Sample().

◆ operator=()

G4ParticleHPContEnergyAngular & G4ParticleHPContEnergyAngular::operator= ( const G4ParticleHPContEnergyAngular & right)
delete

◆ Sample()

G4ReactionProduct * G4ParticleHPContEnergyAngular::Sample ( G4double anEnergy,
G4double massCode,
G4double mass )
overridevirtual

Implements G4VParticleHPEnergyAngular.

Definition at line 69 of file G4ParticleHPContEnergyAngular.cc.

71{
72 G4ReactionProduct* result;
73 G4int i(0);
74 G4int it(0);
75 for (i = 0; i < nEnergy; ++i) {
76 it = i;
77#ifdef PHP_AS_HP
78 if (theAngular[i].GetEnergy() > anEnergy) break;
79#else
80 if (theAngular[i].GetEnergy() >= anEnergy) break;
81#endif
82 }
83 G4double targetMass = GetTarget()->GetMass();
84 /*
85 G4cout << "G4ParticleHPContEnergyAngular::Sample E="<<anEnergy<<" code="<< massCode<< " it=" << it
86 << " M=" << targetMass << G4endl;
87 */
88 if (it == 0) {
89 theAngular[0].SetTarget(GetTarget());
90 theAngular[0].SetTargetCode(theTargetCode);
91 theAngular[0].SetPrimary(GetProjectileRP());
92 result = theAngular[0].Sample(anEnergy, massCode, targetMass, theAngularRep, theInterpolation);
93 currentMeanEnergy.Put(theAngular[0].MeanEnergyOfThisInteraction());
94 }
95 else {
96 // interpolation through alternating sampling. This needs improvement @@@
97 // This is the cause of the He3 problem !!!!!!!!
98 // See to it, if you can improve this.
99 // G4double random = G4UniformRand();
100 // G4double deltaE = theAngular[it].GetEnergy()-theAngular[it-1].GetEnergy();
101 // G4double offset = theAngular[it].GetEnergy()-anEnergy;
102 // if(random<offset/deltaE) it--;
103 //--- create new
104 // if (theManager.GetScheme(0) != LINLIN) {
105 // // asserted in G4ParticleHPContEnergyAngular::init there is only one range
106#ifdef PHP_AS_HP
107 theAngular[it].SetTarget(GetTarget());
108 theAngular[it].SetTargetCode(theTargetCode);
109 theAngular[it].SetPrimary(GetProjectileRP());
110 result = theAngular[it].Sample(anEnergy, massCode, targetMass, theAngularRep, theInterpolation);
111 currentMeanEnergy.Put(theAngular[it].MeanEnergyOfThisInteraction());
112
113#else
114 if (fCacheAngular.Get() == nullptr) {
115 auto angpar = new G4ParticleHPContAngularPar(theProjectile);
116 fCacheAngular.Put(angpar);
117 }
118 fCacheAngular.Get()->SetInterpolation(theInterpolation);
119 fCacheAngular.Get()->BuildByInterpolation(anEnergy, theManager.GetScheme(0),
120 (theAngular[it - 1]), (theAngular[it]));
121 fCacheAngular.Get()->SetTarget(GetTarget());
122 fCacheAngular.Get()->SetTargetCode(theTargetCode);
123 fCacheAngular.Get()->SetPrimary(GetProjectileRP());
124
125 result =
126 fCacheAngular.Get()->Sample(anEnergy, massCode, targetMass, theAngularRep, theInterpolation);
127 currentMeanEnergy.Put(fCacheAngular.Get()->MeanEnergyOfThisInteraction());
128#endif
129 } // end (it != 0) branch
130 //G4cout << "+!+ Emin=" << currentMeanEnergy.Get() << G4endl;
131 return result;
132}
G4InterpolationScheme GetScheme(G4int index) const
G4ReactionProduct * Sample(G4double anEnergy, G4double massCode, G4double mass, G4int angularRep, G4int interpol)
void SetPrimary(G4ReactionProduct *aPrimary)
void SetTarget(G4ReactionProduct *aTarget)
void SetTargetCode(G4double aTargetCode)
void BuildByInterpolation(G4double anEnergy, G4InterpolationScheme aScheme, G4ParticleHPContAngularPar &store1, G4ParticleHPContAngularPar &store2)
G4double GetMass() const
G4ReactionProduct * GetTarget() const
G4ReactionProduct * GetProjectileRP() const

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