36 #include "G4ParticleHPDiscreteTwoBody.hh" 85 throw G4HadronicException(__FILE__, __LINE__,
"G4ParticleHPDiscreteTwoBody: Unknown ion case 2");
91 for(i=0; i<nEnergy; i++)
94 if(theCoeff[i].GetEnergy()>anEnergy)
break;
96 if(it==0||it==nEnergy-1)
98 if(theCoeff[it].GetRepresentation()==0)
102 theStore.SetCoeff(0, theCoeff);
103 theStore.SetManager(theManager);
106 cosTh = theStore.SampleDiscreteTwoBody(anEnergy);
108 else if(theCoeff[it].GetRepresentation()==12)
112 aManager.
Init(
LINLIN, theCoeff[it].GetNumberOfPoly()/2);
114 for(i=0;i<theCoeff[it].GetNumberOfPoly(); i+=2)
119 theStore.
SetX(i/2, theCoeff[it].GetCoeff(i));
120 theStore.
SetY(i/2, theCoeff[it].GetCoeff(i+1));
122 cosTh = theStore.
Sample();
124 else if(theCoeff[it].GetRepresentation()==14)
128 aManager.
Init(
LOGLIN, theCoeff[it].GetNumberOfPoly()/2);
130 for(i=0;i<theCoeff[it].GetNumberOfPoly(); i+=2)
135 theStore.
SetX(i/2, theCoeff[it].GetCoeff(i));
136 theStore.
SetY(i/2, theCoeff[it].GetCoeff(i+1));
138 cosTh = theStore.
Sample();
142 throw G4HadronicException(__FILE__, __LINE__,
"unknown representation type in Two-body scattering");
147 if(!bCheckDiffCoeffRepr || theCoeff[it].GetRepresentation() == theCoeff[it-1].GetRepresentation())
149 if(theCoeff[it].GetRepresentation()==0)
153 theStore.SetCoeff(0, &(theCoeff[it-1]));
154 theStore.SetCoeff(1, &(theCoeff[it]));
156 aManager.
Init(theManager.GetScheme(it), 2);
157 theStore.SetManager(aManager);
160 cosTh = theStore.SampleDiscreteTwoBody(anEnergy);
162 else if(theCoeff[it].GetRepresentation()==12)
166 aManager1.
Init(
LINLIN, theCoeff[it-1].GetNumberOfPoly()/2);
168 for(i=0;i<theCoeff[it-1].GetNumberOfPoly(); i+=2)
173 theBuff1.
SetX(i/2, theCoeff[it-1].GetCoeff(i));
174 theBuff1.
SetY(i/2, theCoeff[it-1].GetCoeff(i+1));
178 aManager2.
Init(
LINLIN, theCoeff[it].GetNumberOfPoly()/2);
180 for(i=0;i<theCoeff[it].GetNumberOfPoly(); i+=2)
184 theBuff2.
SetX(i/2, theCoeff[it].GetCoeff(i));
185 theBuff2.
SetY(i/2, theCoeff[it].GetCoeff(i+1));
202 mu = theBuff1.
GetX(i);
203 y1 = theBuff1.
GetY(i);
204 y2 = theBuff2.
GetY(mu);
205 y = theInt.Interpolate(theManager.GetScheme(it),
x,
x1,
x2,
y1,
y2);
210 mu = theBuff2.
GetX(i);
211 y1 = theBuff2.
GetY(i);
212 y2 = theBuff1.
GetY(mu);
213 y = theInt.Interpolate(theManager.GetScheme(it),
x,
x1,
x2,
y1,
y2);
216 theStore.
Merge(&theStore1, &theStore2);
217 cosTh = theStore.
Sample();
219 else if(theCoeff[it].GetRepresentation()==14)
223 aManager1.
Init(
LOGLIN, theCoeff[it-1].GetNumberOfPoly()/2);
225 for(i=0;i<theCoeff[it-1].GetNumberOfPoly(); i+=2)
230 theBuff1.
SetX(i/2, theCoeff[it-1].GetCoeff(i));
231 theBuff1.
SetY(i/2, theCoeff[it-1].GetCoeff(i+1));
236 aManager2.
Init(
LOGLIN, theCoeff[it].GetNumberOfPoly()/2);
238 for(i=0;i<theCoeff[it].GetNumberOfPoly(); i+=2)
243 theBuff2.
SetX(i/2, theCoeff[it].GetCoeff(i));
244 theBuff2.
SetY(i/2, theCoeff[it].GetCoeff(i+1));
247 G4double x1 = theCoeff[it-1].GetEnergy();
248 G4double x2 = theCoeff[it].GetEnergy();
261 mu = theBuff1.
GetX(i);
262 y1 = theBuff1.
GetY(i);
263 y2 = theBuff2.
GetY(mu);
264 y = theInt.Interpolate(theManager.GetScheme(it),
x,
x1,
x2,
y1,
y2);
269 mu = theBuff2.
GetX(i);
270 y1 = theBuff2.
GetY(i);
271 y2 = theBuff1.
GetY(mu);
272 y = theInt.Interpolate(theManager.GetScheme(it),
x,
x1,
x2,
y1,
y2);
275 theStore.
Merge(&theStore1, &theStore2);
276 cosTh = theStore.
Sample();
280 throw G4HadronicException(__FILE__, __LINE__,
"Two neighbouring distributions with different interpolation");
285 G4cout <<
" theCoeff[it].GetRepresent MEM " << it <<
" " << &theCoeff[it] <<
" " << &theCoeff[it-1] <<
G4endl;
286 G4cout <<
" theCoeff[it].GetRepresent " << it <<
" " << theCoeff[it].GetRepresentation() <<
" != " << theCoeff[it-1].GetRepresentation() <<
G4endl;
288 throw G4HadronicException(__FILE__, __LINE__,
"unknown representation type in Two-body scattering, case 2");
302 G4double A1 = GetTarget()->GetMass()/GetProjectileRP()->GetMass();
307 G4double kinE = (A1+1-A1prim)/(A1+1)/(A1+1)*(A1*E1+(1+A1)*GetQValue());
314 G4ThreeVector tempVector(mtot*sinth*std::cos(phi), mtot*sinth*std::sin(phi), mtot*std::cos(theta) );
void Init(G4int aScheme, G4int aRange)
void SetKineticEnergy(const G4double en)
void SetMomentum(const G4double x, const G4double y, const G4double z)
void SetData(G4int i, G4double x, G4double y)
void SetInterpolationManager(const G4InterpolationManager &aManager)
void SetDefinition(const G4ParticleDefinition *aParticleDefinition)
void SetY(G4int i, G4double x)
G4GLOB_DLL std::ostream G4cout
double A(double temperature)
static G4Triton * Triton()
void Merge(G4ParticleHPVector *active, G4ParticleHPVector *passive)
static G4Proton * Proton()
static G4Neutron * Neutron()
G4double GetY(G4double x)
G4int GetVectorLength() const
static G4Deuteron * Deuteron()
G4double GetTotalMomentum() const
static G4Positron * Positron()
G4double GetX(G4int i) const
static G4Electron * Electron()
static const double twopi
void SetX(G4int i, G4double e)