107 out <<
"The Cerenkov effect simulates optical photons created by the\n";
108 out <<
"passage of charged particles through matter. Materials need\n";
109 out <<
"to have the property RINDEX (refractive index) defined.\n";
115 out <<
"Track secondaries first: "
155 for(std::size_t i = 0; i < numOfMaterials; ++i)
161 G4Material* aMaterial = (*theMaterialTable)[i];
173 G4double currentRI = (*refractiveIndex)[0];
191 currentRI = (*refractiveIndex)[ii];
192 currentPM = refractiveIndex->
Energy(ii);
193 currentCAI = prevCAI + (currentPM - prevPM) * 0.5 *
194 (1.0 / (prevRI * prevRI) +
195 1.0 / (currentRI * currentRI));
200 prevCAI = currentCAI;
251 if(MeanNumberOfPhotons <= 0.0)
259 MeanNumberOfPhotons = MeanNumberOfPhotons * step_length;
262 if(fNumPhotons <= 0 || !fStackingFlag)
272 if(fTrackSecondariesFirst)
286 G4double maxCos = BetaInverse / nMax;
287 G4double maxSin2 = (1.0 - maxCos) * (1.0 + maxCos);
297 for(
G4int i = 0; i < fNumPhotons; ++i)
308 sampledEnergy = Pmin + rand * dp;
309 sampledRI = Rindex->
Value(sampledEnergy);
310 cosTheta = BetaInverse / sampledRI;
312 sin2Theta = (1.0 - cosTheta) * (1.0 + cosTheta);
316 }
while(rand * maxSin2 > sin2Theta);
325 G4double sinTheta = std::sqrt(sin2Theta);
333 G4ThreeVector photonPolarization(cosTheta * cosPhi, cosTheta * sinPhi,
340 auto aCerenkovPhoton =
343 aCerenkovPhoton->SetPolarization(photonPolarization);
344 aCerenkovPhoton->SetKineticEnergy(sampledEnergy);
351 NumberOfPhotons = MeanNumberOfPhotons1 -
352 rand * (MeanNumberOfPhotons1 - MeanNumberOfPhotons2);
354 G4UniformRand() * std::max(MeanNumberOfPhotons1, MeanNumberOfPhotons2);
356 }
while(
N > NumberOfPhotons);
365 G4double aSecondaryTime = t0 + deltaTime;
370 new G4Track(aCerenkovPhoton, aSecondaryTime, aSecondaryPosition);
381 G4cout <<
"\n Exiting from G4Cerenkov::DoIt -- NumberOfSecondaries = "
410 std::size_t materialIndex = aMaterial->
GetIndex();
433 if(aMaterialPropertiesTable)
450 G4double GammaMin = 1. / std::sqrt(1. - BetaMin * BetaMin);
454 G4double kinEmin = mass * (GammaMin - 1.);
458 particleType, kineticEnergy, couple);
464 if(Step < minAllowedStep)
478 if(MeanNumberOfPhotons > 0.0)
479 Step = fMaxPhotons / MeanNumberOfPhotons;
480 if(Step > 0. && Step < StepLimit)
485 if(fMaxBetaChange > 0.)
488 particleType, kineticEnergy, couple);
490 gamma - 1. / std::sqrt(1. - beta * beta * (1. - fMaxBetaChange) *
491 (1. - fMaxBetaChange));
493 Step = mass * deltaGamma / dedx;
494 if(Step > 0. && Step < StepLimit)
509 constexpr G4double Rfact = 369.81 / (eV * cm);
517 std::size_t materialIndex = aMaterial->GetIndex();
520 G4PhysicsVector* CerenkovAngleIntegrals = ((*thePhysicsTable)(materialIndex));
528 G4double Pmax = Rindex->GetMaxEnergy();
531 G4double nMin = Rindex->GetMinValue();
532 G4double nMax = Rindex->GetMaxValue();
535 G4double CAImax = (*CerenkovAngleIntegrals)[length - 1];
539 if(nMax < BetaInverse)
545 else if(nMin > BetaInverse)
556 Pmin = Rindex->GetEnergy(BetaInverse);
560 ge = CAImax - CAImin;
569 G4double NumPhotons = Rfact * charge / eplus * charge / eplus *
570 (dp - ge * BetaInverse * BetaInverse);
578 fTrackSecondariesFirst = state;
580 fTrackSecondariesFirst);
586 fMaxBetaChange = value * CLHEP::perCent;
593 fMaxPhotons = NumPhotons;
599 fStackingFlag = stackingFlag;
609 (*thePhysicsTable)[i]->DumpValues();
G4double condition(const G4ErrorSymMatrix &m)
std::vector< G4Material * > G4MaterialTable
G4long G4Poisson(G4double mean)
G4GLOB_DLL std::ostream G4cout
static double getTolerance()
Hep3Vector & rotateUz(const Hep3Vector &)
void ProcessDescription(std::ostream &out) const override
void SetMaxBetaChangePerStep(const G4double d)
G4PhysicsTable * thePhysicsTable
G4double PostStepGetPhysicalInteractionLength(const G4Track &aTrack, G4double, G4ForceCondition *) override
G4VParticleChange * PostStepDoIt(const G4Track &aTrack, const G4Step &aStep) override
void SetTrackSecondariesFirst(const G4bool state)
void DumpPhysicsTable() const
G4double GetAverageNumberOfPhotons(const G4double charge, const G4double beta, const G4Material *aMaterial, G4MaterialPropertyVector *Rindex) const
void SetVerboseLevel(G4int)
void BuildPhysicsTable(const G4ParticleDefinition &aParticleType) override
void PreparePhysicsTable(const G4ParticleDefinition &part) override
G4Cerenkov(const G4String &processName="Cerenkov", G4ProcessType type=fElectromagnetic)
G4bool IsApplicable(const G4ParticleDefinition &aParticleType) override
void SetStackPhotons(const G4bool)
G4double GetMeanFreePath(const G4Track &aTrack, G4double, G4ForceCondition *)
void SetMaxNumPhotonsPerStep(const G4int NumPhotons)
G4ParticleDefinition * GetDefinition() const
G4double GetKineticEnergy() const
G4double GetTotalEnergy() const
G4double GetTotalMomentum() const
static G4LossTableManager * Instance()
G4double GetRange(const G4ParticleDefinition *aParticle, G4double kineticEnergy, const G4MaterialCutsCouple *couple)
G4double GetDEDX(const G4ParticleDefinition *aParticle, G4double kineticEnergy, const G4MaterialCutsCouple *couple)
G4MaterialPropertyVector * GetProperty(const char *key) const
G4MaterialPropertiesTable * GetMaterialPropertiesTable() const
static size_t GetNumberOfMaterials()
static G4MaterialTable * GetMaterialTable()
void SetCerenkovMaxBetaChange(G4double)
void SetCerenkovMaxPhotonsPerStep(G4int)
G4int GetCerenkovVerboseLevel() const
G4int GetCerenkovMaxPhotonsPerStep() const
static G4OpticalParameters * Instance()
G4double GetCerenkovMaxBetaChange() const
void SetCerenkovStackPhotons(G4bool)
void SetCerenkovTrackSecondariesFirst(G4bool)
void SetCerenkovVerboseLevel(G4int)
G4bool GetCerenkovTrackSecondariesFirst() const
G4bool GetCerenkovStackPhotons() const
static G4OpticalPhoton * OpticalPhoton()
void AddSecondary(G4Track *aSecondary)
void Initialize(const G4Track &) override
G4bool IsShortLived() const
G4double GetPDGMass() const
G4double GetPDGCharge() const
const G4String & GetParticleName() const
void InsertValues(const G4double energy, const G4double value)
static G4int GetModelID(const G4int modelIndex)
std::size_t entries() const
void insertAt(std::size_t, G4PhysicsVector *)
G4double GetMaxEnergy() const
G4double GetMaxValue() const
G4double Energy(const std::size_t index) const
G4double Value(const G4double energy, std::size_t &lastidx) const
std::size_t GetVectorLength() const
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)
const G4MaterialCutsCouple * GetMaterialCutsCouple() const
void SetParentID(const G4int aValue)
void ProposeTrackStatus(G4TrackStatus status)
G4int GetNumberOfSecondaries() const
void SetNumberOfSecondaries(G4int totSecondaries)
G4ParticleChange aParticleChange
void SetProcessSubType(G4int)
G4VParticleChange * pParticleChange
virtual void DumpInfo() const
const G4String & GetProcessName() const