Geant4 9.6.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)
 
G4double GetMeanFreePath (const G4Track &aTrack, G4double, G4ForceCondition *)
 
G4double PostStepGetPhysicalInteractionLength (const G4Track &aTrack, G4double, G4ForceCondition *)
 
G4VParticleChangePostStepDoIt (const G4Track &aTrack, const G4Step &aStep)
 
virtual G4double AlongStepGetPhysicalInteractionLength (const G4Track &, G4double, G4double, G4double &, G4GPILSelection *)
 
virtual G4double AtRestGetPhysicalInteractionLength (const G4Track &, G4ForceCondition *)
 
virtual G4VParticleChangeAtRestDoIt (const G4Track &, const G4Step &)
 
virtual G4VParticleChangeAlongStepDoIt (const G4Track &, const G4Step &)
 
void SetTrackSecondariesFirst (const G4bool state)
 
void SetMaxBetaChangePerStep (const G4double d)
 
void SetMaxNumPhotonsPerStep (const G4int NumPhotons)
 
G4PhysicsTableGetPhysicsTable () const
 
void DumpPhysicsTable () const
 
- Public Member Functions inherited from G4VProcess
 G4VProcess (const G4String &aName="NoName", G4ProcessType aType=fNotDefined)
 
 G4VProcess (const G4VProcess &right)
 
virtual ~G4VProcess ()
 
G4int operator== (const G4VProcess &right) const
 
G4int 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
 
void SetVerboseLevel (G4int value)
 
G4int GetVerboseLevel () const
 

Protected Attributes

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

Additional Inherited Members

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

Detailed Description

Definition at line 81 of file G4Cerenkov.hh.

Constructor & Destructor Documentation

◆ G4Cerenkov() [1/2]

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

Definition at line 92 of file G4Cerenkov.cc.

93 : G4VProcess(processName, type)
94{
96
97 fTrackSecondariesFirst = false;
98 fMaxBetaChange = 0.;
99 fMaxPhotons = 0;
100
101 thePhysicsTable = NULL;
102
103 if (verboseLevel>0) {
104 G4cout << GetProcessName() << " is created " << G4endl;
105 }
106
107 BuildThePhysicsTable();
108}
@ fCerenkov
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout
G4PhysicsTable * thePhysicsTable
Definition: G4Cerenkov.hh:197
G4int verboseLevel
Definition: G4VProcess.hh:368
void SetProcessSubType(G4int)
Definition: G4VProcess.hh:403
const G4String & GetProcessName() const
Definition: G4VProcess.hh:379

◆ ~G4Cerenkov()

G4Cerenkov::~G4Cerenkov ( )

Definition at line 118 of file G4Cerenkov.cc.

119{
120 if (thePhysicsTable != NULL) {
122 delete thePhysicsTable;
123 }
124}
void clearAndDestroy()

◆ G4Cerenkov() [2/2]

G4Cerenkov::G4Cerenkov ( const G4Cerenkov right)

Member Function Documentation

◆ AlongStepDoIt()

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

Implements G4VProcess.

Definition at line 150 of file G4Cerenkov.hh.

153 {return 0;};

◆ AlongStepGetPhysicalInteractionLength()

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

Implements G4VProcess.

Definition at line 131 of file G4Cerenkov.hh.

137 { return -1.0; };

◆ AtRestDoIt()

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

Implements G4VProcess.

Definition at line 145 of file G4Cerenkov.hh.

148 {return 0;};

◆ AtRestGetPhysicalInteractionLength()

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

Implements G4VProcess.

Definition at line 139 of file G4Cerenkov.hh.

142 { return -1.0; };

◆ DumpPhysicsTable()

void G4Cerenkov::DumpPhysicsTable ( ) const
inline

Definition at line 241 of file G4Cerenkov.hh.

242{
243 G4int PhysicsTableSize = thePhysicsTable->entries();
245
246 for (G4int i = 0 ; i < PhysicsTableSize ; i++ )
247 {
249 v->DumpValues();
250 }
251}
int G4int
Definition: G4Types.hh:66
size_t entries() const

◆ GetMeanFreePath()

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

Definition at line 454 of file G4Cerenkov.cc.

457{
458 return 1.;
459}

◆ GetPhysicsTable()

G4PhysicsTable * G4Cerenkov::GetPhysicsTable ( ) const
inline

Definition at line 254 of file G4Cerenkov.hh.

255{
256 return thePhysicsTable;
257}

◆ IsApplicable()

G4bool G4Cerenkov::IsApplicable ( const G4ParticleDefinition aParticleType)
inlinevirtual

