Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4Cerenkov Class Reference

#include <G4Cerenkov.hh>

+ Inheritance diagram for G4Cerenkov:

Public Member Functions

 G4Cerenkov (const G4String &processName="Cerenkov", G4ProcessType type=fElectromagnetic)
 
 ~G4Cerenkov ()
 
 G4Cerenkov (const G4Cerenkov &right)
 
G4Cerenkovoperator= (const G4Cerenkov &right)=delete
 
G4bool IsApplicable (const G4ParticleDefinition &aParticleType) override
 
void BuildPhysicsTable (const G4ParticleDefinition &aParticleType) override
 
void PreparePhysicsTable (const G4ParticleDefinition &part) override
 
void Initialise ()
 
G4double GetMeanFreePath (const G4Track &aTrack, G4double, G4ForceCondition *)
 
G4double PostStepGetPhysicalInteractionLength (const G4Track &aTrack, G4double, G4ForceCondition *) override
 
G4VParticleChangePostStepDoIt (const G4Track &aTrack, const G4Step &aStep) override
 
virtual G4double AlongStepGetPhysicalInteractionLength (const G4Track &, G4double, G4double, G4double &, G4GPILSelection *) override
 
virtual G4double AtRestGetPhysicalInteractionLength (const G4Track &, G4ForceCondition *) override
 
virtual G4VParticleChangeAtRestDoIt (const G4Track &, const G4Step &) override
 
virtual G4VParticleChangeAlongStepDoIt (const G4Track &, const G4Step &) override
 
void SetTrackSecondariesFirst (const G4bool state)
 
G4bool GetTrackSecondariesFirst () const
 
void SetMaxBetaChangePerStep (const G4double d)
 
G4double GetMaxBetaChangePerStep () const
 
void SetMaxNumPhotonsPerStep (const G4int NumPhotons)
 
G4int GetMaxNumPhotonsPerStep () const
 
void SetStackPhotons (const G4bool)
 
G4bool GetStackPhotons () const
 
G4int GetNumPhotons () const
 
G4PhysicsTableGetPhysicsTable () const
 
void DumpPhysicsTable () const
 
G4double GetAverageNumberOfPhotons (const G4double charge, const G4double beta, const G4Material *aMaterial, G4MaterialPropertyVector *Rindex) const
 
void DumpInfo () const override
 
void ProcessDescription (std::ostream &out) const override
 
void SetVerboseLevel (G4int)
 
- Public Member Functions inherited from G4VProcess
 G4VProcess (const G4String &aName="NoName", G4ProcessType aType=fNotDefined)
 
 G4VProcess (const G4VProcess &right)
 
virtual ~G4VProcess ()
 
G4VProcessoperator= (const G4VProcess &)=delete
 
G4bool operator== (const G4VProcess &right) const
 
G4bool operator!= (const G4VProcess &right) const
 
G4double GetCurrentInteractionLength () const
 
void SetPILfactor (G4double value)
 
G4double GetPILfactor () const
 
G4double AlongStepGPIL (const G4Track &track, G4double previousStepSize, G4double currentMinimumStep, G4double &proposedSafety, G4GPILSelection *selection)
 
G4double AtRestGPIL (const G4Track &track, G4ForceCondition *condition)
 
G4double PostStepGPIL (const G4Track &track, G4double previousStepSize, G4ForceCondition *condition)
 
virtual G4bool StorePhysicsTable (const G4ParticleDefinition *, const G4String &, G4bool)
 
virtual G4bool RetrievePhysicsTable (const G4ParticleDefinition *, const G4String &, G4bool)
 
const G4StringGetPhysicsTableFileName (const G4ParticleDefinition *, const G4String &directory, const G4String &tableName, G4bool ascii=false)
 
const G4StringGetProcessName () const
 
G4ProcessType GetProcessType () const
 
void SetProcessType (G4ProcessType)
 
G4int GetProcessSubType () const
 
void SetProcessSubType (G4int)
 
virtual const G4VProcessGetCreatorProcess () const
 
virtual void StartTracking (G4Track *)
 
