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