262 {
263 aParticleChange.Initialize(aTrack);
264
265
266 const G4DynamicParticle *aParticle(aTrack.GetDynamicParticle());
267 G4double KineticEnergy(aParticle->GetKineticEnergy());
268
269
271 return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
272
273
274 G4double
ParticleMass(aParticle->GetDefinition()->GetPDGMass());
275 G4double
Gamma(1.0 + KineticEnergy/ParticleMass);
276
279 return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
280 }
281
282 G4double FoilThickness(0.);
283 G4double GasThickness(0.);
285
286
287 std::vector<TRTRadiatorParameters>::const_iterator currentRadiator(
m_radiators.begin());
288 const std::vector<TRTRadiatorParameters>::const_iterator endOfRadiators(
m_radiators.end());
289 while(currentRadiator!=endOfRadiators) {
290 if ( currentRadiator->GetLogicalVolume() ==
291 aTrack.GetVolume()->GetLogicalVolume() ) {
292 FoilThickness = currentRadiator->GetFoilThickness();
293 GasThickness = currentRadiator->GetGasThickness();
294 BEflag = currentRadiator->GetBEflag();
295 break;
296 }
297 ++currentRadiator;
298 }
299
300 if ( currentRadiator == endOfRadiators ) {
301 return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
302 }
303
305 << currentRadiator->GetLogicalVolume()->GetName() );
306
307 G4ThreeVector ParticleDirection(aParticle->GetMomentumDirection());
308
310 G4double costh(std::abs(ParticleDirection[2]));
311 FoilThickness /= costh;
312 GasThickness /= costh;
313 }
314
316 G4int FoilsTraversed(static_cast<G4int>(StepLength/(FoilThickness+GasThickness)+0.5));
317
318
319
320
321
322 if ( FoilsTraversed == 0 ) {
324 return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
325 }
326
327 G4double Gy(0.), Gmany(0.), Neff(0.);
328
329
330
331
332
333
334
336
337#ifdef ARTRU
339 Gamma,
340 GasThickness,
341 FoilThickness );
344 GasThickness,
345 FoilThickness,
346 FoilsTraversed );
347#else
349 Gamma,
350 GasThickness,
351 FoilThickness );
354 GasThickness,
355 FoilThickness,
356 FoilsTraversed );
357#endif
358
359 Gmany = Neff*Gy;
361
362 }
363
364
366 G4double Sph_org(Sph);
367
369 G4double tempLog10Gamma(log10(Gamma));
370 G4double pHT_dEdxData = -0.001 + 0.0005*tempLog10Gamma;
371 G4double pHT_TRData = 0.15/(1.0 +
exp(-(tempLog10Gamma - 3.3)/0.27));
372 G4double pHT_dEdxMC = -0.0031 + 0.00016*tempLog10Gamma;
373 G4double pHT_TRMC = 0.1289/(1.0 +
exp(-(tempLog10Gamma - 3.01)/0.1253));
374
375 G4double fudge = std::min(2.0,(pHT_dEdxData+pHT_TRData)/( pHT_dEdxMC+pHT_TRMC));
376
377 Sph *= fudge;
378 }
379
380
381 G4long NumberOfPhotonsGenerated(CLHEP::RandPoisson::shoot(Sph));
382
383
384 Sph = Sph_org;
385
387 << ", Gamma = " << Gamma
388 << ", Sph = " << Sph
389 << ", Nph = " << NumberOfPhotonsGenerated );
390
391 if ( NumberOfPhotonsGenerated <= 0 ) {
393 << "No photons generated." );
394
395 return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
396 }
397
398
399 aParticleChange.SetNumberOfSecondaries( NumberOfPhotonsGenerated );
400 G4StepPoint *pPostStepPoint(aStep.GetPostStepPoint());
401 G4ThreeVector x0(pPostStepPoint->GetPosition());
402
403 G4double Esum(0.), XRannu(0.), Ephot(0.),
Theta(0.),
Phi(0.),
405
406 G4ThreeVector
pos(0),TRPhotonDirection(0);
407
408 for( G4int
i(0);
i<NumberOfPhotonsGenerated; ++
i ) {
409 XRannu = CLHEP::RandFlat::shoot();
411
412 Esum += Ephot;
413
414 pos = pPostStepPoint->GetPosition();
415
416 ATH_MSG_VERBOSE (
" Photon generated with energy : " << Ephot/CLHEP::keV
417 <<
" keV; position: ( " <<
pos.x()/CLHEP::cm <<
" cm, "
418 <<
pos.y()/CLHEP::cm <<
" cm, " <<
pos.z()/CLHEP::cm <<
" cm )" );
419
420
421 Theta = std::abs( CLHEP::RandGaussZiggurat::shoot( 0.0,
M_PI/Gamma ) );
422 if( Theta >= 0.1 )
Theta = 0.1;
423
424 Phi = (2.*
M_PI)*CLHEP::RandFlat::shoot();
425
429
430 TRPhotonDirection.set(X,Y,Z);
431 TRPhotonDirection.rotateUz( ParticleDirection );
432 TRPhotonDirection.unit();
433
434 G4DynamicParticle*
435 TRPhoton = new G4DynamicParticle( G4Gamma::Gamma(),
436 TRPhotonDirection,
437 Ephot );
438 aParticleChange.AddSecondary( TRPhoton );
439
440 }
441
442 aParticleChange.ProposeEnergy( KineticEnergy-Esum );
443
445 << "Number of TR photons generated: " << NumberOfPhotonsGenerated );
446
447 return &aParticleChange;
448}
#define ATH_MSG_VERBOSE(x)
G4double NeffNevski(const G4double &sigGas, const G4double &sigFoil, const G4double &GasThickness, const G4double &FoilThickness, const G4int &FoilsTraversed) const
G4double XFinter(const G4double &X, const G4double *A, const G4double *F) const
G4double XInteg(const G4double *yy, G4double *ss) const
G4double XEmitanNevski(const G4double &PhotonEnergy, const G4double &Gamma, const G4double &GasThickness, const G4double &FoilThickness) const
G4double NeffArtru(const G4double &sigGas, const G4double &sigFoil, const G4double &GasThickness, const G4double &FoilThickness, const G4int &FoilsTraversed) const
G4double XEmitanArtru(const G4double &PhotonEnergy, const G4double &Gamma, const G4double &GasThickness, const G4double &FoilThickness) const