virtual void EndTracking ()
 
virtual void SetProcessManager (const G4ProcessManager *)
 
virtual const G4ProcessManagerGetProcessManager ()
 
virtual void ResetNumberOfInteractionLengthLeft ()
 
G4double GetNumberOfInteractionLengthLeft () const
 
G4double GetTotalNumberOfInteractionLengthTraversed () const
 
G4bool isAtRestDoItIsEnabled () const
 
G4bool isAlongStepDoItIsEnabled () const
 
G4bool isPostStepDoItIsEnabled () const
 
void SetVerboseLevel (G4int value)
 
G4int GetVerboseLevel () const
 
virtual void SetMasterProcess (G4VProcess *masterP)
 
const G4VProcessGetMasterProcess () const
 
virtual void BuildWorkerPhysicsTable (const G4ParticleDefinition &part)
 
virtual void PrepareWorkerPhysicsTable (const G4ParticleDefinition &)
 

Protected Attributes

G4PhysicsTablethePhysicsTable
 
- Protected Attributes inherited from G4VProcess
const G4ProcessManageraProcessManager = nullptr
 
G4VParticleChangepParticleChange = nullptr
 
G4ParticleChange aParticleChange
 
G4double theNumberOfInteractionLengthLeft = -1.0
 
G4double currentInteractionLength = -1.0
 
G4double theInitialNumberOfInteractionLength = -1.0
 
G4String theProcessName
 
G4String thePhysicsTableFileName
 
G4ProcessType theProcessType = fNotDefined
 
G4int theProcessSubType = -1
 
G4double thePILfactor = 1.0
 
G4int verboseLevel = 0
 
G4bool enableAtRestDoIt = true
 
G4bool enableAlongStepDoIt = true
 
G4bool enablePostStepDoIt = true
 

Additional Inherited Members

- Static Public Member Functions inherited from G4VProcess
static const G4StringGetProcessTypeName (G4ProcessType)
 
- Protected Member Functions inherited from G4VProcess
void SubtractNumberOfInteractionLengthLeft (G4double prevStepSize)
 
void ClearNumberOfInteractionLengthLeft ()
 

Detailed Description

Definition at line 60 of file G4Cerenkov.hh.

Constructor & Destructor Documentation

◆ G4Cerenkov() [1/2]

G4Cerenkov::G4Cerenkov ( const G4String & processName = "Cerenkov",
G4ProcessType type = fElectromagnetic )
explicit

Definition at line 79 of file G4Cerenkov.cc.

80 : G4VProcess(processName, type)
81 , fNumPhotons(0)
82{
83 secID = G4PhysicsModelCatalog::GetModelID("model_Cerenkov");
85
86 thePhysicsTable = nullptr;
87
88 if(verboseLevel > 0)
89 {
90 G4cout << GetProcessName() << " is created." << G4endl;
91 }
92 Initialise();
93}
@ fCerenkov
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
void Initialise()
G4PhysicsTable * thePhysicsTable
static G4int GetModelID(const G4int modelIndex)
G4int verboseLevel
void SetProcessSubType(G4int)
const G4String & GetProcessName() const

◆ ~G4Cerenkov()

G4Cerenkov::~G4Cerenkov ( )

Definition at line 96 of file G4Cerenkov.cc.

97{
98 if(thePhysicsTable != nullptr)
99 {
101 delete thePhysicsTable;
102 }
103}
void clearAndDestroy()

◆ G4Cerenkov() [2/2]

G4Cerenkov::G4Cerenkov ( const G4Cerenkov & right)
explicit

Member Function Documentation

◆ AlongStepDoIt()

virtual G4VParticleChange * G4Cerenkov::AlongStepDoIt ( const G4Track & ,
const G4Step &  )
inlineoverridevirtual

Implements G4VProcess.

Definition at line 113 of file G4Cerenkov.hh.

115 {
116 return nullptr;
117 };

◆ AlongStepGetPhysicalInteractionLength()

virtual G4double G4Cerenkov::AlongStepGetPhysicalInteractionLength ( const G4Track & ,
G4double ,
G4double ,
G4double & ,
G4GPILSelection *  )
inlineoverridevirtual

