Geant4 10.7.0
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 (G4ParticleDefinition *proj)
 
 ~G4ParticleHPContEnergyAngular ()
 
void Init (std::istream &aDataFile)
 
G4double MeanEnergyOfThisInteraction ()
 
G4ReactionProductSample (G4double anEnergy, G4double massCode, G4double mass)
 
void ClearHistories ()
 
- Public Member Functions inherited from G4VParticleHPEnergyAngular
 G4VParticleHPEnergyAngular ()
 
virtual ~G4VParticleHPEnergyAngular ()
 
virtual void Init (std::istream &aDataFile)=0
 
virtual G4ReactionProductSample (G4double anEnergy, G4double massCode, G4double mass)=0
 
virtual G4double MeanEnergyOfThisInteraction ()=0
 
void SetProjectileRP (G4ReactionProduct *aIncidentParticleRP)
 
void SetTarget (G4ReactionProduct *aTarget)
 
G4ReactionProductGetTarget ()
 
G4ReactionProductGetProjectileRP ()
 
G4ReactionProductGetCMS ()
 
void SetQValue (G4double aValue)
 
virtual void ClearHistories ()
 

Additional Inherited Members

- Protected Member Functions inherited from G4VParticleHPEnergyAngular
G4double GetQValue ()
 

Detailed Description

Definition at line 48 of file G4ParticleHPContEnergyAngular.hh.

Constructor & Destructor Documentation

◆ G4ParticleHPContEnergyAngular()

G4ParticleHPContEnergyAngular::G4ParticleHPContEnergyAngular ( G4ParticleDefinition proj)
inline

Definition at line 52 of file G4ParticleHPContEnergyAngular.hh.

53 : theProjectile(proj)
54 {
55 theAngular = 0;
56 currentMeanEnergy.Put( -2 );
57 theTargetCode = -1.0;
58 theAngularRep = -1;
59 nEnergy = -1;
60 theInterpolation = -1;
61 fCacheAngular.Put(0); //fix
62 }
void Put(const value_type &val) const
Definition: G4Cache.hh:321

◆ ~G4ParticleHPContEnergyAngular()

G4ParticleHPContEnergyAngular::~G4ParticleHPContEnergyAngular ( )
inline

Definition at line 64 of file G4ParticleHPContEnergyAngular.hh.

65 {
66 if(theAngular!=0) delete [] theAngular;
67 if (fCacheAngular.Get() != 0) delete fCacheAngular.Get(); //fix
68 }
value_type & Get() const
Definition: G4Cache.hh:315

Member Function Documentation

◆ ClearHistories()

void G4ParticleHPContEnergyAngular::ClearHistories ( )
virtual

Reimplemented from G4VParticleHPEnergyAngular.

Definition at line 126 of file G4ParticleHPContEnergyAngular.cc.

127{
128 if ( theAngular!= NULL )
129 {
130 for ( G4int i = 0 ; i< nEnergy ; i++ )
131 theAngular[i].ClearHistories();
132 }
133}
int G4int
Definition: G4Types.hh:85

Referenced by ClearHistories().

◆ Init()

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

Implements G4VParticleHPEnergyAngular.

Definition at line 70 of file G4ParticleHPContEnergyAngular.hh.

71 {
72 aDataFile >> theTargetCode >> theAngularRep >> theInterpolation >> nEnergy;
73 theAngular = new G4ParticleHPContAngularPar[nEnergy];
74 theManager.Init(aDataFile);
75 for(G4int i=0; i<nEnergy; i++)
76 {
77 theAngular[i].Init(aDataFile, theProjectile);
78 theAngular[i].SetInterpolation(theInterpolation);
79#ifndef PHP_AS_HP
80 if( i != 0 ) {
81 theAngular[i].PrepareTableInterpolation(&(theAngular[i-1]));
82 } else {
84 }
85#endif
86 }
87 }
void Init(G4int aScheme, G4int aRange)
void PrepareTableInterpolation(const G4ParticleHPContAngularPar *angularPrev)
void Init(std::istream &aDataFile, G4ParticleDefinition *projectile)
void SetInterpolation(G4int theInterpolation)

◆ MeanEnergyOfThisInteraction()

G4double G4ParticleHPContEnergyAngular::MeanEnergyOfThisInteraction ( )
virtual

Implements G4VParticleHPEnergyAngular.

Definition at line 108 of file G4ParticleHPContEnergyAngular.cc.

110{
111 G4double result(0);
112 if(currentMeanEnergy.Get()<-1)
113 {
114 throw G4HadronicException(__FILE__, __LINE__, "G4ParticleHPContEnergyAngular: Logical error in Product class");
115 }
116 else
117 {
118 result = currentMeanEnergy.Get();
119 }
120 currentMeanEnergy.Put( -2 );
121 return result;
122}
double G4double
Definition: G4Types.hh:83

