97 asymmetry *= (k0 + 1.)*
sqr(k1)*
G4Log(k1) - 2.*k0*(5.*
sqr(k0) + 4.*k0 + 1.);
98 asymmetry /= ((k0 - 2.)*k0 -2.)*
sqr(k1)*
G4Log(k1) + 2.*k0*(k0*(k0 + 1.)*(k0 + 8.) + 2.);
101 if (asymmetry>1.)
G4cout<<
"ERROR in G4PolarizedComptonModel::ComputeAsymmetryPerAtom"<<
G4endl;
121 xs *= (1.+polzz*asym);
129 std::vector<G4DynamicParticle*>* fvect,
142 G4cout<<
"G4PolarizedComptonModel::SampleSecondaries in "
165 if (targetIsPolarized) {
175 G4double E0_m = gamEnergy0 / electron_mass_c2 ;
191 G4double alpha2 = alpha1 + 0.5*(1.- epsilon0sq);
196 CLHEP::HepRandomEngine* rndmEngineMod = G4Random::getTheEngine();
207 PrintWarning(aDynamicGamma, nloop, greject, onecost, Phi,
208 "too many iterations");
213 rndmEngineMod->flatArray(3, rndm);
215 if ( alpha1 > alpha2*rndm[0]) {
216 epsilon =
G4Exp(-alpha1*rndm[1]);
218 epsilon = std::sqrt(epsilon0sq + (1.- epsilon0sq)*rndm[1]);
221 onecost = (1.-
epsilon)/(epsilon*E0_m);
222 sint2 = onecost*(2.-onecost);
225 G4double gdist = 1./epsilon + epsilon - sint2
226 - polarization*(1./epsilon-
epsilon)*(1.-onecost);
228 greject = gdist/gdiced;
231 PrintWarning(aDynamicGamma, nloop, greject, onecost, Phi,
232 "theta majoranta wrong");
235 }
while (greject < rndm[2]);
243 cosTeta = 1. - onecost;
244 sinTeta = std::sqrt(sint2);
249 rndmEngineMod->flatArray(2, rndm);
252 Phi =
twopi * rndm[0];
254 PrintWarning(aDynamicGamma, nloop, greject, onecost, Phi,
255 "too many iterations");
259 G4double gdiced = 1./epsilon + epsilon - sint2
267 G4double gdist = 1./epsilon + epsilon - sint2
274 greject = gdist/gdiced;
277 PrintWarning(aDynamicGamma, nloop, greject, onecost, Phi,
278 "phi majoranta wrong");
281 if(greject < 1.e-3) {
282 PrintWarning(aDynamicGamma, nloop, greject, onecost, Phi,
283 "phi loop ineffective");
290 }
while (greject < rndm[1]);
292 G4double dirx = sinTeta*std::cos(Phi), diry = sinTeta*std::sin(Phi),
300 gamDirection1.rotateUz(gamDirection0);
301 G4double gamEnergy1 = epsilon*gamEnergy0;
322 G4cout <<
"========================================\n";
323 G4cout <<
" nInteractionFrame = " <<nInteractionFrame<<
"\n";
324 G4cout <<
" GammaDirection0 = " <<gamDirection0<<
"\n";
333 G4cout <<
"----------------------------------------\n";
336 G4cout <<
"----------------------------------------\n";
357 G4cout<<
"ERROR in Polarizaed Compton Scattering !"<<
G4endl;
358 G4cout<<
"Polarization of final photon more than 100%"<<
G4endl;
366 G4cout <<
" GammaDirection1 = " <<gamDirection1<<
"\n";
373 G4double eKinEnergy = gamEnergy0 - gamEnergy1;
378 gamEnergy0*gamDirection0 - gamEnergy1*gamDirection1;
379 eDirection = eDirection.unit();
383 G4cout <<
" electronPolarization1 = "
389 G4cout <<
" electronPolarization1 = "
391 G4cout <<
" ElecDirection = " <<eDirection<<
"\n";
399 G4cout<<
"ERROR in Polarizaed Compton Scattering !"<<
G4endl;
400 G4cout<<
"Polarization of final electron more than 100%"<<
G4endl;
407 fvect->push_back(aElectron);
425 ed <<
"Problem of scattering sampling: " << sss <<
"\n"
426 <<
"Niter= " << nloop <<
" grej= " << grej <<
" cos(theta)= "
427 << 1.0-onecos <<
" phi= " << phi <<
"\n"
431 G4Exception(
"G4PolarizedComptonModel::SampleSecondaries",
"em0044",
virtual void SampleSecondaries(std::vector< G4DynamicParticle * > *, const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double tmin, G4double maxEnergy)
G4double LowEnergyLimit() const
G4ParticleChangeForGamma * fParticleChange
std::ostringstream G4ExceptionDescription
G4double GetKineticEnergy() const
CLHEP::Hep3Vector G4ThreeVector
G4StokesVector theTargetPolarization
static const G4int nlooplim
static G4PolarizationManager * GetInstance()
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
void ProposeLocalEnergyDeposit(G4double anEnergyPart)
G4StokesVector finalGammaPolarization
virtual G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition *, G4double kinEnergy, G4double Z, G4double A, G4double cut, G4double emax)
G4StokesVector finalElectronPolarization
G4GLOB_DLL std::ostream G4cout
double A(double temperature)
G4PolarizedComptonCrossSection * crossSectionCalculator
const G4ThreeVector & GetMomentumDirection() const
static const double twopi
void ProposePolarization(const G4ThreeVector &dir)
static G4ThreeVector GetFrame(const G4ThreeVector &, const G4ThreeVector &)
void PrintWarning(const G4DynamicParticle *, G4int, G4double grej, G4double onecos, G4double phi, const G4String) const
G4double lowestSecondaryEnergy
void SetPolarization(G4double polX, G4double polY, G4double polZ)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
static const G4double emax
G4double G4Log(G4double x)
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
void InvRotateAz(G4ThreeVector nInteractionFrame, G4ThreeVector particleDirection)
virtual void Initialize(G4double eps, G4double X, G4double phi, const G4StokesVector &p0, const G4StokesVector &p1, G4int flag=0)
G4PolarizedComptonModel(const G4ParticleDefinition *p=0, const G4String &nam="Polarized-Compton")
G4LogicalVolume * GetLogicalVolume() const
static const char sss[MAX_N_PAR+2]
G4double ComputeAsymmetryPerAtom(G4double gammaEnergy, G4double Z)
G4StokesVector theBeamPolarization
bool IsPolarized(G4LogicalVolume *lVol) const
const G4ThreeVector & GetPolarization() const
virtual ~G4PolarizedComptonModel()
G4VPhysicalVolume * GetVolume() const
const G4Track * GetCurrentTrack() const
void SetProposedKineticEnergy(G4double proposedKinEnergy)
G4ParticleDefinition * theElectron
const G4String & GetName() const
void ProposeTrackStatus(G4TrackStatus status)
virtual G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition *, G4double kinEnergy, G4double Z, G4double A, G4double cut, G4double emax)
const G4ThreeVector & GetVolumePolarization(G4LogicalVolume *lVol) const
double epsilon(double density, double temperature)
void RotateAz(G4ThreeVector nInteractionFrame, G4ThreeVector particleDirection)