Implements G4VProcess.

Definition at line 95 of file G4Cerenkov.hh.

97 {
98 return -1.0;
99 };

◆ AtRestDoIt()

virtual G4VParticleChange * G4Cerenkov::AtRestDoIt ( const G4Track & ,
const G4Step &  )
inlineoverridevirtual

Implements G4VProcess.

Definition at line 108 of file G4Cerenkov.hh.

109 {
110 return nullptr;
111 };

◆ AtRestGetPhysicalInteractionLength()

virtual G4double G4Cerenkov::AtRestGetPhysicalInteractionLength ( const G4Track & ,
G4ForceCondition *  )
inlineoverridevirtual

Implements G4VProcess.

Definition at line 101 of file G4Cerenkov.hh.

103 {
104 return -1.0;
105 };

◆ BuildPhysicsTable()

void G4Cerenkov::BuildPhysicsTable ( const G4ParticleDefinition & aParticleType)
overridevirtual

Reimplemented from G4VProcess.

Definition at line 144 of file G4Cerenkov.cc.

145{
147 return;
148
149 const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
150 std::size_t numOfMaterials = G4Material::GetNumberOfMaterials();
151
152 thePhysicsTable = new G4PhysicsTable(numOfMaterials);
153
154 // loop over materials
155 for(std::size_t i = 0; i < numOfMaterials; ++i)
156 {
157 G4PhysicsFreeVector* cerenkovIntegral = nullptr;
158
159 // Retrieve vector of refraction indices for the material
160 // from the material's optical properties table
161 G4Material* aMaterial = (*theMaterialTable)[i];
163
164 if(MPT)
165 {
166 cerenkovIntegral = new G4PhysicsFreeVector();
167 G4MaterialPropertyVector* refractiveIndex = MPT->GetProperty(kRINDEX);
168
169 if(refractiveIndex)
170 {
171 // Retrieve the first refraction index in vector
172 // of (photon energy, refraction index) pairs
173 G4double currentRI = (*refractiveIndex)[0];
174 if(currentRI > 1.0)
175 {
176 // Create first (photon energy, Cerenkov Integral) pair
177 G4double currentPM = refractiveIndex->Energy(0);
178 G4double currentCAI = 0.0;
179
180 cerenkovIntegral->InsertValues(currentPM, currentCAI);
181
182 // Set previous values to current ones prior to loop
183 G4double prevPM = currentPM;
184 G4double prevCAI = currentCAI;
185 G4double prevRI = currentRI;
186
187 // loop over all (photon energy, refraction index)
188 // pairs stored for this material
189 for(std::size_t ii = 1; ii < refractiveIndex->GetVectorLength(); ++ii)
190 {
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));
196
197 cerenkovIntegral->InsertValues(currentPM, currentCAI);
198
199 prevPM = currentPM;
200 prevCAI = currentCAI;
201 prevRI = currentRI;
202 }
203 }
204 }
205 }
206
207 // The Cerenkov integral for a given material will be inserted in
208 // thePhysicsTable according to the position of the material in
209 // the material table.
210 thePhysicsTable->insertAt(i, cerenkovIntegral);
211 }
212}
std::vector< G4Material * > G4MaterialTable
double G4double
Definition G4Types.hh:83
G4MaterialPropertyVector * GetProperty(const char *key) const
G4MaterialPropertiesTable * GetMaterialPropertiesTable() const
static std::size_t GetNumberOfMaterials()
static G4MaterialTable * GetMaterialTable()
void InsertValues(const G4double energy, const G4double value)
void insertAt(std::size_t, G4PhysicsVector *)
G4double Energy(const std::size_t index) const
std::size_t GetVectorLength() const

◆ DumpInfo()

void G4Cerenkov::DumpInfo ( ) const
inlineoverridevirtual

Reimplemented from G4VProcess.

Definition at line 163 of file G4Cerenkov.hh.

void ProcessDescription(std::ostream &out) const override

◆ DumpPhysicsTable()

