Geant4 10.7.0
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)
 
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
 
- 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
 
virtual G4VParticleChangePostStepDoIt (const G4Track &track, const G4Step &stepData)=0
 
virtual G4VParticleChangeAlongStepDoIt (const G4Track &track, const G4Step &stepData)=0
 
virtual G4VParticleChangeAtRestDoIt (const G4Track &track, const G4Step &stepData)=0
 
virtual G4double AlongStepGetPhysicalInteractionLength (const G4Track &track, G4double previousStepSize, G4double currentMinimumStep, G4double &proposedSafety, G4GPILSelection *selection)=0
 
virtual G4double AtRestGetPhysicalInteractionLength (const G4Track &track, G4ForceCondition *condition)=0
 
virtual G4double PostStepGetPhysicalInteractionLength (const G4Track &track, G4double previousStepSize, G4ForceCondition *condition)=0
 
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 IsApplicable (const G4ParticleDefinition &)
 
virtual void BuildPhysicsTable (const G4ParticleDefinition &)
 
virtual void PreparePhysicsTable (const G4ParticleDefinition &)
 
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 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
 
virtual void DumpInfo () const
 
virtual void ProcessDescription (std::ostream &outfile) 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 66 of file G4Cerenkov.hh.

Constructor & Destructor Documentation

◆ G4Cerenkov() [1/2]

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

Definition at line 76 of file G4Cerenkov.cc.

77 : G4VProcess(processName, type)
78 , fNumPhotons(0)
79{
81
82 thePhysicsTable = nullptr;
83
84 if(verboseLevel > 0)
85 {
86 G4cout << GetProcessName() << " is created." << G4endl;
87 }
88 Initialise();
89}
@ fCerenkov
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
void Initialise()
Definition: G4Cerenkov.cc:113
G4PhysicsTable * thePhysicsTable
Definition: G4Cerenkov.hh:172
G4int verboseLevel
Definition: G4VProcess.hh:356
void SetProcessSubType(G4int)
Definition: G4VProcess.hh:406
const G4String & GetProcessName() const
Definition: G4VProcess.hh:382

◆ ~G4Cerenkov()

G4Cerenkov::~G4Cerenkov ( )

Definition at line 92 of file G4Cerenkov.cc.

93{
94 if(thePhysicsTable != nullptr)
95 {
97 delete thePhysicsTable;
98 }
99}
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 121 of file G4Cerenkov.hh.

123 {
124 return nullptr;
125 };

◆ AlongStepGetPhysicalInteractionLength()

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

Implements G4VProcess.

Definition at line 103 of file G4Cerenkov.hh.

105 {
106 return -1.0;
107 };

◆ AtRestDoIt()

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

Implements G4VProcess.

Definition at line 116 of file G4Cerenkov.hh.

117 {
118 return nullptr;
119 };

◆ AtRestGetPhysicalInteractionLength()

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

Implements G4VProcess.

Definition at line 109 of file G4Cerenkov.hh.

111 {
112 return -1.0;
113 };

◆ BuildPhysicsTable()

void G4Cerenkov::BuildPhysicsTable ( const G4ParticleDefinition aParticleType)
overridevirtual

Reimplemented from G4VProcess.

Definition at line 124 of file G4Cerenkov.cc.

