77 out <<
"The Cerenkov effect simulates optical photons created by the\n";
78 out <<
"passage of charged particles through matter. Materials need\n";
79 out <<
"to have the property RINDEX (refractive index) defined.\n";
85 out <<
"Track secondaries first: "
124 std::size_t numOfMaterialsWithMPT = 0;
125 for(std::size_t i = 0; i < numOfMaterials; ++i)
127 if(((*theMaterialTable)[i])->GetMaterialPropertiesTable())
129 ++numOfMaterialsWithMPT;
136 std::size_t indexMPT = 0;
137 for(std::size_t i = 0; i < numOfMaterials; ++i)
143 G4Material* aMaterial = (*theMaterialTable)[i];
155 G4double currentRI = (*refractiveIndex)[0];
173 currentRI = (*refractiveIndex)[ii];
174 currentPM = refractiveIndex->
Energy(ii);
175 currentCAI = prevCAI + (currentPM - prevPM) * 0.5 *
176 (1.0 / (prevRI * prevRI) +
177 1.0 / (currentRI * currentRI));
182 prevCAI = currentCAI;
191 fIndexMPT.insert(std::make_pair(i, indexMPT));
232 G4double beta = (beta1 + beta2) * 0.5;
241 if(MeanNumberOfPhotons <= 0.0)
253 if(fNumPhotons <= 0 || !fStackingFlag ||
254 std::max(MeanNumberOfPhotons1, MeanNumberOfPhotons2) < 1e-15)
284 MeanNumberOfPhotons1, MeanNumberOfPhotons2));
294 if(fTrackSecondariesFirst)
304 G4double deltaNumberOfPhotons = MeanNumberOfPhotons1 - MeanNumberOfPhotons2;
306 std::max(MeanNumberOfPhotons1, MeanNumberOfPhotons2);
311 G4double maxCos = BetaInverse / nMax;
312 G4double maxSin2 = 1.0 - maxCos * maxCos;
314 for(
G4int i = 0; i < fNumPhotons; ++i)
325 sampledEnergy = Pmin + rand * dp;
326 cosTheta = BetaInverse / Rindex->
Value(sampledEnergy);
328 sin2Theta = 1.0 - cosTheta * cosTheta;
332 }
while(rand * maxSin2 > sin2Theta);
341 G4double sinTheta = std::sqrt(sin2Theta);
349 G4ThreeVector photonPolarization(cosTheta * cosPhi, cosTheta * sinPhi,
356 auto aCerenkovPhoton =
359 aCerenkovPhoton->SetPolarization(photonPolarization);
360 aCerenkovPhoton->SetKineticEnergy(sampledEnergy);
367 NumberOfPhotons = MeanNumberOfPhotons1 - rand * deltaNumberOfPhotons;
369 }
while(
G4UniformRand() * maxNumberOfPhotons > NumberOfPhotons);
373 delta / (pPreStepPoint->
GetVelocity() + rand * deltaVelocity * 0.5);
375 G4double aSecondaryTime = t0 + deltaTime;
380 new G4Track(aCerenkovPhoton, aSecondaryTime, aSecondaryPosition);
390 G4cout <<
"\n Exiting from G4QuasiCerenkov::DoIt -- NumberOfSecondaries = "
419 std::size_t materialIndex = aMaterial->
GetIndex();
424 ((*materialTable)[materialIndex])->GetMaterialPropertiesTable();
446 if(aMaterialPropertiesTable)
463 G4double GammaMin = 1. / std::sqrt(1. - BetaMin * BetaMin);
467 G4double kinEmin = mass * (GammaMin - 1.);
471 particleType, kineticEnergy, couple);
477 if(Step < minAllowedStep)
491 if(MeanNumberOfPhotons > 0.0)
492 Step = fMaxPhotons / MeanNumberOfPhotons;
493 if(Step > 0. && Step < StepLimit)
498 if(fMaxBetaChange > 0.)
501 particleType, kineticEnergy, couple);
503 gamma - 1. / std::sqrt(1. - beta * beta * (1. - fMaxBetaChange) *
504 (1. - fMaxBetaChange));
506 Step = mass * deltaGamma / dedx;
507 if(Step > 0. && Step < StepLimit)
522 constexpr G4double Rfact = 369.81 / (eV * cm);
530 std::size_t materialIndex = aMaterial->GetIndex();
535 std::size_t indexMPT = 0;
538 indexMPT = it->second;
543 ed <<
"G4MaterialPropertiesTable for " << aMaterial->GetName()
544 <<
" is not found!" <<
G4endl;
545 G4Exception(
"G4QuasiCerenkov::GetAverageNumberOfPhotons",
549 G4PhysicsVector* CerenkovAngleIntegrals = ((*thePhysicsTable)(indexMPT));
557 G4double Pmax = Rindex->GetMaxEnergy();
560 G4double nMin = Rindex->GetMinValue();
561 G4double nMax = Rindex->GetMaxValue();
564 G4double CAImax = (*CerenkovAngleIntegrals)[length - 1];
568 if(nMax < BetaInverse)
574 else if(nMin > BetaInverse)
585 Pmin = Rindex->GetEnergy(BetaInverse);
589 ge = CAImax - CAImin;
598 G4double NumPhotons = Rfact * charge / eplus * charge / eplus *
599 (dp - ge * BetaInverse * BetaInverse);
607 fTrackSecondariesFirst = state;
609 fTrackSecondariesFirst);
615 fMaxBetaChange = value * CLHEP::perCent;
622 fMaxPhotons = NumPhotons;
628 fStackingFlag = stackingFlag;
634 fOffloadingFlag = offloadingFlag;
644 (*thePhysicsTable)[i]->DumpValues();
G4double condition(const G4ErrorSymMatrix &m)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
G4PhysicsFreeVector G4MaterialPropertyVector
std::vector< G4Material * > G4MaterialTable
G4ThreeVector G4ParticleMomentum
G4long G4Poisson(G4double mean)
CLHEP::Hep3Vector G4ThreeVector
G4GLOB_DLL std::ostream G4cout
static double getTolerance()
Hep3Vector & rotateUz(const Hep3Vector &)
G4ParticleDefinition * GetDefinition() const
G4double GetKineticEnergy() const
G4double GetTotalEnergy() const
G4ThreeVector GetMomentum() 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)
G4bool GetCerenkovOffloadPhotons() const
void SetCerenkovVerboseLevel(G4int)
void SetCerenkovOffloadPhotons(G4bool)
G4bool GetCerenkovTrackSecondariesFirst() const
G4bool GetCerenkovStackPhotons() const
static G4OpticalPhoton * OpticalPhoton()
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)
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 GetAverageNumberOfPhotons(const G4double charge, const G4double beta, const G4Material *aMaterial, G4MaterialPropertyVector *Rindex) const
G4double PostStepGetPhysicalInteractionLength(const G4Track &aTrack, G4double, G4ForceCondition *) override
void ProcessDescription(std::ostream &out) const override
void PreparePhysicsTable(const G4ParticleDefinition &part) override
G4bool IsApplicable(const G4ParticleDefinition &aParticleType) override
void SetMaxNumPhotonsPerStep(const G4int NumPhotons)
void DumpPhysicsTable() const
G4PhysicsTable * thePhysicsTable
void BuildPhysicsTable(const G4ParticleDefinition &aParticleType) override
void SetOffloadPhotons(const G4bool)
std::map< std::size_t, std::size_t > fIndexMPT
G4QuasiCerenkov(const G4String &processName="QuasiCerenkov", G4ProcessType type=fElectromagnetic)
void SetTrackSecondariesFirst(const G4bool state)
void SetVerboseLevel(G4int)
void SetMaxBetaChangePerStep(const G4double d)
G4VParticleChange * PostStepDoIt(const G4Track &aTrack, const G4Step &aStep) override
G4double GetMeanFreePath(const G4Track &aTrack, G4double, G4ForceCondition *)
void SetStackPhotons(const G4bool)
static G4QuasiOpticalPhoton * QuasiOpticalPhotonDefinition()
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 SetAuxiliaryTrackInformation(G4int id, G4VAuxiliaryTrackInformation *info) 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)
G4ParticleChange aParticleChange
G4VProcess(const G4String &aName="NoName", G4ProcessType aType=fNotDefined)
void SetProcessSubType(G4int)
G4VParticleChange * pParticleChange
virtual void DumpInfo() const
const G4String & GetProcessName() const