void G4Cerenkov::DumpPhysicsTable ( ) const

Definition at line 605 of file G4Cerenkov.cc.

606{
607 G4cout << "Dump Physics Table!" << G4endl;
608 for(std::size_t i = 0; i < thePhysicsTable->entries(); ++i)
609 {
610 (*thePhysicsTable)[i]->DumpValues();
611 }
612}
std::size_t entries() const

◆ GetAverageNumberOfPhotons()

G4double G4Cerenkov::GetAverageNumberOfPhotons ( const G4double charge,
const G4double beta,
const G4Material * aMaterial,
G4MaterialPropertyVector * Rindex ) const

Definition at line 504 of file G4Cerenkov.cc.

509{
510 constexpr G4double Rfact = 369.81 / (eV * cm);
511 if(beta <= 0.0)
512 return 0.0;
513 G4double BetaInverse = 1. / beta;
514
515 // Vectors used in computation of Cerenkov Angle Integral:
516 // - Refraction Indices for the current material
517 // - new G4PhysicsFreeVector allocated to hold CAI's
518 std::size_t materialIndex = aMaterial->GetIndex();
519
520 // Retrieve the Cerenkov Angle Integrals for this material
521 G4PhysicsVector* CerenkovAngleIntegrals = ((*thePhysicsTable)(materialIndex));
522
523 std::size_t length = CerenkovAngleIntegrals->GetVectorLength();
524 if(0 == length)
525 return 0.0;
526
527 // Min and Max photon energies
528 G4double Pmin = Rindex->Energy(0);
529 G4double Pmax = Rindex->GetMaxEnergy();
530
531 // Min and Max Refraction Indices
532 G4double nMin = Rindex->GetMinValue();
533 G4double nMax = Rindex->GetMaxValue();
534
535 // Max Cerenkov Angle Integral
536 G4double CAImax = (*CerenkovAngleIntegrals)[length - 1];
537
538 G4double dp, ge;
539 // If n(Pmax) < 1/Beta -- no photons generated
540 if(nMax < BetaInverse)
541 {
542 dp = 0.0;
543 ge = 0.0;
544 }
545 // otherwise if n(Pmin) >= 1/Beta -- photons generated
546 else if(nMin > BetaInverse)
547 {
548 dp = Pmax - Pmin;
549 ge = CAImax;
550 }
551 // If n(Pmin) < 1/Beta, and n(Pmax) >= 1/Beta, then we need to find a P such
552 // that the value of n(P) == 1/Beta. Interpolation is performed by the
553 // GetEnergy() and Value() methods of the G4MaterialPropertiesTable and
554 // the Value() method of G4PhysicsVector.
555 else
556 {
557 Pmin = Rindex->GetEnergy(BetaInverse);
558 dp = Pmax - Pmin;
559
560 G4double CAImin = CerenkovAngleIntegrals->Value(Pmin);
561 ge = CAImax - CAImin;
562
563 if(verboseLevel > 1)
564 {
565 G4cout << "CAImin = " << CAImin << G4endl << "ge = " << ge << G4endl;
566 }
567 }
568
569 // Calculate number of photons
570 G4double NumPhotons = Rfact * charge / eplus * charge / eplus *
571 (dp - ge * BetaInverse * BetaInverse);
572
573 return NumPhotons;
574}
std::size_t GetIndex() const
G4double GetEnergy(const G4double value) const
G4double GetMinValue() const
G4double GetMaxEnergy() const
G4double GetMaxValue() const
G4double Value(const G4double energy, std::size_t &lastidx) const

Referenced by PostStepDoIt(), and PostStepGetPhysicalInteractionLength().

◆ GetMaxBetaChangePerStep()

G4double G4Cerenkov::GetMaxBetaChangePerStep ( ) const
inline

Definition at line 190 of file G4Cerenkov.hh.

191{
192 return fMaxBetaChange;
193}

◆ GetMaxNumPhotonsPerStep()

G4int G4Cerenkov::GetMaxNumPhotonsPerStep ( ) const
inline

Definition at line 195 of file G4Cerenkov.hh.

