224{
226
229
232
236
238 if(!MPT)
240
242 if(!Rindex)
244
246
249 G4double beta = (beta1 + beta2) * 0.5;
250
257
258 if(MeanNumberOfPhotons <= 0.0)
259 {
260
263 }
264
267
268
269
270 if(fNumPhotons <= 0 || !fStackingFlag ||
271 std::max(MeanNumberOfPhotons1, MeanNumberOfPhotons2) < 1e-15)
272 {
273
276 }
277
278
280
281 if(fTrackSecondariesFirst)
282 {
285 }
286
287
291
294
295 G4double maxCos = BetaInverse / nMax;
296 G4double maxSin2 = (1.0 - maxCos) * (1.0 + maxCos);
297
298 for(
G4int i = 0; i < fNumPhotons; ++i)
299 {
300
304
305
306 do
307 {
309 sampledEnergy = Pmin + rand * dp;
310 sampledRI = Rindex->
Value(sampledEnergy);
311 cosTheta = BetaInverse / sampledRI;
312
313 sin2Theta = (1.0 - cosTheta) * (1.0 + cosTheta);
315
316
317 } while(rand * maxSin2 > sin2Theta);
318
319
320
321
326 G4double sinTheta = std::sqrt(sin2Theta);
328 cosTheta);
329
330
331 photonMomentum.rotateUz(p0);
332
333
334 G4ThreeVector photonPolarization(cosTheta * cosPhi, cosTheta * sinPhi,
335 -sinTheta);
336
337
338 photonPolarization.rotateUz(p0);
339
340
341 auto aCerenkovPhoton =
343
344 aCerenkovPhoton->SetPolarization(photonPolarization);
345 aCerenkovPhoton->SetKineticEnergy(sampledEnergy);
346
348
349 do
350 {
352 NumberOfPhotons = MeanNumberOfPhotons1 -
353 rand * (MeanNumberOfPhotons1 - MeanNumberOfPhotons2);
355 G4UniformRand() * std::max(MeanNumberOfPhotons1, MeanNumberOfPhotons2);
356
357 }
while(
N > NumberOfPhotons);
358
361 delta /
364 0.5);
365
366 G4double aSecondaryTime = t0 + deltaTime;
368
369
371 new G4Track(aCerenkovPhoton, aSecondaryTime, aSecondaryPosition);
372
378 }
379
381 {
382 G4cout <<
"\n Exiting from G4Cerenkov::DoIt -- NumberOfSecondaries = "
384 }
385
387}
G4long G4Poisson(G4double mean)
G4double GetAverageNumberOfPhotons(const G4double charge, const G4double beta, const G4Material *aMaterial, G4MaterialPropertyVector *Rindex) const
G4ParticleDefinition * GetDefinition() const
static G4OpticalPhoton * OpticalPhoton()
void AddSecondary(G4Track *aSecondary)
void Initialize(const G4Track &) override
G4double GetVelocity() const
G4double GetGlobalTime() const
const G4ThreeVector & GetPosition() const
const G4TouchableHandle & GetTouchableHandle() const
G4ThreeVector GetDeltaPosition() const
G4StepPoint * GetPreStepPoint() const
G4double GetStepLength() const
G4StepPoint * GetPostStepPoint() const
G4TrackStatus GetTrackStatus() const
void SetTouchableHandle(const G4TouchableHandle &apValue)
G4Material * GetMaterial() const
const G4DynamicParticle * GetDynamicParticle() const
void SetCreatorModelID(const G4int id)
void SetParentID(const G4int aValue)
void ProposeTrackStatus(G4TrackStatus status)
G4int GetNumberOfSecondaries() const
void SetNumberOfSecondaries(G4int totSecondaries)
G4ParticleChange aParticleChange
G4VParticleChange * pParticleChange