110 #ifdef G4DEBUG_SCINTILLATION
112 ScintTrackYield = 0.;
192 if (!aMaterialPropertiesTable)
196 aMaterialPropertiesTable->
GetProperty(
"FASTCOMPONENT");
198 aMaterialPropertiesTable->
GetProperty(
"SLOWCOMPONENT");
200 if (!Fast_Intensity && !Slow_Intensity )
204 if (Fast_Intensity && Slow_Intensity) nscnt = 2;
217 ScintillationYield = aMaterialPropertiesTable->
218 GetConstProperty(
"SCINTILLATIONYIELD");
224 G4double ResolutionScale = aMaterialPropertiesTable->
225 GetConstProperty(
"RESOLUTIONSCALE");
239 MeanNumberOfPhotons = ScintillationYield;
240 else if (emSaturation)
241 MeanNumberOfPhotons = ScintillationYield*
244 MeanNumberOfPhotons = ScintillationYield*TotalEnergyDeposit;
248 if (MeanNumberOfPhotons > 10.)
250 G4double sigma = ResolutionScale * std::sqrt(MeanNumberOfPhotons);
283 G4int Num = NumPhotons;
285 for (
G4int scnt = 1; scnt <= nscnt; scnt++) {
293 if (Fast_Intensity) {
294 ScintillationTime = aMaterialPropertiesTable->
295 GetConstProperty(
"FASTTIMECONSTANT");
297 ScintillationRiseTime = aMaterialPropertiesTable->
298 GetConstProperty(
"FASTSCINTILLATIONRISETIME");
300 ScintillationIntegral =
304 if (Slow_Intensity) {
305 ScintillationTime = aMaterialPropertiesTable->
306 GetConstProperty(
"SLOWTIMECONSTANT");
308 ScintillationRiseTime = aMaterialPropertiesTable->
309 GetConstProperty(
"SLOWSCINTILLATIONRISETIME");
311 ScintillationIntegral =
317 G4double YieldRatio = aMaterialPropertiesTable->
318 GetConstProperty(
"YIELDRATIO");
325 ScintillationTime = aMaterialPropertiesTable->
326 GetConstProperty(
"FASTTIMECONSTANT");
328 ScintillationRiseTime = aMaterialPropertiesTable->
329 GetConstProperty(
"FASTSCINTILLATIONRISETIME");
331 ScintillationIntegral =
337 Num = NumPhotons - Num;
338 ScintillationTime = aMaterialPropertiesTable->
339 GetConstProperty(
"SLOWTIMECONSTANT");
341 ScintillationRiseTime = aMaterialPropertiesTable->
342 GetConstProperty(
"SLOWSCINTILLATIONRISETIME");
344 ScintillationIntegral =
349 if (!ScintillationIntegral)
continue;
355 for (
G4int i = 0; i < Num; i++) {
361 ScintillationIntegral->
GetEnergy(CIIvalue);
364 G4cout <<
"sampledEnergy = " << sampledEnergy <<
G4endl;
371 G4double sint = std::sqrt((1.-cost)*(1.+cost));
396 sinp = std::sin(phi);
397 cosp = std::cos(phi);
399 photonPolarization = cosp * photonPolarization + sinp * perp;
401 photonPolarization = photonPolarization.
unit();
409 (photonPolarization.
x(),
410 photonPolarization.
y(),
411 photonPolarization.
z());
431 if (ScintillationRiseTime==0.0) {
432 deltaTime = deltaTime -
435 deltaTime = deltaTime +
436 sample_time(ScintillationRiseTime, ScintillationTime);
439 G4double aSecondaryTime = t0 + deltaTime;
460 G4cout <<
"\n Exiting from G4Scintillation::DoIt -- NumberOfSecondaries = "
488 for (
G4int i=0 ; i < numOfMaterials; i++)
498 G4Material* aMaterial = (*theMaterialTable)[i];
503 if (aMaterialPropertiesTable) {
506 aMaterialPropertiesTable->
GetProperty(
"FASTCOMPONENT");
508 if (theFastLightVector) {
513 G4double currentIN = (*theFastLightVector)[0];
515 if (currentIN >= 0.0) {
524 aPhysicsOrderedFreeVector->
525 InsertValues(currentPM , currentCII);
540 currentPM = theFastLightVector->
Energy(ii);
541 currentIN = (*theFastLightVector)[ii];
543 currentCII = 0.5 * (prevIN + currentIN);
545 currentCII = prevCII +
546 (currentPM - prevPM) * currentCII;
548 aPhysicsOrderedFreeVector->
549 InsertValues(currentPM, currentCII);
552 prevCII = currentCII;
560 aMaterialPropertiesTable->
GetProperty(
"SLOWCOMPONENT");
562 if (theSlowLightVector) {
567 G4double currentIN = (*theSlowLightVector)[0];
569 if (currentIN >= 0.0) {
578 bPhysicsOrderedFreeVector->
579 InsertValues(currentPM , currentCII);
594 currentPM = theSlowLightVector->
Energy(ii);
595 currentIN = (*theSlowLightVector)[ii];
597 currentCII = 0.5 * (prevIN + currentIN);
599 currentCII = prevCII +
600 (currentPM - prevPM) * currentCII;
602 bPhysicsOrderedFreeVector->
603 InsertValues(currentPM, currentCII);
606 prevCII = currentCII;
630 G4Exception(
"G4Scintillation::SetScintillationByParticleType",
"Scint02",
631 JustWarning,
"Redefinition: Birks Saturation is replaced by ScintillationByParticleType!");
678 G4double t = -1.0*tau2*std::log(1-ran1);
680 if (ran2 <= bi_exp(t,tau1,tau2)/gg)
return t;
704 Scint_Yield_Vector = aMaterialPropertiesTable->
705 GetProperty(
"PROTONSCINTILLATIONYIELD");
709 Scint_Yield_Vector = aMaterialPropertiesTable->
710 GetProperty(
"DEUTERONSCINTILLATIONYIELD");
714 Scint_Yield_Vector = aMaterialPropertiesTable->
715 GetProperty(
"TRITONSCINTILLATIONYIELD");
719 Scint_Yield_Vector = aMaterialPropertiesTable->
720 GetProperty(
"ALPHASCINTILLATIONYIELD");
726 Scint_Yield_Vector = aMaterialPropertiesTable->
727 GetProperty(
"IONSCINTILLATIONYIELD");
733 Scint_Yield_Vector = aMaterialPropertiesTable->
734 GetProperty(
"ELECTRONSCINTILLATIONYIELD");
738 Scint_Yield_Vector = aMaterialPropertiesTable->
739 GetProperty(
"ELECTRONSCINTILLATIONYIELD");
743 if(!Scint_Yield_Vector)
744 Scint_Yield_Vector = aMaterialPropertiesTable->
745 GetProperty(
"ELECTRONSCINTILLATIONYIELD");
748 if (!Scint_Yield_Vector) {
750 ed <<
"\nG4Scintillation::PostStepDoIt(): "
751 <<
"Request for scintillation yield for energy deposit and particle\n"
752 <<
"type without correct entry in MaterialPropertiesTable.\n"
753 <<
"ScintillationByParticleType requires at minimum that \n"
754 <<
"ELECTRONSCINTILLATIONYIELD is set by the user\n"
756 G4String comments =
"Missing MaterialPropertiesTable entry - No correct entry in MaterialPropertiesTable";
757 G4Exception(
"G4Scintillation::PostStepDoIt",
"Scint01",
774 if(PreStepKineticEnergy <= Scint_Yield_Vector->GetMaxEnergy()){
775 G4double Yield1 = Scint_Yield_Vector->
Value(PreStepKineticEnergy);
776 G4double Yield2 = Scint_Yield_Vector->
777 Value(PreStepKineticEnergy - StepEnergyDeposit);
778 ScintillationYield = Yield1 - Yield2;
781 ed <<
"\nG4Scintillation::GetScintillationYieldByParticleType(): Request\n"
782 <<
"for scintillation light yield above the available energy range\n"
783 <<
"specifed in G4MaterialPropertiesTable. A linear interpolation\n"
784 <<
"will be performed to compute the scintillation light yield using\n"
785 <<
"(L_max / E_max) as the photon yield per unit energy."
787 G4String cmt =
"\nScintillation yield may be unphysical!\n";
788 G4Exception(
"G4Scintillation::GetScintillationYieldByParticleType()",
795 ScintillationYield = LinearYield * StepEnergyDeposit;
798 #ifdef G4DEBUG_SCINTILLATION
801 ScintTrackYield += ScintillationYield;
802 ScintTrackEDep += StepEnergyDeposit;
804 G4cout <<
"\n--- G4Scintillation::GetScintillationYieldByParticleType() ---\n"
807 <<
"-- TrackID = " << aTrack.
GetTrackID() <<
"\n"
808 <<
"-- ParentID = " << aTrack.
GetParentID() <<
"\n"
811 <<
"-- Track EDep = " << ScintTrackEDep/
MeV <<
" MeV\n"
813 <<
"-- Step yield = " << ScintillationYield <<
" photons\n"
814 <<
"-- Track yield = " << ScintTrackYield <<
" photons\n"
823 ScintTrackYield = 0.;
828 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()
G4int GetParentID() const
ThreeVector shoot(const G4int Ap, const G4int Af)
G4long G4Poisson(G4double mean)
G4int GetNumberOfSecondaries() const
G4MaterialPropertyVector * GetProperty(const char *key)
G4double GetMaxEnergy() const
G4bool fTrackSecondariesFirst
virtual G4VParticleChange * PostStepDoIt(const G4Track &, const G4Step &)
std::ostringstream G4ExceptionDescription
void BuildThePhysicsTable()
G4double GetStepLength() const
const G4DynamicParticle * GetDynamicParticle() const
G4double GetMeanLifeTime(const G4Track &aTrack, G4ForceCondition *)
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
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
G4PhysicsTable * theSlowIntegralTable
G4double GetKineticEnergy() const
G4GLOB_DLL std::ostream G4cout
G4PhysicsTable * theFastIntegralTable
G4VParticleChange * PostStepDoIt(const G4Track &aTrack, const G4Step &aStep)
G4double GetVertexKineticEnergy() const
const G4ThreeVector & GetPosition() const
G4bool scintillationByParticleType
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 G4OpticalPhoton * OpticalPhoton()
virtual void Initialize(const G4Track &)
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 *)
G4double GetGlobalTime() const
Hep3Vector cross(const Hep3Vector &) const
G4double GetKineticEnergy() const
void ProposeTrackStatus(G4TrackStatus status)
void BuildPhysicsTable(const G4ParticleDefinition &aParticleType)
G4double GetPDGCharge() const
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()