195{ return fMaxPhotons; }

◆ GetMeanFreePath()

G4double G4Cerenkov::GetMeanFreePath ( const G4Track & aTrack,
G4double ,
G4ForceCondition *  )

Definition at line 396 of file G4Cerenkov.cc.

398{
399 return 1.;
400}

◆ GetNumPhotons()

G4int G4Cerenkov::GetNumPhotons ( ) const
inline

Definition at line 199 of file G4Cerenkov.hh.

199{ return fNumPhotons; }

◆ GetPhysicsTable()

G4PhysicsTable * G4Cerenkov::GetPhysicsTable ( ) const
inline

Definition at line 201 of file G4Cerenkov.hh.

202{
203 return thePhysicsTable;
204}

◆ GetStackPhotons()

G4bool G4Cerenkov::GetStackPhotons ( ) const
inline

Definition at line 197 of file G4Cerenkov.hh.

197{ return fStackingFlag; }

◆ GetTrackSecondariesFirst()

G4bool G4Cerenkov::GetTrackSecondariesFirst ( ) const
inline

Definition at line 185 of file G4Cerenkov.hh.

186{
187 return fTrackSecondariesFirst;
188}

◆ Initialise()

void G4Cerenkov::Initialise ( )

Definition at line 133 of file G4Cerenkov.cc.

134{
141}
void SetMaxBetaChangePerStep(const G4double d)
void SetTrackSecondariesFirst(const G4bool state)
void SetVerboseLevel(G4int)
void SetStackPhotons(const G4bool)
void SetMaxNumPhotonsPerStep(const G4int NumPhotons)
G4int GetCerenkovVerboseLevel() const
G4int GetCerenkovMaxPhotonsPerStep() const
static G4OpticalParameters * Instance()
G4double GetCerenkovMaxBetaChange() const
G4bool GetCerenkovTrackSecondariesFirst() const
G4bool GetCerenkovStackPhotons() const

Referenced by G4Cerenkov(), and PreparePhysicsTable().

◆ IsApplicable()

G4bool G4Cerenkov::IsApplicable ( const G4ParticleDefinition & aParticleType)
overridevirtual

Reimplemented from G4VProcess.

Definition at line 122 of file G4Cerenkov.cc.

123{
124 return (aParticleType.GetPDGCharge() != 0.0 &&
125 aParticleType.GetPDGMass() != 0.0 &&
126 aParticleType.GetParticleName() != "chargedgeantino" &&
127 !aParticleType.IsShortLived())
128 ? true
129 : false;
130}
const G4String & GetParticleName() const

Referenced by G4OpticalPhysics::ConstructProcess().

◆ operator=()

G4Cerenkov & G4Cerenkov::operator= ( const G4Cerenkov & right)
delete

◆ PostStepDoIt()

G4VParticleChange * G4Cerenkov::PostStepDoIt ( const G4Track & aTrack,
const G4Step & aStep )
overridevirtual

Implements G4VProcess.

Definition at line 215 of file G4Cerenkov.cc.