Referenced by Sample().

◆ Sample()

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

Implements G4VParticleHPEnergyAngular.

Definition at line 36 of file G4ParticleHPContEnergyAngular.cc.

37{
38 G4ReactionProduct * result;
39 G4int i(0);
40 G4int it(0);
41 for(i=0;i<nEnergy;i++)
42 {
43 it = i;
44#ifdef PHP_AS_HP
45 if(theAngular[i].GetEnergy()>anEnergy) break;
46#else
47 if(theAngular[i].GetEnergy()>=anEnergy) break;
48#endif
49 }
50 if( std::getenv("G4PHPTEST") ) G4cout << i << " G4ParticleHPContEnergyAngular dataE " << theAngular[i].GetEnergy() << " > " << anEnergy << " it_theAngular " << it << " interpolation " << theInterpolation << G4endl; //GDEB
51 G4double targetMass = GetTarget()->GetMass();
52 if(it==0)
53 {
54 theAngular[0].SetTarget(GetTarget());
55 theAngular[0].SetTargetCode(theTargetCode);
56 theAngular[0].SetPrimary(GetProjectileRP());
57 result = theAngular[0].Sample(anEnergy, massCode, targetMass,
58 theAngularRep, theInterpolation);
59 currentMeanEnergy.Put( theAngular[0].MeanEnergyOfThisInteraction() );
60 }
61 else
62 {
63 // interpolation through alternating sampling. This needs improvement @@@
64 // This is the cause of the He3 problem !!!!!!!!
65 // See to it, if you can improve this.
66 //080714 TK commnet Randomizing use angular distribution
67 //080714 TK Always use the upper side distribution. enabling ClearHistories method.
68 //G4double random = G4UniformRand();
69 //G4double deltaE = theAngular[it].GetEnergy()-theAngular[it-1].GetEnergy();
70 //G4double offset = theAngular[it].GetEnergy()-anEnergy;
71 //if(random<offset/deltaE) it--;
72 //--- create new
73 // if( theManager.GetScheme(0) != LINLIN ) { // asserted in G4ParticleHPContEnergyAngular::init there is only one range
74#ifdef PHP_AS_HP
75 theAngular[it].SetTarget(GetTarget());
76 theAngular[it].SetTargetCode(theTargetCode);
77 theAngular[it].SetPrimary(GetProjectileRP());
78 result = theAngular[it].Sample(anEnergy, massCode, targetMass,
79 theAngularRep, theInterpolation);
80 currentMeanEnergy.Put( theAngular[it].MeanEnergyOfThisInteraction() );
81#else
82 if( std::getenv("G4PHPTEST") ) G4cout << i << " G4ParticleHPContEnergyAngular To BUILDBYINTERPOLATION " << it << " : " << theAngular[it].GetEnergy()<< " , " << theAngular[it].GetNEnergies() << " " << it-1 << " : " << theAngular[it-1].GetEnergy()<< " : " << theAngular[it-1].GetNEnergies() << G4endl; //GDEB
83
84// G4ParticleHPContAngularPar * fAngular = new G4ParticleHPContAngularPar(theProjectile ); //fix start
85 if (fCacheAngular.Get() == NULL) {
86 G4ParticleHPContAngularPar* angpar = new G4ParticleHPContAngularPar(theProjectile);
87 fCacheAngular.Put(angpar);
88 }
89 fCacheAngular.Get()->SetInterpolation(theInterpolation);
90 fCacheAngular.Get()->BuildByInterpolation( anEnergy, theManager.GetScheme(0), (theAngular[it-1]), (theAngular[it]) );
91 fCacheAngular.Get()->SetTarget(GetTarget());
92 fCacheAngular.Get()->SetTargetCode(theTargetCode);
93 fCacheAngular.Get()->SetPrimary(GetProjectileRP());
94 result = fCacheAngular.Get()->Sample(anEnergy, massCode, targetMass,
95 theAngularRep, theInterpolation);
96 currentMeanEnergy.Put( fCacheAngular.Get()->MeanEnergyOfThisInteraction() );
97 fCacheAngular.Get()->ClearHistories();
98
99// delete fAngular; //fix end
100
101#endif
102 }
103
104 // G4cout << " 0 0 @@@ G4ParticleHPContEnergyAngular::Sample " << result->GetDefinition()->GetParticleName() << " E= " << result->GetKineticEnergy() << G4endl;//GDEB
105 return result;
106}
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
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

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