125{
127 return;
128
129 const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
130 G4int numOfMaterials = G4Material::GetNumberOfMaterials();
131
132 thePhysicsTable = new G4PhysicsTable(numOfMaterials);
133
134 // loop over materials
135 for(G4int i = 0; i < numOfMaterials; ++i)
136 {
137 G4PhysicsOrderedFreeVector* aPhysicsOrderedFreeVector = 0;
138
139 // Retrieve vector of refraction indices for the material
140 // from the material's optical properties table
141 G4Material* aMaterial = (*theMaterialTable)[i];
142 G4MaterialPropertiesTable* aMaterialPropertiesTable =
143 aMaterial->GetMaterialPropertiesTable();
144
145 if(aMaterialPropertiesTable)
146 {
147 aPhysicsOrderedFreeVector = new G4PhysicsOrderedFreeVector();
148 G4MaterialPropertyVector* theRefractionIndexVector =
149 aMaterialPropertiesTable->GetProperty(kRINDEX);
150
151 if(theRefractionIndexVector)
152 {
153 // Retrieve the first refraction index in vector
154 // of (photon energy, refraction index) pairs
155 G4double currentRI = (*theRefractionIndexVector)[0];
156
157 if(currentRI > 1.0)
158 {
159 // Create first (photon energy, Cerenkov Integral) pair
160 G4double currentPM = theRefractionIndexVector->Energy(0);
161 G4double currentCAI = 0.0;
162
163 aPhysicsOrderedFreeVector->InsertValues(currentPM, currentCAI);
164
165 // Set previous values to current ones prior to loop
166 G4double prevPM = currentPM;
167 G4double prevCAI = currentCAI;
168 G4double prevRI = currentRI;
169
170 // loop over all (photon energy, refraction index)
171 // pairs stored for this material
172 for(size_t ii = 1; ii < theRefractionIndexVector->GetVectorLength();
173 ++ii)
174 {
175 currentRI = (*theRefractionIndexVector)[ii];
176 currentPM = theRefractionIndexVector->Energy(ii);
177 currentCAI = prevCAI + (currentPM - prevPM) * 0.5 *
178 (1.0 / (prevRI * prevRI) +
179 1.0 / (currentRI * currentRI));
180
181 aPhysicsOrderedFreeVector->InsertValues(currentPM, currentCAI);
182
183 prevPM = currentPM;
184 prevCAI = currentCAI;
185 prevRI = currentRI;
186 }
187 }
188 }
189 }
190
191 // The Cerenkov integral for a given material will be inserted in
192 // thePhysicsTable according to the position of the material in
193 // the material table.
194 thePhysicsTable->insertAt(i, aPhysicsOrderedFreeVector);
195 }
196}
std::vector< G4Material * > G4MaterialTable
double G4double
Definition: G4Types.hh:83
int G4int
Definition: G4Types.hh:85
G4MaterialPropertyVector * GetProperty(const char *key, G4bool warning=false)
G4MaterialPropertiesTable * GetMaterialPropertiesTable() const
Definition: G4Material.hh:254
static size_t GetNumberOfMaterials()
Definition: G4Material.cc:644
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:637
void InsertValues(G4double energy, G4double value)
void insertAt(std::size_t, G4PhysicsVector *)
G4double Energy(std::size_t index) const
std::size_t GetVectorLength() const

◆ DumpPhysicsTable()

void G4Cerenkov::DumpPhysicsTable ( ) const

Definition at line 584 of file G4Cerenkov.cc.

585{
587 for(size_t i = 0; i < thePhysicsTable->entries(); ++i)
588 {
590 v->DumpValues();
591 }
592}
std::size_t entries() const
void DumpValues(G4double unitE=1.0, G4double unitV=1.0) const

◆ GetAverageNumberOfPhotons()

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

Definition at line 492 of file G4Cerenkov.cc.

498{
499 const G4double Rfact = 369.81 / (eV * cm);
500 if(beta <= 0.0)
501 return 0.0;
502 G4double BetaInverse = 1. / beta;
503
504 // Vectors used in computation of Cerenkov Angle Integral:
505 // - Refraction Indices for the current material
506 // - new G4PhysicsOrderedFreeVector allocated to hold CAI's
507 G4int materialIndex = aMaterial->GetIndex();
508
509 // Retrieve the Cerenkov Angle Integrals for this material
510 G4PhysicsOrderedFreeVector* CerenkovAngleIntegrals =
511 (G4PhysicsOrderedFreeVector*) ((*thePhysicsTable)(materialIndex));
512
513 if(!(CerenkovAngleIntegrals->IsFilledVectorExist()))
514 return 0.0;
515
516 // Min and Max photon energies
517 G4double Pmin = Rindex->GetMinLowEdgeEnergy();
518 G4double Pmax = Rindex->GetMaxLowEdgeEnergy();
519
520 // Min and Max Refraction Indices
521 G4double nMin = Rindex->GetMinValue();
522 G4double nMax = Rindex->GetMaxValue();
523
524 // Max Cerenkov Angle Integral
525 G4double CAImax = CerenkovAngleIntegrals->GetMaxValue();
526
527 G4double dp, ge;
528 // If n(Pmax) < 1/Beta -- no photons generated
529 if(nMax < BetaInverse)
530 {
531 dp = 0.0;
532 ge = 0.0;
533 }
534 // otherwise if n(Pmin) >= 1/Beta -- photons generated
535 else if(nMin > BetaInverse)
536 {
537 dp = Pmax - Pmin;
538 ge = CAImax;
539 }
540 // If n(Pmin) < 1/Beta, and n(Pmax) >= 1/Beta, then we need to find a P such
541 // that the value of n(P) == 1/Beta. Interpolation is performed by the
542 // GetEnergy() and Value() methods of the G4MaterialPropertiesTable and
543 // the Value() method of G4PhysicsVector.
544 else
545 {
546 Pmin = Rindex->GetEnergy(BetaInverse);
547 dp = Pmax - Pmin;
548
549 G4double CAImin = CerenkovAngleIntegrals->Value(Pmin);
550 ge = CAImax - CAImin;
551
552 if(verboseLevel > 1)
553 {
554 G4cout << "CAImin = " << CAImin << G4endl << "ge = " << ge << G4endl;
555 }
556 }
557
558 // Calculate number of photons
559 G4double NumPhotons = Rfact * charge / eplus * charge / eplus *
560 (dp - ge * BetaInverse * BetaInverse);
561
562 return NumPhotons;
563}
size_t GetIndex() const
Definition: G4Material.hh:258
G4double GetEnergy(G4double aValue)
G4double Value(G4double theEnergy, std::size_t &lastidx) const
G4bool IsFilledVectorExist() const