224{
226
227 const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
228 const G4Material* aMaterial = aTrack.GetMaterial();
229
230 G4StepPoint* pPreStepPoint = aStep.GetPreStepPoint();
231 G4StepPoint* pPostStepPoint = aStep.GetPostStepPoint();
232
233 G4ThreeVector x0 = pPreStepPoint->GetPosition();
234 G4ThreeVector p0 = aStep.GetDeltaPosition().unit();
235 G4double t0 = pPreStepPoint->GetGlobalTime();
236
238 if(!MPT)
239 return pParticleChange;
240
242 if(!Rindex)
243 return pParticleChange;
244
245 G4double charge = aParticle->GetDefinition()->GetPDGCharge();
246
247 G4double beta1 = pPreStepPoint->GetBeta();
248 G4double beta2 = pPostStepPoint->GetBeta();
249 G4double beta = (beta1 + beta2) * 0.5;
250
251 G4double MeanNumberOfPhotons =
252 GetAverageNumberOfPhotons(charge, beta, aMaterial, Rindex);
253 G4double MeanNumberOfPhotons1 =
254 GetAverageNumberOfPhotons(charge, beta1, aMaterial, Rindex);
255 G4double MeanNumberOfPhotons2 =
256 GetAverageNumberOfPhotons(charge, beta2, aMaterial, Rindex);
257
258 if(MeanNumberOfPhotons <= 0.0)
259 {
260 // return unchanged particle and no secondaries
262 return pParticleChange;
263 }
264
265 MeanNumberOfPhotons *= aStep.GetStepLength();
266 fNumPhotons = (G4int) G4Poisson(MeanNumberOfPhotons);
267
268 // third condition added to prevent infinite loop in do-while below,
269 // see bugzilla 2555
270 if(fNumPhotons <= 0 || !fStackingFlag ||
271 std::max(MeanNumberOfPhotons1, MeanNumberOfPhotons2) < 1e-15)
272 {
273 // return unchanged particle and no secondaries
275 return pParticleChange;
276 }
277
278 ////////////////////////////////////////////////////////////////
280
281 if(fTrackSecondariesFirst)
282 {
283 if(aTrack.GetTrackStatus() == fAlive)
285 }
286
287 ////////////////////////////////////////////////////////////////
288 G4double Pmin = Rindex->Energy(0);
289 G4double Pmax = Rindex->GetMaxEnergy();
290 G4double dp = Pmax - Pmin;
291
292 G4double nMax = Rindex->GetMaxValue();
293 G4double BetaInverse = 1. / beta;
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 // Determine photon energy
301 G4double rand;
302 G4double sampledEnergy, sampledRI;
303 G4double cosTheta, sin2Theta;
304
305 // sample an energy
306 do
307 {
308 rand = G4UniformRand();
309 sampledEnergy = Pmin + rand * dp;
310 sampledRI = Rindex->Value(sampledEnergy);
311 cosTheta = BetaInverse / sampledRI;
312
313 sin2Theta = (1.0 - cosTheta) * (1.0 + cosTheta);
314 rand = G4UniformRand();
315
316 // Loop checking, 07-Aug-2015, Vladimir Ivanchenko
317 } while(rand * maxSin2 > sin2Theta);
318
319 // Create photon momentum direction vector. The momentum direction is still
320 // with respect to the coordinate system where the primary particle
321 // direction is aligned with the z axis
322 rand = G4UniformRand();
323 G4double phi = twopi * rand;
324 G4double sinPhi = std::sin(phi);
325 G4double cosPhi = std::cos(phi);
326 G4double sinTheta = std::sqrt(sin2Theta);
327 G4ParticleMomentum photonMomentum(sinTheta * cosPhi, sinTheta * sinPhi,
328 cosTheta);
329
330 // Rotate momentum direction back to global reference system
331 photonMomentum.rotateUz(p0);
332
333 // Determine polarization of new photon
334 G4ThreeVector photonPolarization(cosTheta * cosPhi, cosTheta * sinPhi,
335 -sinTheta);
336
337 // Rotate back to original coord system
338 photonPolarization.rotateUz(p0);
339
340 // Generate a new photon:
341 auto aCerenkovPhoton =
343
344 aCerenkovPhoton->SetPolarization(photonPolarization);
345 aCerenkovPhoton->SetKineticEnergy(sampledEnergy);
346
347 G4double NumberOfPhotons, N;
348
349 do
350 {
351 rand = G4UniformRand();
352 NumberOfPhotons = MeanNumberOfPhotons1 -
353 rand * (MeanNumberOfPhotons1 - MeanNumberOfPhotons2);
354 N =
355 G4UniformRand() * std::max(MeanNumberOfPhotons1, MeanNumberOfPhotons2);
356 // Loop checking, 07-Aug-2015, Vladimir Ivanchenko
357 } while(N > NumberOfPhotons);
358
359 G4double delta = rand * aStep.GetStepLength();
360 G4double deltaTime =
361 delta /
362 (pPreStepPoint->GetVelocity() +
363 rand * (pPostStepPoint->GetVelocity() - pPreStepPoint->GetVelocity()) *
364 0.5);
365
366 G4double aSecondaryTime = t0 + deltaTime;
367 G4ThreeVector aSecondaryPosition = x0 + rand * aStep.GetDeltaPosition();
368
369 // Generate new G4Track object:
370 G4Track* aSecondaryTrack =
371 new G4Track(aCerenkovPhoton, aSecondaryTime, aSecondaryPosition);
372
373 aSecondaryTrack->SetTouchableHandle(
375 aSecondaryTrack->SetParentID(aTrack.GetTrackID());
376 aSecondaryTrack->SetCreatorModelID(secID);
377 aParticleChange.AddSecondary(aSecondaryTrack);
378 }
379
380 if(verboseLevel > 1)
381 {
382 G4cout << "\n Exiting from G4Cerenkov::DoIt -- NumberOfSecondaries = "
384 }
385
386 return pParticleChange;
387}
G4long G4Poisson(G4double mean)
Definition G4Poisson.hh:50
@ fSuspend
@ fAlive
int G4int
Definition G4Types.hh:85
#define G4UniformRand()
Definition Randomize.hh:52
Hep3Vector unit() const
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 GetBeta() 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
G4int GetTrackID() 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
#define N
Definition crc32.c:57

