183 if (!aMaterialPropertiesTable)
187 aMaterialPropertiesTable->
GetProperty(
"FASTCOMPONENT");
189 aMaterialPropertiesTable->
GetProperty(
"SLOWCOMPONENT");
191 if (!Fast_Intensity && !Slow_Intensity )
195 if (Fast_Intensity && Slow_Intensity) nscnt = 2;
213 Scint_Yield_Vector = aMaterialPropertiesTable->
214 GetProperty(
"PROTONSCINTILLATIONYIELD");
218 Scint_Yield_Vector = aMaterialPropertiesTable->
219 GetProperty(
"DEUTERONSCINTILLATIONYIELD");
223 Scint_Yield_Vector = aMaterialPropertiesTable->
224 GetProperty(
"TRITONSCINTILLATIONYIELD");
228 Scint_Yield_Vector = aMaterialPropertiesTable->
229 GetProperty(
"ALPHASCINTILLATIONYIELD");
235 Scint_Yield_Vector = aMaterialPropertiesTable->
236 GetProperty(
"IONSCINTILLATIONYIELD");
242 Scint_Yield_Vector = aMaterialPropertiesTable->
243 GetProperty(
"ELECTRONSCINTILLATIONYIELD");
247 Scint_Yield_Vector = aMaterialPropertiesTable->
248 GetProperty(
"ELECTRONSCINTILLATIONYIELD");
253 if(!Scint_Yield_Vector){
254 Scint_Yield_Vector = aMaterialPropertiesTable->
255 GetProperty(
"ELECTRONSCINTILLATIONYIELD");
259 if (!Scint_Yield_Vector) {
261 ed <<
"\nG4Scintillation::PostStepDoIt(): "
262 <<
"Request for scintillation yield for energy deposit and particle type without correct entry in MaterialPropertiesTable\n"
263 <<
"ScintillationByParticleType requires at minimum that ELECTRONSCINTILLATIONYIELD is set by the user\n"
265 G4String comments =
"Missing MaterialPropertiesTable entry - No correct entry in MaterialPropertiesTable";
266 G4Exception(
"G4Scintillation::PostStepDoIt",
"Scint01",
274 <<
"Energy Dep. = " << TotalEnergyDeposit/MeV <<
"\n"
276 << Scint_Yield_Vector->
Value(TotalEnergyDeposit)
284 ScintillationYield = Scint_Yield_Vector->
285 Value(TotalEnergyDeposit);
288 ScintillationYield = aMaterialPropertiesTable->
289 GetConstProperty(
"SCINTILLATIONYIELD");
295 G4double ResolutionScale = aMaterialPropertiesTable->
296 GetConstProperty(
"RESOLUTIONSCALE");
310 MeanNumberOfPhotons = ScintillationYield;
311 else if (emSaturation)
312 MeanNumberOfPhotons = ScintillationYield*
315 MeanNumberOfPhotons = ScintillationYield*TotalEnergyDeposit;
319 if (MeanNumberOfPhotons > 10.)
321 G4double sigma = ResolutionScale * std::sqrt(MeanNumberOfPhotons);
322 NumPhotons =
G4int(G4RandGauss::shoot(MeanNumberOfPhotons,sigma)+0.5);
354 G4int Num = NumPhotons;
356 for (
G4int scnt = 1; scnt <= nscnt; scnt++) {
365 ScintillationTime = aMaterialPropertiesTable->
366 GetConstProperty(
"FASTTIMECONSTANT");
368 ScintillationRiseTime = aMaterialPropertiesTable->
369 GetConstProperty(
"FASTSCINTILLATIONRISETIME");
371 ScintillationIntegral =
375 ScintillationTime = aMaterialPropertiesTable->
376 GetConstProperty(
"SLOWTIMECONSTANT");
378 ScintillationRiseTime = aMaterialPropertiesTable->
379 GetConstProperty(
"SLOWSCINTILLATIONRISETIME");
381 ScintillationIntegral =
386 G4double YieldRatio = aMaterialPropertiesTable->
387 GetConstProperty(
"YIELDRATIO");
389 Num =
G4int (std::min(YieldRatio,1.0) * NumPhotons);
394 ScintillationTime = aMaterialPropertiesTable->
395 GetConstProperty(
"FASTTIMECONSTANT");
397 ScintillationRiseTime = aMaterialPropertiesTable->
398 GetConstProperty(
"FASTSCINTILLATIONRISETIME");
400 ScintillationIntegral =
405 Num = NumPhotons - Num;
406 ScintillationTime = aMaterialPropertiesTable->
407 GetConstProperty(
"SLOWTIMECONSTANT");
409 ScintillationRiseTime = aMaterialPropertiesTable->
410 GetConstProperty(
"SLOWSCINTILLATIONRISETIME");
412 ScintillationIntegral =
416 if (!ScintillationIntegral)
continue;
422 for (
G4int i = 0; i < Num; i++) {
428 ScintillationIntegral->
GetEnergy(CIIvalue);
431 G4cout <<
"sampledEnergy = " << sampledEnergy <<
G4endl;
438 G4double sint = std::sqrt((1.-cost)*(1.+cost));
463 sinp = std::sin(phi);
464 cosp = std::cos(phi);
466 photonPolarization = cosp * photonPolarization + sinp * perp;
468 photonPolarization = photonPolarization.
unit();
476 (photonPolarization.
x(),
477 photonPolarization.
y(),
478 photonPolarization.
z());
498 if (ScintillationRiseTime==0.0) {
499 deltaTime = deltaTime -
502 deltaTime = deltaTime +
503 sample_time(ScintillationRiseTime, ScintillationTime);
506 G4double aSecondaryTime = t0 + deltaTime;
512 new G4Track(aScintillationPhoton,aSecondaryTime,aSecondaryPosition);
526 G4cout <<
"\n Exiting from G4Scintillation::DoIt -- NumberOfSecondaries = "
552 for (
G4int i=0 ; i < numOfMaterials; i++)
562 G4Material* aMaterial = (*theMaterialTable)[i];
567 if (aMaterialPropertiesTable) {
570 aMaterialPropertiesTable->
GetProperty(
"FASTCOMPONENT");
572 if (theFastLightVector) {
577 G4double currentIN = (*theFastLightVector)[0];
579 if (currentIN >= 0.0) {
588 aPhysicsOrderedFreeVector->
589 InsertValues(currentPM , currentCII);
604 currentPM = theFastLightVector->
Energy(ii);
605 currentIN = (*theFastLightVector)[ii];
607 currentCII = 0.5 * (prevIN + currentIN);
609 currentCII = prevCII +
610 (currentPM - prevPM) * currentCII;
612 aPhysicsOrderedFreeVector->
613 InsertValues(currentPM, currentCII);
616 prevCII = currentCII;
624 aMaterialPropertiesTable->
GetProperty(
"SLOWCOMPONENT");
626 if (theSlowLightVector) {
631 G4double currentIN = (*theSlowLightVector)[0];
633 if (currentIN >= 0.0) {
642 bPhysicsOrderedFreeVector->
643 InsertValues(currentPM , currentCII);
658 currentPM = theSlowLightVector->
Energy(ii);
659 currentIN = (*theSlowLightVector)[ii];
661 currentCII = 0.5 * (prevIN + currentIN);
663 currentCII = prevCII +
664 (currentPM - prevPM) * currentCII;
666 bPhysicsOrderedFreeVector->
667 InsertValues(currentPM, currentCII);
670 prevCII = currentCII;
694 G4Exception(
"G4Scintillation::SetScintillationByParticleType",
"Scint02",
695 JustWarning,
"Redefinition: Birks Saturation is replaced by ScintillationByParticleType!");
742 G4double t = -1.0*tau2*std::log(1-ran1);
744 if (ran2 <= bi_exp(t,tau1,tau2)/gg)
return t;
G4double condition(const G4ErrorSymMatrix &m)
std::vector< G4Material * > G4MaterialTable
G4long G4Poisson(G4double mean)
G4DLLIMPORT std::ostream G4cout
Hep3Vector cross(const Hep3Vector &) const
static G4Alpha * AlphaDefinition()
static G4Deuteron * DeuteronDefinition()
void SetPolarization(G4double polX, G4double polY, G4double polZ)
G4ParticleDefinition * GetDefinition() const
void SetKineticEnergy(G4double aEnergy)
static G4Electron * ElectronDefinition()
G4double VisibleEnergyDeposition(const G4ParticleDefinition *, const G4MaterialCutsCouple *, G4double length, G4double edepTotal, G4double edepNIEL=0.0)
static G4Gamma * GammaDefinition()
G4MaterialPropertyVector * GetProperty(const char *key)
static const G4MaterialTable * GetMaterialTable()
G4MaterialPropertiesTable * GetMaterialPropertiesTable() const
static size_t GetNumberOfMaterials()
static G4Neutron * NeutronDefinition()
static G4OpticalPhoton * OpticalPhoton()
void AddSecondary(G4Track *aSecondary)
virtual void Initialize(const G4Track &)
const G4String & GetParticleType() const
G4double GetPDGCharge() const
const G4String & GetParticleName() const
G4double GetEnergy(G4double aValue)
void insertAt(size_t, G4PhysicsVector *)
G4double Value(G4double theEnergy)
size_t GetVectorLength() const
G4double Energy(size_t index) const
static G4Proton * ProtonDefinition()
G4VParticleChange * PostStepDoIt(const G4Track &aTrack, const G4Step &aStep)
G4bool scintillationByParticleType
G4double GetMeanFreePath(const G4Track &aTrack, G4double, G4ForceCondition *)
void BuildThePhysicsTable()
G4VParticleChange * AtRestDoIt(const G4Track &aTrack, const G4Step &aStep)
G4bool fTrackSecondariesFirst
G4Scintillation(const G4String &processName="Scintillation", G4ProcessType type=fElectromagnetic)
G4double GetMeanLifeTime(const G4Track &aTrack, G4ForceCondition *)
void SetScintillationByParticleType(const G4bool)
G4PhysicsTable * theSlowIntegralTable
G4PhysicsTable * theFastIntegralTable
G4double GetVelocity() const
G4double GetGlobalTime() const
const G4ThreeVector & GetPosition() const
const G4TouchableHandle & GetTouchableHandle() const
G4ThreeVector GetDeltaPosition() const
G4StepPoint * GetPreStepPoint() const
G4double GetStepLength() const
G4double GetTotalEnergyDeposit() const
G4StepPoint * GetPostStepPoint() const
G4TrackStatus GetTrackStatus() const
void SetTouchableHandle(const G4TouchableHandle &apValue)
G4Material * GetMaterial() const
const G4DynamicParticle * GetDynamicParticle() const
void SetParentID(const G4int aValue)
static G4Triton * TritonDefinition()
void ProposeTrackStatus(G4TrackStatus status)
G4int GetNumberOfSecondaries() const
void SetNumberOfSecondaries(G4int totSecondaries)
G4ParticleChange aParticleChange
void SetProcessSubType(G4int)
const G4String & GetProcessName() const
virtual G4VParticleChange * PostStepDoIt(const G4Track &, const G4Step &)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
std::ostringstream G4ExceptionDescription