153{
154
155
157
158
161
162
164
166
168 G4double sinTeta = std::sqrt((1.0 - cosTeta)*(1.0 + cosTeta));
170 G4ThreeVector dir(sinTeta*std::cos(phi), sinTeta*std::sin(phi), cosTeta);
173 return;
174 }
175
176
178
179
181
182
187
188
189 if (targetIsPolarized)
191
193
194
195 G4double polarization = theBeamPolarization.
p3()*theTargetPolarization.
p3();
196
197 G4double gamam1 = PositKinEnergy/electron_mass_c2;
198 G4double gama = gamam1+1. , gamap1 = gamam1+2.;
199 G4double sqgrate = std::sqrt(gamam1/gamap1)/2. , sqg2m1 = std::sqrt(gamam1*gamap1);
200
201
202 G4double epsilmin = 0.5 - sqgrate , epsilmax = 0.5 + sqgrate;
203 G4double epsilqot = epsilmax/epsilmin;
204
205
206
207
208
209
211 G4double gmax=1. + std::fabs(polarization);
212
213
214
215 crossSectionCalculator->
Initialize(epsilmin, gama, 0., theBeamPolarization, theTargetPolarization);
217 G4cout<<
"ERROR in PolarizedAnnihilationPS::PostStepDoIt\n"
218 <<
"epsilmin DiceRoutine not appropriate ! "<<crossSectionCalculator->
DiceEpsilon()<<
G4endl;
219
220 }
221
222 crossSectionCalculator->
Initialize(epsilmax, gama, 0., theBeamPolarization, theTargetPolarization);
224 G4cout<<
"ERROR in PolarizedAnnihilationPS::PostStepDoIt\n"
225 <<
"epsilmax DiceRoutine not appropriate ! "<<crossSectionCalculator->
DiceEpsilon()<<
G4endl;
226
227 }
228
232
233
234 do {
235
237
238 crossSectionCalculator->
Initialize(epsil, gama, 0., theBeamPolarization, theTargetPolarization,1);
239
241 treject*=epsil;
242
243 if (treject>gmax || treject<0.)
244 G4cout<<
"ERROR in PolarizedAnnihilationPS::PostStepDoIt\n"
245 <<
" eps ("<<epsil<<
") rejection does not work properly: "<<treject<<
G4endl;
246 ++ncount;
247 if (treject>trejectmax) trejectmax=treject;
248 if (ncount>1000) {
249 G4cout<<
"WARNING in PolarizedAnnihilationPS::PostStepDoIt\n"
250 <<"eps dicing very inefficient ="<<trejectmax/gmax
251 <<
", "<<treject/gmax<<
". For secondary energy = "<<epsil<<
" "<<ncount<<
G4endl;
252 break;
253 }
254
256
257
258
259
260
261 G4double cost = (epsil*gamap1-1.)/(epsil*sqg2m1);
262 G4double sint = std::sqrt((1.+cost)*(1.-cost));
264 G4double beamTrans = std::sqrt(
sqr(theBeamPolarization.
p1()) +
sqr(theBeamPolarization.
p2()));
265 G4double targetTrans = std::sqrt(
sqr(theTargetPolarization.
p1()) +
sqr(theTargetPolarization.
p2()));
266
267
268 do{
270 crossSectionCalculator->
Initialize(epsil, gama, 0., theBeamPolarization, theTargetPolarization,2);
271
273 gdiced += crossSectionCalculator->
getVar(3)*theBeamPolarization.
p3()*theTargetPolarization.
p3();
274 gdiced += 1.*(std::fabs(crossSectionCalculator->
getVar(1))
275 + std::fabs(crossSectionCalculator->
getVar(2)))*beamTrans*targetTrans;
276 gdiced += 1.*std::fabs(crossSectionCalculator->
getVar(4))
277 *(std::fabs(theBeamPolarization.
p3())*targetTrans + std::fabs(theTargetPolarization.
p3())*beamTrans);
278
280 gdist += crossSectionCalculator->
getVar(3)*theBeamPolarization.
p3()*theTargetPolarization.
p3();
281 gdist += crossSectionCalculator->
getVar(1)*(std::cos(phi)*theBeamPolarization.
p1()
282 + std::sin(phi)*theBeamPolarization.
p2())
283 *(std::cos(phi)*theTargetPolarization.
p1()
284 + std::sin(phi)*theTargetPolarization.
p2());
285 gdist += crossSectionCalculator->
getVar(2)*(std::cos(phi)*theBeamPolarization.
p2()
286 - std::sin(phi)*theBeamPolarization.
p1())
287 *(std::cos(phi)*theTargetPolarization.
p2()
288 - std::sin(phi)*theTargetPolarization.
p1());
289 gdist += crossSectionCalculator->
getVar(4)
290 *(std::cos(phi)*theBeamPolarization.
p3()*theTargetPolarization.
p1()
291 + std::cos(phi)*theBeamPolarization.
p1()*theTargetPolarization.
p3()
292 + std::sin(phi)*theBeamPolarization.
p3()*theTargetPolarization.
p2()
293 + std::sin(phi)*theBeamPolarization.
p2()*theTargetPolarization.
p3());
294
295 treject = gdist/gdiced;
296
297 if (treject>1.+1.e-10 || treject<0){
298 G4cout<<
"!!!ERROR in PolarizedAnnihilationPS::PostStepDoIt\n"
299 <<
" phi rejection does not work properly: "<<treject<<
G4endl;
303 }
304
305 if (treject<1.e-3) {
306 G4cout<<
"!!!ERROR in PolarizedAnnihilationPS::PostStepDoIt\n"
307 <<" phi rejection does not work properly: "<<treject<<"\n";
308 G4cout<<
" gdiced="<<gdiced<<
" gdist="<<gdist<<
"\n";
310 }
311
313
314
315 G4double dirx = sint*std::cos(phi) , diry = sint*std::sin(phi) , dirz = cost;
316
317
318
319
320 G4double TotalAvailableEnergy = PositKinEnergy + 2*electron_mass_c2;
321 G4double Phot1Energy = epsil*TotalAvailableEnergy;
322 G4double Phot2Energy =(1.-epsil)*TotalAvailableEnergy;
323
324
326
327
330
331
332 theBeamPolarization.
InvRotateAz(nInteractionFrame,PositDirection);
333 theTargetPolarization.
InvRotateAz(nInteractionFrame,PositDirection);
334
335
336
337 crossSectionCalculator->
Initialize(epsil,gama,phi,theBeamPolarization,theTargetPolarization,2);
338
339
340
341 Phot1Direction.rotateUz(PositDirection);
342
344 Phot1Direction, Phot1Energy);
345 finalGamma1Polarization=crossSectionCalculator->
GetPol2();
347 if (n1>1) {
348 G4cout<<
"ERROR: PolarizedAnnihilation Polarization Vector at epsil = "
349 <<epsil<<" is too large!!! \n"
350 <<"annihi pol1= "<<finalGamma1Polarization<<", ("<<n1<<")\n";
351 finalGamma1Polarization*=1./std::sqrt(n1);
352 }
353
354
356 finalGamma1Polarization.
RotateAz(nInteractionFrame,Phot1Direction);
358 finalGamma1Polarization.
p2(),
359 finalGamma1Polarization.
p3());
360
361 fvect->push_back(aParticle1);
362
363
364
365
366 G4double Eratio= Phot1Energy/Phot2Energy;
367 G4double PositP= std::sqrt(PositKinEnergy*(PositKinEnergy+2.*electron_mass_c2));
369 (PositP-dirz*Phot1Energy)/Phot2Energy);
370 Phot2Direction.rotateUz(PositDirection);
371
373 Phot2Direction, Phot2Energy);
374
375
376 finalGamma2Polarization=crossSectionCalculator->
GetPol3();
378 if (n2>1) {
379 G4cout<<
"ERROR: PolarizedAnnihilation Polarization Vector at epsil = "<<epsil<<
" is too large!!! \n";
380 G4cout<<
"annihi pol2= "<<finalGamma2Polarization<<
", ("<<n2<<
")\n";
381
382 finalGamma2Polarization*=1./std::sqrt(n2);
383 }
385 finalGamma2Polarization.
RotateAz(nInteractionFrame,Phot2Direction);
387 finalGamma2Polarization.
p2(),
388 finalGamma2Polarization.
p3());
389
390 fvect->push_back(aParticle2);
391}
Hep3Vector & rotateUz(const Hep3Vector &)
const G4ThreeVector & GetMomentumDirection() const
void SetPolarization(G4double polX, G4double polY, G4double polZ)
G4double GetKineticEnergy() const
const G4Track * GetCurrentTrack() const
void SetProposedKineticEnergy(G4double proposedKinEnergy)
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 gamma, 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
const G4ThreeVector & GetPolarization() const
void ProposeTrackStatus(G4TrackStatus status)
G4LogicalVolume * GetLogicalVolume() const