Reimplemented from G4VProcess.

Definition at line 214 of file G4Cerenkov.hh.

215{
216 if (aParticleType.GetParticleName() == "chargedgeantino") return false;
217 if (aParticleType.IsShortLived()) return false;
218
219 return (aParticleType.GetPDGCharge() != 0);
220}
G4double GetPDGCharge() const
const G4String & GetParticleName() const

Referenced by G4OpticalPhysics::ConstructProcess().

◆ PostStepDoIt()

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

Implements G4VProcess.

Definition at line 134 of file G4Cerenkov.cc.

143{
144 //////////////////////////////////////////////////////
145 // Should we ensure that the material is dispersive?
146 //////////////////////////////////////////////////////
147
149
150 const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
151 const G4Material* aMaterial = aTrack.GetMaterial();
152
153 G4StepPoint* pPreStepPoint = aStep.GetPreStepPoint();
154 G4StepPoint* pPostStepPoint = aStep.GetPostStepPoint();
155
156 G4ThreeVector x0 = pPreStepPoint->GetPosition();
157 G4ThreeVector p0 = aStep.GetDeltaPosition().unit();
158 G4double t0 = pPreStepPoint->GetGlobalTime();
159
160 G4MaterialPropertiesTable* aMaterialPropertiesTable =
161 aMaterial->GetMaterialPropertiesTable();
162 if (!aMaterialPropertiesTable) return pParticleChange;
163
164 G4MaterialPropertyVector* Rindex =
165 aMaterialPropertiesTable->GetProperty("RINDEX");
166 if (!Rindex) return pParticleChange;
167
168 // particle charge
169 const G4double charge = aParticle->GetDefinition()->GetPDGCharge();
170
171 // particle beta
172 const G4double beta = (pPreStepPoint ->GetBeta() +
173 pPostStepPoint->GetBeta())/2.;
174
175 G4double MeanNumberOfPhotons =
176 GetAverageNumberOfPhotons(charge,beta,aMaterial,Rindex);
177
178 if (MeanNumberOfPhotons <= 0.0) {
179
180 // return unchanged particle and no secondaries
181
183
184 return pParticleChange;
185
186 }
187
188 G4double step_length;
189 step_length = aStep.GetStepLength();
190
191 MeanNumberOfPhotons = MeanNumberOfPhotons * step_length;
192
193 G4int NumPhotons = (G4int) G4Poisson(MeanNumberOfPhotons);
194
195 if (NumPhotons <= 0) {
196
197 // return unchanged particle and no secondaries
198
200
201 return pParticleChange;
202 }
203
204 ////////////////////////////////////////////////////////////////
205
207
208 if (fTrackSecondariesFirst) {
209 if (aTrack.GetTrackStatus() == fAlive )
211 }
212
213 ////////////////////////////////////////////////////////////////
214
215 G4double Pmin = Rindex->GetMinLowEdgeEnergy();
216 G4double Pmax = Rindex->GetMaxLowEdgeEnergy();
217 G4double dp = Pmax - Pmin;
218
219 G4double nMax = Rindex->GetMaxValue();
220
221 G4double BetaInverse = 1./beta;
222
223 G4double maxCos = BetaInverse / nMax;
224 G4double maxSin2 = (1.0 - maxCos) * (1.0 + maxCos);
225
226 const G4double beta1 = pPreStepPoint ->GetBeta();
227 const G4double beta2 = pPostStepPoint->GetBeta();
228
229 G4double MeanNumberOfPhotons1 =
230 GetAverageNumberOfPhotons(charge,beta1,aMaterial,Rindex);
231 G4double MeanNumberOfPhotons2 =
232 GetAverageNumberOfPhotons(charge,beta2,aMaterial,Rindex);
233
234 for (G4int i = 0; i < NumPhotons; i++) {
235
236 // Determine photon energy
237
238 G4double rand;
239 G4double sampledEnergy, sampledRI;
240 G4double cosTheta, sin2Theta;
241
242 // sample an energy
243
244 do {
245 rand = G4UniformRand();
246 sampledEnergy = Pmin + rand * dp;
247 sampledRI = Rindex->Value(sampledEnergy);
248 cosTheta = BetaInverse / sampledRI;
249
250 sin2Theta = (1.0 - cosTheta)*(1.0 + cosTheta);
251 rand = G4UniformRand();
252
253 } while (rand*maxSin2 > sin2Theta);
254
255 // Generate random position of photon on cone surface
256 // defined by Theta
257
258 rand = G4UniformRand();
259
260 G4double phi = twopi*rand;
261 G4double sinPhi = std::sin(phi);
262 G4double cosPhi = std::cos(phi);
263
264 // calculate x,y, and z components of photon energy
265 // (in coord system with primary particle direction
266 // aligned with the z axis)
267
268 G4double sinTheta = std::sqrt(sin2Theta);
269 G4double px = sinTheta*cosPhi;
270 G4double py = sinTheta*sinPhi;
271 G4double pz = cosTheta;
272
273 // Create photon momentum direction vector
274 // The momentum direction is still with respect
275 // to the coordinate system where the primary
276 // particle direction is aligned with the z axis
277
278 G4ParticleMomentum photonMomentum(px, py, pz);
279
280 // Rotate momentum direction back to global reference
281 // system
282
283 photonMomentum.rotateUz(p0);
284
285 // Determine polarization of new photon
286
287 G4double sx = cosTheta*cosPhi;
288 G4double sy = cosTheta*sinPhi;
289 G4double sz = -sinTheta;
290
291 G4ThreeVector photonPolarization(sx, sy, sz);
292
293 // Rotate back to original coord system
294
295 photonPolarization.rotateUz(p0);
296
297 // Generate a new photon:
298
299 G4DynamicParticle* aCerenkovPhoton =
301 photonMomentum);
302 aCerenkovPhoton->SetPolarization
303 (photonPolarization.x(),
304 photonPolarization.y(),
305 photonPolarization.z());
306
307 aCerenkovPhoton->SetKineticEnergy(sampledEnergy);
308
309 // Generate new G4Track object:
310
311 G4double delta, NumberOfPhotons, N;
312
313 do {
314 rand = G4UniformRand();
315 delta = rand * aStep.GetStepLength();
316 NumberOfPhotons = MeanNumberOfPhotons1 - delta *
317 (MeanNumberOfPhotons1-MeanNumberOfPhotons2)/
318 aStep.GetStepLength();
319 N = G4UniformRand() *
320 std::max(MeanNumberOfPhotons1,MeanNumberOfPhotons2);
321 } while (N > NumberOfPhotons);
322
323 G4double deltaTime = delta /
324 ((pPreStepPoint->GetVelocity()+
325 pPostStepPoint->GetVelocity())/2.);
326
327 G4double aSecondaryTime = t0 + deltaTime;
328
329 G4ThreeVector aSecondaryPosition =
330 x0 + rand * aStep.GetDeltaPosition();
331
332 G4Track* aSecondaryTrack =
333 new G4Track(aCerenkovPhoton,aSecondaryTime,aSecondaryPosition);
334
335 aSecondaryTrack->SetTouchableHandle(
337
338 aSecondaryTrack->SetParentID(aTrack.GetTrackID());
339
340 aParticleChange.AddSecondary(aSecondaryTrack);
341 }
342
343 if (verboseLevel>0) {
344 G4cout <<"\n Exiting from G4Cerenkov::DoIt -- NumberOfSecondaries = "
346 }
347
348 return pParticleChange;
349}
G4long G4Poisson(G4double mean)
Definition: G4Poisson.hh:50
@ fSuspend
@ fAlive
double G4double
Definition: G4Types.hh:64
#define G4UniformRand()
Definition: Randomize.hh:53
Hep3Vector unit() const
void SetPolarization(G4double polX, G4double polY, G4double polZ)
G4ParticleDefinition * GetDefinition() const
void SetKineticEnergy(G4double aEnergy)
G4MaterialPropertyVector * GetProperty(const char *key)
G4MaterialPropertiesTable * GetMaterialPropertiesTable() const
Definition: G4Material.hh:251
static G4OpticalPhoton * OpticalPhoton()
void AddSecondary(G4Track *aSecondary)
virtual void Initialize(const G4Track &)
G4double Value(G4double theEnergy)
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:289
G4VParticleChange * pParticleChange
Definition: G4VProcess.hh:283

