Geant4  10.02.p03
G4Cerenkov Class Reference

#include <G4Cerenkov.hh>

Inheritance diagram for G4Cerenkov:
Collaboration diagram for G4Cerenkov:

Public Member Functions

 G4Cerenkov (const G4String &processName="Cerenkov", G4ProcessType type=fElectromagnetic)
 
 ~G4Cerenkov ()
 
 G4Cerenkov (const G4Cerenkov &right)
 
G4bool IsApplicable (const G4ParticleDefinition &aParticleType)
 
void BuildPhysicsTable (const G4ParticleDefinition &aParticleType)
 
G4double GetMeanFreePath (const G4Track &aTrack, G4double, G4ForceCondition *)
 
G4double PostStepGetPhysicalInteractionLength (const G4Track &aTrack, G4double, G4ForceCondition *)
 
G4VParticleChange * PostStepDoIt (const G4Track &aTrack, const G4Step &aStep)
 
virtual G4double AlongStepGetPhysicalInteractionLength (const G4Track &, G4double, G4double, G4double &, G4GPILSelection *)
 
virtual G4double AtRestGetPhysicalInteractionLength (const G4Track &, G4ForceCondition *)
 
virtual G4VParticleChange * AtRestDoIt (const G4Track &, const G4Step &)
 
virtual G4VParticleChange * AlongStepDoIt (const G4Track &, const G4Step &)
 
void SetTrackSecondariesFirst (const G4bool state)
 
G4bool GetTrackSecondariesFirst () const
 
void SetMaxBetaChangePerStep (const G4double d)
 
G4double GetMaxBetaChangePerStep () const
 
void SetMaxNumPhotonsPerStep (const G4int NumPhotons)
 
G4int GetMaxNumPhotonsPerStep () const
 
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
 
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 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
 
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
 
G4VParticleChange * pParticleChange
 
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
 

Private Member Functions

G4Cerenkovoperator= (const G4Cerenkov &right)
 
void BuildThePhysicsTable ()
 
G4double GetAverageNumberOfPhotons (const G4double charge, const G4double beta, const G4Material *aMaterial, G4MaterialPropertyVector *Rindex) const
 

Private Attributes

G4bool fTrackSecondariesFirst
 
G4double fMaxBetaChange
 
G4int fMaxPhotons
 

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 100 of file G4Cerenkov.cc.

101  : G4VProcess(processName, type) ,
102  fTrackSecondariesFirst(false),
103  fMaxBetaChange(0),
104  fMaxPhotons(0)
105 {
107 
108  thePhysicsTable = NULL;
109 
110  if (verboseLevel>0) {
111  G4cout << GetProcessName() << " is created " << G4endl;
112  }
113 }
G4int verboseLevel
Definition: G4VProcess.hh:368
G4VProcess(const G4String &aName="NoName", G4ProcessType aType=fNotDefined)
Definition: G4VProcess.cc:52
G4PhysicsTable * thePhysicsTable
Definition: G4Cerenkov.hh:210
G4int fMaxPhotons
Definition: G4Cerenkov.hh:219
const G4String & GetProcessName() const
Definition: G4VProcess.hh:408
G4GLOB_DLL std::ostream G4cout
G4double fMaxBetaChange
Definition: G4Cerenkov.hh:218
void SetProcessSubType(G4int)
Definition: G4VProcess.hh:432
#define G4endl
Definition: G4ios.hh:61
G4bool fTrackSecondariesFirst
Definition: G4Cerenkov.hh:217
Here is the call graph for this function:

◆ ~G4Cerenkov()

G4Cerenkov::~G4Cerenkov ( )

Definition at line 123 of file G4Cerenkov.cc.

124 {
125  if (thePhysicsTable != NULL) {
127  delete thePhysicsTable;
128  }
129 }
G4PhysicsTable * thePhysicsTable
Definition: G4Cerenkov.hh:210
void clearAndDestroy()
Here is the call graph for this function:

