114 #ifdef G4DEBUG_SCINTILLATION
116 ScintTrackYield = 0.;
194 if (!aMaterialPropertiesTable)
198 aMaterialPropertiesTable->
GetProperty(
"FASTCOMPONENT");
200 aMaterialPropertiesTable->
GetProperty(
"SLOWCOMPONENT");
202 if (!Fast_Intensity && !Slow_Intensity )
206 if (Fast_Intensity && Slow_Intensity) nscnt = 2;
219 ScintillationYield = aMaterialPropertiesTable->
220 GetConstProperty(
"SCINTILLATIONYIELD");
226 G4double ResolutionScale = aMaterialPropertiesTable->
227 GetConstProperty(
"RESOLUTIONSCALE");
241 MeanNumberOfPhotons = ScintillationYield;
243 MeanNumberOfPhotons = ScintillationYield*
246 MeanNumberOfPhotons = ScintillationYield*TotalEnergyDeposit;
250 if (MeanNumberOfPhotons > 10.)
252 G4double sigma = ResolutionScale * std::sqrt(MeanNumberOfPhotons);
285 G4int Num = NumPhotons;
287 for (
G4int scnt = 1; scnt <= nscnt; scnt++) {
295 if (Fast_Intensity) {
296 ScintillationTime = aMaterialPropertiesTable->
297 GetConstProperty(
"FASTTIMECONSTANT");
299 ScintillationRiseTime = aMaterialPropertiesTable->
300 GetConstProperty(
"FASTSCINTILLATIONRISETIME");
302 ScintillationIntegral =
306 if (Slow_Intensity) {
307 ScintillationTime = aMaterialPropertiesTable->
308 GetConstProperty(
"SLOWTIMECONSTANT");
310 ScintillationRiseTime = aMaterialPropertiesTable->
311 GetConstProperty(
"SLOWSCINTILLATIONRISETIME");
313 ScintillationIntegral =
319 G4double yieldRatio = aMaterialPropertiesTable->
320 GetConstProperty(
"YIELDRATIO");
327 ScintillationTime = aMaterialPropertiesTable->
328 GetConstProperty(
"FASTTIMECONSTANT");
330 ScintillationRiseTime = aMaterialPropertiesTable->
331 GetConstProperty(
"FASTSCINTILLATIONRISETIME");
333 ScintillationIntegral =
339 Num = NumPhotons - Num;
340 ScintillationTime = aMaterialPropertiesTable->
341 GetConstProperty(
"SLOWTIMECONSTANT");
343 ScintillationRiseTime = aMaterialPropertiesTable->
344 GetConstProperty(
"SLOWSCINTILLATIONRISETIME");
346 ScintillationIntegral =
351 if (!ScintillationIntegral)
continue;
357 for (
G4int i = 0; i < Num; i++) {
363 ScintillationIntegral->
GetEnergy(CIIvalue);
366 G4cout <<
"sampledEnergy = " << sampledEnergy <<
G4endl;
373 G4double sint = std::sqrt((1.-cost)*(1.+cost));
395 G4ThreeVector perp = photonMomentum.cross(photonPolarization);
398 sinp = std::sin(phi);
399 cosp = std::cos(phi);
401 photonPolarization = cosp * photonPolarization + sinp * perp;
403 photonPolarization = photonPolarization.unit();
411 (photonPolarization.x(),
412 photonPolarization.y(),
413 photonPolarization.z());
433 if (ScintillationRiseTime==0.0) {
434 deltaTime = deltaTime -
437 deltaTime = deltaTime +
438 sample_time(ScintillationRiseTime, ScintillationTime);
441 G4double aSecondaryTime = t0 + deltaTime;
462 G4cout <<
"\n Exiting from G4Scintillation::DoIt -- NumberOfSecondaries = "
490 for (
G4int i=0 ; i < numOfMaterials; i++)
500 G4Material* aMaterial = (*theMaterialTable)[i];
505 if (aMaterialPropertiesTable) {
508 aMaterialPropertiesTable->
GetProperty(
"FASTCOMPONENT");
510 if (theFastLightVector) {
515 G4double currentIN = (*theFastLightVector)[0];
517 if (currentIN >= 0.0) {
526 aPhysicsOrderedFreeVector->
527 InsertValues(currentPM , currentCII);
542 currentPM = theFastLightVector->
Energy(ii);
543 currentIN = (*theFastLightVector)[ii];
545 currentCII = 0.5 * (prevIN + currentIN);
547 currentCII = prevCII +
548 (currentPM - prevPM) * currentCII;
550 aPhysicsOrderedFreeVector->
551 InsertValues(currentPM, currentCII);
554 prevCII = currentCII;
562 aMaterialPropertiesTable->
GetProperty(
"SLOWCOMPONENT");
564 if (theSlowLightVector) {
569 G4double currentIN = (*theSlowLightVector)[0];
571 if (currentIN >= 0.0) {
580 bPhysicsOrderedFreeVector->
581 InsertValues(currentPM , currentCII);
596 currentPM = theSlowLightVector->
Energy(ii);
597 currentIN = (*theSlowLightVector)[ii];
599 currentCII = 0.5 * (prevIN + currentIN);
601 currentCII = prevCII +
602 (currentPM - prevPM) * currentCII;
604 bPhysicsOrderedFreeVector->
605 InsertValues(currentPM, currentCII);
608 prevCII = currentCII;
651 G4Exception(
"G4Scintillation::SetScintillationByParticleType",
"Scint02",
652 JustWarning,
"Redefinition: Birks Saturation is replaced by ScintillationByParticleType!");
709 G4double t = -1.0*tau2*std::log(1-ran1);
711 if (ran2 <=
bi_exp(t,tau1,tau2)/gg)
return t;
735 Scint_Yield_Vector = aMaterialPropertiesTable->
736 GetProperty(
"PROTONSCINTILLATIONYIELD");
740 Scint_Yield_Vector = aMaterialPropertiesTable->
741 GetProperty(
"DEUTERONSCINTILLATIONYIELD");
745 Scint_Yield_Vector = aMaterialPropertiesTable->
746 GetProperty(
"TRITONSCINTILLATIONYIELD");
750 Scint_Yield_Vector = aMaterialPropertiesTable->
751 GetProperty(
"ALPHASCINTILLATIONYIELD");
757 Scint_Yield_Vector = aMaterialPropertiesTable->
758 GetProperty(
"IONSCINTILLATIONYIELD");
764 Scint_Yield_Vector = aMaterialPropertiesTable->
765 GetProperty(
"ELECTRONSCINTILLATIONYIELD");
769 Scint_Yield_Vector = aMaterialPropertiesTable->
770 GetProperty(
"ELECTRONSCINTILLATIONYIELD");
774 if(!Scint_Yield_Vector)
775 Scint_Yield_Vector = aMaterialPropertiesTable->
776 GetProperty(
"ELECTRONSCINTILLATIONYIELD");
779 if (!Scint_Yield_Vector) {
781 ed <<
"\nG4Scintillation::PostStepDoIt(): "
782 <<
"Request for scintillation yield for energy deposit and particle\n"
783 <<
"type without correct entry in MaterialPropertiesTable.\n"
784 <<
"ScintillationByParticleType requires at minimum that \n"
785 <<
"ELECTRONSCINTILLATIONYIELD is set by the user\n"
787 G4String comments =
"Missing MaterialPropertiesTable entry - No correct entry in MaterialPropertiesTable";
788 G4Exception(
"G4Scintillation::PostStepDoIt",
"Scint01",
805 if(PreStepKineticEnergy <= Scint_Yield_Vector->GetMaxEnergy()){
806 G4double Yield1 = Scint_Yield_Vector->
Value(PreStepKineticEnergy);
807 G4double Yield2 = Scint_Yield_Vector->
808 Value(PreStepKineticEnergy - StepEnergyDeposit);
809 ScintillationYield = Yield1 - Yield2;
812 ed <<
"\nG4Scintillation::GetScintillationYieldByParticleType(): Request\n"
813 <<
"for scintillation light yield above the available energy range\n"
814 <<
"specifed in G4MaterialPropertiesTable. A linear interpolation\n"
815 <<
"will be performed to compute the scintillation light yield using\n"
816 <<
"(L_max / E_max) as the photon yield per unit energy."
818 G4String cmt =
"\nScintillation yield may be unphysical!\n";
819 G4Exception(
"G4Scintillation::GetScintillationYieldByParticleType()",
826 ScintillationYield = LinearYield * StepEnergyDeposit;
829 #ifdef G4DEBUG_SCINTILLATION
832 ScintTrackYield += ScintillationYield;
833 ScintTrackEDep += StepEnergyDeposit;
835 G4cout <<
"\n--- G4Scintillation::GetScintillationYieldByParticleType() ---\n"
838 <<
"-- TrackID = " << aTrack.
GetTrackID() <<
"\n"
839 <<
"-- ParentID = " << aTrack.
GetParentID() <<
"\n"
842 <<
"-- Track EDep = " << ScintTrackEDep/
MeV <<
" MeV\n"
844 <<
"-- Step yield = " << ScintillationYield <<
" photons\n"
845 <<
"-- Track yield = " << ScintTrackYield <<
" photons\n"
854 ScintTrackYield = 0.;
859 return ScintillationYield;
static 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)
G4int GetParentID() const
ThreeVector shoot(const G4int Ap, const G4int Af)
static G4double fYieldFactor
G4long G4Poisson(G4double mean)
G4int GetNumberOfSecondaries() const
G4MaterialPropertyVector * GetProperty(const char *key)
G4double GetMaxEnergy() const
static void SetFiniteRiseTime(const G4bool state)
static G4bool fTrackSecondariesFirst
virtual G4VParticleChange * PostStepDoIt(const G4Track &, const G4Step &)
std::ostringstream G4ExceptionDescription
CLHEP::Hep3Vector G4ThreeVector
void BuildThePhysicsTable()
G4double GetStepLength() const
static G4EmSaturation * fEmSaturation
const G4DynamicParticle * GetDynamicParticle() const
G4double GetMeanLifeTime(const G4Track &aTrack, G4ForceCondition *)
G4double single_exp(G4double t, G4double tau2)
G4PhysicsTable * fFastIntegralTable
G4StepStatus GetStepStatus() const
G4double VisibleEnergyDeposition(const G4ParticleDefinition *, const G4MaterialCutsCouple *, G4double length, G4double edepTotal, G4double edepNIEL=0.0)
G4TrackStatus GetTrackStatus() const
static G4MaterialTable * GetMaterialTable()
static G4Proton * ProtonDefinition()
std::vector< G4Material * > G4MaterialTable
G4PhysicsTable * fSlowIntegralTable
void SetTouchableHandle(const G4TouchableHandle &apValue)
G4VParticleChange * AtRestDoIt(const G4Track &aTrack, const G4Step &aStep)
G4ParticleDefinition * GetDefinition() const
G4double GetVelocity() const
size_t GetVectorLength() const
const G4String & GetParticleName() const
G4StepPoint * GetPreStepPoint() const
static void SetScintillationYieldFactor(const G4double yieldfactor)
G4double GetKineticEnergy() const
G4GLOB_DLL std::ostream G4cout
G4VParticleChange * PostStepDoIt(const G4Track &aTrack, const G4Step &aStep)
G4double GetVertexKineticEnergy() const
const G4ThreeVector & GetPosition() const
static void AddSaturation(G4EmSaturation *)
G4double GetMeanFreePath(const G4Track &aTrack, G4double, G4ForceCondition *)
const G4ParticleDefinition * GetParticleDefinition() const
void SetProcessSubType(G4int)
const G4String & GetParticleType() const
void SetPolarization(G4double polX, G4double polY, G4double polZ)
G4double Energy(size_t index) const
G4double Value(G4double theEnergy, size_t &lastidx) const
static size_t GetNumberOfMaterials()
const G4String & GetProcessName() const
void SetKineticEnergy(G4double aEnergy)
G4double GetEnergy(G4double aValue)
G4double GetTotalEnergyDeposit() const
G4Material * GetMaterial() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
static void SetScintillationExcitationRatio(const G4double ratio)
static G4double fExcitationRatio
static G4OpticalPhoton * OpticalPhoton()
virtual void Initialize(const G4Track &)
static void SetTrackSecondariesFirst(const G4bool state)
G4MaterialPropertiesTable * GetMaterialPropertiesTable() const
void SetNumberOfSecondaries(G4int totSecondaries)
void SetParentID(const G4int aValue)
G4StepPoint * GetPostStepPoint() const
G4ParticleChange aParticleChange
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
void AddSecondary(G4Track *aSecondary)
void insertAt(size_t, G4PhysicsVector *)
static G4bool fFiniteRiseTime
G4double GetGlobalTime() const
G4double GetKineticEnergy() const
void ProposeTrackStatus(G4TrackStatus status)
static void RemoveSaturation()
void BuildPhysicsTable(const G4ParticleDefinition &aParticleType)
G4double GetPDGCharge() const
G4ThreeVector G4ParticleMomentum
G4double sample_time(G4double tau1, G4double tau2)
G4ThreeVector GetDeltaPosition() const
G4double GetScintillationYieldByParticleType(const G4Track &aTrack, const G4Step &aStep)
static G4Deuteron * DeuteronDefinition()
static G4Alpha * AlphaDefinition()
static G4Neutron * NeutronDefinition()
const G4TouchableHandle & GetTouchableHandle() const
static G4Gamma * GammaDefinition()
static G4bool fScintillationByParticleType