113 fTrackSecondariesFirst(false),
114 fFiniteRiseTime(false),
116 fExcitationRatio(1.0),
117 fScintillationByParticleType(false),
118 fScintillationTrackInfo(false),
121 fEmSaturation(nullptr)
125 #ifdef G4DEBUG_SCINTILLATION
127 ScintTrackYield = 0.;
223 if (!aMaterialPropertiesTable)
231 if (!Fast_Intensity && !Slow_Intensity )
235 if (Fast_Intensity && Slow_Intensity) nscnt = 2;
248 ScintillationYield = aMaterialPropertiesTable->
255 G4double ResolutionScale = aMaterialPropertiesTable->
270 MeanNumberOfPhotons = ScintillationYield;
272 MeanNumberOfPhotons = ScintillationYield*
275 MeanNumberOfPhotons = ScintillationYield*TotalEnergyDeposit;
277 if (MeanNumberOfPhotons > 10.)
279 G4double sigma = ResolutionScale * std::sqrt(MeanNumberOfPhotons);
314 for (
G4int scnt = 1; scnt <= nscnt; scnt++) {
323 if (Fast_Intensity) {
324 ScintillationTime = aMaterialPropertiesTable->
327 ScintillationRiseTime = aMaterialPropertiesTable->
330 ScintillationType =
Fast;
331 ScintillationIntegral =
335 if (Slow_Intensity) {
336 ScintillationTime = aMaterialPropertiesTable->
339 ScintillationRiseTime = aMaterialPropertiesTable->
342 ScintillationType =
Slow;
343 ScintillationIntegral =
349 G4double yieldRatio = aMaterialPropertiesTable->
357 ScintillationTime = aMaterialPropertiesTable->
360 ScintillationRiseTime = aMaterialPropertiesTable->
363 ScintillationType =
Fast;
364 ScintillationIntegral =
371 ScintillationTime = aMaterialPropertiesTable->
374 ScintillationRiseTime = aMaterialPropertiesTable->
377 ScintillationType =
Slow;
378 ScintillationIntegral =
383 if (!ScintillationIntegral)
continue;
389 for (
G4int i = 0; i < Num; i++) {
395 ScintillationIntegral->
GetEnergy(CIIvalue);
398 G4cout <<
"sampledEnergy = " << sampledEnergy <<
G4endl;
405 G4double sint = std::sqrt((1.-cost)*(1.+cost));
430 sinp = std::sin(phi);
431 cosp = std::cos(phi);
433 photonPolarization = cosp * photonPolarization + sinp * perp;
435 photonPolarization = photonPolarization.
unit();
443 (photonPolarization.
x(),
444 photonPolarization.
y(),
445 photonPolarization.
z());
465 if (ScintillationRiseTime==0.0) {
466 deltaTime = deltaTime -
469 deltaTime = deltaTime +
470 sample_time(ScintillationRiseTime, ScintillationTime);
473 G4double aSecondaryTime = t0 + deltaTime;
497 G4cout <<
"\n Exiting from G4Scintillation::DoIt -- NumberOfSecondaries = "
525 for (
G4int i=0 ; i < numOfMaterials; i++)
535 G4Material* aMaterial = (*theMaterialTable)[i];
540 if (aMaterialPropertiesTable) {
545 if (theFastLightVector) {
550 G4double currentIN = (*theFastLightVector)[0];
552 if (currentIN >= 0.0) {
561 aPhysicsOrderedFreeVector->
562 InsertValues(currentPM , currentCII);
577 currentPM = theFastLightVector->
Energy(ii);
578 currentIN = (*theFastLightVector)[ii];
580 currentCII = 0.5 * (prevIN + currentIN);
582 currentCII = prevCII +
583 (currentPM - prevPM) * currentCII;
585 aPhysicsOrderedFreeVector->
586 InsertValues(currentPM, currentCII);
589 prevCII = currentCII;
599 if (theSlowLightVector) {
604 G4double currentIN = (*theSlowLightVector)[0];
606 if (currentIN >= 0.0) {
615 bPhysicsOrderedFreeVector->
616 InsertValues(currentPM , currentCII);
631 currentPM = theSlowLightVector->
Energy(ii);
632 currentIN = (*theSlowLightVector)[ii];
634 currentCII = 0.5 * (prevIN + currentIN);
636 currentCII = prevCII +
637 (currentPM - prevPM) * currentCII;
639 bPhysicsOrderedFreeVector->
640 InsertValues(currentPM, currentCII);
643 prevCII = currentCII;
664 G4Exception(
"G4Scintillation::SetScintillationByParticleType",
"Scint02",
665 JustWarning,
"Redefinition: Birks Saturation is replaced by ScintillationByParticleType!");
713 G4double t = -1.0*tau2*std::log(1-ran1);
715 if (ran2 <=
bi_exp(t,tau1,tau2)/gg)
return t;
739 Scint_Yield_Vector = aMaterialPropertiesTable->
744 Scint_Yield_Vector = aMaterialPropertiesTable->
749 Scint_Yield_Vector = aMaterialPropertiesTable->
754 Scint_Yield_Vector = aMaterialPropertiesTable->
761 Scint_Yield_Vector = aMaterialPropertiesTable->
768 Scint_Yield_Vector = aMaterialPropertiesTable->
773 Scint_Yield_Vector = aMaterialPropertiesTable->
778 if(!Scint_Yield_Vector)
779 Scint_Yield_Vector = aMaterialPropertiesTable->
783 if (!Scint_Yield_Vector) {
785 ed <<
"\nG4Scintillation::PostStepDoIt(): "
786 <<
"Request for scintillation yield for energy deposit and particle\n"
787 <<
"type without correct entry in MaterialPropertiesTable.\n"
788 <<
"ScintillationByParticleType requires at minimum that \n"
789 <<
"ELECTRONSCINTILLATIONYIELD is set by the user\n"
791 G4String comments =
"Missing MaterialPropertiesTable entry - No correct entry in MaterialPropertiesTable";
792 G4Exception(
"G4Scintillation::PostStepDoIt",
"Scint01",
809 if(PreStepKineticEnergy <= Scint_Yield_Vector->GetMaxEnergy()){
810 G4double Yield1 = Scint_Yield_Vector->
Value(PreStepKineticEnergy);
811 G4double Yield2 = Scint_Yield_Vector->
812 Value(PreStepKineticEnergy - StepEnergyDeposit);
813 ScintillationYield = Yield1 - Yield2;
816 ed <<
"\nG4Scintillation::GetScintillationYieldByParticleType(): Request\n"
817 <<
"for scintillation light yield above the available energy range\n"
818 <<
"specifed in G4MaterialPropertiesTable. A linear interpolation\n"
819 <<
"will be performed to compute the scintillation light yield using\n"
820 <<
"(L_max / E_max) as the photon yield per unit energy."
822 G4String cmt =
"\nScintillation yield may be unphysical!\n";
823 G4Exception(
"G4Scintillation::GetScintillationYieldByParticleType()",
830 ScintillationYield = LinearYield * StepEnergyDeposit;
833 #ifdef G4DEBUG_SCINTILLATION
836 ScintTrackYield += ScintillationYield;
837 ScintTrackEDep += StepEnergyDeposit;
839 G4cout <<
"\n--- G4Scintillation::GetScintillationYieldByParticleType() ---\n"
842 <<
"-- TrackID = " << aTrack.
GetTrackID() <<
"\n"
843 <<
"-- ParentID = " << aTrack.
GetParentID() <<
"\n"
846 <<
"-- Track EDep = " << ScintTrackEDep/
MeV <<
" MeV\n"
848 <<
"-- Step yield = " << ScintillationYield <<
" photons\n"
849 <<
"-- Track yield = " << ScintTrackYield <<
" photons\n"
858 ScintTrackYield = 0.;
863 return ScintillationYield;
872 for (
G4int i = 0 ; i < PhysicsTableSize ; i++ )
883 for (
G4int i = 0 ; i < PhysicsTableSize ; i++ )
G4double Energy(size_t index) const
G4double GetKineticEnergy() const
G4double fExcitationRatio
static G4Triton * TritonDefinition()
G4Scintillation(const G4String &processName="Scintillation", G4ProcessType type=fElectromagnetic)
G4double GetScintillationYieldByParticleType(const G4Track &aTrack, const G4Step &aStep)
G4PhysicsTable * fSlowIntegralTable
void SetPolarization(G4double polX, G4double polY, G4double polZ)
G4int GetNumberOfSecondaries() const
std::ostringstream G4ExceptionDescription
G4EmSaturation * fEmSaturation
static size_t GetNumberOfMaterials()
static constexpr double MeV
static G4Deuteron * DeuteronDefinition()
static G4MaterialTable * GetMaterialTable()
void SetKineticEnergy(G4double aEnergy)
G4bool fTrackSecondariesFirst
G4StepPoint * GetPreStepPoint() const
G4VParticleChange * PostStepDoIt(const G4Track &aTrack, const G4Step &aStep) override
G4double GetEnergy(G4double aValue)
virtual G4VParticleChange * PostStepDoIt(const G4Track &, const G4Step &)
G4bool fScintillationByParticleType
const G4String & GetParticleName() const
const G4String & GetParticleType() const
G4double GetPDGCharge() const
G4bool fScintillationTrackInfo
const G4ParticleDefinition * GetParticleDefinition() const
void insertAt(size_t, G4PhysicsVector *)
G4double Value(G4double theEnergy, size_t &lastidx) const
G4double condition(const G4ErrorSymMatrix &m)
void BuildThePhysicsTable()
const G4TouchableHandle & GetTouchableHandle() const
void AddSecondary(G4Track *aSecondary)
G4double GetVelocity() const
G4double GetVertexKineticEnergy() const
G4ParticleChange aParticleChange
void DumpValues(G4double unitE=1.0, G4double unitV=1.0) const
G4PhysicsTable * fFastIntegralTable
G4StepStatus GetStepStatus() const
G4ParticleDefinition * GetDefinition() const
static G4Proton * ProtonDefinition()
virtual void Initialize(const G4Track &)
G4double GetStepLength() const
const G4ThreeVector & GetPosition() const
static constexpr double twopi
static G4OpticalPhoton * OpticalPhoton()
void SetTouchableHandle(const G4TouchableHandle &apValue)
const G4String & GetProcessName() const
G4double GetTotalEnergyDeposit() const
G4double GetGlobalTime() const
G4StepPoint * GetPostStepPoint() const
G4Material * GetMaterial() const
G4double GetKineticEnergy() const
ThreeVector shoot(const G4int Ap, const G4int Af)
G4double single_exp(G4double t, G4double tau2)
static G4Electron * ElectronDefinition()
Hep3Vector cross(const Hep3Vector &) const
std::vector< G4Material * > G4MaterialTable
G4VParticleChange * AtRestDoIt(const G4Track &aTrack, const G4Step &aStep) override
static G4Alpha * AlphaDefinition()
G4double VisibleEnergyDepositionAtAStep(const G4Step *) const
void SetScintillationByParticleType(const G4bool)
static G4Gamma * GammaDefinition()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4double GetMaxEnergy() const
void SetParentID(const G4int aValue)
void BuildPhysicsTable(const G4ParticleDefinition &aParticleType) override
void SetProcessSubType(G4int)
static G4Neutron * NeutronDefinition()
G4double GetMeanFreePath(const G4Track &aTrack, G4double, G4ForceCondition *) override
G4GLOB_DLL std::ostream G4cout
G4double bi_exp(G4double t, G4double tau1, G4double tau2)
G4MaterialPropertyVector * GetProperty(const char *key, G4bool warning=false)
G4bool IsApplicable(const G4ParticleDefinition &aParticleType) override
G4long G4Poisson(G4double mean)
G4ThreeVector GetDeltaPosition() const
G4bool IsShortLived() const
G4double GetMeanLifeTime(const G4Track &aTrack, G4ForceCondition *) override
G4TrackStatus GetTrackStatus() const
void DumpPhysicsTable() const
void ProposeTrackStatus(G4TrackStatus status)
G4double sample_time(G4double tau1, G4double tau2)
const G4DynamicParticle * GetDynamicParticle() const
G4MaterialPropertiesTable * GetMaterialPropertiesTable() const
size_t GetVectorLength() const
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
G4int GetParentID() const
void SetNumberOfSecondaries(G4int totSecondaries)