Referenced by PostStepDoIt(), and PostStepGetPhysicalInteractionLength().

◆ GetMaxBetaChangePerStep()

G4double G4Cerenkov::GetMaxBetaChangePerStep ( ) const
inline

Definition at line 189 of file G4Cerenkov.hh.

190{
191 return fMaxBetaChange;
192}

◆ GetMaxNumPhotonsPerStep()

G4int G4Cerenkov::GetMaxNumPhotonsPerStep ( ) const
inline

Definition at line 194 of file G4Cerenkov.hh.

194{ return fMaxPhotons; }

◆ GetMeanFreePath()

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

Definition at line 384 of file G4Cerenkov.cc.

386{
387 return 1.;
388}

◆ GetNumPhotons()

G4int G4Cerenkov::GetNumPhotons ( ) const
inline

Definition at line 203 of file G4Cerenkov.hh.

203{ return fNumPhotons; }

◆ GetPhysicsTable()

G4PhysicsTable * G4Cerenkov::GetPhysicsTable ( ) const
inline

Definition at line 205 of file G4Cerenkov.hh.

206{
207 return thePhysicsTable;
208}

◆ GetStackPhotons()

G4bool G4Cerenkov::GetStackPhotons ( ) const
inline

Definition at line 201 of file G4Cerenkov.hh.

201{ return fStackingFlag; }

◆ GetTrackSecondariesFirst()

G4bool G4Cerenkov::GetTrackSecondariesFirst ( ) const
inline

Definition at line 184 of file G4Cerenkov.hh.

185{
186 return fTrackSecondariesFirst;
187}

◆ Initialise()

void G4Cerenkov::Initialise ( )

Definition at line 113 of file G4Cerenkov.cc.

114{
121}
void SetMaxBetaChangePerStep(const G4double d)
Definition: G4Cerenkov.cc:572
void SetTrackSecondariesFirst(const G4bool state)
Definition: G4Cerenkov.cc:566
void SetStackPhotons(const G4bool)
Definition: G4Cerenkov.hh:196
void SetMaxNumPhotonsPerStep(const G4int NumPhotons)
Definition: G4Cerenkov.cc:578
G4int GetCerenkovVerboseLevel() const
G4int GetCerenkovMaxPhotonsPerStep() const
static G4OpticalParameters * Instance()
G4double GetCerenkovMaxBetaChange() const
G4bool GetCerenkovTrackSecondariesFirst() const
G4bool GetCerenkovStackPhotons() const
void SetVerboseLevel(G4int value)
Definition: G4VProcess.hh:412

Referenced by G4Cerenkov(), and PreparePhysicsTable().

◆ IsApplicable()

G4bool G4Cerenkov::IsApplicable ( const G4ParticleDefinition aParticleType)
overridevirtual

Reimplemented from G4VProcess.

Definition at line 102 of file G4Cerenkov.cc.

103{
104 return (aParticleType.GetPDGCharge() != 0.0 &&
105 aParticleType.GetPDGMass() != 0.0 &&
106 aParticleType.GetParticleName() != "chargedgeantino" &&
107 !aParticleType.IsShortLived())
108 ? true
109 : false;
110}
G4double GetPDGCharge() const
const G4String & GetParticleName() const

Referenced by G4OpticalPhysics::ConstructProcess().

◆ PostStepDoIt()

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

Implements G4VProcess.

Definition at line 199 of file G4Cerenkov.cc.