◆ PostStepGetPhysicalInteractionLength()

G4double G4Cerenkov::PostStepGetPhysicalInteractionLength ( const G4Track & aTrack,
G4double ,
G4ForceCondition * condition )
overridevirtual

Implements G4VProcess.

Definition at line 403 of file G4Cerenkov.cc.

405{
407 G4double StepLimit = DBL_MAX;
408 fNumPhotons = 0;
409
410 const G4Material* aMaterial = aTrack.GetMaterial();
411 std::size_t materialIndex = aMaterial->GetIndex();
412
413 // If Physics Vector is not defined no Cerenkov photons
414 if(!(*thePhysicsTable)[materialIndex])
415 {
416 return StepLimit;
417 }
418
419 const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
420 const G4MaterialCutsCouple* couple = aTrack.GetMaterialCutsCouple();
421
422 G4double kineticEnergy = aParticle->GetKineticEnergy();
423 const G4ParticleDefinition* particleType = aParticle->GetDefinition();
424 G4double mass = particleType->GetPDGMass();
425
426 G4double beta = aParticle->GetTotalMomentum() / aParticle->GetTotalEnergy();
427 G4double gamma = aParticle->GetTotalEnergy() / mass;
428
429 G4MaterialPropertiesTable* aMaterialPropertiesTable =
430 aMaterial->GetMaterialPropertiesTable();
431
432 G4MaterialPropertyVector* Rindex = nullptr;
433
434 if(aMaterialPropertiesTable)
435 Rindex = aMaterialPropertiesTable->GetProperty(kRINDEX);
436
437 G4double nMax;
438 if(Rindex)
439 {
440 nMax = Rindex->GetMaxValue();
441 }
442 else
443 {
444 return StepLimit;
445 }
446
447 G4double BetaMin = 1. / nMax;
448 if(BetaMin >= 1.)
449 return StepLimit;
450
451 G4double GammaMin = 1. / std::sqrt(1. - BetaMin * BetaMin);
452 if(gamma < GammaMin)
453 return StepLimit;
454
455 G4double kinEmin = mass * (GammaMin - 1.);
456 G4double RangeMin =
457 G4LossTableManager::Instance()->GetRange(particleType, kinEmin, couple);
459 particleType, kineticEnergy, couple);
460 G4double Step = Range - RangeMin;
461
462 // If the step is smaller than G4ThreeVector::getTolerance(), it may happen
463 // that the particle does not move. See bug 1992.
464 static const G4double minAllowedStep = G4ThreeVector::getTolerance();
465 if(Step < minAllowedStep)
466 return StepLimit;
467
468 if(Step < StepLimit)
469 StepLimit = Step;
470
471 // If user has defined an average maximum number of photons to be generated in
472 // a Step, then calculate the Step length for that number of photons.
473 if(fMaxPhotons > 0)
474 {
475 const G4double charge = aParticle->GetDefinition()->GetPDGCharge();
476 G4double MeanNumberOfPhotons =
477 GetAverageNumberOfPhotons(charge, beta, aMaterial, Rindex);
478 Step = 0.;
479 if(MeanNumberOfPhotons > 0.0)
480 Step = fMaxPhotons / MeanNumberOfPhotons;
481 if(Step > 0. && Step < StepLimit)
482 StepLimit = Step;
483 }
484
485 // If user has defined an maximum allowed change in beta per step
486 if(fMaxBetaChange > 0.)
487 {
489 particleType, kineticEnergy, couple);
490 G4double deltaGamma =
491 gamma - 1. / std::sqrt(1. - beta * beta * (1. - fMaxBetaChange) *
492 (1. - fMaxBetaChange));
493
494 Step = mass * deltaGamma / dedx;
495 if(Step > 0. && Step < StepLimit)
496 StepLimit = Step;
497 }
498
500 return StepLimit;
501}
G4double condition(const G4ErrorSymMatrix &m)
@ StronglyForced
@ NotForced
static double getTolerance()
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)
const G4MaterialCutsCouple * GetMaterialCutsCouple() const
#define DBL_MAX
Definition templates.hh:62