◆ PostStepGetPhysicalInteractionLength()

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

Implements G4VProcess.

Definition at line 461 of file G4Cerenkov.cc.

465{
467 G4double StepLimit = DBL_MAX;
468
469 const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
470 const G4Material* aMaterial = aTrack.GetMaterial();
471 const G4MaterialCutsCouple* couple = aTrack.GetMaterialCutsCouple();
472
473 G4double kineticEnergy = aParticle->GetKineticEnergy();
474 const G4ParticleDefinition* particleType = aParticle->GetDefinition();
475 G4double mass = particleType->GetPDGMass();
476
477 // particle beta
478 G4double beta = aParticle->GetTotalMomentum() /
479 aParticle->GetTotalEnergy();
480 // particle gamma
481 G4double gamma = aParticle->GetTotalEnergy()/mass;
482
483 G4MaterialPropertiesTable* aMaterialPropertiesTable =
484 aMaterial->GetMaterialPropertiesTable();
485
486 G4MaterialPropertyVector* Rindex = NULL;
487
488 if (aMaterialPropertiesTable)
489 Rindex = aMaterialPropertiesTable->GetProperty("RINDEX");
490
491 G4double nMax;
492 if (Rindex) {
493 nMax = Rindex->GetMaxValue();
494 } else {
495 return StepLimit;
496 }
497
498 G4double BetaMin = 1./nMax;
499 if ( BetaMin >= 1. ) return StepLimit;
500
501 G4double GammaMin = 1./std::sqrt(1.-BetaMin*BetaMin);
502
503 if (gamma < GammaMin ) return StepLimit;
504
505 G4double kinEmin = mass*(GammaMin-1.);
506
508 GetRange(particleType,
509 kinEmin,
510 couple);
512 GetRange(particleType,
513 kineticEnergy,
514 couple);
515
516 G4double Step = Range - RangeMin;
517 if (Step < 1.*um ) return StepLimit;
518
519 if (Step > 0. && Step < StepLimit) StepLimit = Step;
520
521 // If user has defined an average maximum number of photons to
522 // be generated in a Step, then calculate the Step length for
523 // that number of photons.
524
525 if (fMaxPhotons > 0) {
526
527 // particle charge
528 const G4double charge = aParticle->
529 GetDefinition()->GetPDGCharge();
530
531 G4double MeanNumberOfPhotons =
532 GetAverageNumberOfPhotons(charge,beta,aMaterial,Rindex);
533
534 Step = 0.;
535 if (MeanNumberOfPhotons > 0.0) Step = fMaxPhotons /
536 MeanNumberOfPhotons;
537
538 if (Step > 0. && Step < StepLimit) StepLimit = Step;
539 }
540
541 // If user has defined an maximum allowed change in beta per step
542 if (fMaxBetaChange > 0.) {
543
545 GetDEDX(particleType,
546 kineticEnergy,
547 couple);
548
549 G4double deltaGamma = gamma -
550 1./std::sqrt(1.-beta*beta*
551 (1.-fMaxBetaChange)*
552 (1.-fMaxBetaChange));
553
554 Step = mass * deltaGamma / dedx;
555
556 if (Step > 0. && Step < StepLimit) StepLimit = Step;
557
558 }
559
561 return StepLimit;
562}
G4double condition(const G4ErrorSymMatrix &m)
@ StronglyForced
@ NotForced
G4double GetKineticEnergy() const
G4double GetTotalEnergy() const
G4double GetTotalMomentum() const
static G4LossTableManager * Instance()
const G4MaterialCutsCouple * GetMaterialCutsCouple() const
#define DBL_MAX
Definition: templates.hh:83

