131{
135
136 if (verboseLevel>=1)
137 G4cout<<
"G4PolarizedComptonModel::SampleSecondaries in "
139
141
142
145
146
149
150
151
152
153
155
156
157
158 if (targetIsPolarized)
159 theTargetPolarization.
rotateUz(gamDirection0);
160
161
162
163
164
165
167 G4double E0_m = gamEnergy0 / electron_mass_c2 ;
168
169
170
171
172
173
174 G4double epsilon, epsilonsq, onecost, sint2, greject ;
175
179 G4double alpha2 = 0.5*(1.- epsilon0sq);
180
181 G4double polarization = theBeamPolarization.
p3()*theTargetPolarization.
p3();
182 do {
185 epsilonsq = epsilon*epsilon;
186
187 } else {
189 epsilon = std::sqrt(epsilonsq);
190 };
191
192 onecost = (1.- epsilon)/(epsilon*E0_m);
193 sint2 = onecost*(2.-onecost);
194
195
196 G4double gdiced = 2.*(1./epsilon+epsilon);
197 G4double gdist = 1./epsilon + epsilon - sint2
198 - polarization*(1./epsilon-epsilon)*(1.-onecost);
199
200 greject = gdist/gdiced;
201
202 if (greject>1)
G4cout<<
"ERROR in PolarizedComptonScattering::PostStepDoIt\n"
203 <<
" costh rejection does not work properly: "<<greject<<
G4endl;
204
206
207
208
209
210
212 G4double sinTeta = std::sqrt (sint2);
214 do {
216 G4double gdiced = 1./epsilon + epsilon - sint2
217 + std::abs(theBeamPolarization.
p3())*
218 ( std::abs((1./epsilon-epsilon)*cosTeta*theTargetPolarization.
p3())
219 +(1.-epsilon)*sinTeta*(std::sqrt(
sqr(theTargetPolarization.
p1())
220 +
sqr(theTargetPolarization.
p2()))))
221 +sint2*(std::sqrt(
sqr(theBeamPolarization.
p1()) +
sqr(theBeamPolarization.
p2())));
222
223 G4double gdist = 1./epsilon + epsilon - sint2
224 + theBeamPolarization.
p3()*
225 ((1./epsilon-epsilon)*cosTeta*theTargetPolarization.
p3()
226 +(1.-epsilon)*sinTeta*(std::cos(Phi)*theTargetPolarization.
p1()+
227 std::sin(Phi)*theTargetPolarization.
p2()))
228 -sint2*(std::cos(2.*Phi)*theBeamPolarization.
p1()
229 +std::sin(2.*Phi)*theBeamPolarization.
p2());
230 greject = gdist/gdiced;
231
232 if (greject>1.+1.e-10 || greject<0)
G4cout<<
"ERROR in PolarizedComptonScattering::PostStepDoIt\n"
233 <<
" phi rejection does not work properly: "<<greject<<
G4endl;
234
235 if (greject<1.e-3) {
236 G4cout<<
"ERROR in PolarizedComptonScattering::PostStepDoIt\n"
237 <<" phi rejection does not work properly: "<<greject<<"\n";
238 G4cout<<
" greject="<<greject<<
" phi="<<Phi<<
" cost="<<cosTeta<<
"\n";
239 G4cout<<
" gdiced="<<gdiced<<
" gdist="<<gdist<<
"\n";
240 G4cout<<
" eps="<<epsilon<<
" 1/eps="<<1./epsilon<<
"\n";
241 }
242
244 G4double dirx = sinTeta*std::cos(Phi), diry = sinTeta*std::sin(Phi), dirz = cosTeta;
245
246
247
248
249
251 gamDirection1.rotateUz(gamDirection0);
252 G4double gamEnergy1 = epsilon*gamEnergy0;
254
255
258 } else {
262 }
263
264
265
266
267
268 G4double eKinEnergy = gamEnergy0 - gamEnergy1;
269 G4ThreeVector eDirection = gamEnergy0*gamDirection0 - gamEnergy1*gamDirection1;
270 eDirection = eDirection.
unit();
271
272
273
274
278
279
280
281
284 else
286
287
288
289 if (verboseLevel>=1) {
290 G4cout <<
"========================================\n";
291 G4cout <<
" nInteractionFrame = " <<nInteractionFrame<<
"\n";
292 G4cout <<
" GammaDirection0 = " <<gamDirection0<<
"\n";
293 G4cout <<
" gammaPolarization = " <<theBeamPolarization<<
"\n";
294 G4cout <<
" electronPolarization = " <<theTargetPolarization<<
"\n";
295 }
296
297 theBeamPolarization.
InvRotateAz(nInteractionFrame,gamDirection0);
298 theTargetPolarization.
InvRotateAz(nInteractionFrame,gamDirection0);
299
300 if (verboseLevel>=1) {
301 G4cout <<
"----------------------------------------\n";
302 G4cout <<
" gammaPolarization = " <<theBeamPolarization<<
"\n";
303 G4cout <<
" electronPolarization = " <<theTargetPolarization<<
"\n";
304 G4cout <<
"----------------------------------------\n";
305 }
306
307
308 crossSectionCalculator->
Initialize(epsilon,E0_m,0.,
309 theBeamPolarization,
310 theTargetPolarization,2);
311 }
312
313
314 {
315
316
317 finalGammaPolarization = crossSectionCalculator->
GetPol2();
318 if (verboseLevel>=1)
G4cout <<
" gammaPolarization1 = " <<finalGammaPolarization<<
"\n";
320
321
322 finalGammaPolarization.RotateAz(nInteractionFrame,gamDirection1);
323
325 if (finalGammaPolarization.mag() > 1.+1.e-8){
326 G4cout<<
"ERROR in Polarizaed Compton Scattering !"<<
G4endl;
327 G4cout<<
"Polarization of final photon more than 100%"<<
G4endl;
328 G4cout<<finalGammaPolarization<<
" mag = "<<finalGammaPolarization.mag()<<
G4endl;
329 }
330 if (verboseLevel>=1) {
331 G4cout <<
" gammaPolarization1 = " <<finalGammaPolarization<<
"\n";
332 G4cout <<
" GammaDirection1 = " <<gamDirection1<<
"\n";
333 }
334 }
335
336
337 {
338 finalElectronPolarization = crossSectionCalculator->
GetPol3();
339 if (verboseLevel>=1)
340 G4cout <<
" electronPolarization1 = " <<finalElectronPolarization<<
"\n";
341
342
343 finalElectronPolarization.
RotateAz(nInteractionFrame,eDirection);
344 if (verboseLevel>=1) {
345 G4cout <<
" electronPolarization1 = " <<finalElectronPolarization<<
"\n";
346 G4cout <<
" ElecDirection = " <<eDirection<<
"\n";
347 }
348 }
349 if (verboseLevel>=1)
350 G4cout <<
"========================================\n";
351
352
354
355
357
358 if (finalElectronPolarization.mag() > 1.+1.e-8){
359 G4cout<<
"ERROR in Polarizaed Compton Scattering !"<<
G4endl;
360 G4cout<<
"Polarization of final electron more than 100%"<<
G4endl;
361 G4cout<<finalElectronPolarization<<
" mag = "<<finalElectronPolarization.mag()<<
G4endl;
362 }
364 finalElectronPolarization.p2(),
365 finalElectronPolarization.p3());
366 fvect->push_back(aElectron);
367 }
368}
Hep3Vector & rotateUz(const Hep3Vector &)
const G4ThreeVector & GetMomentumDirection() const
void SetPolarization(G4double polX, G4double polY, G4double polZ)
G4double GetKineticEnergy() const
const G4ThreeVector & GetPolarization() const
G4ParticleChangeForGamma * fParticleChange
G4double lowestGammaEnergy
G4ParticleDefinition * theElectron
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
virtual void Initialize(G4double eps, G4double X, G4double phi, const G4StokesVector &p0, const G4StokesVector &p1, G4int flag=0)
void InvRotateAz(G4ThreeVector nInteractionFrame, G4ThreeVector particleDirection)
void RotateAz(G4ThreeVector nInteractionFrame, G4ThreeVector particleDirection)
G4VPhysicalVolume * GetVolume() const
void ProposeTrackStatus(G4TrackStatus status)
G4double GetLocalEnergyDeposit() const
void ProposeLocalEnergyDeposit(G4double anEnergyPart)
G4LogicalVolume * GetLogicalVolume() const