111 fTrackSecondariesFirst(false),
112 fFiniteRiseTime(false),
114 fExcitationRatio(1.0),
115 fScintillationByParticleType(false),
116 fEmSaturation(nullptr)
120 #ifdef G4DEBUG_SCINTILLATION 122 ScintTrackYield = 0.;
199 G4StepPoint* pPreStepPoint = aStep.GetPreStepPoint();
200 G4StepPoint* pPostStepPoint = aStep.GetPostStepPoint();
204 G4double t0 = pPreStepPoint->GetGlobalTime();
206 G4double TotalEnergyDeposit = aStep.GetTotalEnergyDeposit();
210 if (!aMaterialPropertiesTable)
214 aMaterialPropertiesTable->
GetProperty(
"FASTCOMPONENT");
216 aMaterialPropertiesTable->
GetProperty(
"SLOWCOMPONENT");
218 if (!Fast_Intensity && !Slow_Intensity )
222 if (Fast_Intensity && Slow_Intensity) nscnt = 2;
235 ScintillationYield = aMaterialPropertiesTable->
236 GetConstProperty(
"SCINTILLATIONYIELD");
242 G4double ResolutionScale = aMaterialPropertiesTable->
243 GetConstProperty(
"RESOLUTIONSCALE");
257 MeanNumberOfPhotons = ScintillationYield;
259 MeanNumberOfPhotons = ScintillationYield*
262 MeanNumberOfPhotons = ScintillationYield*TotalEnergyDeposit;
266 if (MeanNumberOfPhotons > 10.)
268 G4double sigma = ResolutionScale * std::sqrt(MeanNumberOfPhotons);
290 if (aTrack.GetTrackStatus() == fAlive )
301 G4int Num = NumPhotons;
303 for (
G4int scnt = 1; scnt <= nscnt; scnt++) {
311 if (Fast_Intensity) {
312 ScintillationTime = aMaterialPropertiesTable->
313 GetConstProperty(
"FASTTIMECONSTANT");
315 ScintillationRiseTime = aMaterialPropertiesTable->
316 GetConstProperty(
"FASTSCINTILLATIONRISETIME");
318 ScintillationIntegral =
322 if (Slow_Intensity) {
323 ScintillationTime = aMaterialPropertiesTable->
324 GetConstProperty(
"SLOWTIMECONSTANT");
326 ScintillationRiseTime = aMaterialPropertiesTable->
327 GetConstProperty(
"SLOWSCINTILLATIONRISETIME");
329 ScintillationIntegral =
335 G4double yieldRatio = aMaterialPropertiesTable->
336 GetConstProperty(
"YIELDRATIO");
343 ScintillationTime = aMaterialPropertiesTable->
344 GetConstProperty(
"FASTTIMECONSTANT");
346 ScintillationRiseTime = aMaterialPropertiesTable->
347 GetConstProperty(
"FASTSCINTILLATIONRISETIME");
349 ScintillationIntegral =
355 Num = NumPhotons - Num;
356 ScintillationTime = aMaterialPropertiesTable->
357 GetConstProperty(
"SLOWTIMECONSTANT");
359 ScintillationRiseTime = aMaterialPropertiesTable->
360 GetConstProperty(
"SLOWSCINTILLATIONRISETIME");
362 ScintillationIntegral =
367 if (!ScintillationIntegral)
continue;
373 for (
G4int i = 0; i < Num; i++) {
379 ScintillationIntegral->
GetEnergy(CIIvalue);
382 G4cout <<
"sampledEnergy = " << sampledEnergy <<
G4endl;
389 G4double sint = std::sqrt((1.-cost)*(1.+cost));
414 sinp = std::sin(phi);
415 cosp = std::cos(phi);
417 photonPolarization = cosp * photonPolarization + sinp * perp;
419 photonPolarization = photonPolarization.
unit();
427 (photonPolarization.
x(),
428 photonPolarization.
y(),
429 photonPolarization.
z());
443 G4double delta = rand * aStep.GetStepLength();
444 G4double deltaTime = delta / (pPreStepPoint->GetVelocity()+
445 rand*(pPostStepPoint->GetVelocity()-
446 pPreStepPoint->GetVelocity())/2.);
449 if (ScintillationRiseTime==0.0) {
450 deltaTime = deltaTime -
453 deltaTime = deltaTime +
454 sample_time(ScintillationRiseTime, ScintillationTime);
457 G4double aSecondaryTime = t0 + deltaTime;
460 x0 + rand * aStep.GetDeltaPosition();
462 G4Track* aSecondaryTrack =
new G4Track(aScintillationPhoton,
466 aSecondaryTrack->SetTouchableHandle(
467 aStep.GetPreStepPoint()->GetTouchableHandle());
470 aSecondaryTrack->SetParentID(aTrack.GetTrackID());
478 G4cout <<
"\n Exiting from G4Scintillation::DoIt -- NumberOfSecondaries = " 506 for (
G4int i=0 ; i < numOfMaterials; i++)
516 G4Material* aMaterial = (*theMaterialTable)[i];
521 if (aMaterialPropertiesTable) {
524 aMaterialPropertiesTable->
GetProperty(
"FASTCOMPONENT");
526 if (theFastLightVector) {
531 G4double currentIN = (*theFastLightVector)[0];
533 if (currentIN >= 0.0) {
542 aPhysicsOrderedFreeVector->
543 InsertValues(currentPM , currentCII);
558 currentPM = theFastLightVector->
Energy(ii);
559 currentIN = (*theFastLightVector)[ii];
561 currentCII = 0.5 * (prevIN + currentIN);
563 currentCII = prevCII +
564 (currentPM - prevPM) * currentCII;
566 aPhysicsOrderedFreeVector->
567 InsertValues(currentPM, currentCII);
570 prevCII = currentCII;
578 aMaterialPropertiesTable->
GetProperty(
"SLOWCOMPONENT");
580 if (theSlowLightVector) {
585 G4double currentIN = (*theSlowLightVector)[0];
587 if (currentIN >= 0.0) {
596 bPhysicsOrderedFreeVector->
597 InsertValues(currentPM , currentCII);
612 currentPM = theSlowLightVector->
Energy(ii);
613 currentIN = (*theSlowLightVector)[ii];
615 currentCII = 0.5 * (prevIN + currentIN);
617 currentCII = prevCII +
618 (currentPM - prevPM) * currentCII;
620 bPhysicsOrderedFreeVector->
621 InsertValues(currentPM, currentCII);
624 prevCII = currentCII;
667 G4Exception(
"G4Scintillation::SetScintillationByParticleType",
"Scint02",
668 JustWarning,
"Redefinition: Birks Saturation is replaced by ScintillationByParticleType!");
692 *condition = StronglyForced;
726 G4double t = -1.0*tau2*std::log(1-ran1);
728 if (ran2 <=
bi_exp(t,tau1,tau2)/gg)
return t;
745 = aTrack.GetMaterial()->GetMaterialPropertiesTable();
752 Scint_Yield_Vector = aMaterialPropertiesTable->
753 GetProperty(
"PROTONSCINTILLATIONYIELD");
757 Scint_Yield_Vector = aMaterialPropertiesTable->
758 GetProperty(
"DEUTERONSCINTILLATIONYIELD");
762 Scint_Yield_Vector = aMaterialPropertiesTable->
763 GetProperty(
"TRITONSCINTILLATIONYIELD");
767 Scint_Yield_Vector = aMaterialPropertiesTable->
768 GetProperty(
"ALPHASCINTILLATIONYIELD");
774 Scint_Yield_Vector = aMaterialPropertiesTable->
775 GetProperty(
"IONSCINTILLATIONYIELD");
781 Scint_Yield_Vector = aMaterialPropertiesTable->
782 GetProperty(
"ELECTRONSCINTILLATIONYIELD");
786 Scint_Yield_Vector = aMaterialPropertiesTable->
787 GetProperty(
"ELECTRONSCINTILLATIONYIELD");
791 if(!Scint_Yield_Vector)
792 Scint_Yield_Vector = aMaterialPropertiesTable->
793 GetProperty(
"ELECTRONSCINTILLATIONYIELD");
796 if (!Scint_Yield_Vector) {
798 ed <<
"\nG4Scintillation::PostStepDoIt(): " 799 <<
"Request for scintillation yield for energy deposit and particle\n" 800 <<
"type without correct entry in MaterialPropertiesTable.\n" 801 <<
"ScintillationByParticleType requires at minimum that \n" 802 <<
"ELECTRONSCINTILLATIONYIELD is set by the user\n" 804 G4String comments =
"Missing MaterialPropertiesTable entry - No correct entry in MaterialPropertiesTable";
805 G4Exception(
"G4Scintillation::PostStepDoIt",
"Scint01",
819 G4double StepEnergyDeposit = aStep.GetTotalEnergyDeposit();
820 G4double PreStepKineticEnergy = aStep.GetPreStepPoint()->GetKineticEnergy();
822 if(PreStepKineticEnergy <= Scint_Yield_Vector->GetMaxEnergy()){
823 G4double Yield1 = Scint_Yield_Vector->
Value(PreStepKineticEnergy);
824 G4double Yield2 = Scint_Yield_Vector->
825 Value(PreStepKineticEnergy - StepEnergyDeposit);
826 ScintillationYield = Yield1 - Yield2;
829 ed <<
"\nG4Scintillation::GetScintillationYieldByParticleType(): Request\n" 830 <<
"for scintillation light yield above the available energy range\n" 831 <<
"specifed in G4MaterialPropertiesTable. A linear interpolation\n" 832 <<
"will be performed to compute the scintillation light yield using\n" 833 <<
"(L_max / E_max) as the photon yield per unit energy." 835 G4String cmt =
"\nScintillation yield may be unphysical!\n";
836 G4Exception(
"G4Scintillation::GetScintillationYieldByParticleType()",
843 ScintillationYield = LinearYield * StepEnergyDeposit;
846 #ifdef G4DEBUG_SCINTILLATION 849 ScintTrackYield += ScintillationYield;
850 ScintTrackEDep += StepEnergyDeposit;
852 G4cout <<
"\n--- G4Scintillation::GetScintillationYieldByParticleType() ---\n" 854 <<
"-- Name = " << aTrack.GetParticleDefinition()->GetParticleName() <<
"\n" 855 <<
"-- TrackID = " << aTrack.GetTrackID() <<
"\n" 856 <<
"-- ParentID = " << aTrack.GetParentID() <<
"\n" 857 <<
"-- Current KE = " << aTrack.GetKineticEnergy()/
MeV <<
" MeV\n" 858 <<
"-- Step EDep = " << aStep.GetTotalEnergyDeposit()/
MeV <<
" MeV\n" 859 <<
"-- Track EDep = " << ScintTrackEDep/
MeV <<
" MeV\n" 860 <<
"-- Vertex KE = " << aTrack.GetVertexKineticEnergy()/
MeV <<
" MeV\n" 861 <<
"-- Step yield = " << ScintillationYield <<
" photons\n" 862 <<
"-- Track yield = " << ScintTrackYield <<
" photons\n" 866 if( (aTrack.GetTrackStatus() == fStopButAlive) or
867 (aStep.GetPostStepPoint()->GetStepStatus() == fGeomBoundary) ){
871 ScintTrackYield = 0.;
876 return ScintillationYield;
void SetScintillationByParticleType(const G4bool)
G4double condition(const G4ErrorSymMatrix &m)
G4Scintillation(const G4String &processName="Scintillation", G4ProcessType type=fElectromagnetic)
static G4Electron * ElectronDefinition()
static G4Triton * TritonDefinition()
G4double bi_exp(G4double t, G4double tau1, G4double tau2)
ThreeVector shoot(const G4int Ap, const G4int Af)
G4long G4Poisson(G4double mean)
G4MaterialPropertyVector * GetProperty(const char *key)
void SetFiniteRiseTime(const G4bool state)
G4bool fTrackSecondariesFirst
virtual G4VParticleChange * PostStepDoIt(const G4Track &, const G4Step &)
std::ostringstream G4ExceptionDescription
void BuildThePhysicsTable()
G4double GetMeanLifeTime(const G4Track &aTrack, G4ForceCondition *)
static G4Material * GetMaterial(const G4String &name, G4bool warning=true)
G4double single_exp(G4double t, G4double tau2)
G4PhysicsTable * fFastIntegralTable
G4EmSaturation * fEmSaturation
G4MaterialPropertiesTable * GetMaterialPropertiesTable() const
static G4MaterialTable * GetMaterialTable()
static G4Proton * ProtonDefinition()
std::vector< G4Material * > G4MaterialTable
G4PhysicsTable * fSlowIntegralTable
G4VParticleChange * AtRestDoIt(const G4Track &aTrack, const G4Step &aStep)
const G4String & GetParticleType() const
void SetScintillationYieldFactor(const G4double yieldfactor)
const G4String & GetProcessName() const
G4GLOB_DLL std::ostream G4cout
G4VParticleChange * PostStepDoIt(const G4Track &aTrack, const G4Step &aStep)
Hep3Vector cross(const Hep3Vector &) const
void AddSaturation(G4EmSaturation *)
static const double twopi
G4double GetMeanFreePath(const G4Track &aTrack, G4double, G4ForceCondition *)
void SetProcessSubType(G4int)
size_t GetVectorLength() const
G4double Value(G4double theEnergy, size_t &lastidx) const
void SetPolarization(G4double polX, G4double polY, G4double polZ)
static size_t GetNumberOfMaterials()
void SetKineticEnergy(G4double aEnergy)
G4double GetEnergy(G4double aValue)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
void SetScintillationExcitationRatio(const G4double ratio)
G4double fExcitationRatio
static G4OpticalPhoton * OpticalPhoton()
G4double GetMaxEnergy() const
void SetTrackSecondariesFirst(const G4bool state)
G4ParticleChange aParticleChange
void insertAt(size_t, G4PhysicsVector *)
G4ParticleDefinition * GetDefinition() const
G4double Energy(size_t index) const
void BuildPhysicsTable(const G4ParticleDefinition &aParticleType)
G4double sample_time(G4double tau1, G4double tau2)
G4double GetScintillationYieldByParticleType(const G4Track &aTrack, const G4Step &aStep)
static G4Deuteron * DeuteronDefinition()
static G4Alpha * AlphaDefinition()
static G4Neutron * NeutronDefinition()
G4double GetPDGCharge() const
G4double VisibleEnergyDepositionAtAStep(const G4Step *)
static G4Gamma * GammaDefinition()
G4bool fScintillationByParticleType