◆ 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 153 of file G4Cerenkov.hh.

156  {return 0;};
Here is the call graph for this function:

◆ AlongStepGetPhysicalInteractionLength()

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

Implements G4VProcess.

Definition at line 134 of file G4Cerenkov.hh.

140  { return -1.0; };

◆ AtRestDoIt()

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

Implements G4VProcess.

Definition at line 148 of file G4Cerenkov.hh.

151  {return 0;};

◆ AtRestGetPhysicalInteractionLength()

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

Implements G4VProcess.

Definition at line 142 of file G4Cerenkov.hh.

145  { return -1.0; };

◆ BuildPhysicsTable()

void G4Cerenkov::BuildPhysicsTable ( const G4ParticleDefinition aParticleType)
virtual

Reimplemented from G4VProcess.

Definition at line 161 of file G4Cerenkov.cc.

162 {
164 }
G4PhysicsTable * thePhysicsTable
Definition: G4Cerenkov.hh:210
void BuildThePhysicsTable()
Definition: G4Cerenkov.cc:393
Here is the call graph for this function:

◆ BuildThePhysicsTable()

void G4Cerenkov::BuildThePhysicsTable ( )
private

Definition at line 393 of file G4Cerenkov.cc.

394 {
395  if (thePhysicsTable) return;
396 
397  const G4MaterialTable* theMaterialTable=
399  G4int numOfMaterials = G4Material::GetNumberOfMaterials();
400 
401  // create new physics table
402 
403  thePhysicsTable = new G4PhysicsTable(numOfMaterials);
404 
405  // loop for materials
406 
407  for (G4int i=0 ; i < numOfMaterials; i++)
408  {
409  G4PhysicsOrderedFreeVector* aPhysicsOrderedFreeVector = 0;
410 
411  // Retrieve vector of refraction indices for the material
412  // from the material's optical properties table
413 
414  G4Material* aMaterial = (*theMaterialTable)[i];
415 
416  G4MaterialPropertiesTable* aMaterialPropertiesTable =
417  aMaterial->GetMaterialPropertiesTable();
418 
419  if (aMaterialPropertiesTable) {
420 
421  aPhysicsOrderedFreeVector = new G4PhysicsOrderedFreeVector();
422  G4MaterialPropertyVector* theRefractionIndexVector =
423  aMaterialPropertiesTable->GetProperty("RINDEX");
424 
425  if (theRefractionIndexVector) {
426 
427  // Retrieve the first refraction index in vector
428  // of (photon energy, refraction index) pairs
429 
430  G4double currentRI = (*theRefractionIndexVector)[0];
431 
432  if (currentRI > 1.0) {
433 
434  // Create first (photon energy, Cerenkov Integral)
435  // pair
436 
437  G4double currentPM = theRefractionIndexVector->
438  Energy(0);
439  G4double currentCAI = 0.0;
440 
441  aPhysicsOrderedFreeVector->
442  InsertValues(currentPM , currentCAI);
443 
444  // Set previous values to current ones prior to loop
445 
446  G4double prevPM = currentPM;
447  G4double prevCAI = currentCAI;
448  G4double prevRI = currentRI;
449 
450  // loop over all (photon energy, refraction index)
451  // pairs stored for this material
452 
453  for (size_t ii = 1;
454  ii < theRefractionIndexVector->GetVectorLength();
455  ++ii)
456  {
457  currentRI = (*theRefractionIndexVector)[ii];
458  currentPM = theRefractionIndexVector->Energy(ii);
459 
460  currentCAI = 0.5*(1.0/(prevRI*prevRI) +
461  1.0/(currentRI*currentRI));
462 
463  currentCAI = prevCAI +
464  (currentPM - prevPM) * currentCAI;
465 
466  aPhysicsOrderedFreeVector->
467  InsertValues(currentPM, currentCAI);
468 
469  prevPM = currentPM;
470  prevCAI = currentCAI;
471  prevRI = currentRI;
472  }
473 
474  }
475  }
476  }
477 
478  // The Cerenkov integral for a given material
479  // will be inserted in thePhysicsTable
480  // according to the position of the material in
481  // the material table.
482 
483  thePhysicsTable->insertAt(i,aPhysicsOrderedFreeVector);
484 
485  }
486 }
G4MaterialPropertyVector * GetProperty(const char *key)
G4MaterialPropertiesTable * GetMaterialPropertiesTable() const
Definition: G4Material.hh:252
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:589
std::vector< G4Material * > G4MaterialTable
G4PhysicsTable * thePhysicsTable
Definition: G4Cerenkov.hh:210
int G4int
Definition: G4Types.hh:78
size_t GetVectorLength() const
static size_t GetNumberOfMaterials()
Definition: G4Material.cc:596
void insertAt(size_t, G4PhysicsVector *)
G4double Energy(size_t index) const
double G4double
Definition: G4Types.hh:76
Here is the call graph for this function:
Here is the caller graph for this function:

◆ DumpPhysicsTable()

void G4Cerenkov::DumpPhysicsTable ( ) const
inline

Definition at line 245 of file G4Cerenkov.hh.

246 {
247  G4int PhysicsTableSize = thePhysicsTable->entries();
249 
250  for (G4int i = 0 ; i < PhysicsTableSize ; i++ )
251  {
253  v->DumpValues();
254  }
255 }
G4PhysicsTable * thePhysicsTable
Definition: G4Cerenkov.hh:210
int G4int
Definition: G4Types.hh:78
size_t entries() const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetAverageNumberOfPhotons()

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

Definition at line 615 of file G4Cerenkov.cc.

619 {
620  const G4double Rfact = 369.81/(eV * cm);
621 
622  if(beta <= 0.0)return 0.0;
623 
624  G4double BetaInverse = 1./beta;
625 
626  // Vectors used in computation of Cerenkov Angle Integral:
627  // - Refraction Indices for the current material
628  // - new G4PhysicsOrderedFreeVector allocated to hold CAI's
629 
630  G4int materialIndex = aMaterial->GetIndex();
631 
632  // Retrieve the Cerenkov Angle Integrals for this material
633 
634  G4PhysicsOrderedFreeVector* CerenkovAngleIntegrals =
635  (G4PhysicsOrderedFreeVector*)((*thePhysicsTable)(materialIndex));
636 
637  if(!(CerenkovAngleIntegrals->IsFilledVectorExist()))return 0.0;
638 
639  // Min and Max photon energies
640  G4double Pmin = Rindex->GetMinLowEdgeEnergy();
641  G4double Pmax = Rindex->GetMaxLowEdgeEnergy();
642 
643  // Min and Max Refraction Indices
644  G4double nMin = Rindex->GetMinValue();
645  G4double nMax = Rindex->GetMaxValue();
646 
647  // Max Cerenkov Angle Integral
648  G4double CAImax = CerenkovAngleIntegrals->GetMaxValue();
649 
650  G4double dp, ge;
651 
652  // If n(Pmax) < 1/Beta -- no photons generated
653 
654  if (nMax < BetaInverse) {
655  dp = 0;
656  ge = 0;
657  }
658 
659  // otherwise if n(Pmin) >= 1/Beta -- photons generated
660 
661  else if (nMin > BetaInverse) {
662  dp = Pmax - Pmin;
663  ge = CAImax;
664  }
665 
666  // If n(Pmin) < 1/Beta, and n(Pmax) >= 1/Beta, then
667  // we need to find a P such that the value of n(P) == 1/Beta.
668  // Interpolation is performed by the GetEnergy() and
669  // Value() methods of the G4MaterialPropertiesTable and
670  // the GetValue() method of G4PhysicsVector.
671 
672  else {
673  Pmin = Rindex->GetEnergy(BetaInverse);
674  dp = Pmax - Pmin;
675 
676  // need boolean for current implementation of G4PhysicsVector
677  // ==> being phased out
678  G4bool isOutRange;
679  G4double CAImin = CerenkovAngleIntegrals->
680  GetValue(Pmin, isOutRange);
681  ge = CAImax - CAImin;
682 
683  if (verboseLevel>0) {
684  G4cout << "CAImin = " << CAImin << G4endl;
685  G4cout << "ge = " << ge << G4endl;
686  }
687  }
688 
689  // Calculate number of photons
690  G4double NumPhotons = Rfact * charge/eplus * charge/eplus *
691  (dp - ge * BetaInverse*BetaInverse);
692 
693  return NumPhotons;
694 }
static const double cm
Definition: G4SIunits.hh:118
G4int verboseLevel
Definition: G4VProcess.hh:368
size_t GetIndex() const
Definition: G4Material.hh:262
G4PhysicsTable * thePhysicsTable
Definition: G4Cerenkov.hh:210
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
G4double GetEnergy(G4double aValue)
static const double eV
Definition: G4SIunits.hh:212
G4bool IsFilledVectorExist() const
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
static const double eplus
Definition: G4SIunits.hh:196
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetMaxBetaChangePerStep()

G4double G4Cerenkov::GetMaxBetaChangePerStep ( ) const
inline

Definition at line 233 of file G4Cerenkov.hh.

234 {
235  return fMaxBetaChange;
236 }
G4double fMaxBetaChange
Definition: G4Cerenkov.hh:218
Here is the caller graph for this function:

◆ GetMaxNumPhotonsPerStep()

G4int G4Cerenkov::GetMaxNumPhotonsPerStep ( ) const
inline

Definition at line 239 of file G4Cerenkov.hh.

240 {
241  return fMaxPhotons;
242 }
G4int fMaxPhotons
Definition: G4Cerenkov.hh:219
Here is the caller graph for this function:

◆ GetMeanFreePath()

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

Definition at line 492 of file G4Cerenkov.cc.

495 {
496  return 1.;
497 }

◆ GetPhysicsTable()

G4PhysicsTable * G4Cerenkov::GetPhysicsTable ( ) const
inline

Definition at line 258 of file G4Cerenkov.hh.

259 {
260  return thePhysicsTable;
261 }
G4PhysicsTable * thePhysicsTable
Definition: G4Cerenkov.hh:210
Here is the caller graph for this function:

◆ GetTrackSecondariesFirst()

G4bool G4Cerenkov::GetTrackSecondariesFirst ( ) const
inline

Definition at line 227 of file G4Cerenkov.hh.

228 {
229  return fTrackSecondariesFirst;
230 }
G4bool fTrackSecondariesFirst
Definition: G4Cerenkov.hh:217
Here is the caller graph for this function:

◆ IsApplicable()

G4bool G4Cerenkov::IsApplicable ( const G4ParticleDefinition aParticleType)
virtual

Reimplemented from G4VProcess.

Definition at line 135 of file G4Cerenkov.cc.

136 {
137  G4bool result = false;
138  if (aParticleType.GetPDGCharge() != 0.0 &&
139  aParticleType.GetPDGMass() != 0.0 &&
140  aParticleType.GetParticleName() != "chargedgeantino" &&
141  !aParticleType.IsShortLived() ) { result = true; }
142 
143  return result;
144 }
const G4String & GetParticleName() const
bool G4bool
Definition: G4Types.hh:79
G4double GetPDGCharge() const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=()

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

◆ PostStepDoIt()

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

Implements G4VProcess.

Definition at line 170 of file G4Cerenkov.cc.

