132{
133
135
139
140 if (verboseLevel >= 1) {
141 G4cout<<
"G4PolarizedComptonModel::SampleSecondaries in "
143 }
146
147
150
151
153 theTargetPolarization =
155
156
157
158
159
161
162
163
164 if (targetIsPolarized) {
165 theTargetPolarization.
rotateUz(gamDirection0);
166 }
167
168
169
170
171
172
174 G4double E0_m = gamEnergy0 / electron_mass_c2 ;
175
176
177
178
179
186
190 G4double alpha2 = alpha1 + 0.5*(1.- epsilon0sq);
191
193 theBeamPolarization.
p3()*theTargetPolarization.
p3();
194
198
200
201 do {
202 do {
203 ++nloop;
204
205 if(nloop > nlooplim) {
206 PrintWarning(aDynamicGamma, nloop, greject, onecost, Phi,
207 "too many iterations");
208 return;
209 }
210
211
213
214 if ( alpha1 > alpha2*rndm[0]) {
216 } else {
217 epsilon = std::sqrt(epsilon0sq + (1.- epsilon0sq)*rndm[1]);
218 }
219
221 sint2 = onecost*(2.-onecost);
222
226
227 greject = gdist/gdiced;
228
229 if (greject > 1.0) {
230 PrintWarning(aDynamicGamma, nloop, greject, onecost, Phi,
231 "theta majoranta wrong");
232 }
233
234 } while (greject < rndm[2]);
235
236
237 end = true;
238
239
240
241
242 cosTeta = 1. - onecost;
243 sinTeta = std::sqrt(sint2);
244 do {
245 ++nloop;
246
247
249
250
251 Phi = twopi * rndm[0];
252 if(nloop > nlooplim) {
253 PrintWarning(aDynamicGamma, nloop, greject, onecost, Phi,
254 "too many iterations");
255 return;
256 }
257
259 + std::abs(theBeamPolarization.
p3())*
261 +(1.-
epsilon)*sinTeta*(std::sqrt(
sqr(theTargetPolarization.
p1())
262 +
sqr(theTargetPolarization.
p2()))))
263 +sint2*(std::sqrt(
sqr(theBeamPolarization.
p1()) +
264 sqr(theBeamPolarization.
p2())));
265
267 + theBeamPolarization.
p3()*
269 +(1.-
epsilon)*sinTeta*(std::cos(Phi)*theTargetPolarization.
p1()+
270 std::sin(Phi)*theTargetPolarization.
p2()))
271 -sint2*(std::cos(2.*Phi)*theBeamPolarization.
p1()
272 +std::sin(2.*Phi)*theBeamPolarization.
p2());
273 greject = gdist/gdiced;
274
275 if (greject > 1.0) {
276 PrintWarning(aDynamicGamma, nloop, greject, onecost, Phi,
277 "phi majoranta wrong");
278 }
279
280 if(greject < 1.e-3) {
281 PrintWarning(aDynamicGamma, nloop, greject, onecost, Phi,
282 "phi loop ineffective");
283
284 end = false;
285 break;
286 }
287
288
289 } while (greject < rndm[1]);
290 } while(!end);
291 G4double dirx = sinTeta*std::cos(Phi), diry = sinTeta*std::sin(Phi),
292 dirz = cosTeta;
293
294
295
296
297
299 gamDirection1.rotateUz(gamDirection0);
301
306 } else {
309 edep = gamEnergy1;
310 }
311
312
313
314
317
318
319
320 if (verboseLevel>=1) {
321 G4cout <<
"========================================\n";
322 G4cout <<
" nInteractionFrame = " <<nInteractionFrame<<
"\n";
323 G4cout <<
" GammaDirection0 = " <<gamDirection0<<
"\n";
324 G4cout <<
" gammaPolarization = " <<theBeamPolarization<<
"\n";
325 G4cout <<
" electronPolarization = " <<theTargetPolarization<<
"\n";
326 }
327
328 theBeamPolarization.
InvRotateAz(nInteractionFrame,gamDirection0);
329 theTargetPolarization.
InvRotateAz(nInteractionFrame,gamDirection0);
330
331 if (verboseLevel>=1) {
332 G4cout <<
"----------------------------------------\n";
333 G4cout <<
" gammaPolarization = " <<theBeamPolarization<<
"\n";
334 G4cout <<
" electronPolarization = " <<theTargetPolarization<<
"\n";
335 G4cout <<
"----------------------------------------\n";
336 }
337
338
340 theBeamPolarization,
341 theTargetPolarization,2);
342
344
345
346
347 finalGammaPolarization = crossSectionCalculator->
GetPol2();
348 if (verboseLevel>=1) {
349 G4cout <<
" gammaPolarization1 = " <<finalGammaPolarization<<
"\n";
350 }
352
353
354 finalGammaPolarization.
RotateAz(nInteractionFrame,gamDirection1);
355 if (finalGammaPolarization.
mag() > 1.+1.e-8){
356 G4cout<<
"ERROR in Polarizaed Compton Scattering !"<<
G4endl;
357 G4cout<<
"Polarization of final photon more than 100%"<<
G4endl;
358 G4cout<<finalGammaPolarization<<
" mag = "
360 }
361
363 if (verboseLevel>=1) {
364 G4cout <<
" gammaPolarization1 = " <<finalGammaPolarization<<
"\n";
365 G4cout <<
" GammaDirection1 = " <<gamDirection1<<
"\n";
366 }
367 }
368
369
370
371
372 G4double eKinEnergy = gamEnergy0 - gamEnergy1;
373
375
377 gamEnergy0*gamDirection0 - gamEnergy1*gamDirection1;
378 eDirection = eDirection.
unit();
379
380 finalElectronPolarization = crossSectionCalculator->
GetPol3();
381 if (verboseLevel>=1) {
382 G4cout <<
" electronPolarization1 = "
383 <<finalElectronPolarization<<"\n";
384 }
385
386 finalElectronPolarization.
RotateAz(nInteractionFrame,eDirection);
387 if (verboseLevel>=1) {
388 G4cout <<
" electronPolarization1 = "
389 <<finalElectronPolarization<<"\n";
390 G4cout <<
" ElecDirection = " <<eDirection<<
"\n";
391 }
392
393
396
397 if (finalElectronPolarization.
mag() > 1.+1.e-8){
398 G4cout<<
"ERROR in Polarizaed Compton Scattering !"<<
G4endl;
399 G4cout<<
"Polarization of final electron more than 100%"<<
G4endl;
400 G4cout<<finalElectronPolarization<<
" mag = "
401 <<finalElectronPolarization.
mag()<<
G4endl;
402 }
404 finalElectronPolarization.
p2(),
405 finalElectronPolarization.
p3());
406 fvect->push_back(aElectron);
407 } else {
408 edep += eKinEnergy;
409 }
410
411 if(edep > 0.0) {
413 }
414}
double epsilon(double density, double temperature)
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
Hep3Vector & rotateUz(const Hep3Vector &)
virtual void flatArray(const int size, double *vect)=0
void SetPolarization(const G4ThreeVector &)
const G4ThreeVector & GetMomentumDirection() const
G4double GetKineticEnergy() const
const G4ThreeVector & GetPolarization() const
G4double lowestSecondaryEnergy
G4ParticleChangeForGamma * fParticleChange
G4ParticleDefinition * theElectron
const G4String & GetName() const
const G4Track * GetCurrentTrack() const
void SetProposedKineticEnergy(G4double proposedKinEnergy)
void ProposePolarization(const G4ThreeVector &dir)
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
static G4ThreeVector GetFrame(const G4ThreeVector &, const G4ThreeVector &)
bool IsPolarized(G4LogicalVolume *lVol) const
static G4PolarizationManager * GetInstance()
const G4ThreeVector & GetVolumePolarization(G4LogicalVolume *lVol) const
G4StokesVector GetPol2() override
G4StokesVector GetPol3() override
virtual void Initialize(G4double eps, G4double X, G4double phi, const G4StokesVector &p0, const G4StokesVector &p1, G4int flag=0) override
void InvRotateAz(G4ThreeVector nInteractionFrame, G4ThreeVector particleDirection)
void RotateAz(G4ThreeVector nInteractionFrame, G4ThreeVector particleDirection)
G4VPhysicalVolume * GetVolume() const
G4double LowEnergyLimit() const
void ProposeTrackStatus(G4TrackStatus status)
void ProposeLocalEnergyDeposit(G4double anEnergyPart)
G4LogicalVolume * GetLogicalVolume() const