233{
235
237 const G4Material* aMaterial = aTrack.
GetMaterial();
238
241
245
247 if(!MPT)
249
251 if(!Rindex)
253
255
258 G4double beta = (beta1 + beta2) * 0.5;
259
266
267 if(MeanNumberOfPhotons <= 0.0)
268 {
269
272 }
273
276
277
278
279 if(fNumPhotons <= 0 || !fStackingFlag ||
280 std::max(MeanNumberOfPhotons1, MeanNumberOfPhotons2) < 1e-15)
281 {
282
285 }
286
290
291
293
294 if(fTrackSecondariesFirst)
295 {
298 }
299
300
304 G4double deltaNumberOfPhotons = MeanNumberOfPhotons1 - MeanNumberOfPhotons2;
306 std::max(MeanNumberOfPhotons1, MeanNumberOfPhotons2);
307
310
311 G4double maxCos = BetaInverse / nMax;
312 G4double maxSin2 = 1.0 - maxCos * maxCos;
313
314 for(
G4int i = 0; i < fNumPhotons; ++i)
315 {
316
320
321
322 do
323 {
325 sampledEnergy = Pmin + rand * dp;
326 cosTheta = BetaInverse / Rindex->
Value(sampledEnergy);
327
328 sin2Theta = 1.0 - cosTheta * cosTheta;
330
331
332 } while(rand * maxSin2 > sin2Theta);
333
334
335
336
341 G4double sinTheta = std::sqrt(sin2Theta);
343 cosTheta);
344
345
346 photonMomentum.rotateUz(p0);
347
348
349 G4ThreeVector photonPolarization(cosTheta * cosPhi, cosTheta * sinPhi,
350 -sinTheta);
351
352
353 photonPolarization.rotateUz(p0);
354
355
356 auto aCerenkovPhoton =
358
359 aCerenkovPhoton->SetPolarization(photonPolarization);
360 aCerenkovPhoton->SetKineticEnergy(sampledEnergy);
361
363
364 do
365 {
367 NumberOfPhotons = MeanNumberOfPhotons1 - rand * deltaNumberOfPhotons;
368
369 }
while(
G4UniformRand() * maxNumberOfPhotons > NumberOfPhotons);
370
373 delta / (pPreStepPoint->
GetVelocity() + rand * deltaVelocity * 0.5);
374
375 G4double aSecondaryTime = t0 + deltaTime;
377
378
379 G4Track* aSecondaryTrack =
380 new G4Track(aCerenkovPhoton, aSecondaryTime, aSecondaryPosition);
381
386 }
387
389 {
390 G4cout <<
"\n Exiting from G4Cerenkov::DoIt -- NumberOfSecondaries = "
392 }
393
395}
G4ThreeVector G4ParticleMomentum
G4long G4Poisson(G4double mean)
CLHEP::Hep3Vector G4ThreeVector
G4double GetAverageNumberOfPhotons(const G4double charge, const G4double beta, const G4Material *aMaterial, G4MaterialPropertyVector *Rindex) const
G4ParticleDefinition * GetDefinition() const
static G4OpticalPhoton * OpticalPhoton()
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)
G4ParticleChange aParticleChange
G4VParticleChange * pParticleChange