◆ SetMaxBetaChangePerStep()

void G4Cerenkov::SetMaxBetaChangePerStep ( const G4double  d)
inline

Definition at line 229 of file G4Cerenkov.hh.

230{
231 fMaxBetaChange = value*CLHEP::perCent;
232}

Referenced by G4OpticalPhysics::ConstructProcess(), and G4OpticalPhysics::SetMaxBetaChangePerStep().

◆ SetMaxNumPhotonsPerStep()

void G4Cerenkov::SetMaxNumPhotonsPerStep ( const G4int  NumPhotons)
inline

Definition at line 235 of file G4Cerenkov.hh.

236{
237 fMaxPhotons = NumPhotons;
238}

Referenced by G4OpticalPhysics::ConstructProcess(), and G4OpticalPhysics::SetMaxNumPhotonsPerStep().

◆ SetTrackSecondariesFirst()

void G4Cerenkov::SetTrackSecondariesFirst ( const G4bool  state)
inline

Definition at line 223 of file G4Cerenkov.hh.

224{
225 fTrackSecondariesFirst = state;
226}

Referenced by G4OpticalPhysics::SetTrackSecondariesFirst().

Member Data Documentation

◆ thePhysicsTable

G4PhysicsTable* G4Cerenkov::thePhysicsTable
protected

Definition at line 197 of file G4Cerenkov.hh.

Referenced by DumpPhysicsTable(), G4Cerenkov(), GetPhysicsTable(), and ~G4Cerenkov().


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