71 std::istringstream theData(std::ios::in);
74 theData >> repFlag >> targetMass >> frameFlag;
82 G4int tempdep, nLegendre;
84 for (i=0; i<nEnergy; i++)
86 theData >> temp >> energy >> tempdep >> nLegendre;
88 theCoefficients->
Init(i, energy, nLegendre);
91 for(ii=0; ii<nLegendre; ii++)
95 theCoefficients->
SetCoeff(i, ii+1, coeff);
106 G4int tempdep, nPoints;
107 for(
G4int i=0; i<nEnergy; i++)
109 theData >> temp >> energy >> tempdep >> nPoints;
112 theProbArray->
SetT(i, temp);
113 theProbArray->
SetX(i, energy);
115 for(
G4int ii=0; ii<nPoints; ii++)
118 theData >> costh >> prob;
119 theProbArray->
SetX(i, ii, costh);
120 theProbArray->
SetY(i, ii, prob);
125 else if ( repFlag==3 )
127 G4int nEnergy_Legendre;
128 theData >> nEnergy_Legendre;
129 if ( nEnergy_Legendre <= 0 ) {
130 std::stringstream iss;
131 iss <<
"G4ParticleHPElasticFS::Init Data Error repFlag is 3 but nEnergy_Legendre <= 0";
138 G4int tempdep, nLegendre;
140 for (
G4int i = 0 ; i < nEnergy_Legendre ; i++ )
142 theData >> temp >> energy >> tempdep >> nLegendre;
144 theCoefficients->
Init( i , energy , nLegendre );
147 for (
G4int ii = 0 ; ii < nLegendre ; ii++ )
151 theCoefficients->
SetCoeff(i, ii+1, coeff);
158 theData >> nEnergy_Prob;
162 for (
G4int i=0 ; i < nEnergy_Prob ; i++ )
164 theData >> temp >> energy >> tempdep >> nPoints;
171 if ( std::abs( energy - tE_of_repFlag3 ) / tE_of_repFlag3 > 1.0e-15 )
172 G4cout <<
"Warning Transition Energy of repFlag3 is not consistent." <<
G4endl;
175 theProbArray->
SetT( i , temp );
176 theProbArray->
SetX( i , energy );
178 for(
G4int ii = 0 ; ii < nPoints ; ii++ )
181 theData >> costh >> prob;
182 theProbArray->
SetX( i , ii , costh );
183 theProbArray->
SetY( i , ii , prob );
190 theData >> frameFlag;
194 G4cout <<
"unusable number for repFlag: repFlag="<<repFlag<<
G4endl;
195 throw G4HadronicException(__FILE__, __LINE__,
"G4ParticleHPElasticFS::Init -- unusable number for repFlag");
236 G4double cmsMom = std::sqrt(the3CMS*the3CMS);
237 G4double sqrts = std::sqrt((totE-cmsMom)*(totE+cmsMom));
243 boosted.
Lorentz(theNeutron, theTarget);
253 cosTh = theProbArray->
Sample(eKinetic);
257 if ( eKinetic <= tE_of_repFlag3 )
263 cosTh = theProbArray->
Sample(eKinetic);
272 G4cout <<
"unusable number for repFlag: repFlag="<<repFlag<<
G4endl;
273 throw G4HadronicException(__FILE__, __LINE__,
"G4ParticleHPElasticFS::Init -- unusable number for repFlag");
275 if(cosTh<-1.1) {
return 0; }
284 theNeutron.
Lorentz(theNeutron, theTarget);
290 G4double ap = (mT+eE)*(mT-eE) + (p0+mN)*(p0-mN);
291 G4double a = 4*(eE+p0*cosTh)*(eE-p0*cosTh);
294 G4double en = (-b+std::sqrt(b*b - 4*a*c) )/(2*a);
295 G4ThreeVector tempVector(en*sinth*std::cos(phi), en*sinth*std::sin(phi), en*std::cos(theta) );
299 theNeutron.
Lorentz(theNeutron, -1.*theTarget);
301 theNeutron.
Lorentz(theNeutron, theCMS);
305 theNeutron.
Lorentz(theNeutron, -1.*theCMS);
306 theTarget.
Lorentz(theTarget, -1.*theCMS);
311 else if (frameFlag == 2)
313 theNeutron.
Lorentz(theNeutron, theCMS);
314 theTarget.
Lorentz(theTarget, theCMS);
320 tempVector.
setX(std::cos(theta)*std::sin(cms_theta)*std::cos(cms_phi)
321 +std::sin(theta)*std::cos(phi)*std::cos(cms_theta)*std::cos(cms_phi)
322 -std::sin(theta)*std::sin(phi)*std::sin(cms_phi) );
323 tempVector.
setY(std::cos(theta)*std::sin(cms_theta)*std::sin(cms_phi)
324 +std::sin(theta)*std::cos(phi)*std::cos(cms_theta)*std::sin(cms_phi)
325 +std::sin(theta)*std::sin(phi)*std::cos(cms_phi) );
326 tempVector.
setZ(std::cos(theta)*std::cos(cms_theta)
327 -std::sin(theta)*std::cos(phi)*std::sin(cms_theta) );
348 theNeutron.
Lorentz(theNeutron, -1.*theCMS);
358 theTarget.
Lorentz(theTarget, -1.*theCMS);
370 G4cout <<
"Value of frameFlag (1=LAB, 2=CMS): "<<frameFlag;
371 throw G4HadronicException(__FILE__, __LINE__,
"G4ParticleHPElasticFS::ApplyYourSelf frameflag incorrect");
static G4ParticleHPManager * GetInstance()
static G4Pow * GetInstance()
G4double powA(G4double A, G4double y) const
void Init(G4int i, G4double e, G4int n)
G4Cache< G4HadFinalState * > theResult
void SetMomentum(const G4ThreeVector &momentum)
G4double GetTotalMomentum() const
void Lorentz(const G4ReactionProduct &p1, const G4ReactionProduct &p2)
void InitInterpolation(G4int i, std::istream &aDataFile)
std::vector< ExP01TrackerHit * > a
void SetKineticEnergy(const G4double en)
void SetMomentum(const G4double x, const G4double y, const G4double z)
void SetY(G4int i, G4int j, G4double y)
void SetAZMs(G4double anA, G4double aZ, G4int aM, G4ParticleHPDataUsed used)
void GetDataStream(G4String, std::istringstream &iss)
void InitInterpolation(std::istream &aDataFile)
static constexpr double twopi
void SetStatusChange(G4HadFinalStateStatus aS)
void Init(G4double A, G4double Z, G4int M, G4String &dirName, G4String &aFSType, G4ParticleDefinition *)
G4ReactionProduct GetBiasedThermalNucleus(G4double aMass, G4ThreeVector aVelocity, G4double temp=-1) const
void SetMass(const G4double mas)
G4GLOB_DLL std::ostream G4cout
double A(double temperature)
const G4ParticleDefinition * GetDefinition() const
G4ParticleHPNames theNames
G4double Sample(G4double x)
G4double GetKineticEnergy() const
void SetTotalEnergy(const G4double en)
G4HadFinalState * ApplyYourself(const G4HadProjectile &theTrack)
G4ErrorTarget * theTarget
static constexpr double eV
const G4LorentzVector & Get4Momentum() const
static G4IonTable * GetIonTable()
G4double GetKineticEnergy() const
void SetTemperature(G4int i, G4double temp)
void SetX(G4int i, G4double x)
void SetEnergyChange(G4double anEnergy)
G4double SampleElastic(G4double anEnergy)
G4double GetTotalEnergy() const
G4double GetPDGMass() const
G4double energy(const ThreeVector &p, const G4double m)
void SetCoeff(G4int i, G4int l, G4double coeff)
G4ThreeVector GetMomentum() const
G4double GetTemperature() const
G4ParticleHPDataUsed GetName(G4int A, G4int Z, G4String base, G4String rest, G4bool &active)
void SetT(G4int i, G4double x)
const G4Material * GetMaterial() const
void AddSecondary(G4DynamicParticle *aP, G4int mod=-1)
void SetDefinition(const G4ParticleDefinition *aParticleDefinition)
void Put(const value_type &val) const
void SetMomentumChange(const G4ThreeVector &aV)