111 fTrackSecondariesFirst(false),
112 fFiniteRiseTime(false),
114 fExcitationRatio(1.0),
115 fScintillationByParticleType(false),
120 #ifdef G4DEBUG_SCINTILLATION
122 ScintTrackYield = 0.;
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);
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));
411 G4ThreeVector perp = photonMomentum.cross(photonPolarization);
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());
449 if (ScintillationRiseTime==0.0) {
450 deltaTime = deltaTime -
453 deltaTime = deltaTime +
454 sample_time(ScintillationRiseTime, ScintillationTime);
457 G4double aSecondaryTime = t0 + deltaTime;
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!");
725 G4double t = -1.0*tau2*std::log(1-ran1);
727 if (ran2 <=
bi_exp(t,tau1,tau2)/gg)
return t;
751 Scint_Yield_Vector = aMaterialPropertiesTable->
752 GetProperty(
"PROTONSCINTILLATIONYIELD");
756 Scint_Yield_Vector = aMaterialPropertiesTable->
757 GetProperty(
"DEUTERONSCINTILLATIONYIELD");
761 Scint_Yield_Vector = aMaterialPropertiesTable->
762 GetProperty(
"TRITONSCINTILLATIONYIELD");
766 Scint_Yield_Vector = aMaterialPropertiesTable->
767 GetProperty(
"ALPHASCINTILLATIONYIELD");
773 Scint_Yield_Vector = aMaterialPropertiesTable->
774 GetProperty(
"IONSCINTILLATIONYIELD");
780 Scint_Yield_Vector = aMaterialPropertiesTable->
781 GetProperty(
"ELECTRONSCINTILLATIONYIELD");
785 Scint_Yield_Vector = aMaterialPropertiesTable->
786 GetProperty(
"ELECTRONSCINTILLATIONYIELD");
790 if(!Scint_Yield_Vector)
791 Scint_Yield_Vector = aMaterialPropertiesTable->
792 GetProperty(
"ELECTRONSCINTILLATIONYIELD");
795 if (!Scint_Yield_Vector) {
797 ed <<
"\nG4Scintillation::PostStepDoIt(): "
798 <<
"Request for scintillation yield for energy deposit and particle\n"
799 <<
"type without correct entry in MaterialPropertiesTable.\n"
800 <<
"ScintillationByParticleType requires at minimum that \n"
801 <<
"ELECTRONSCINTILLATIONYIELD is set by the user\n"
803 G4String comments =
"Missing MaterialPropertiesTable entry - No correct entry in MaterialPropertiesTable";
804 G4Exception(
"G4Scintillation::PostStepDoIt",
"Scint01",
821 if(PreStepKineticEnergy <= Scint_Yield_Vector->GetMaxEnergy()){
822 G4double Yield1 = Scint_Yield_Vector->
Value(PreStepKineticEnergy);
823 G4double Yield2 = Scint_Yield_Vector->
824 Value(PreStepKineticEnergy - StepEnergyDeposit);
825 ScintillationYield = Yield1 - Yield2;
828 ed <<
"\nG4Scintillation::GetScintillationYieldByParticleType(): Request\n"
829 <<
"for scintillation light yield above the available energy range\n"
830 <<
"specifed in G4MaterialPropertiesTable. A linear interpolation\n"
831 <<
"will be performed to compute the scintillation light yield using\n"
832 <<
"(L_max / E_max) as the photon yield per unit energy."
834 G4String cmt =
"\nScintillation yield may be unphysical!\n";
835 G4Exception(
"G4Scintillation::GetScintillationYieldByParticleType()",
842 ScintillationYield = LinearYield * StepEnergyDeposit;
845 #ifdef G4DEBUG_SCINTILLATION
848 ScintTrackYield += ScintillationYield;
849 ScintTrackEDep += StepEnergyDeposit;
851 G4cout <<
"\n--- G4Scintillation::GetScintillationYieldByParticleType() ---\n"
854 <<
"-- TrackID = " << aTrack.
GetTrackID() <<
"\n"
855 <<
"-- ParentID = " << aTrack.
GetParentID() <<
"\n"
858 <<
"-- Track EDep = " << ScintTrackEDep/
MeV <<
" MeV\n"
860 <<
"-- Step yield = " << ScintillationYield <<
" photons\n"
861 <<
"-- Track yield = " << ScintTrackYield <<
" photons\n"
870 ScintTrackYield = 0.;
875 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)
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
void SetFiniteRiseTime(const G4bool state)
G4bool fTrackSecondariesFirst
virtual G4VParticleChange * PostStepDoIt(const G4Track &, const G4Step &)
std::ostringstream G4ExceptionDescription
CLHEP::Hep3Vector G4ThreeVector
void BuildThePhysicsTable()
G4double GetStepLength() const
const G4DynamicParticle * GetDynamicParticle() const
G4double GetMeanLifeTime(const G4Track &aTrack, G4ForceCondition *)
G4double single_exp(G4double t, G4double tau2)
G4PhysicsTable * fFastIntegralTable
G4StepStatus GetStepStatus() const
virtual G4double VisibleEnergyDeposition(const G4ParticleDefinition *, const G4MaterialCutsCouple *, G4double length, G4double edepTotal, G4double edepNIEL=0.0)
G4EmSaturation * fEmSaturation
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
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
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)
void SetScintillationExcitationRatio(const G4double ratio)
G4double fExcitationRatio
static G4OpticalPhoton * OpticalPhoton()
virtual void Initialize(const G4Track &)
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 *)
G4double GetGlobalTime() const
G4double GetKineticEnergy() const
void ProposeTrackStatus(G4TrackStatus status)
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()
G4bool fScintillationByParticleType