◆ PreparePhysicsTable()

void G4Cerenkov::PreparePhysicsTable ( const G4ParticleDefinition & part)
overridevirtual

Reimplemented from G4VProcess.

Definition at line 390 of file G4Cerenkov.cc.

391{
392 Initialise();
393}

◆ ProcessDescription()

void G4Cerenkov::ProcessDescription ( std::ostream & out) const
overridevirtual

Reimplemented from G4VProcess.

Definition at line 105 of file G4Cerenkov.cc.

106{
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";
111
113 out << "Maximum beta change per step: " << params->GetCerenkovMaxBetaChange();
114 out << "Maximum photons per step: " << params->GetCerenkovMaxPhotonsPerStep();
115 out << "Track secondaries first: "
117 out << "Stack photons: " << params->GetCerenkovStackPhotons();
118 out << "Verbose level: " << params->GetCerenkovVerboseLevel();
119}
virtual void DumpInfo() const

Referenced by DumpInfo().

◆ SetMaxBetaChangePerStep()

void G4Cerenkov::SetMaxBetaChangePerStep ( const G4double d)

Definition at line 585 of file G4Cerenkov.cc.

586{
587 fMaxBetaChange = value * CLHEP::perCent;
589}
void SetCerenkovMaxBetaChange(G4double)

Referenced by Initialise().

◆ SetMaxNumPhotonsPerStep()

void G4Cerenkov::SetMaxNumPhotonsPerStep ( const G4int NumPhotons)

Definition at line 592 of file G4Cerenkov.cc.

593{
594 fMaxPhotons = NumPhotons;
596}
void SetCerenkovMaxPhotonsPerStep(G4int)

Referenced by Initialise().

◆ SetStackPhotons()

void G4Cerenkov::SetStackPhotons ( const G4bool stackingFlag)

Definition at line 598 of file G4Cerenkov.cc.

599{
600 fStackingFlag = stackingFlag;
602}
void SetCerenkovStackPhotons(G4bool)

Referenced by Initialise().

◆ SetTrackSecondariesFirst()

void G4Cerenkov::SetTrackSecondariesFirst ( const G4bool state)

Definition at line 577 of file G4Cerenkov.cc.

578{
579 fTrackSecondariesFirst = state;
581 fTrackSecondariesFirst);
582}
void SetCerenkovTrackSecondariesFirst(G4bool)

Referenced by Initialise().

◆ SetVerboseLevel()

void G4Cerenkov::SetVerboseLevel ( G4int verbose)

Definition at line 615 of file G4Cerenkov.cc.

Referenced by Initialise().

Member Data Documentation

◆ thePhysicsTable

G4PhysicsTable* G4Cerenkov::thePhysicsTable
protected

The documentation for this class was generated from the following files: