287{
288 if (verboseLevel > 1) {
289
290 G4cout <<
"Calling SampleSecondaries() of G4JAEAPolarizedElasticScatteringModel."
292 }
294
295
296 if (photonEnergy0 <= lowEnergyLimit)
297 {
301 return ;
302 }
303
307
308
309
310G4int energyindex=round(100*photonEnergy0)-1;
311
312
314 for (
G4int i=0;i<=180;++i)
315 {
316 a1=Polarized_ES_Data[Z]->at(4*i+300+181*4*(energyindex));
317 a2=Polarized_ES_Data[Z]->at(4*i+1+300+181*4*(energyindex));
318 a3=Polarized_ES_Data[Z]->at(4*i+2+300+181*4*(energyindex));
319 a4=Polarized_ES_Data[Z]->at(4*i+3+300+181*4*(energyindex));
320 distribution[i]=a1*a1+a2*a2+a3*a3+a4*a4;
321 }
322
324
325 G4double theta = CLHEP::pi*GenThetaDist.shoot();
326
327
328 G4int theta_in_degree =round(theta*180./CLHEP::pi);
329
330
331
332 G4double am1=0,am2=0,am3=0,am4=0,aparaSquare=0,aperpSquare=0,apara_aper_Asterisk=0,img_apara_aper_Asterisk=0;
333 am1=Polarized_ES_Data[Z]->at(4*theta_in_degree+300+181*4*(energyindex));
334 am2=Polarized_ES_Data[Z]->at(4*theta_in_degree+1+300+181*4*(energyindex));
335 am3=Polarized_ES_Data[Z]->at(4*theta_in_degree+2+300+181*4*(energyindex));
336 am4=Polarized_ES_Data[Z]->at(4*theta_in_degree+3+300+181*4*(energyindex));
337 aparaSquare=am1*am1+am2*am2;
338 aperpSquare=am3*am3+am4*am4;
339 apara_aper_Asterisk=2*a1*a3+2*a2*a4;
340 img_apara_aper_Asterisk=2*a1*a4-2*a2*a3;
341
350
351
352
353G4double Xi1=0, Xi2=0, Xi3=0, Xi1_Prime=0,Xi2_Prime=0,Xi3_Prime=0;
354
355
357Xi1=gammaPolarization0.
x();
358Xi2=gammaPolarization0.
y();
359Xi3=gammaPolarization0.
z();
360
361
362
363if ((gammaPolarization0.
mag())>1.05 || (Xi1*Xi1>1.05) || (Xi2*Xi2>1.05) || (Xi3*Xi3>1.05))
364 {
365 G4Exception(
"G4JAEAPolarizedElasticScatteringModel::SampleSecondaries()",
"em1006",
367 "WARNING: G4JAEAPolarizedElasticScatteringModel is only compatible with a unit polarization vector.");
368 return;
369}
370
371if (Xi1==0 && Xi2==0 && Xi3==0)
372{
374 if (fLinearPolarizationSensitvity1)
375 Phi_Unpolarized=GeneratePolarizedPhi(aparaSquare,aperpSquare,0.);
376 else
378 Direction_Unpolarized.setX(sin(theta)*cos(Phi_Unpolarized));
379 Direction_Unpolarized.setY(sin(theta)*sin(Phi_Unpolarized));
380 Direction_Unpolarized.setZ(cos(theta));
382 Xi1_Prime=(aparaSquare-aperpSquare)/(aparaSquare+aperpSquare);
383 Polarization_Unpolarized.setX(Xi1_Prime);
384 Polarization_Unpolarized.setY(0.);
385 Polarization_Unpolarized.setZ(0.);
388 return;
389}
390
391
393if(InitialAzimuth<0) InitialAzimuth=InitialAzimuth+CLHEP::twopi;
394
396
397Phi_Linear1 = GeneratePolarizedPhi(aparaSquare+aperpSquare+Xi1*(aparaSquare-aperpSquare),
398 aparaSquare+aperpSquare-Xi1*(aparaSquare-aperpSquare),InitialAzimuth);
399
400Xi1_Prime=((aparaSquare-aperpSquare)+Xi1*(aparaSquare+aperpSquare)*cos(2*Phi_Linear1))/
401 ((aparaSquare+aperpSquare)+Xi1*(aparaSquare-aperpSquare)*cos(2*Phi_Linear1));
402Xi2_Prime=(-Xi1*apara_aper_Asterisk*sin(2*Phi_Linear1))/
403 ((aparaSquare+aperpSquare)+Xi1*(aparaSquare-aperpSquare)*cos(2*Phi_Linear1));
404Xi3_Prime=(-Xi1*img_apara_aper_Asterisk*sin(2*Phi_Linear1))/
405 ((aparaSquare+aperpSquare)+Xi1*(aparaSquare-aperpSquare)*cos(2*Phi_Linear1));
406
407Direction_Linear1.setX(sin(theta)*cos(Phi_Linear1));
408Direction_Linear1.setY(sin(theta)*sin(Phi_Linear1));
409Direction_Linear1.setZ(cos(theta));
410Polarization_Linear1.setX(Xi1_Prime);
411Polarization_Linear1.setY(Xi2_Prime);
412Polarization_Linear1.setZ(Xi3_Prime);
413
414
415Xi1_Prime=Xi1_Prime*fLinearPolarizationSensitvity1;
416Xi2_Prime=Xi2_Prime*fLinearPolarizationSensitvity2;
417Xi3_Prime=Xi3_Prime*fCircularPolarizationSensitvity;
418
420if(abs(Xi1)>0.0) dsigmaL1=0.25*((aparaSquare+aperpSquare)*(1+Xi1*Xi1_Prime*cos(2*Phi_Linear1))+(aparaSquare-aperpSquare)*(Xi1*cos(2*Phi_Linear1)+Xi1_Prime)
421 -Xi1*Xi2_Prime*apara_aper_Asterisk*sin(2*Phi_Linear1)-Xi1*Xi3_Prime*img_apara_aper_Asterisk*sin(2*Phi_Linear1));
422
423
424
425
427
428InitialAzimuth=InitialAzimuth-CLHEP::pi/4.;
429if(InitialAzimuth<0) InitialAzimuth=InitialAzimuth+CLHEP::twopi;
430
431Phi_Linear2 = GeneratePolarizedPhi(aparaSquare+aperpSquare+Xi1*(aparaSquare-aperpSquare)
432 ,aparaSquare+aperpSquare-Xi1*(aparaSquare-aperpSquare),InitialAzimuth);
433
434Xi1_Prime=((aparaSquare-aperpSquare)+Xi2*(aparaSquare+aperpSquare)*sin(2*Phi_Linear2))/
435 ((aparaSquare+aperpSquare)+Xi2*(aparaSquare-aperpSquare)*sin(2*Phi_Linear2));
436Xi2_Prime=(Xi2*apara_aper_Asterisk*cos(2*Phi_Linear2))/
437 ((aparaSquare+aperpSquare)+Xi2*(aparaSquare-aperpSquare)*sin(2*Phi_Linear2));
438Xi3_Prime=(Xi2*img_apara_aper_Asterisk*cos(2*Phi_Linear2))/
439 ((aparaSquare+aperpSquare)+Xi2*(aparaSquare-aperpSquare)*sin(2*Phi_Linear2));
440
441Direction_Linear2.setX(sin(theta)*cos(Phi_Linear2));
442Direction_Linear2.setY(sin(theta)*sin(Phi_Linear2));
443Direction_Linear2.setZ(cos(theta));
444Polarization_Linear2.setX(Xi1_Prime);
445Polarization_Linear2.setY(Xi2_Prime);
446Polarization_Linear2.setZ(Xi3_Prime);
447
448
449Xi1_Prime=Xi1_Prime*fLinearPolarizationSensitvity1;
450Xi2_Prime=Xi2_Prime*fLinearPolarizationSensitvity2;
451Xi3_Prime=Xi3_Prime*fCircularPolarizationSensitvity;
452
454if(abs(Xi2)>0.0)
455dsigmaL2=0.25*((aparaSquare+aperpSquare)*(1+Xi2*Xi1_Prime*sin(2*Phi_Linear2))+(aparaSquare-aperpSquare)*(Xi2*sin(2*Phi_Linear2)+Xi1_Prime)
456 +Xi2*Xi2_Prime*apara_aper_Asterisk*cos(2*Phi_Linear2)-Xi2*Xi3_Prime*img_apara_aper_Asterisk*cos(2*Phi_Linear2));
457
458
459
462
463Xi1_Prime=(aparaSquare-aperpSquare)/(aparaSquare+aperpSquare);
464Xi2_Prime=(-Xi3*img_apara_aper_Asterisk)/(aparaSquare+aperpSquare);
465Xi3_Prime=(Xi3*apara_aper_Asterisk)/(aparaSquare+aperpSquare);
466
467Polarization_Circular.setX(Xi1_Prime);
468Polarization_Circular.setY(Xi2_Prime);
469Polarization_Circular.setZ(Xi3_Prime);
470
471
472Xi1_Prime=Xi1_Prime*fLinearPolarizationSensitvity1;
473Xi2_Prime=Xi2_Prime*fLinearPolarizationSensitvity2;
474Xi3_Prime=Xi3_Prime*fCircularPolarizationSensitvity;
475
477if(abs(Xi3)>0.0)
478dsigmaC=0.25*(aparaSquare+aperpSquare+Xi1_Prime*(aparaSquare-aperpSquare)-Xi3*Xi2_Prime*img_apara_aper_Asterisk
479 +Xi3*Xi3_Prime*apara_aper_Asterisk);
480
481if (abs(Xi3)==0.0 && abs(Xi1_Prime)==0.0)
482{
483 Direction_Circular.setX(sin(theta)*cos(Phi_Circular));
484 Direction_Circular.setY(sin(theta)*sin(Phi_Circular));
485 Direction_Circular.setZ(cos(theta));
486}
487else
488{
490 for (
G4int i=0;i<=180;++i)
491 {
492 c1=Polarized_ES_Data[Z]->at(4*i+300+181*4*(energyindex));
493 c2=Polarized_ES_Data[Z]->at(4*i+1+300+181*4*(energyindex));
494 c3=Polarized_ES_Data[Z]->at(4*i+2+300+181*4*(energyindex));
495 c4=Polarized_ES_Data[Z]->at(4*i+3+300+181*4*(energyindex));
496 cdistribution[i]=0.25*((c1*c1+c2*c2+c3*c3+c4*c4)+Xi1_Prime*(c1*c1+c2*c2-c3*c3-c4*c4)-Xi3*Xi2_Prime*(2*c1*c4-2*c2*c3)
497 +Xi3*Xi3_Prime*(2*c1*c4-2*c2*c3));
498 }
500Theta_Circular=CLHEP::pi*GenTheta_Circ_Dist.shoot();
501Direction_Circular.setX(sin(Theta_Circular)*cos(Phi_Circular));
502Direction_Circular.setY(sin(Theta_Circular)*sin(Phi_Circular));
503Direction_Circular.setZ(cos(Theta_Circular));
504}
505
506
507G4double totalSigma= dsigmaL1+dsigmaL2+dsigmaC;
511
512
513 if (abs(probc - dsigmaC/totalSigma)>=0.0001)
514 {
515 G4Exception(
"G4JAEAPolarizedElasticScatteringModel::SampleSecondaries()",
"em1007",
517 "WARNING: Polarization mixing might be incorrect.");
518 }
519
520
523
524
526if (polmix<=prob1)
527{
528 finaldirection.setX(Direction_Linear1.x());
529 finaldirection.setY(Direction_Linear1.y());
530 finaldirection.setZ(Direction_Linear1.z());
531 outcomingPhotonPolarization.setX(Polarization_Linear1.x());
532 outcomingPhotonPolarization.setY(Polarization_Linear1.y());
533 outcomingPhotonPolarization.setZ(Polarization_Linear1.z());
534}
535else if ((polmix>prob1) && (polmix<=prob1+prob2))
536{
537 finaldirection.setX(Direction_Linear2.x());
538 finaldirection.setY(Direction_Linear2.y());
539 finaldirection.setZ(Direction_Linear2.z());
540 outcomingPhotonPolarization.setX(Polarization_Linear2.x());
541 outcomingPhotonPolarization.setY(Polarization_Linear2.y());
542 outcomingPhotonPolarization.setZ(Polarization_Linear2.z());
543}
544else if (polmix>prob1+prob2)
545{
546 finaldirection.setX(Direction_Circular.x());
547 finaldirection.setY(Direction_Circular.y());
548 finaldirection.setZ(Direction_Circular.z());
549 outcomingPhotonPolarization.setX(Polarization_Circular.x());
550 outcomingPhotonPolarization.setY(Polarization_Circular.y());
551 outcomingPhotonPolarization.setZ(Polarization_Circular.z());
552}
553
554
559
560}
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
const G4ThreeVector & GetMomentumDirection() const
G4ParticleDefinition * GetDefinition() const
G4double GetKineticEnergy() const
const G4ThreeVector & GetPolarization() const
void SetProposedKineticEnergy(G4double proposedKinEnergy)
void ProposePolarization(const G4ThreeVector &dir)
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
const G4Element * SelectRandomAtom(const G4MaterialCutsCouple *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
void ProposeTrackStatus(G4TrackStatus status)
void ProposeLocalEnergyDeposit(G4double anEnergyPart)