Geant4_10
G4Scintillation.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 // $Id: G4Scintillation.cc 73929 2013-09-17 08:02:54Z gcosmo $
28 //
30 // Scintillation Light Class Implementation
32 //
33 // File: G4Scintillation.cc
34 // Description: RestDiscrete Process - Generation of Scintillation Photons
35 // Version: 1.0
36 // Created: 1998-11-07
37 // Author: Peter Gumplinger
38 // Updated: 2010-10-20 Allow the scintillation yield to be a function
39 // of energy deposited by particle type
40 // Thanks to Zach Hartwig (Department of Nuclear
41 // Science and Engineeering - MIT)
42 // 2010-09-22 by Peter Gumplinger
43 // > scintillation rise time included, thanks to
44 // > Martin Goettlich/DESY
45 // 2005-08-17 by Peter Gumplinger
46 // > change variable name MeanNumPhotons -> MeanNumberOfPhotons
47 // 2005-07-28 by Peter Gumplinger
48 // > add G4ProcessType to constructor
49 // 2004-08-05 by Peter Gumplinger
50 // > changed StronglyForced back to Forced in GetMeanLifeTime
51 // 2002-11-21 by Peter Gumplinger
52 // > change to use G4Poisson for small MeanNumberOfPhotons
53 // 2002-11-07 by Peter Gumplinger
54 // > now allow for fast and slow scintillation component
55 // 2002-11-05 by Peter Gumplinger
56 // > now use scintillation constants from G4Material
57 // 2002-05-09 by Peter Gumplinger
58 // > use only the PostStepPoint location for the origin of
59 // scintillation photons when energy is lost to the medium
60 // by a neutral particle
61 // 2000-09-18 by Peter Gumplinger
62 // > change: aSecondaryPosition=x0+rand*aStep.GetDeltaPosition();
63 // aSecondaryTrack->SetTouchable(0);
64 // 2001-09-17, migration of Materials to pure STL (mma)
65 // 2003-06-03, V.Ivanchenko fix compilation warnings
66 //
67 // mail: gum@triumf.ca
68 //
70 
71 #include "G4ios.hh"
72 #include "globals.hh"
73 #include "G4PhysicalConstants.hh"
74 #include "G4SystemOfUnits.hh"
75 #include "G4ParticleTypes.hh"
76 #include "G4EmProcessSubType.hh"
77 
78 #include "G4Scintillation.hh"
79 
81 // Class Implementation
83 
85  // Operators
87 
88 // G4Scintillation::operator=(const G4Scintillation &right)
89 // {
90 // }
91 
93  // Constructors
95 
97  G4ProcessType type)
98  : G4VRestDiscreteProcess(processName, type)
99 {
101 
102  fTrackSecondariesFirst = false;
103  fFiniteRiseTime = false;
104 
105  YieldFactor = 1.0;
106  ExcitationRatio = 1.0;
107 
109 
110 #ifdef G4DEBUG_SCINTILLATION
111  ScintTrackEDep = 0.;
112  ScintTrackYield = 0.;
113 #endif
114 
115  theFastIntegralTable = NULL;
116  theSlowIntegralTable = NULL;
117 
118  if (verboseLevel>0) {
119  G4cout << GetProcessName() << " is created " << G4endl;
120  }
121 
122  emSaturation = NULL;
123 }
124 
126  // Destructors
128 
130 {
131  if (theFastIntegralTable != NULL) {
133  delete theFastIntegralTable;
134  }
135  if (theSlowIntegralTable != NULL) {
137  delete theSlowIntegralTable;
138  }
139 }
140 
142  // Methods
144 
146 {
148 }
149 
150 
151 // AtRestDoIt
152 // ----------
153 //
155 G4Scintillation::AtRestDoIt(const G4Track& aTrack, const G4Step& aStep)
156 
157 // This routine simply calls the equivalent PostStepDoIt since all the
158 // necessary information resides in aStep.GetTotalEnergyDeposit()
159 
160 {
161  return G4Scintillation::PostStepDoIt(aTrack, aStep);
162 }
163 
164 // PostStepDoIt
165 // -------------
166 //
168 G4Scintillation::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
169 
170 // This routine is called for each tracking step of a charged particle
171 // in a scintillator. A Poisson/Gauss-distributed number of photons is
172 // generated according to the scintillation yield formula, distributed
173 // evenly along the track segment and uniformly into 4pi.
174 
175 {
176  aParticleChange.Initialize(aTrack);
177 
178  const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
179  const G4Material* aMaterial = aTrack.GetMaterial();
180 
181  G4StepPoint* pPreStepPoint = aStep.GetPreStepPoint();
182  G4StepPoint* pPostStepPoint = aStep.GetPostStepPoint();
183 
184  G4ThreeVector x0 = pPreStepPoint->GetPosition();
185  G4ThreeVector p0 = aStep.GetDeltaPosition().unit();
186  G4double t0 = pPreStepPoint->GetGlobalTime();
187 
188  G4double TotalEnergyDeposit = aStep.GetTotalEnergyDeposit();
189 
190  G4MaterialPropertiesTable* aMaterialPropertiesTable =
191  aMaterial->GetMaterialPropertiesTable();
192  if (!aMaterialPropertiesTable)
193  return G4VRestDiscreteProcess::PostStepDoIt(aTrack, aStep);
194 
195  G4MaterialPropertyVector* Fast_Intensity =
196  aMaterialPropertiesTable->GetProperty("FASTCOMPONENT");
197  G4MaterialPropertyVector* Slow_Intensity =
198  aMaterialPropertiesTable->GetProperty("SLOWCOMPONENT");
199 
200  if (!Fast_Intensity && !Slow_Intensity )
201  return G4VRestDiscreteProcess::PostStepDoIt(aTrack, aStep);
202 
203  G4int nscnt = 1;
204  if (Fast_Intensity && Slow_Intensity) nscnt = 2;
205 
206  G4double ScintillationYield = 0.;
207 
208  // Scintillation depends on particle type, energy deposited
210 
211  ScintillationYield =
213 
214  // The default linear scintillation process
215  } else {
216 
217  ScintillationYield = aMaterialPropertiesTable->
218  GetConstProperty("SCINTILLATIONYIELD");
219 
220  // Units: [# scintillation photons / MeV]
221  ScintillationYield *= YieldFactor;
222  }
223 
224  G4double ResolutionScale = aMaterialPropertiesTable->
225  GetConstProperty("RESOLUTIONSCALE");
226 
227  // Birks law saturation:
228 
229  //G4double constBirks = 0.0;
230 
231  //constBirks = aMaterial->GetIonisation()->GetBirksConstant();
232 
233  G4double MeanNumberOfPhotons;
234 
235  // Birk's correction via emSaturation and specifying scintillation by
236  // by particle type are physically mutually exclusive
237 
239  MeanNumberOfPhotons = ScintillationYield;
240  else if (emSaturation)
241  MeanNumberOfPhotons = ScintillationYield*
242  (emSaturation->VisibleEnergyDeposition(&aStep));
243  else
244  MeanNumberOfPhotons = ScintillationYield*TotalEnergyDeposit;
245 
246  G4int NumPhotons;
247 
248  if (MeanNumberOfPhotons > 10.)
249  {
250  G4double sigma = ResolutionScale * std::sqrt(MeanNumberOfPhotons);
251  NumPhotons = G4int(G4RandGauss::shoot(MeanNumberOfPhotons,sigma)+0.5);
252  }
253  else
254  {
255  NumPhotons = G4int(G4Poisson(MeanNumberOfPhotons));
256  }
257 
258  if (NumPhotons <= 0)
259  {
260  // return unchanged particle and no secondaries
261 
263 
264  return G4VRestDiscreteProcess::PostStepDoIt(aTrack, aStep);
265  }
266 
268 
270 
272  if (aTrack.GetTrackStatus() == fAlive )
274  }
275 
277 
278  G4int materialIndex = aMaterial->GetIndex();
279 
280  // Retrieve the Scintillation Integral for this material
281  // new G4PhysicsOrderedFreeVector allocated to hold CII's
282 
283  G4int Num = NumPhotons;
284 
285  for (G4int scnt = 1; scnt <= nscnt; scnt++) {
286 
287  G4double ScintillationTime = 0.*ns;
288  G4double ScintillationRiseTime = 0.*ns;
289  G4PhysicsOrderedFreeVector* ScintillationIntegral = NULL;
290 
291  if (scnt == 1) {
292  if (nscnt == 1) {
293  if (Fast_Intensity) {
294  ScintillationTime = aMaterialPropertiesTable->
295  GetConstProperty("FASTTIMECONSTANT");
296  if (fFiniteRiseTime) {
297  ScintillationRiseTime = aMaterialPropertiesTable->
298  GetConstProperty("FASTSCINTILLATIONRISETIME");
299  }
300  ScintillationIntegral =
302  ((*theFastIntegralTable)(materialIndex));
303  }
304  if (Slow_Intensity) {
305  ScintillationTime = aMaterialPropertiesTable->
306  GetConstProperty("SLOWTIMECONSTANT");
307  if (fFiniteRiseTime) {
308  ScintillationRiseTime = aMaterialPropertiesTable->
309  GetConstProperty("SLOWSCINTILLATIONRISETIME");
310  }
311  ScintillationIntegral =
313  ((*theSlowIntegralTable)(materialIndex));
314  }
315  }
316  else {
317  G4double YieldRatio = aMaterialPropertiesTable->
318  GetConstProperty("YIELDRATIO");
319  if ( ExcitationRatio == 1.0 || ExcitationRatio == 0.0) {
320  Num = G4int (std::min(YieldRatio,1.0) * NumPhotons);
321  }
322  else {
323  Num = G4int (std::min(ExcitationRatio,1.0) * NumPhotons);
324  }
325  ScintillationTime = aMaterialPropertiesTable->
326  GetConstProperty("FASTTIMECONSTANT");
327  if (fFiniteRiseTime) {
328  ScintillationRiseTime = aMaterialPropertiesTable->
329  GetConstProperty("FASTSCINTILLATIONRISETIME");
330  }
331  ScintillationIntegral =
333  ((*theFastIntegralTable)(materialIndex));
334  }
335  }
336  else {
337  Num = NumPhotons - Num;
338  ScintillationTime = aMaterialPropertiesTable->
339  GetConstProperty("SLOWTIMECONSTANT");
340  if (fFiniteRiseTime) {
341  ScintillationRiseTime = aMaterialPropertiesTable->
342  GetConstProperty("SLOWSCINTILLATIONRISETIME");
343  }
344  ScintillationIntegral =
346  ((*theSlowIntegralTable)(materialIndex));
347  }
348 
349  if (!ScintillationIntegral) continue;
350 
351  // Max Scintillation Integral
352 
353  G4double CIImax = ScintillationIntegral->GetMaxValue();
354 
355  for (G4int i = 0; i < Num; i++) {
356 
357  // Determine photon energy
358 
359  G4double CIIvalue = G4UniformRand()*CIImax;
360  G4double sampledEnergy =
361  ScintillationIntegral->GetEnergy(CIIvalue);
362 
363  if (verboseLevel>1) {
364  G4cout << "sampledEnergy = " << sampledEnergy << G4endl;
365  G4cout << "CIIvalue = " << CIIvalue << G4endl;
366  }
367 
368  // Generate random photon direction
369 
370  G4double cost = 1. - 2.*G4UniformRand();
371  G4double sint = std::sqrt((1.-cost)*(1.+cost));
372 
373  G4double phi = twopi*G4UniformRand();
374  G4double sinp = std::sin(phi);
375  G4double cosp = std::cos(phi);
376 
377  G4double px = sint*cosp;
378  G4double py = sint*sinp;
379  G4double pz = cost;
380 
381  // Create photon momentum direction vector
382 
383  G4ParticleMomentum photonMomentum(px, py, pz);
384 
385  // Determine polarization of new photon
386 
387  G4double sx = cost*cosp;
388  G4double sy = cost*sinp;
389  G4double sz = -sint;
390 
391  G4ThreeVector photonPolarization(sx, sy, sz);
392 
393  G4ThreeVector perp = photonMomentum.cross(photonPolarization);
394 
395  phi = twopi*G4UniformRand();
396  sinp = std::sin(phi);
397  cosp = std::cos(phi);
398 
399  photonPolarization = cosp * photonPolarization + sinp * perp;
400 
401  photonPolarization = photonPolarization.unit();
402 
403  // Generate a new photon:
404 
405  G4DynamicParticle* aScintillationPhoton =
407  photonMomentum);
408  aScintillationPhoton->SetPolarization
409  (photonPolarization.x(),
410  photonPolarization.y(),
411  photonPolarization.z());
412 
413  aScintillationPhoton->SetKineticEnergy(sampledEnergy);
414 
415  // Generate new G4Track object:
416 
417  G4double rand;
418 
419  if (aParticle->GetDefinition()->GetPDGCharge() != 0) {
420  rand = G4UniformRand();
421  } else {
422  rand = 1.0;
423  }
424 
425  G4double delta = rand * aStep.GetStepLength();
426  G4double deltaTime = delta /
427  ((pPreStepPoint->GetVelocity()+
428  pPostStepPoint->GetVelocity())/2.);
429 
430  // emission time distribution
431  if (ScintillationRiseTime==0.0) {
432  deltaTime = deltaTime -
433  ScintillationTime * std::log( G4UniformRand() );
434  } else {
435  deltaTime = deltaTime +
436  sample_time(ScintillationRiseTime, ScintillationTime);
437  }
438 
439  G4double aSecondaryTime = t0 + deltaTime;
440 
441  G4ThreeVector aSecondaryPosition =
442  x0 + rand * aStep.GetDeltaPosition();
443 
444  G4Track* aSecondaryTrack = new G4Track(aScintillationPhoton,
445  aSecondaryTime,
446  aSecondaryPosition);
447 
448  aSecondaryTrack->SetTouchableHandle(
450  // aSecondaryTrack->SetTouchableHandle((G4VTouchable*)0);
451 
452  aSecondaryTrack->SetParentID(aTrack.GetTrackID());
453 
454  aParticleChange.AddSecondary(aSecondaryTrack);
455 
456  }
457  }
458 
459  if (verboseLevel>0) {
460  G4cout << "\n Exiting from G4Scintillation::DoIt -- NumberOfSecondaries = "
462  }
463 
464  return G4VRestDiscreteProcess::PostStepDoIt(aTrack, aStep);
465 }
466 
467 // BuildThePhysicsTable for the scintillation process
468 // --------------------------------------------------
469 //
470 
472 {
474 
475  const G4MaterialTable* theMaterialTable =
477  G4int numOfMaterials = G4Material::GetNumberOfMaterials();
478 
479  // create new physics table
480 
482  new G4PhysicsTable(numOfMaterials);
484  new G4PhysicsTable(numOfMaterials);
485 
486  // loop for materials
487 
488  for (G4int i=0 ; i < numOfMaterials; i++)
489  {
490  G4PhysicsOrderedFreeVector* aPhysicsOrderedFreeVector =
492  G4PhysicsOrderedFreeVector* bPhysicsOrderedFreeVector =
494 
495  // Retrieve vector of scintillation wavelength intensity for
496  // the material from the material's optical properties table.
497 
498  G4Material* aMaterial = (*theMaterialTable)[i];
499 
500  G4MaterialPropertiesTable* aMaterialPropertiesTable =
501  aMaterial->GetMaterialPropertiesTable();
502 
503  if (aMaterialPropertiesTable) {
504 
505  G4MaterialPropertyVector* theFastLightVector =
506  aMaterialPropertiesTable->GetProperty("FASTCOMPONENT");
507 
508  if (theFastLightVector) {
509 
510  // Retrieve the first intensity point in vector
511  // of (photon energy, intensity) pairs
512 
513  G4double currentIN = (*theFastLightVector)[0];
514 
515  if (currentIN >= 0.0) {
516 
517  // Create first (photon energy, Scintillation
518  // Integral pair
519 
520  G4double currentPM = theFastLightVector->Energy(0);
521 
522  G4double currentCII = 0.0;
523 
524  aPhysicsOrderedFreeVector->
525  InsertValues(currentPM , currentCII);
526 
527  // Set previous values to current ones prior to loop
528 
529  G4double prevPM = currentPM;
530  G4double prevCII = currentCII;
531  G4double prevIN = currentIN;
532 
533  // loop over all (photon energy, intensity)
534  // pairs stored for this material
535 
536  for (size_t ii = 1;
537  ii < theFastLightVector->GetVectorLength();
538  ++ii)
539  {
540  currentPM = theFastLightVector->Energy(ii);
541  currentIN = (*theFastLightVector)[ii];
542 
543  currentCII = 0.5 * (prevIN + currentIN);
544 
545  currentCII = prevCII +
546  (currentPM - prevPM) * currentCII;
547 
548  aPhysicsOrderedFreeVector->
549  InsertValues(currentPM, currentCII);
550 
551  prevPM = currentPM;
552  prevCII = currentCII;
553  prevIN = currentIN;
554  }
555 
556  }
557  }
558 
559  G4MaterialPropertyVector* theSlowLightVector =
560  aMaterialPropertiesTable->GetProperty("SLOWCOMPONENT");
561 
562  if (theSlowLightVector) {
563 
564  // Retrieve the first intensity point in vector
565  // of (photon energy, intensity) pairs
566 
567  G4double currentIN = (*theSlowLightVector)[0];
568 
569  if (currentIN >= 0.0) {
570 
571  // Create first (photon energy, Scintillation
572  // Integral pair
573 
574  G4double currentPM = theSlowLightVector->Energy(0);
575 
576  G4double currentCII = 0.0;
577 
578  bPhysicsOrderedFreeVector->
579  InsertValues(currentPM , currentCII);
580 
581  // Set previous values to current ones prior to loop
582 
583  G4double prevPM = currentPM;
584  G4double prevCII = currentCII;
585  G4double prevIN = currentIN;
586 
587  // loop over all (photon energy, intensity)
588  // pairs stored for this material
589 
590  for (size_t ii = 1;
591  ii < theSlowLightVector->GetVectorLength();
592  ++ii)
593  {
594  currentPM = theSlowLightVector->Energy(ii);
595  currentIN = (*theSlowLightVector)[ii];
596 
597  currentCII = 0.5 * (prevIN + currentIN);
598 
599  currentCII = prevCII +
600  (currentPM - prevPM) * currentCII;
601 
602  bPhysicsOrderedFreeVector->
603  InsertValues(currentPM, currentCII);
604 
605  prevPM = currentPM;
606  prevCII = currentCII;
607  prevIN = currentIN;
608  }
609 
610  }
611  }
612  }
613 
614  // The scintillation integral(s) for a given material
615  // will be inserted in the table(s) according to the
616  // position of the material in the material table.
617 
618  theFastIntegralTable->insertAt(i,aPhysicsOrderedFreeVector);
619  theSlowIntegralTable->insertAt(i,bPhysicsOrderedFreeVector);
620 
621  }
622 }
623 
624 // Called by the user to set the scintillation yield as a function
625 // of energy deposited by particle type
626 
628 {
629  if (emSaturation) {
630  G4Exception("G4Scintillation::SetScintillationByParticleType", "Scint02",
631  JustWarning, "Redefinition: Birks Saturation is replaced by ScintillationByParticleType!");
633  }
634  scintillationByParticleType = scintType;
635 }
636 
637 // GetMeanFreePath
638 // ---------------
639 //
640 
642  G4double ,
644 {
645  *condition = StronglyForced;
646 
647  return DBL_MAX;
648 
649 }
650 
651 // GetMeanLifeTime
652 // ---------------
653 //
654 
657 {
658  *condition = Forced;
659 
660  return DBL_MAX;
661 
662 }
663 
664 G4double G4Scintillation::sample_time(G4double tau1, G4double tau2)
665 {
666 // tau1: rise time and tau2: decay time
667 
668  while(1) {
669  // two random numbers
670  G4double ran1 = G4UniformRand();
671  G4double ran2 = G4UniformRand();
672  //
673  // exponential distribution as envelope function: very efficient
674  //
675  G4double d = (tau1+tau2)/tau2;
676  // make sure the envelope function is
677  // always larger than the bi-exponential
678  G4double t = -1.0*tau2*std::log(1-ran1);
679  G4double gg = d*single_exp(t,tau2);
680  if (ran2 <= bi_exp(t,tau1,tau2)/gg) return t;
681  }
682  return -1.0;
683 }
684 
687 {
689  // Get the scintillation yield vector //
691 
693 
694  G4MaterialPropertyVector *Scint_Yield_Vector = NULL;
695 
696  G4MaterialPropertiesTable *aMaterialPropertiesTable
698 
699  // Get the G4MaterialPropertyVector containing the scintillation
700  // yield as a function of the energy deposited and particle type
701 
702  // Protons
703  if(pDef==G4Proton::ProtonDefinition())
704  Scint_Yield_Vector = aMaterialPropertiesTable->
705  GetProperty("PROTONSCINTILLATIONYIELD");
706 
707  // Deuterons
708  else if(pDef==G4Deuteron::DeuteronDefinition())
709  Scint_Yield_Vector = aMaterialPropertiesTable->
710  GetProperty("DEUTERONSCINTILLATIONYIELD");
711 
712  // Tritons
713  else if(pDef==G4Triton::TritonDefinition())
714  Scint_Yield_Vector = aMaterialPropertiesTable->
715  GetProperty("TRITONSCINTILLATIONYIELD");
716 
717  // Alphas
718  else if(pDef==G4Alpha::AlphaDefinition())
719  Scint_Yield_Vector = aMaterialPropertiesTable->
720  GetProperty("ALPHASCINTILLATIONYIELD");
721 
722  // Ions (particles derived from G4VIon and G4Ions) and recoil ions
723  // below the production cut from neutrons after hElastic
724  else if(pDef->GetParticleType()== "nucleus" ||
726  Scint_Yield_Vector = aMaterialPropertiesTable->
727  GetProperty("IONSCINTILLATIONYIELD");
728 
729  // Electrons (must also account for shell-binding energy
730  // attributed to gamma from standard photoelectric effect)
731  else if(pDef==G4Electron::ElectronDefinition() ||
732  pDef==G4Gamma::GammaDefinition())
733  Scint_Yield_Vector = aMaterialPropertiesTable->
734  GetProperty("ELECTRONSCINTILLATIONYIELD");
735 
736  // Default for particles not enumerated/listed above
737  else
738  Scint_Yield_Vector = aMaterialPropertiesTable->
739  GetProperty("ELECTRONSCINTILLATIONYIELD");
740 
741  // If the user has specified none of the above particles then the
742  // default is the electron scintillation yield
743  if(!Scint_Yield_Vector)
744  Scint_Yield_Vector = aMaterialPropertiesTable->
745  GetProperty("ELECTRONSCINTILLATIONYIELD");
746 
747  // Throw an exception if no scintillation yield vector is found
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"
755  << G4endl;
756  G4String comments = "Missing MaterialPropertiesTable entry - No correct entry in MaterialPropertiesTable";
757  G4Exception("G4Scintillation::PostStepDoIt","Scint01",
758  FatalException,ed,comments);
759  }
760 
762  // Calculate the scintillation light //
764  // To account for potential nonlinearity and scintillation photon
765  // density along the track, light (L) is produced according to:
766  //
767  // L_currentStep = L(PreStepKE) - L(PreStepKE - EDep)
768 
769  G4double ScintillationYield = 0.;
770 
771  G4double StepEnergyDeposit = aStep.GetTotalEnergyDeposit();
772  G4double PreStepKineticEnergy = aStep.GetPreStepPoint()->GetKineticEnergy();
773 
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;
779  } else {
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."
786  << G4endl;
787  G4String cmt = "\nScintillation yield may be unphysical!\n";
788  G4Exception("G4Scintillation::GetScintillationYieldByParticleType()",
789  "Scint03", JustWarning, ed, cmt);
790 
791  G4double LinearYield = Scint_Yield_Vector->GetMaxValue()
792  / Scint_Yield_Vector->GetMaxEnergy();
793 
794  // Units: [# scintillation photons]
795  ScintillationYield = LinearYield * StepEnergyDeposit;
796  }
797 
798 #ifdef G4DEBUG_SCINTILLATION
799 
800  // Increment track aggregators
801  ScintTrackYield += ScintillationYield;
802  ScintTrackEDep += StepEnergyDeposit;
803 
804  G4cout << "\n--- G4Scintillation::GetScintillationYieldByParticleType() ---\n"
805  << "--\n"
806  << "-- Name = " << aTrack.GetParticleDefinition()->GetParticleName() << "\n"
807  << "-- TrackID = " << aTrack.GetTrackID() << "\n"
808  << "-- ParentID = " << aTrack.GetParentID() << "\n"
809  << "-- Current KE = " << aTrack.GetKineticEnergy()/MeV << " MeV\n"
810  << "-- Step EDep = " << aStep.GetTotalEnergyDeposit()/MeV << " MeV\n"
811  << "-- Track EDep = " << ScintTrackEDep/MeV << " MeV\n"
812  << "-- Vertex KE = " << aTrack.GetVertexKineticEnergy()/MeV << " MeV\n"
813  << "-- Step yield = " << ScintillationYield << " photons\n"
814  << "-- Track yield = " << ScintTrackYield << " photons\n"
815  << G4endl;
816 
817  // The track has terminated within or has left the scintillator volume
818  if( (aTrack.GetTrackStatus() == fStopButAlive) or
819  (aStep.GetPostStepPoint()->GetStepStatus() == fGeomBoundary) ){
820 
821  // Reset aggregators for the next track
822  ScintTrackEDep = 0.;
823  ScintTrackYield = 0.;
824  }
825 
826 #endif
827 
828  return ScintillationYield;
829 }
void SetScintillationByParticleType(const G4bool)
G4double condition(const G4ErrorSymMatrix &m)
G4Scintillation(const G4String &processName="Scintillation", G4ProcessType type=fElectromagnetic)
static G4Electron * ElectronDefinition()
Definition: G4Electron.cc:89
static G4Triton * TritonDefinition()
Definition: G4Triton.cc:90
G4int GetParentID() const
ThreeVector shoot(const G4int Ap, const G4int Af)
G4long G4Poisson(G4double mean)
Definition: G4Poisson.hh:51
G4int GetNumberOfSecondaries() const
G4MaterialPropertyVector * GetProperty(const char *key)
G4double GetMaxEnergy() const
G4int verboseLevel
Definition: G4VProcess.hh:368
G4bool fTrackSecondariesFirst
virtual G4VParticleChange * PostStepDoIt(const G4Track &, const G4Step &)
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
Float_t d
Definition: plot.C:237
G4double GetStepLength() const
double x() const
const G4DynamicParticle * GetDynamicParticle() const
G4double GetMeanLifeTime(const G4Track &aTrack, G4ForceCondition *)
size_t GetIndex() const
Definition: G4Material.hh:260
G4StepStatus GetStepStatus() const
G4double VisibleEnergyDeposition(const G4ParticleDefinition *, const G4MaterialCutsCouple *, G4double length, G4double edepTotal, G4double edepNIEL=0.0)
G4TrackStatus GetTrackStatus() const
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:564
static G4Proton * ProtonDefinition()
Definition: G4Proton.cc:88
std::vector< G4Material * > G4MaterialTable
G4double ExcitationRatio
void SetTouchableHandle(const G4TouchableHandle &apValue)
G4VParticleChange * AtRestDoIt(const G4Track &aTrack, const G4Step &aStep)
G4ParticleDefinition * GetDefinition() const
G4double GetVelocity() const
size_t GetVectorLength() const
int G4int
Definition: G4Types.hh:78
const G4String & GetParticleName() const
double z() const
G4StepPoint * GetPreStepPoint() const
G4PhysicsTable * theSlowIntegralTable
G4double GetKineticEnergy() const
#define G4UniformRand()
Definition: Randomize.hh:87
G4GLOB_DLL std::ostream G4cout
G4PhysicsTable * theFastIntegralTable
G4VParticleChange * PostStepDoIt(const G4Track &aTrack, const G4Step &aStep)
G4double GetVertexKineticEnergy() const
const G4ThreeVector & GetPosition() const
G4bool scintillationByParticleType
bool G4bool
Definition: G4Types.hh:79
G4double GetMeanFreePath(const G4Track &aTrack, G4double, G4ForceCondition *)
const G4ParticleDefinition * GetParticleDefinition() const
void SetProcessSubType(G4int)
Definition: G4VProcess.hh:432
const G4String & GetParticleType() const
Definition: G4Step.hh:76
G4int GetTrackID() 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()
Definition: G4Material.cc:571
const G4String & GetProcessName() const
Definition: G4VProcess.hh:408
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)
Definition: G4Exception.cc:41
static G4OpticalPhoton * OpticalPhoton()
virtual void Initialize(const G4Track &)
G4MaterialPropertiesTable * GetMaterialPropertiesTable() const
Definition: G4Material.hh:250
void SetNumberOfSecondaries(G4int totSecondaries)
Hep3Vector unit() const
void SetParentID(const G4int aValue)
G4StepPoint * GetPostStepPoint() const
double y() const
G4ParticleChange aParticleChange
Definition: G4VProcess.hh:289
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 *)
#define G4endl
Definition: G4ios.hh:61
G4double GetGlobalTime() const
Hep3Vector cross(const Hep3Vector &) const
G4double GetKineticEnergy() const
double G4double
Definition: G4Types.hh:76
void ProposeTrackStatus(G4TrackStatus status)
G4ForceCondition
void BuildPhysicsTable(const G4ParticleDefinition &aParticleType)
G4double GetPDGCharge() const
G4ThreeVector GetDeltaPosition() const
#define DBL_MAX
Definition: templates.hh:83
G4double GetScintillationYieldByParticleType(const G4Track &aTrack, const G4Step &aStep)
static G4Deuteron * DeuteronDefinition()
Definition: G4Deuteron.cc:89
static G4Alpha * AlphaDefinition()
Definition: G4Alpha.cc:84
static G4Neutron * NeutronDefinition()
Definition: G4Neutron.cc:99
#define ns
Definition: xmlparse.cc:597
const G4TouchableHandle & GetTouchableHandle() const
void clearAndDestroy()
static G4Gamma * GammaDefinition()
Definition: G4Gamma.cc:81
G4ProcessType