179 {
181  // Should we ensure that the material is dispersive?
183 
184  aParticleChange.Initialize(aTrack);
185 
186  const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
187  const G4Material* aMaterial = aTrack.GetMaterial();
188 
189  G4StepPoint* pPreStepPoint = aStep.GetPreStepPoint();
190  G4StepPoint* pPostStepPoint = aStep.GetPostStepPoint();
191 
192  G4ThreeVector x0 = pPreStepPoint->GetPosition();
193  G4ThreeVector p0 = aStep.GetDeltaPosition().unit();
194  G4double t0 = pPreStepPoint->GetGlobalTime();
195 
196  G4MaterialPropertiesTable* aMaterialPropertiesTable =
197  aMaterial->GetMaterialPropertiesTable();
198  if (!aMaterialPropertiesTable) return pParticleChange;
199 
200  G4MaterialPropertyVector* Rindex =
201  aMaterialPropertiesTable->GetProperty("RINDEX");
202  if (!Rindex) return pParticleChange;
203 
204  // particle charge
205  G4double charge = aParticle->GetDefinition()->GetPDGCharge();
206 
207  // particle beta
208  G4double beta = (pPreStepPoint ->GetBeta() +
209  pPostStepPoint->GetBeta())*0.5;
210 
211  G4double MeanNumberOfPhotons =
212  GetAverageNumberOfPhotons(charge,beta,aMaterial,Rindex);
213 
214  if (MeanNumberOfPhotons <= 0.0) {
215 
216  // return unchanged particle and no secondaries
217 
218  aParticleChange.SetNumberOfSecondaries(0);
219 
220  return pParticleChange;
221 
222  }
223 
224  G4double step_length;
225  step_length = aStep.GetStepLength();
226 
227  MeanNumberOfPhotons = MeanNumberOfPhotons * step_length;
228 
229  G4int NumPhotons = (G4int) G4Poisson(MeanNumberOfPhotons);
230 
231  if (NumPhotons <= 0) {
232 
233  // return unchanged particle and no secondaries
234 
235  aParticleChange.SetNumberOfSecondaries(0);
236 
237  return pParticleChange;
238  }
239 
241 
242  aParticleChange.SetNumberOfSecondaries(NumPhotons);
243 
245  if (aTrack.GetTrackStatus() == fAlive )
246  aParticleChange.ProposeTrackStatus(fSuspend);
247  }
248 
250 
251  G4double Pmin = Rindex->GetMinLowEdgeEnergy();
252  G4double Pmax = Rindex->GetMaxLowEdgeEnergy();
253  G4double dp = Pmax - Pmin;
254 
255  G4double nMax = Rindex->GetMaxValue();
256 
257  G4double BetaInverse = 1./beta;
258 
259  G4double maxCos = BetaInverse / nMax;
260  G4double maxSin2 = (1.0 - maxCos) * (1.0 + maxCos);
261 
262  G4double beta1 = pPreStepPoint ->GetBeta();
263  G4double beta2 = pPostStepPoint->GetBeta();
264 
265  G4double MeanNumberOfPhotons1 =
266  GetAverageNumberOfPhotons(charge,beta1,aMaterial,Rindex);
267  G4double MeanNumberOfPhotons2 =
268  GetAverageNumberOfPhotons(charge,beta2,aMaterial,Rindex);
269 
270  for (G4int i = 0; i < NumPhotons; i++) {
271 
272  // Determine photon energy
273 
274  G4double rand;
275  G4double sampledEnergy, sampledRI;
276  G4double cosTheta, sin2Theta;
277 
278  // sample an energy
279 
280  do {
281  rand = G4UniformRand();
282  sampledEnergy = Pmin + rand * dp;
283  sampledRI = Rindex->Value(sampledEnergy);
284  cosTheta = BetaInverse / sampledRI;
285 
286  sin2Theta = (1.0 - cosTheta)*(1.0 + cosTheta);
287  rand = G4UniformRand();
288 
289  // Loop checking, 07-Aug-2015, Vladimir Ivanchenko
290  } while (rand*maxSin2 > sin2Theta);
291 
292  // Generate random position of photon on cone surface
293  // defined by Theta
294 
295  rand = G4UniformRand();
296 
297  G4double phi = twopi*rand;
298  G4double sinPhi = std::sin(phi);
299  G4double cosPhi = std::cos(phi);
300 
301  // calculate x,y, and z components of photon energy
302  // (in coord system with primary particle direction
303  // aligned with the z axis)
304 
305  G4double sinTheta = std::sqrt(sin2Theta);
306  G4double px = sinTheta*cosPhi;
307  G4double py = sinTheta*sinPhi;
308  G4double pz = cosTheta;
309 
310  // Create photon momentum direction vector
311  // The momentum direction is still with respect
312  // to the coordinate system where the primary
313  // particle direction is aligned with the z axis
314 
315  G4ParticleMomentum photonMomentum(px, py, pz);
316 
317  // Rotate momentum direction back to global reference
318  // system
319 
320  photonMomentum.rotateUz(p0);
321 
322  // Determine polarization of new photon
323 
324  G4double sx = cosTheta*cosPhi;
325  G4double sy = cosTheta*sinPhi;
326  G4double sz = -sinTheta;
327 
328  G4ThreeVector photonPolarization(sx, sy, sz);
329 
330  // Rotate back to original coord system
331 
332  photonPolarization.rotateUz(p0);
333 
334  // Generate a new photon:
335 
336  G4DynamicParticle* aCerenkovPhoton =
338  photonMomentum);
339  aCerenkovPhoton->SetPolarization
340  (photonPolarization.x(),
341  photonPolarization.y(),
342  photonPolarization.z());
343 
344  aCerenkovPhoton->SetKineticEnergy(sampledEnergy);
345 
346  // Generate new G4Track object:
347 
348  G4double NumberOfPhotons, N;
349 
350  do {
351  rand = G4UniformRand();
352  NumberOfPhotons = MeanNumberOfPhotons1 - rand *
353  (MeanNumberOfPhotons1-MeanNumberOfPhotons2);
354  N = G4UniformRand() *
355  std::max(MeanNumberOfPhotons1,MeanNumberOfPhotons2);
356  // Loop checking, 07-Aug-2015, Vladimir Ivanchenko
357  } while (N > NumberOfPhotons);
358 
359  G4double delta = rand * aStep.GetStepLength();
360 
361  G4double deltaTime = delta / (pPreStepPoint->GetVelocity()+
362  rand*(pPostStepPoint->GetVelocity()-
363  pPreStepPoint->GetVelocity())*0.5);
364 
365  G4double aSecondaryTime = t0 + deltaTime;
366 
367  G4ThreeVector aSecondaryPosition =
368  x0 + rand * aStep.GetDeltaPosition();
369 
370  G4Track* aSecondaryTrack =
371  new G4Track(aCerenkovPhoton,aSecondaryTime,aSecondaryPosition);
372 
373  aSecondaryTrack->SetTouchableHandle(
374  aStep.GetPreStepPoint()->GetTouchableHandle());
375 
376  aSecondaryTrack->SetParentID(aTrack.GetTrackID());
377 
378  aParticleChange.AddSecondary(aSecondaryTrack);
379  }
380 
381  if (verboseLevel>0) {
382  G4cout <<"\n Exiting from G4Cerenkov::DoIt -- NumberOfSecondaries = "
383  << aParticleChange.GetNumberOfSecondaries() << G4endl;
384  }
385 
386  return pParticleChange;
387 }
G4long G4Poisson(G4double mean)
Definition: G4Poisson.hh:51
G4MaterialPropertyVector * GetProperty(const char *key)
G4int verboseLevel
Definition: G4VProcess.hh:368
static G4Material * GetMaterial(const G4String &name, G4bool warning=true)
Definition: G4Material.cc:604
G4MaterialPropertiesTable * GetMaterialPropertiesTable() const
Definition: G4Material.hh:252
int G4int
Definition: G4Types.hh:78
#define G4UniformRand()
Definition: Randomize.hh:97
G4GLOB_DLL std::ostream G4cout
G4double GetAverageNumberOfPhotons(const G4double charge, const G4double beta, const G4Material *aMaterial, G4MaterialPropertyVector *Rindex) const
Definition: G4Cerenkov.cc:615
Hep3Vector unit() const
static const double twopi
Definition: G4SIunits.hh:75
G4double Value(G4double theEnergy, size_t &lastidx) const
void SetPolarization(G4double polX, G4double polY, G4double polZ)
void SetKineticEnergy(G4double aEnergy)
static G4OpticalPhoton * OpticalPhoton()
G4VParticleChange * pParticleChange
Definition: G4VProcess.hh:283
G4ParticleChange aParticleChange
Definition: G4VProcess.hh:289
G4ParticleDefinition * GetDefinition() const
#define G4endl
Definition: G4ios.hh:61
**D E S C R I P T I O N
double G4double
Definition: G4Types.hh:76
G4double GetPDGCharge() const
G4bool fTrackSecondariesFirst
Definition: G4Cerenkov.hh:217
Here is the call graph for this function:

◆ PostStepGetPhysicalInteractionLength()

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

Implements G4VProcess.

Definition at line 499 of file G4Cerenkov.cc.

503 {
504  *condition = NotForced;
505  G4double StepLimit = DBL_MAX;
506 
507  const G4Material* aMaterial = aTrack.GetMaterial();
508  G4int materialIndex = aMaterial->GetIndex();
509 
510  // If Physics Vector is not defined no Cerenkov photons
511  // this check avoid string comparison below
512  if(!(*thePhysicsTable)[materialIndex]) { return StepLimit; }
513 
514  const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
515  const G4MaterialCutsCouple* couple = aTrack.GetMaterialCutsCouple();
516 
517  G4double kineticEnergy = aParticle->GetKineticEnergy();
518  const G4ParticleDefinition* particleType = aParticle->GetDefinition();
519  G4double mass = particleType->GetPDGMass();
520 
521  // particle beta
522  G4double beta = aParticle->GetTotalMomentum() /
523  aParticle->GetTotalEnergy();
524  // particle gamma
525  G4double gamma = aParticle->GetTotalEnergy()/mass;
526 
527  G4MaterialPropertiesTable* aMaterialPropertiesTable =
528  aMaterial->GetMaterialPropertiesTable();
529 
530  G4MaterialPropertyVector* Rindex = NULL;
531 
532  if (aMaterialPropertiesTable)
533  Rindex = aMaterialPropertiesTable->GetProperty("RINDEX");
534 
535  G4double nMax;
536  if (Rindex) {
537  nMax = Rindex->GetMaxValue();
538  } else {
539  return StepLimit;
540  }
541 
542  G4double BetaMin = 1./nMax;
543  if ( BetaMin >= 1. ) return StepLimit;
544 
545  G4double GammaMin = 1./std::sqrt(1.-BetaMin*BetaMin);
546 
547  if (gamma < GammaMin ) return StepLimit;
548 
549  G4double kinEmin = mass*(GammaMin-1.);
550 
552  GetRange(particleType,
553  kinEmin,
554  couple);
556  GetRange(particleType,
557  kineticEnergy,
558  couple);
559 
560  G4double Step = Range - RangeMin;
561  if (Step < 1.*um ) return StepLimit;
562 
563  if (Step > 0. && Step < StepLimit) StepLimit = Step;
564 
565  // If user has defined an average maximum number of photons to
566  // be generated in a Step, then calculate the Step length for
567  // that number of photons.
568 
569  if (fMaxPhotons > 0) {
570 
571  // particle charge
572  const G4double charge = aParticle->
573  GetDefinition()->GetPDGCharge();
574 
575  G4double MeanNumberOfPhotons =
576  GetAverageNumberOfPhotons(charge,beta,aMaterial,Rindex);
577 
578  Step = 0.;
579  if (MeanNumberOfPhotons > 0.0) Step = fMaxPhotons /
580  MeanNumberOfPhotons;
581 
582  if (Step > 0. && Step < StepLimit) StepLimit = Step;
583  }
584 
585  // If user has defined an maximum allowed change in beta per step
586  if (fMaxBetaChange > 0.) {
587 
589  GetDEDX(particleType,
590  kineticEnergy,
591  couple);
592 
593  G4double deltaGamma = gamma -
594  1./std::sqrt(1.-beta*beta*
595  (1.-fMaxBetaChange)*
596  (1.-fMaxBetaChange));
597 
598  Step = mass * deltaGamma / dedx;
599 
600  if (Step > 0. && Step < StepLimit) StepLimit = Step;
601 
602  }
603 
604  *condition = StronglyForced;
605  return StepLimit;
606 }
G4double condition(const G4ErrorSymMatrix &m)
static G4LossTableManager * Instance()
G4MaterialPropertyVector * GetProperty(const char *key)
static G4Material * GetMaterial(const G4String &name, G4bool warning=true)
Definition: G4Material.cc:604
G4MaterialPropertiesTable * GetMaterialPropertiesTable() const
Definition: G4Material.hh:252
G4double GetTotalMomentum() const
size_t GetIndex() const
Definition: G4Material.hh:262
G4PhysicsTable * thePhysicsTable
Definition: G4Cerenkov.hh:210
int G4int
Definition: G4Types.hh:78
G4double GetTotalEnergy() const
G4int fMaxPhotons
Definition: G4Cerenkov.hh:219
G4double GetKineticEnergy() const
G4double GetAverageNumberOfPhotons(const G4double charge, const G4double beta, const G4Material *aMaterial, G4MaterialPropertyVector *Rindex) const
Definition: G4Cerenkov.cc:615
G4double fMaxBetaChange
Definition: G4Cerenkov.hh:218
Definition: Step.hh:41
static const double um
Definition: G4SIunits.hh:112
G4ParticleDefinition * GetDefinition() const
double G4double
Definition: G4Types.hh:76
#define DBL_MAX
Definition: templates.hh:83
Here is the call graph for this function:

