90 std::istringstream theData(std::ios::in);
93 theData >> repFlag >> targetMass >> frameFlag;
101 G4int tempdep, nLegendre;
103 for (i=0; i < nEnergy; i++) {
104 theData >> temp >> energy >> tempdep >> nLegendre;
106 theCoefficients->
Init(i, energy, nLegendre);
109 for (ii = 0; ii < nLegendre; ii++) {
112 theCoefficients->
SetCoeff(i, ii+1, coeff);
116 }
else if (repFlag == 2) {
122 G4int tempdep, nPoints;
123 for (
G4int i = 0; i < nEnergy; i++) {
124 theData >> temp >> energy >> tempdep >> nPoints;
127 theProbArray->
SetT(i, temp);
128 theProbArray->
SetX(i, energy);
130 for (
G4int ii = 0; ii < nPoints; ii++) {
132 theData >> costh >> prob;
133 theProbArray->
SetX(i, ii, costh);
134 theProbArray->
SetY(i, ii, prob);
139 }
else if (repFlag == 3) {
140 G4int nEnergy_Legendre;
141 theData >> nEnergy_Legendre;
142 if (nEnergy_Legendre <= 0 ) {
143 std::stringstream iss;
144 iss <<
"G4ParticleHPElasticFS::Init Data Error repFlag is 3 but nEnergy_Legendre <= 0";
145 iss <<
"Z, A and M of problematic file is " <<
theNDLDataZ <<
", "
152 G4int tempdep, nLegendre;
154 for (
G4int i = 0; i < nEnergy_Legendre; i++) {
155 theData >> temp >> energy >> tempdep >> nLegendre;
157 theCoefficients->
Init( i , energy , nLegendre );
160 for (
G4int ii = 0; ii < nLegendre; ii++) {
163 theCoefficients->
SetCoeff(i, ii+1, coeff);
167 tE_of_repFlag3 = energy;
170 theData >> nEnergy_Prob;
174 for (
G4int i = 0; i < nEnergy_Prob; i++) {
175 theData >> temp >> energy >> tempdep >> nPoints;
181 if (std::abs(energy - tE_of_repFlag3) / tE_of_repFlag3 > 1.0e-15)
182 G4cout <<
"Warning Transition Energy of repFlag3 is not consistent." <<
G4endl;
185 theProbArray->
SetT( i , temp );
186 theProbArray->
SetX( i , energy );
188 for (
G4int ii = 0; ii < nPoints; ii++) {
190 theData >> costh >> prob;
191 theProbArray->
SetX( i , ii , costh );
192 theProbArray->
SetY( i , ii , prob );
197 }
else if (repFlag==0) {
198 theData >> frameFlag;
201 G4cout <<
"unusable number for repFlag: repFlag="<<repFlag<<
G4endl;
202 throw G4HadronicException(__FILE__, __LINE__,
"G4ParticleHPElasticFS::Init -- unusable number for repFlag");
238 G4double cmsMom = std::sqrt(the3CMS*the3CMS);
239 G4double sqrts = std::sqrt((totE-cmsMom)*(totE+cmsMom));
245 boosted.
Lorentz(theNeutron, theTarget);
252 }
else if (repFlag == 2) {
253 cosTh = theProbArray->
Sample(eKinetic);
255 }
else if (repFlag == 3) {
256 if (eKinetic <= tE_of_repFlag3) {
259 cosTh = theProbArray->
Sample(eKinetic);
262 }
else if (repFlag == 0) {
266 G4cout <<
"Unusable number for repFlag: repFlag=" << repFlag <<
G4endl;
268 "G4ParticleHPElasticFS::Init -- unusable number for repFlag");
271 if (cosTh < -1.1) {
return 0; }
279 if (frameFlag == 1) {
284 theNeutron.
Lorentz(theNeutron, theTarget);
291 G4double sqt = std::sqrt(ratio*ratio - 1.0 + cosTh*cosTh);
293 G4double denom = 1. - beta*beta*cosTh*cosTh;
294 G4double term1 = cosTh*(Einit*ratio + mN)/(mN*ratio + Einit);
295 G4double pN = beta*mN*(term1 + sqt)/denom;
304 pcmRot.
setX(px*cosTh*cosPhi - py*sinPhi + pz*sinth*cosPhi);
305 pcmRot.
setY(px*cosTh*sinPhi + py*cosPhi + pz*sinth*sinPhi);
306 pcmRot.
setZ(-px*sinth + pz*cosTh);
308 G4double eN = std::sqrt(pN*pN + mN*mN);
318 theNeutron.
Lorentz(theNeutron, toLab);
319 theTarget.
Lorentz(theTarget, toLab);
327 }
else if (frameFlag == 2) {
333 proj.
boost(boostToCM);
334 targ.
boost(boostToCM);
344 pcmRot.
setX(px*cosTh*cosPhi - py*sinPhi + pz*sinth*cosPhi);
345 pcmRot.
setY(px*cosTh*sinPhi + py*cosPhi + pz*sinth*sinPhi);
346 pcmRot.
setZ(-px*sinth + pz*cosTh);
351 proj.
boost(-boostToCM);
352 targ.
boost(-boostToCM);
371 G4cout <<
"Value of frameFlag (1=LAB, 2=CMS): " << frameFlag;
373 "G4ParticleHPElasticFS::ApplyYourSelf frameflag incorrect");
G4GLOB_DLL std::ostream G4cout
HepLorentzVector & boost(double, double, double)
void setVect(const Hep3Vector &)
Hep3Vector findBoostToCM() const
void Put(const value_type &val) const
void SetDefinition(const G4ParticleDefinition *aParticleDefinition)
void SetMomentum(const G4ThreeVector &momentum)
void SetStatusChange(G4HadFinalStateStatus aS)
void AddSecondary(G4DynamicParticle *aP, G4int mod=-1)
void SetEnergyChange(G4double anEnergy)
void SetMomentumChange(const G4ThreeVector &aV)
const G4Material * GetMaterial() const
const G4ParticleDefinition * GetDefinition() const
G4double GetKineticEnergy() const
const G4LorentzVector & Get4Momentum() const
static G4IonTable * GetIonTable()
G4double GetTemperature() const
G4ReactionProduct GetBiasedThermalNucleus(G4double aMass, G4ThreeVector aVelocity, G4double temp=-1) const
G4double GetPDGMass() const
G4HadFinalState * ApplyYourself(const G4HadProjectile &theTrack)
void Init(G4double A, G4double Z, G4int M, G4String &dirName, G4String &aFSType, G4ParticleDefinition *)
void SetAZMs(G4double anA, G4double aZ, G4int aM, G4ParticleHPDataUsed used)
G4Cache< G4HadFinalState * > theResult
G4ParticleHPNames theNames
void SetCoeff(G4int i, G4int l, G4double coeff)
void Init(G4int i, G4double e, G4int n)
void SetTemperature(G4int i, G4double temp)
void InitInterpolation(std::istream &aDataFile)
G4double SampleElastic(G4double anEnergy)
static G4ParticleHPManager * GetInstance()
void GetDataStream(G4String, std::istringstream &iss)
G4ParticleHPDataUsed GetName(G4int A, G4int Z, G4String base, G4String rest, G4bool &active)
G4double Sample(G4double x)
void SetT(G4int i, G4double x)
void SetX(G4int i, G4double x)
void SetY(G4int i, G4int j, G4double y)
void InitInterpolation(G4int i, std::istream &aDataFile)
static G4int GetModelID(const G4int modelIndex)
static G4Pow * GetInstance()
G4double powA(G4double A, G4double y) const
void SetMomentum(const G4double x, const G4double y, const G4double z)
void SetTotalEnergy(const G4double en)
G4double GetTotalMomentum() const
G4double GetKineticEnergy() const
G4double GetTotalEnergy() const
G4ThreeVector GetMomentum() const
void Lorentz(const G4ReactionProduct &p1, const G4ReactionProduct &p2)
void SetKineticEnergy(const G4double en)
void SetMass(const G4double mas)