83 , fIntegralTable1(nullptr)
84 , fIntegralTable2(nullptr)
85 , fIntegralTable3(nullptr)
87 , fEmSaturation(nullptr)
91#ifdef G4DEBUG_SCINTILLATION
185 for(
size_t i = 0; i < numOfMaterials; ++i)
194 ((*materialTable)[i])->GetMaterialPropertiesTable();
223 currentPM = MPV->
Energy(ii);
224 currentIN = (*MPV)[ii];
226 prevCII + 0.5 * (currentPM - prevPM) * (prevIN + currentIN);
231 prevCII = currentCII;
260 currentPM = MPV->
Energy(ii);
261 currentIN = (*MPV)[ii];
263 prevCII + 0.5 * (currentPM - prevPM) * (prevIN + currentIN);
268 prevCII = currentCII;
298 currentPM = MPV->
Energy(ii);
299 currentIN = (*MPV)[ii];
301 prevCII + 0.5 * (currentPM - prevPM) * (prevIN + currentIN);
306 prevCII = currentCII;
354 G4int N_timeconstants = 1;
360 if(fEnhancedTimeConstants)
376 if(!Fast_Intensity && !Slow_Intensity)
378 if(Fast_Intensity && Slow_Intensity)
390 if(!fEnhancedTimeConstants)
393 if(fScintillationByParticleType)
401 MeanNumberOfPhotons =
406 MeanNumberOfPhotons *=
409 MeanNumberOfPhotons *= TotalEnergyDeposit;
415 if(fScintillationByParticleType)
418 aTrack, aStep, yield1, yield2, yield3);
433 MeanNumberOfPhotons =
438 MeanNumberOfPhotons *=
441 MeanNumberOfPhotons *= TotalEnergyDeposit;
443 sum_yields = yield1 + yield2 + yield3;
446 if(MeanNumberOfPhotons > 10.)
448 G4double sigma = ResolutionScale * std::sqrt(MeanNumberOfPhotons);
449 fNumPhotons =
G4int(G4RandGauss::shoot(MeanNumberOfPhotons, sigma) + 0.5);
456 if(fNumPhotons <= 0 || !fStackingFlag)
465 if(fTrackSecondariesFirst)
475 size_t numPhot = fNumPhotons;
481 for(
G4int scnt = 0; scnt < N_timeconstants; ++scnt)
484 if(!fEnhancedTimeConstants)
488 if(N_timeconstants == 1)
516 if(fExcitationRatio == 1.0 || fExcitationRatio == 0.0)
518 numPhot =
G4int(std::min(yieldRatio, 1.0) * fNumPhotons);
522 numPhot =
G4int(std::min(fExcitationRatio, 1.0) * fNumPhotons);
536 numPhot = fNumPhotons - numPhot;
553 if(N_timeconstants == 1)
555 numPhot = fNumPhotons;
559 numPhot = yield1 / sum_yields * fNumPhotons;
573 if(N_timeconstants == 2)
575 numPhot = fNumPhotons - numPhot;
579 numPhot = yield2 / sum_yields * fNumPhotons;
592 numPhot = yield3 / sum_yields * fNumPhotons;
608 for(
size_t i = 0; i < numPhot; ++i)
616 G4cout <<
"sampledEnergy = " << sampledEnergy <<
G4endl;
622 G4double sint = std::sqrt((1. - cost) * (1. + cost));
629 G4ThreeVector photonPolarization(cost * cosp, cost * sinp, -sint);
632 sinp = std::sin(phi);
633 cosp = std::cos(phi);
634 photonPolarization = (cosp * photonPolarization + sinp * perp).unit();
662 deltaTime += sample_time(riseTime, scintTime);
668 G4Track* secTrack =
new G4Track(scintPhoton, secTime, secPosition);
672 if(fScintillationTrackInfo)
681 G4cout <<
"\n Exiting from G4Scintillation::DoIt -- NumberOfSecondaries = "
691 if(fEmSaturation && scintType)
693 G4Exception(
"G4Scintillation::SetScintillationByParticleType",
"Scint02",
695 "Redefinition: Birks Saturation is replaced by "
696 "ScintillationByParticleType!");
699 fScintillationByParticleType = scintType;
732 G4double t = -1.0 * tau2 * std::log(1. - ran1);
733 G4double gg = d * single_exp(t, tau2);
734 if(ran2 <= bi_exp(t, tau1, tau2) / gg)
789 ed <<
"\nG4Scintillation::PostStepDoIt(): "
790 <<
"Request for scintillation yield for energy deposit and particle\n"
791 <<
"type without correct entry in MaterialPropertiesTable.\n"
792 <<
"ScintillationByParticleType requires at minimum that \n"
793 <<
"ELECTRONSCINTILLATIONYIELD is set by the user\n"
795 G4String comments =
"Missing MaterialPropertiesTable entry - No correct "
796 "entry in MaterialPropertiesTable";
812 if(PreStepKineticEnergy <= scintVector->GetMaxEnergy())
816 scintVector->
Value(PreStepKineticEnergy - StepEnergyDeposit);
817 ScintillationYield = Yield1 - Yield2;
822 ed <<
"\nG4Scintillation::GetScintillationYieldByParticleType(): Request\n"
823 <<
"for scintillation light yield above the available energy range\n"
824 <<
"specified in G4MaterialPropertiesTable. A linear interpolation\n"
825 <<
"will be performed to compute the scintillation light yield using\n"
826 <<
"(L_max / E_max) as the photon yield per unit energy." <<
G4endl;
827 G4String cmt =
"\nScintillation yield may be unphysical!\n";
828 G4Exception(
"G4Scintillation::GetScintillationYieldByParticleType()",
836#ifdef G4DEBUG_SCINTILLATION
838 ScintTrackYield += ScintillationYield;
839 ScintTrackEDep += StepEnergyDeposit;
841 G4cout <<
"\n--- G4Scintillation::GetScintillationYieldByParticleType() ---\n"
845 <<
"-- TrackID = " << aTrack.
GetTrackID() <<
"\n"
846 <<
"-- ParentID = " << aTrack.
GetParentID() <<
"\n"
851 <<
"-- Track EDep = " << ScintTrackEDep / MeV <<
" MeV\n"
854 <<
"-- Step yield = " << ScintillationYield <<
" photons\n"
855 <<
"-- Track yield = " << ScintTrackYield <<
" photons\n"
864 ScintTrackYield = 0.;
868 return ScintillationYield;
983 ed <<
"\nG4Scintillation::PostStepDoIt(): "
984 <<
"Request for scintillation yield for energy deposit and particle\n"
985 <<
"type without correct entry in MaterialPropertiesTable.\n"
986 <<
"ScintillationByParticleType requires at minimum that \n"
987 <<
"ELECTRONSCINTILLATIONYIELD is set by the user\n"
989 G4String comments =
"Missing MaterialPropertiesTable entry - No correct "
990 "entry in MaterialPropertiesTable";
1006 if(PreStepKineticEnergy <= yieldVector->GetMaxEnergy())
1011 ScintillationYield =
1012 yieldVector->
Value(PreStepKineticEnergy) -
1013 yieldVector->
Value(PreStepKineticEnergy - StepEnergyDeposit);
1018 ed <<
"\nG4Scintillation::GetScintillationYieldByParticleType(): Request\n"
1019 <<
"for scintillation light yield above the available energy range\n"
1020 <<
"specified in G4MaterialPropertiesTable. A linear interpolation\n"
1021 <<
"will be performed to compute the scintillation light yield using\n"
1022 <<
"(L_max / E_max) as the photon yield per unit energy." <<
G4endl;
1023 G4String cmt =
"\nScintillation yield may be unphysical!\n";
1024 G4Exception(
"G4Scintillation::GetScintillationYieldByParticleType()",
1032#ifdef G4DEBUG_SCINTILLATION
1034 ScintTrackYield += ScintillationYield;
1035 ScintTrackEDep += StepEnergyDeposit;
1037 G4cout <<
"\n--- G4Scintillation::GetScintillationYieldByParticleType() ---\n"
1041 <<
"-- TrackID = " << aTrack.
GetTrackID() <<
"\n"
1042 <<
"-- ParentID = " << aTrack.
GetParentID() <<
"\n"
1047 <<
"-- Track EDep = " << ScintTrackEDep / MeV <<
" MeV\n"
1050 <<
"-- Step yield = " << ScintillationYield <<
" photons\n"
1051 <<
"-- Track yield = " << ScintTrackYield <<
" photons\n"
1059 ScintTrackEDep = 0.;
1060 ScintTrackYield = 0.;
1064 return ScintillationYield;
G4double condition(const G4ErrorSymMatrix &m)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
@ kSCINTILLATIONCOMPONENT1
@ kSCINTILLATIONCOMPONENT2
@ kSCINTILLATIONCOMPONENT3
@ kELECTRONSCINTILLATIONYIELD
@ kALPHASCINTILLATIONYIELD
@ kPROTONSCINTILLATIONYIELD
@ kDEUTERONSCINTILLATIONYIELD
@ kTRITONSCINTILLATIONYIELD
@ kSCINTILLATIONTIMECONSTANT1
@ kSCINTILLATIONRISETIME2
@ kTRITONSCINTILLATIONYIELD1
@ kDEUTERONSCINTILLATIONYIELD3
@ kIONSCINTILLATIONYIELD1
@ kSCINTILLATIONRISETIME1
@ kFASTSCINTILLATIONRISETIME
@ kDEUTERONSCINTILLATIONYIELD2
@ kSLOWSCINTILLATIONRISETIME
@ kTRITONSCINTILLATIONYIELD2
@ kALPHASCINTILLATIONYIELD2
@ kELECTRONSCINTILLATIONYIELD3
@ kALPHASCINTILLATIONYIELD1
@ kELECTRONSCINTILLATIONYIELD2
@ kIONSCINTILLATIONYIELD2
@ kIONSCINTILLATIONYIELD3
@ kSCINTILLATIONRISETIME3
@ kPROTONSCINTILLATIONYIELD2
@ kDEUTERONSCINTILLATIONYIELD1
@ kTRITONSCINTILLATIONYIELD3
@ kSCINTILLATIONTIMECONSTANT3
@ kPROTONSCINTILLATIONYIELD3
@ kELECTRONSCINTILLATIONYIELD1
@ kALPHASCINTILLATIONYIELD3
@ kSCINTILLATIONTIMECONSTANT2
@ kPROTONSCINTILLATIONYIELD1
std::vector< G4Material * > G4MaterialTable
G4long G4Poisson(G4double mean)
G4GLOB_DLL std::ostream G4cout
Hep3Vector cross(const Hep3Vector &) const
static G4Alpha * AlphaDefinition()
static G4Deuteron * DeuteronDefinition()
void SetPolarization(const G4ThreeVector &)
G4ParticleDefinition * GetDefinition() const
void SetKineticEnergy(G4double aEnergy)
static G4Electron * ElectronDefinition()
G4double VisibleEnergyDepositionAtAStep(const G4Step *) const
static G4Gamma * GammaDefinition()
G4MaterialPropertyVector * GetProperty(const char *key, G4bool warning=false)
G4bool ConstPropertyExists(const G4String &key) const
G4double GetConstProperty(const G4String &key) const
G4MaterialPropertiesTable * GetMaterialPropertiesTable() const
static size_t GetNumberOfMaterials()
static G4MaterialTable * GetMaterialTable()
static G4Neutron * NeutronDefinition()
G4int GetScintVerboseLevel() const
G4bool GetScintStackPhotons() const
static G4OpticalParameters * Instance()
G4double GetScintExcitationRatio() const
G4bool GetScintEnhancedTimeConstants() const
G4bool GetScintByParticleType() const
G4bool GetScintFiniteRiseTime() const
G4double GetScintYieldFactor() const
G4bool GetScintTrackInfo() const
G4bool GetScintTrackSecondariesFirst() const
void AddSecondary(G4Track *aSecondary)
virtual void Initialize(const G4Track &)
const G4String & GetParticleType() const
G4bool IsShortLived() const
G4double GetPDGCharge() const
const G4String & GetParticleName() const
void InsertValues(G4double energy, G4double value)
G4double GetEnergy(G4double aValue)
std::size_t entries() const
void insertAt(std::size_t, G4PhysicsVector *)
G4double Energy(std::size_t index) const
G4double Value(G4double theEnergy, std::size_t &lastidx) const
G4double GetMaxEnergy() const
std::size_t GetVectorLength() const
void DumpValues(G4double unitE=1.0, G4double unitV=1.0) const
static G4Proton * ProtonDefinition()
G4PhysicsTable * fIntegralTable3
G4VParticleChange * AtRestDoIt(const G4Track &aTrack, const G4Step &aStep) override
void SetScintillationYieldFactor(const G4double yieldfactor)
void SetTrackSecondariesFirst(const G4bool state)
void SetStackPhotons(const G4bool)
G4double GetMeanFreePath(const G4Track &aTrack, G4double, G4ForceCondition *) override
void BuildPhysicsTable(const G4ParticleDefinition &aParticleType) override
G4double GetScintillationYieldByParticleType(const G4Track &aTrack, const G4Step &aStep)
void SetScintillationExcitationRatio(const G4double ratio)
G4PhysicsTable * fIntegralTable1
void SetScintillationTrackInfo(const G4bool trackType)
void SetEnhancedTimeConstants(G4bool)
G4double GetMeanLifeTime(const G4Track &aTrack, G4ForceCondition *) override
G4VParticleChange * PostStepDoIt(const G4Track &aTrack, const G4Step &aStep) override
G4bool IsApplicable(const G4ParticleDefinition &aParticleType) override
void DumpPhysicsTable() const
void SetFiniteRiseTime(const G4bool state)
G4Scintillation(const G4String &processName="Scintillation", G4ProcessType type=fElectromagnetic)
void PreparePhysicsTable(const G4ParticleDefinition &part) override
void SetScintillationByParticleType(const G4bool)
G4PhysicsTable * fIntegralTable2
G4StepStatus GetStepStatus() const
G4double GetVelocity() const
G4double GetGlobalTime() const
const G4ThreeVector & GetPosition() const
const G4TouchableHandle & GetTouchableHandle() const
G4double GetKineticEnergy() const
G4ThreeVector GetDeltaPosition() const
G4StepPoint * GetPreStepPoint() const
G4double GetStepLength() const
G4double GetTotalEnergyDeposit() const
G4StepPoint * GetPostStepPoint() const
G4TrackStatus GetTrackStatus() const
G4double GetVertexKineticEnergy() const
const G4ParticleDefinition * GetParticleDefinition() const
void SetTouchableHandle(const G4TouchableHandle &apValue)
G4Material * GetMaterial() const
const G4DynamicParticle * GetDynamicParticle() const
G4double GetKineticEnergy() const
void SetUserInformation(G4VUserTrackInformation *aValue) const
G4int GetParentID() const
void SetParentID(const G4int aValue)
static G4Triton * TritonDefinition()
void ProposeTrackStatus(G4TrackStatus status)
G4int GetNumberOfSecondaries() const
void SetNumberOfSecondaries(G4int totSecondaries)
void SetVerboseLevel(G4int value)
G4ParticleChange aParticleChange
void SetProcessSubType(G4int)
const G4String & GetProcessName() const
virtual G4VParticleChange * PostStepDoIt(const G4Track &, const G4Step &)