◆ SetMaxBetaChangePerStep()

void G4Cerenkov::SetMaxBetaChangePerStep ( const G4double  d)

Definition at line 151 of file G4Cerenkov.cc.

152 {
154 }
static const double perCent
G4double fMaxBetaChange
Definition: G4Cerenkov.hh:218
Here is the caller graph for this function:

◆ SetMaxNumPhotonsPerStep()

void G4Cerenkov::SetMaxNumPhotonsPerStep ( const G4int  NumPhotons)

Definition at line 156 of file G4Cerenkov.cc.

157 {
158  fMaxPhotons = NumPhotons;
159 }
G4int fMaxPhotons
Definition: G4Cerenkov.hh:219
Here is the caller graph for this function:

◆ SetTrackSecondariesFirst()

void G4Cerenkov::SetTrackSecondariesFirst ( const G4bool  state)

Definition at line 146 of file G4Cerenkov.cc.

147 {
148  fTrackSecondariesFirst = state;
149 }
G4bool fTrackSecondariesFirst
Definition: G4Cerenkov.hh:217
Here is the caller graph for this function:

Member Data Documentation

◆ fMaxBetaChange

G4double G4Cerenkov::fMaxBetaChange
private

Definition at line 218 of file G4Cerenkov.hh.

◆ fMaxPhotons

G4int G4Cerenkov::fMaxPhotons
private

Definition at line 219 of file G4Cerenkov.hh.

◆ fTrackSecondariesFirst

G4bool G4Cerenkov::fTrackSecondariesFirst
private

Definition at line 217 of file G4Cerenkov.hh.

◆ thePhysicsTable

G4PhysicsTable* G4Cerenkov::thePhysicsTable
protected

Definition at line 210 of file G4Cerenkov.hh.


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