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;
249 G4double beta = (beta1 + beta2) * 0.5;
258 if(MeanNumberOfPhotons <= 0.0)
270 if(fNumPhotons <= 0 || !fStackingFlag ||
271 std::max(MeanNumberOfPhotons1, MeanNumberOfPhotons2) < 1e-15)
281 if(fTrackSecondariesFirst)
295 G4double maxCos = BetaInverse / nMax;
296 G4double maxSin2 = (1.0 - maxCos) * (1.0 + maxCos);
298 for(
G4int i = 0; i < fNumPhotons; ++i)
309 sampledEnergy = Pmin + rand * dp;
310 sampledRI = Rindex->
Value(sampledEnergy);
311 cosTheta = BetaInverse / sampledRI;
313 sin2Theta = (1.0 - cosTheta) * (1.0 + cosTheta);
317 }
while(rand * maxSin2 > sin2Theta);
326 G4double sinTheta = std::sqrt(sin2Theta);
334 G4ThreeVector photonPolarization(cosTheta * cosPhi, cosTheta * sinPhi,
341 auto aCerenkovPhoton =
344 aCerenkovPhoton->SetPolarization(photonPolarization);
345 aCerenkovPhoton->SetKineticEnergy(sampledEnergy);
352 NumberOfPhotons = MeanNumberOfPhotons1 -
353 rand * (MeanNumberOfPhotons1 - MeanNumberOfPhotons2);
355 G4UniformRand() * std::max(MeanNumberOfPhotons1, MeanNumberOfPhotons2);
357 }
while(
N > NumberOfPhotons);
366 G4double aSecondaryTime = t0 + deltaTime;
371 new G4Track(aCerenkovPhoton, aSecondaryTime, aSecondaryPosition);
382 G4cout <<
"\n Exiting from G4Cerenkov::DoIt -- NumberOfSecondaries = "
411 std::size_t materialIndex = aMaterial->
GetIndex();
434 if(aMaterialPropertiesTable)
451 G4double GammaMin = 1. / std::sqrt(1. - BetaMin * BetaMin);
455 G4double kinEmin = mass * (GammaMin - 1.);
459 particleType, kineticEnergy, couple);
465 if(Step < minAllowedStep)
479 if(MeanNumberOfPhotons > 0.0)
480 Step = fMaxPhotons / MeanNumberOfPhotons;
481 if(Step > 0. && Step < StepLimit)
486 if(fMaxBetaChange > 0.)
489 particleType, kineticEnergy, couple);
491 gamma - 1. / std::sqrt(1. - beta * beta * (1. - fMaxBetaChange) *
492 (1. - fMaxBetaChange));
494 Step = mass * deltaGamma / dedx;
495 if(Step > 0. && Step < StepLimit)
510 constexpr G4double Rfact = 369.81 / (eV * cm);
518 std::size_t materialIndex = aMaterial->GetIndex();
521 G4PhysicsVector* CerenkovAngleIntegrals = ((*thePhysicsTable)(materialIndex));
529 G4double Pmax = Rindex->GetMaxEnergy();
532 G4double nMin = Rindex->GetMinValue();
533 G4double nMax = Rindex->GetMaxValue();
536 G4double CAImax = (*CerenkovAngleIntegrals)[length - 1];
540 if(nMax < BetaInverse)
546 else if(nMin > BetaInverse)
557 Pmin = Rindex->GetEnergy(BetaInverse);
561 ge = CAImax - CAImin;
570 G4double NumPhotons = Rfact * charge / eplus * charge / eplus *
571 (dp - ge * BetaInverse * BetaInverse);
579 fTrackSecondariesFirst = state;
581 fTrackSecondariesFirst);
587 fMaxBetaChange = value * CLHEP::perCent;
594 fMaxPhotons = NumPhotons;
600 fStackingFlag = stackingFlag;
610 (*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 std::size_t GetNumberOfMaterials()
std::size_t GetIndex() const
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