208{
209 ////////////////////////////////////////////////////
210 // Should we ensure that the material is dispersive?
211 ////////////////////////////////////////////////////
212
214
215 const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
216 const G4Material* aMaterial = aTrack.GetMaterial();
217
218 G4StepPoint* pPreStepPoint = aStep.GetPreStepPoint();
219 G4StepPoint* pPostStepPoint = aStep.GetPostStepPoint();
220
221 G4ThreeVector x0 = pPreStepPoint->GetPosition();
222 G4ThreeVector p0 = aStep.GetDeltaPosition().unit();
223 G4double t0 = pPreStepPoint->GetGlobalTime();
224
226 if(!MPT)
227 return pParticleChange;
228
230 if(!Rindex)
231 return pParticleChange;
232
233 G4double charge = aParticle->GetDefinition()->GetPDGCharge();
234 G4double beta = (pPreStepPoint->GetBeta() + pPostStepPoint->GetBeta()) * 0.5;
235
236 // fNumPhotons = 0; // in PostStepGetPhysicalInteractionLength()
237
238 G4double MeanNumberOfPhotons =
239 GetAverageNumberOfPhotons(charge, beta, aMaterial, Rindex);
240
241 if(MeanNumberOfPhotons <= 0.0)
242 {
243 // return unchanged particle and no secondaries
245 return pParticleChange;
246 }
247
248 G4double step_length = aStep.GetStepLength();
249 MeanNumberOfPhotons = MeanNumberOfPhotons * step_length;
250 fNumPhotons = (G4int) G4Poisson(MeanNumberOfPhotons);
251
252 if(fNumPhotons <= 0 || !fStackingFlag)
253 {
254 // return unchanged particle and no secondaries
256 return pParticleChange;
257 }
258
259 ////////////////////////////////////////////////////////////////
261
262 if(fTrackSecondariesFirst)
263 {
264 if(aTrack.GetTrackStatus() == fAlive)
266 }
267
268 ////////////////////////////////////////////////////////////////
269 G4double Pmin = Rindex->GetMinLowEdgeEnergy();
270 G4double Pmax = Rindex->GetMaxLowEdgeEnergy();
271 G4double dp = Pmax - Pmin;
272
273 G4double nMax = Rindex->GetMaxValue();
274 G4double BetaInverse = 1. / beta;
275
276 G4double maxCos = BetaInverse / nMax;
277 G4double maxSin2 = (1.0 - maxCos) * (1.0 + maxCos);
278
279 G4double beta1 = pPreStepPoint->GetBeta();
280 G4double beta2 = pPostStepPoint->GetBeta();
281
282 G4double MeanNumberOfPhotons1 =
283 GetAverageNumberOfPhotons(charge, beta1, aMaterial, Rindex);
284 G4double MeanNumberOfPhotons2 =
285 GetAverageNumberOfPhotons(charge, beta2, aMaterial, Rindex);
286
287 for(G4int i = 0; i < fNumPhotons; ++i)
288 {
289 // Determine photon energy
290 G4double rand;
291 G4double sampledEnergy, sampledRI;
292 G4double cosTheta, sin2Theta;
293
294 // sample an energy
295 do
296 {
297 rand = G4UniformRand();
298 sampledEnergy = Pmin + rand * dp;
299 sampledRI = Rindex->Value(sampledEnergy);
300 cosTheta = BetaInverse / sampledRI;
301
302 sin2Theta = (1.0 - cosTheta) * (1.0 + cosTheta);
303 rand = G4UniformRand();
304
305 // Loop checking, 07-Aug-2015, Vladimir Ivanchenko
306 } while(rand * maxSin2 > sin2Theta);
307
308 // Create photon momentum direction vector. The momentum direction is still
309 // with respect to the coordinate system where the primary particle
310 // direction is aligned with the z axis
311 rand = G4UniformRand();
312 G4double phi = twopi * rand;
313 G4double sinPhi = std::sin(phi);
314 G4double cosPhi = std::cos(phi);
315 G4double sinTheta = std::sqrt(sin2Theta);
316 G4ParticleMomentum photonMomentum(sinTheta * cosPhi, sinTheta * sinPhi,
317 cosTheta);
318
319 // Rotate momentum direction back to global reference system
320 photonMomentum.rotateUz(p0);
321
322 // Determine polarization of new photon
323 G4ThreeVector photonPolarization(cosTheta * cosPhi, cosTheta * sinPhi,
324 -sinTheta);
325
326 // Rotate back to original coord system
327 photonPolarization.rotateUz(p0);
328
329 // Generate a new photon:
330 G4DynamicParticle* aCerenkovPhoton =
332
333 aCerenkovPhoton->SetPolarization(photonPolarization);
334 aCerenkovPhoton->SetKineticEnergy(sampledEnergy);
335
336 G4double NumberOfPhotons, N;
337
338 do
339 {
340 rand = G4UniformRand();
341 NumberOfPhotons = MeanNumberOfPhotons1 -
342 rand * (MeanNumberOfPhotons1 - MeanNumberOfPhotons2);
343 N =
344 G4UniformRand() * std::max(MeanNumberOfPhotons1, MeanNumberOfPhotons2);
345 // Loop checking, 07-Aug-2015, Vladimir Ivanchenko
346 } while(N > NumberOfPhotons);
347
348 G4double delta = rand * aStep.GetStepLength();
349 G4double deltaTime =
350 delta /
351 (pPreStepPoint->GetVelocity() +
352 rand * (pPostStepPoint->GetVelocity() - pPreStepPoint->GetVelocity()) *
353 0.5);
354
355 G4double aSecondaryTime = t0 + deltaTime;
356 G4ThreeVector aSecondaryPosition = x0 + rand * aStep.GetDeltaPosition();
357
358 // Generate new G4Track object:
359 G4Track* aSecondaryTrack =
360 new G4Track(aCerenkovPhoton, aSecondaryTime, aSecondaryPosition);
361
362 aSecondaryTrack->SetTouchableHandle(
364 aSecondaryTrack->SetParentID(aTrack.GetTrackID());
365 aParticleChange.AddSecondary(aSecondaryTrack);
366 }
367
368 if(verboseLevel > 1)
369 {
370 G4cout << "\n Exiting from G4Cerenkov::DoIt -- NumberOfSecondaries = "
372 }
373
374 return pParticleChange;
375}
G4long G4Poisson(G4double mean)
Definition: G4Poisson.hh:50
@ fSuspend
@ fAlive
#define G4UniformRand()
Definition: Randomize.hh:52
Hep3Vector unit() const
G4double GetAverageNumberOfPhotons(const G4double charge, const G4double beta, const G4Material *aMaterial, G4MaterialPropertyVector *Rindex) const
Definition: G4Cerenkov.cc:492
void SetPolarization(const G4ThreeVector &)
G4ParticleDefinition * GetDefinition() const
void SetKineticEnergy(G4double aEnergy)
static G4OpticalPhoton * OpticalPhoton()
void AddSecondary(G4Track *aSecondary)
virtual void Initialize(const G4Track &)
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 SetParentID(const G4int aValue)
void ProposeTrackStatus(G4TrackStatus status)
G4int GetNumberOfSecondaries() const
void SetNumberOfSecondaries(G4int totSecondaries)
G4ParticleChange aParticleChange
Definition: G4VProcess.hh:327
G4VParticleChange * pParticleChange
Definition: G4VProcess.hh:321

◆ PostStepGetPhysicalInteractionLength()

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

Implements G4VProcess.

Definition at line 391 of file G4Cerenkov.cc.

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

379{
380 Initialise();
381}

◆ SetMaxBetaChangePerStep()

void G4Cerenkov::SetMaxBetaChangePerStep ( const G4double  d)

Definition at line 572 of file G4Cerenkov.cc.

573{
574 fMaxBetaChange = value * CLHEP::perCent;
575}

Referenced by Initialise().

◆ SetMaxNumPhotonsPerStep()

void G4Cerenkov::SetMaxNumPhotonsPerStep ( const G4int  NumPhotons)

Definition at line 578 of file G4Cerenkov.cc.

579{
580 fMaxPhotons = NumPhotons;
581}

Referenced by Initialise().

◆ SetStackPhotons()

void G4Cerenkov::SetStackPhotons ( const G4bool  stackingFlag)
inline

Definition at line 196 of file G4Cerenkov.hh.

197{
198 fStackingFlag = stackingFlag;
199}

Referenced by Initialise().

◆ SetTrackSecondariesFirst()

void G4Cerenkov::SetTrackSecondariesFirst ( const G4bool  state)

Definition at line 566 of file G4Cerenkov.cc.

567{
568 fTrackSecondariesFirst = state;
569}

Referenced by Initialise().

Member Data Documentation

◆ thePhysicsTable

G4PhysicsTable* G4Cerenkov::thePhysicsTable
protected

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