Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4QuasiScintillation.cc
Go to the documentation of this file.
1// ********************************************************************
2// * License and Disclaimer *
3// * *
4// * The Geant4 software is copyright of the Copyright Holders of *
5// * the Geant4 Collaboration. It is provided under the terms and *
6// * conditions of the Geant4 Software License, included in the file *
7// * LICENSE and available at http://cern.ch/geant4/license . These *
8// * include a list of copyright holders. *
9// * *
10// * Neither the authors of this software system, nor their employing *
11// * institutes,nor the agencies providing financial support for this *
12// * work make any representation or warranty, express or implied, *
13// * regarding this software system or assume any liability for its *
14// * use. Please see the license in the file LICENSE and URL above *
15// * for the full disclaimer and the limitation of liability. *
16// * *
17// * This code implementation is the result of the scientific and *
18// * technical work of the GEANT4 collaboration. *
19// * By using, copying, modifying or distributing the software (or *
20// * any work based on the software) you agree to acknowledge its *
21// * use in resulting scientific publications, and indicate your *
22// * acceptance of all terms of the Geant4 Software license. *
23// ********************************************************************
24//
26#include "G4QuasiOpticalData.hh"
29
30#include "globals.hh"
31#include "G4DynamicParticle.hh"
32#include "G4EmProcessSubType.hh"
33#include "G4Material.hh"
37#include "G4ParticleMomentum.hh"
38#include "G4ParticleTypes.hh"
41#include "G4PhysicsTable.hh"
42#include "G4Poisson.hh"
44#include "G4StepPoint.hh"
45#include "G4SystemOfUnits.hh"
46#include "G4ThreeVector.hh"
47#include "Randomize.hh"
49
50//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
52 G4ProcessType type)
53 : G4VRestDiscreteProcess(processName, type)
54 , fIntegralTable1(nullptr)
55 , fIntegralTable2(nullptr)
56 , fIntegralTable3(nullptr)
57 , fEmSaturation(nullptr)
58 , fNumPhotons(0)
59{
60 secID = G4PhysicsModelCatalog::GetModelID("model_QuasiScintillation");
62
63#ifdef G4DEBUG_SCINTILLATION
64 ScintTrackEDep = 0.;
65 ScintTrackYield = 0.;
66#endif
67
68 if(verboseLevel > 0)
69 {
70 G4cout << GetProcessName() << " is created " << G4endl;
71 }
72 Initialise();
73}
74
75//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
77{
78 if(fIntegralTable1 != nullptr)
79 {
80 fIntegralTable1->clearAndDestroy();
81 delete fIntegralTable1;
82 }
83 if(fIntegralTable2 != nullptr)
84 {
85 fIntegralTable2->clearAndDestroy();
86 delete fIntegralTable2;
87 }
88 if(fIntegralTable3 != nullptr)
89 {
90 fIntegralTable3->clearAndDestroy();
91 delete fIntegralTable3;
92 }
93}
94
95//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
96void G4QuasiScintillation::ProcessDescription(std::ostream& out) const
97{
98 out << "Scintillation simulates production of optical photons produced\n"
99 "by a high energy particle traversing matter.\n"
100 "Various material properties need to be defined.\n";
102
104 out << "Track secondaries first: " << params->GetScintTrackSecondariesFirst();
105 out << "Finite rise time: " << params->GetScintFiniteRiseTime();
106 out << "Scintillation by particle type: " << params->GetScintByParticleType();
107 out << "Save track information: " << params->GetScintTrackInfo();
108 out << "Stack photons: " << params->GetScintStackPhotons();
109 out << "Verbose level: " << params->GetScintVerboseLevel();
110}
111
112//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
113G4bool
115{
116 if(aParticleType.GetParticleName() == "opticalphoton")
117 return false;
118 if(aParticleType.IsShortLived())
119 return false;
120 return true;
121}
122
123//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
128
129//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
141
142//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
144{
145 const G4MaterialTable* materialTable = G4Material::GetMaterialTable();
146 std::size_t numOfMaterials = G4Material::GetNumberOfMaterials();
147
148 // Find the number of materials that have non-empty material property tables
149 std::size_t numOfMaterialsWithMPT = 0;
150 for(std::size_t i = 0; i < numOfMaterials; ++i)
151 {
152 if(((*materialTable)[i])->GetMaterialPropertiesTable())
153 {
154 ++numOfMaterialsWithMPT;
155 }
156 }
157
158 // create new physics table
159 fIntegralTable1 = new G4PhysicsTable(numOfMaterialsWithMPT);
160 fIntegralTable2 = new G4PhysicsTable(numOfMaterialsWithMPT);
161 fIntegralTable3 = new G4PhysicsTable(numOfMaterialsWithMPT);
162
163 std::size_t indexMPT = 0;
164 for(std::size_t i = 0; i < numOfMaterials; ++i)
165 {
166 // Retrieve vector of scintillation wavelength intensity for
167 // the material from the material's optical properties table.
169 ((*materialTable)[i])->GetMaterialPropertiesTable();
170
171 if(MPT)
172 {
173 auto vector1 = new G4PhysicsFreeVector();
174 auto vector2 = new G4PhysicsFreeVector();
175 auto vector3 = new G4PhysicsFreeVector();
176
177 BuildInverseCdfTable(MPT->GetProperty(kSCINTILLATIONCOMPONENT1), vector1);
178 BuildInverseCdfTable(MPT->GetProperty(kSCINTILLATIONCOMPONENT2), vector2);
179 BuildInverseCdfTable(MPT->GetProperty(kSCINTILLATIONCOMPONENT3), vector3);
180
181 fIntegralTable1->insertAt(indexMPT, vector1);
182 fIntegralTable2->insertAt(indexMPT, vector2);
183 fIntegralTable3->insertAt(indexMPT, vector3);
184
185 fIndexMPT.insert(std::make_pair(i, indexMPT));
186 ++indexMPT;
187 }
188 }
189}
190
191//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
192void
193G4QuasiScintillation::BuildInverseCdfTable(const G4MaterialPropertyVector* MPV,
194 G4PhysicsFreeVector* vec) const
195// Build the inverse cumulative distribution function (C.D.F.) vector for the
196// scintillation photon spectrum from a given G4MaterialPropertyVector.
197// The resulting C.D.F. is stored in a G4PhysicsFreeVector, with values
198// representing the inverse C.D.F. as a function of photon energy.
199{
200 if(MPV && (*MPV)[0] >= 0.0)
201 {
202 std::vector<G4double> cdf(MPV->GetVectorLength());
203 cdf.front() = 0.0;
204 for (std::size_t ii = 1; ii < MPV->GetVectorLength() ; ++ii)
205 {
206 cdf[ii] = cdf[ii - 1] + 0.5 * (MPV->Energy(ii) - MPV->Energy(ii-1))
207 * ((*MPV)[ii] + (*MPV)[ii - 1]);
208 }
209 // Normalize for the inverse C.D.F. vector
210 for (std::size_t ii = 0; ii < MPV->GetVectorLength(); ++ii)
211 {
212 cdf[ii] = cdf[ii] / cdf.back();
213 vec->InsertValues(cdf[ii], MPV->Energy(ii));
214 }
215 }
216}
217
218//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
220 const G4Step& aStep)
221// This routine simply calls the equivalent PostStepDoIt since all the
222// necessary information resides in aStep.GetTotalEnergyDeposit()
223{
224 return G4QuasiScintillation::PostStepDoIt(aTrack, aStep);
225}
226
227//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
229 const G4Step& aStep)
230// This routine is called for each tracking step of a charged particle
231// in a scintillator. A Poisson/Gauss-distributed number of photons is
232// generated according to the scintillation yield formula, distributed
233// evenly along the track segment and uniformly into 4pi.
234{
235 aParticleChange.Initialize(aTrack);
236 fNumPhotons = 0;
237
238 const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
239 const G4Material* aMaterial = aTrack.GetMaterial();
240
241 G4StepPoint* pPreStepPoint = aStep.GetPreStepPoint();
242 G4StepPoint* pPostStepPoint = aStep.GetPostStepPoint();
243
244 G4ThreeVector x0 = pPreStepPoint->GetPosition();
245 G4ThreeVector p0 = aStep.GetDeltaPosition().unit();
246 G4double t0 = pPreStepPoint->GetGlobalTime();
247
248 G4double TotalEnergyDeposit = aStep.GetTotalEnergyDeposit();
249
251 if(!MPT)
252 return G4VRestDiscreteProcess::PostStepDoIt(aTrack, aStep);
253
254 G4int N_timeconstants = 1;
255
257 N_timeconstants = 3;
259 N_timeconstants = 2;
260 else if(!(MPT->GetProperty(kSCINTILLATIONCOMPONENT1)))
261 {
262 // no components were specified
263 return G4VRestDiscreteProcess::PostStepDoIt(aTrack, aStep);
264 }
265
266 G4double ResolutionScale = MPT->GetConstProperty(kRESOLUTIONSCALE);
267 G4double MeanNumberOfPhotons;
268
269 G4double yield1 = 0.;
270 G4double yield2 = 0.;
271 G4double yield3 = 0.;
272 G4double timeconstant1 = 0.;
273 G4double timeconstant2 = 0.;
274 G4double timeconstant3 = 0.;
275 G4double sum_yields = 0.;
276
277 if(fScintillationByParticleType)
278 {
279 MeanNumberOfPhotons = GetScintillationYieldByParticleType(
280 aTrack, aStep, yield1, yield2, yield3, timeconstant1, timeconstant2,
281 timeconstant3);
282 }
283 else
284 {
287 : 1.;
290 : 0.;
293 : 0.;
294 // The default linear scintillation process
295 // Units: [# scintillation photons / MeV]
296 MeanNumberOfPhotons = MPT->GetConstProperty(kSCINTILLATIONYIELD);
297 // Birk's correction via fEmSaturation and specifying scintillation by
298 // by particle type are physically mutually exclusive
299 if(fEmSaturation)
300 MeanNumberOfPhotons *=
301 (fEmSaturation->VisibleEnergyDepositionAtAStep(&aStep));
302 else
303 MeanNumberOfPhotons *= TotalEnergyDeposit;
304 }
305 sum_yields = yield1 + yield2 + yield3;
306
307 if(MeanNumberOfPhotons > 10.)
308 {
309 G4double sigma = ResolutionScale * std::sqrt(MeanNumberOfPhotons);
310 fNumPhotons = G4int(G4RandGauss::shoot(MeanNumberOfPhotons, sigma) + 0.5);
311 }
312 else
313 {
314 fNumPhotons = G4int(G4Poisson(MeanNumberOfPhotons));
315 }
316
317 if(fNumPhotons <= 0 || !fStackingFlag)
318 {
319 // return unchanged particle and no secondaries
320 aParticleChange.SetNumberOfSecondaries(0);
321 return G4VRestDiscreteProcess::PostStepDoIt(aTrack, aStep);
322 }
323
324 aParticleChange.SetNumberOfSecondaries(fNumPhotons);
325
326 if(fTrackSecondariesFirst)
327 {
328 if(aTrack.GetTrackStatus() == fAlive)
329 aParticleChange.ProposeTrackStatus(fSuspend);
330 }
331
332 std::size_t materialIndex = aMaterial->GetIndex();
333 auto it = fIndexMPT.find(materialIndex);
334
335 std::size_t indexMPT = 0;
336 if(it != fIndexMPT.end())
337 {
338 indexMPT = it->second;
339 }
340 else
341 {
343 ed << "G4MaterialPropertiesTable for " << aMaterial->GetName()
344 << " is not found!" << G4endl;
345 G4Exception("G4QuasiScintillation::PostStepDoIt", "Scint04",
346 FatalException, ed);
347 }
348
349 // Retrieve the Scintillation Integral for this material
350 // new G4PhysicsFreeVector allocated to hold CII's
351 G4int numPhot = fNumPhotons;
352 G4double scintTime = 0.;
353 G4double riseTime = 0.;
354 G4PhysicsFreeVector* scintIntegral = nullptr;
355 G4ScintillationType scintType = Slow;
356
357 G4bool isNeutral = (aParticle->GetDefinition()->GetPDGCharge() == 0);
358 G4double deltaVelocity = pPostStepPoint->GetVelocity() -
359 pPreStepPoint->GetVelocity();
360 auto touchableHandle = aStep.GetPreStepPoint()->GetTouchableHandle();
361
362 for(G4int scnt = 0; scnt < N_timeconstants; ++scnt)
363 {
364 // if there is 1 time constant it is #1, etc.
365 if(scnt == 0)
366 {
367 if(N_timeconstants == 1)
368 {
369 numPhot = fNumPhotons;
370 }
371 else
372 {
373 numPhot = yield1 / sum_yields * fNumPhotons;
374 }
375 if(fScintillationByParticleType)
376 {
377 scintTime = timeconstant1;
378 }
379 else
380 {
382 }
383 if(fFiniteRiseTime)
384 {
386 }
387 scintType = Fast;
388 scintIntegral = (G4PhysicsFreeVector*) ((*fIntegralTable1)(indexMPT));
389 }
390 else if(scnt == 1)
391 {
392 // to be consistent with old version (due to double->int conversion)
393 if(N_timeconstants == 2)
394 {
395 numPhot = fNumPhotons - numPhot;
396 }
397 else
398 {
399 numPhot = yield2 / sum_yields * fNumPhotons;
400 }
401 if(fScintillationByParticleType)
402 {
403 scintTime = timeconstant2;
404 }
405 else
406 {
408 }
409 if(fFiniteRiseTime)
410 {
412 }
413 scintType = Medium;
414 scintIntegral = (G4PhysicsFreeVector*) ((*fIntegralTable2)(indexMPT));
415 }
416 else if(scnt == 2)
417 {
418 numPhot = yield3 / sum_yields * fNumPhotons;
419 if(fScintillationByParticleType)
420 {
421 scintTime = timeconstant3;
422 }
423 else
424 {
426 }
427 if(fFiniteRiseTime)
428 {
430 }
431 scintType = Slow;
432 scintIntegral = (G4PhysicsFreeVector*) ((*fIntegralTable3)(indexMPT));
433 }
434
435 if(!scintIntegral)
436 continue;
437
438 if(fOffloadingFlag)
439 {
440 // Create a G4DynamicParticle with G4QuasiOpticalPhoton
441 auto quasiPhoton = new G4DynamicParticle(
443 aParticle->GetMomentum());
444
445 // Create a new G4Track object with the quasi-optical photon
446 G4Track* aSecondaryTrack = new G4Track(quasiPhoton, t0, x0);
447 aSecondaryTrack->SetTouchableHandle(touchableHandle);
448 aSecondaryTrack->SetParentID(aTrack.GetTrackID());
449 aSecondaryTrack->SetCreatorModelID(secID);
450
451 // Attach auxiliary track information with associated metadata
452 G4QuasiOpticalData quasiTrackData{aMaterial->GetIndex(), numPhot,
453 aParticle->GetDefinition()->GetPDGCharge(), aStep.GetStepLength(),
454 pPreStepPoint->GetVelocity(), deltaVelocity, aStep.GetDeltaPosition()};
455 aSecondaryTrack->SetAuxiliaryTrackInformation(secID,
456 new G4ScintillationQuasiTrackInfo(quasiTrackData, scintTime, riseTime));
457 aParticleChange.AddSecondary(aSecondaryTrack);
458 }
459
460 for(G4int i = 0; i < numPhot; ++i)
461 {
462 // Determine photon energy
463 G4double sampledEnergy = scintIntegral->Value(G4UniformRand());
464
465 if(verboseLevel > 1)
466 {
467 G4cout << "sampledEnergy = " << sampledEnergy << G4endl;
468 }
469
470 // Generate random photon direction
471 G4double cost = 1. - 2. * G4UniformRand();
472 G4double sint = std::sqrt((1. - cost) * (1. + cost));
473 G4double phi = twopi * G4UniformRand();
474 G4double sinp = std::sin(phi);
475 G4double cosp = std::cos(phi);
476 G4ParticleMomentum photonMomentum(sint * cosp, sint * sinp, cost);
477
478 // Determine polarization of new photon
479 G4ThreeVector photonPolarization(cost * cosp, cost * sinp, -sint);
480 G4ThreeVector perp = photonMomentum.cross(photonPolarization);
481 phi = twopi * G4UniformRand();
482 sinp = std::sin(phi);
483 cosp = std::cos(phi);
484 photonPolarization = (cosp * photonPolarization + sinp * perp).unit();
485
486 // Generate a new photon:
487 auto scintPhoton = new G4DynamicParticle(opticalphoton, photonMomentum);
488 scintPhoton->SetPolarization(photonPolarization);
489 scintPhoton->SetKineticEnergy(sampledEnergy);
490
491 // Generate new G4Track object:
492 G4double rand = (isNeutral) ? 1.0 : G4UniformRand();
493
494 // emission time distribution
495 G4double delta = rand * aStep.GetStepLength();
496 G4double deltaTime =
497 delta / (pPreStepPoint->GetVelocity() + 0.5 * rand * deltaVelocity);
498 if(riseTime == 0.0)
499 {
500 deltaTime -= scintTime * std::log(G4UniformRand());
501 }
502 else
503 {
504 deltaTime += sample_time(riseTime, scintTime);
505 }
506
507 G4double secTime = t0 + deltaTime;
508 G4ThreeVector secPosition = x0 + rand * aStep.GetDeltaPosition();
509
510 G4Track* secTrack = new G4Track(scintPhoton, secTime, secPosition);
511 secTrack->SetTouchableHandle(touchableHandle);
512 secTrack->SetParentID(aTrack.GetTrackID());
513 secTrack->SetCreatorModelID(secID);
514 if(fScintillationTrackInfo)
515 secTrack->SetUserInformation(
516 new G4ScintillationTrackInformation(scintType));
517 aParticleChange.AddSecondary(secTrack);
518 }
519 }
520
521 if(verboseLevel > 1)
522 {
523 G4cout << "\n Exiting from G4QuasiScintillation::DoIt -- "
524 << " NumberOfSecondaries = "
525 << aParticleChange.GetNumberOfSecondaries() << G4endl;
526 }
527
528 return G4VRestDiscreteProcess::PostStepDoIt(aTrack, aStep);
529}
530
531//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
538
539//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
546
547//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
548G4double G4QuasiScintillation::sample_time(G4double tau1, G4double tau2)
549{
550 // tau1: rise time and tau2: decay time
551 // Loop checking, 07-Aug-2015, Vladimir Ivanchenko
552 G4double t;
553
554 do
555 {
556 // The exponential distribution as an envelope function: very efficient
557 t = -1.0 * tau2 * G4Log(1.0 - G4UniformRand());
558 }
559 while (G4UniformRand() > (1.0 - G4Exp(-t/tau1)));
560
561 return t;
562}
563
564//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
566 const G4Track& aTrack, const G4Step& aStep, G4double& yield1,
567 G4double& yield2, G4double& yield3, G4double& timeconstant1,
568 G4double& timeconstant2, G4double& timeconstant3)
569{
570 // new in 10.7, allow multiple time constants with ScintByParticleType
571 // Get the G4MaterialPropertyVector containing the scintillation
572 // yield as a function of the energy deposited and particle type
573 // In 11.2, allow different time constants for different particles
574
576 G4MaterialPropertyVector* yieldVector = nullptr;
579
580 // Protons
581 if(pDef == G4Proton::ProtonDefinition())
582 {
583 yieldVector = MPT->GetProperty(kPROTONSCINTILLATIONYIELD);
586 : 1.;
589 : 0.;
592 : 0.;
596 if(yield2 > 0.)
597 {
601 }
602 if(yield3 > 0.)
603 {
607 }
608 }
609
610 // Deuterons
611 else if(pDef == G4Deuteron::DeuteronDefinition())
612 {
613 yieldVector = MPT->GetProperty(kDEUTERONSCINTILLATIONYIELD);
616 : 1.;
619 : 0.;
622 : 0.;
626 if(yield2 > 0.)
627 {
631 }
632 if(yield3 > 0.)
633 {
637 }
638 }
639
640 // Tritons
641 else if(pDef == G4Triton::TritonDefinition())
642 {
643 yieldVector = MPT->GetProperty(kTRITONSCINTILLATIONYIELD);
646 : 1.;
649 : 0.;
652 : 0.;
656 if(yield2 > 0.)
657 {
661 }
662 if(yield3 > 0.)
663 {
667 }
668 }
669
670 // Alphas
671 else if(pDef == G4Alpha::AlphaDefinition())
672 {
673 yieldVector = MPT->GetProperty(kALPHASCINTILLATIONYIELD);
676 : 1.;
679 : 0.;
682 : 0.;
686 if(yield2 > 0.)
687 {
691 }
692 if(yield3 > 0.)
693 {
697 }
698 }
699
700 // Ions (particles derived from G4VIon and G4Ions) and recoil ions
701 // below the production cut from neutrons after hElastic
702 else if(pDef->GetParticleType() == "nucleus" ||
704 {
705 yieldVector = MPT->GetProperty(kIONSCINTILLATIONYIELD);
708 : 1.;
711 : 0.;
714 : 0.;
718 if(yield2 > 0.)
719 {
723 }
724 if(yield3 > 0.)
725 {
729 }
730 }
731
732 // Electrons (must also account for shell-binding energy
733 // attributed to gamma from standard photoelectric effect)
734 // and, default for particles not enumerated/listed above
735 else
736 {
737 yieldVector = MPT->GetProperty(kELECTRONSCINTILLATIONYIELD);
740 : 1.;
743 : 0.;
746 : 0.;
750 if(yield2 > 0.)
751 {
755 }
756 if(yield3 > 0.)
757 {
761 }
762 }
763
764 // Throw an exception if no scintillation yield vector is found
765 if(yieldVector == nullptr)
766 {
768 ed << "\nG4QuasiScintillation::PostStepDoIt(): "
769 << "Request for scintillation yield for energy deposit and particle\n"
770 << "type without correct entry in MaterialPropertiesTable. A material\n"
771 << "property (vector) with name like PARTICLESCINTILLATIONYIELD is\n"
772 << "needed (hint: PARTICLE might not be the primary particle."
773 << G4endl;
774 G4String comments = "Missing MaterialPropertiesTable entry - No correct "
775 "entry in MaterialPropertiesTable";
776 G4Exception("G4QuasiScintillation::PostStepDoIt", "Scint01", FatalException, ed,
777 comments);
778 return 0.; // NOLINT: required to help Coverity recognise this as exit point
779 }
780
781 ///////////////////////////////////////
782 // Calculate the scintillation light //
783 ///////////////////////////////////////
784 // To account for potential nonlinearity and scintillation photon
785 // density along the track, light (L) is produced according to:
786 // L_currentStep = L(PreStepKE) - L(PreStepKE - EDep)
787
788 G4double ScintillationYield = 0.;
789 G4double StepEnergyDeposit = aStep.GetTotalEnergyDeposit();
790 G4double PreStepKineticEnergy = aStep.GetPreStepPoint()->GetKineticEnergy();
791
792 if(PreStepKineticEnergy <= yieldVector->GetMaxEnergy())
793 {
794 // G4double Yield1 = yieldVector->Value(PreStepKineticEnergy);
795 // G4double Yield2 = yieldVector->Value(PreStepKineticEnergy -
796 // StepEnergyDeposit); ScintillationYield = Yield1 - Yield2;
797 ScintillationYield =
798 yieldVector->Value(PreStepKineticEnergy) -
799 yieldVector->Value(PreStepKineticEnergy - StepEnergyDeposit);
800 }
801 else
802 {
803 ++fNumEnergyWarnings;
804 if(verboseLevel > 0 && fNumEnergyWarnings <= 10)
805 {
807 ed << "\nG4QuasiScintillation::GetScintillationYieldByParticleType(): "
808 << "Request\n"
809 << "for scintillation light yield above the available energy range\n"
810 << "specified in G4MaterialPropertiesTable. A linear interpolation\n"
811 << "will be performed to compute the scintillation light yield using\n"
812 << "(L_max / E_max) as the photon yield per unit energy." << G4endl;
813 G4String cmt = "\nScintillation yield may be unphysical!\n";
814
815 if(fNumEnergyWarnings == 10)
816 {
817 ed << G4endl << "*** Scintillation energy warnings stopped.";
818 }
819 G4Exception("G4QuasiScintillation::GetScintillationYieldByParticleType()",
820 "Scint03", JustWarning, ed, cmt);
821 }
822
823 // Units: [# scintillation photons]
824 ScintillationYield = yieldVector->GetMaxValue() /
825 yieldVector->GetMaxEnergy() * StepEnergyDeposit;
826 }
827
828#ifdef G4DEBUG_SCINTILLATION
829 // Increment track aggregators
830 ScintTrackYield += ScintillationYield;
831 ScintTrackEDep += StepEnergyDeposit;
832
833 G4cout << "\n-- "
834 << "G4QuasiScintillation::GetScintillationYieldByParticleType() --\n"
835 << "--\n"
836 << "-- Name = "
837 << aTrack.GetParticleDefinition()->GetParticleName() << "\n"
838 << "-- TrackID = " << aTrack.GetTrackID() << "\n"
839 << "-- ParentID = " << aTrack.GetParentID() << "\n"
840 << "-- Current KE = " << aTrack.GetKineticEnergy() / MeV
841 << " MeV\n"
842 << "-- Step EDep = " << aStep.GetTotalEnergyDeposit() / MeV
843 << " MeV\n"
844 << "-- Track EDep = " << ScintTrackEDep / MeV << " MeV\n"
845 << "-- Vertex KE = " << aTrack.GetVertexKineticEnergy() / MeV
846 << " MeV\n"
847 << "-- Step yield = " << ScintillationYield << " photons\n"
848 << "-- Track yield = " << ScintTrackYield << " photons\n"
849 << G4endl;
850
851 // The track has terminated within or has left the scintillator volume
852 if((aTrack.GetTrackStatus() == fStopButAlive) or
854 {
855 // Reset aggregators for the next track
856 ScintTrackEDep = 0.;
857 ScintTrackYield = 0.;
858 }
859#endif
860
861 return ScintillationYield;
862}
863
864//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
866{
867 if(fIntegralTable1)
868 {
869 for(std::size_t i = 0; i < fIntegralTable1->entries(); ++i)
870 {
871 ((G4PhysicsFreeVector*) (*fIntegralTable1)[i])->DumpValues();
872 }
873 }
874 if(fIntegralTable2)
875 {
876 for(std::size_t i = 0; i < fIntegralTable2->entries(); ++i)
877 {
878 ((G4PhysicsFreeVector*) (*fIntegralTable2)[i])->DumpValues();
879 }
880 }
881 if(fIntegralTable3)
882 {
883 for(std::size_t i = 0; i < fIntegralTable3->entries(); ++i)
884 {
885 ((G4PhysicsFreeVector*) (*fIntegralTable3)[i])->DumpValues();
886 }
887 }
888}
889
890//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
892{
893 fTrackSecondariesFirst = state;
895 fTrackSecondariesFirst);
896}
897
898//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
900{
901 fFiniteRiseTime = state;
903}
904
905//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
907{
908 if(fEmSaturation && scintType)
909 {
910 G4Exception("G4QuasiScintillation::SetScintillationByParticleType",
911 "Scint02", JustWarning,
912 "Redefinition: Birks Saturation is replaced by "
913 "ScintillationByParticleType!");
915 }
916 fScintillationByParticleType = scintType;
918 fScintillationByParticleType);
919}
920
921//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
923{
924 fScintillationTrackInfo = trackType;
925 G4OpticalParameters::Instance()->SetScintTrackInfo(fScintillationTrackInfo);
926}
927
928//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
930{
931 fStackingFlag = stackingFlag;
933}
934
935//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
937{
938 fOffloadingFlag = offloadingFlag;
940}
941
942//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@ fScintillation
G4double condition(const G4ErrorSymMatrix &m)
@ JustWarning
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
Definition G4Exp.hh:132
G4ForceCondition
@ StronglyForced
@ Forced
G4double G4Log(G4double x)
Definition G4Log.hh:169
@ kSCINTILLATIONCOMPONENT1
@ kSCINTILLATIONCOMPONENT2
@ kSCINTILLATIONCOMPONENT3
@ kELECTRONSCINTILLATIONYIELD
@ kALPHASCINTILLATIONYIELD
@ kPROTONSCINTILLATIONYIELD
@ kDEUTERONSCINTILLATIONYIELD
@ kTRITONSCINTILLATIONYIELD
@ kSCINTILLATIONTIMECONSTANT1
@ kTRITONSCINTILLATIONYIELD1
@ kDEUTERONSCINTILLATIONYIELD3
@ kPROTONSCINTILLATIONTIMECONSTANT2
@ kALPHASCINTILLATIONTIMECONSTANT1
@ kELECTRONSCINTILLATIONTIMECONSTANT2
@ kDEUTERONSCINTILLATIONYIELD2
@ kELECTRONSCINTILLATIONTIMECONSTANT3
@ kDEUTERONSCINTILLATIONTIMECONSTANT1
@ kTRITONSCINTILLATIONTIMECONSTANT2
@ kTRITONSCINTILLATIONYIELD2
@ kALPHASCINTILLATIONYIELD2
@ kELECTRONSCINTILLATIONYIELD3
@ kTRITONSCINTILLATIONTIMECONSTANT1
@ kALPHASCINTILLATIONYIELD1
@ kALPHASCINTILLATIONTIMECONSTANT2
@ kPROTONSCINTILLATIONTIMECONSTANT3
@ kDEUTERONSCINTILLATIONTIMECONSTANT3
@ kELECTRONSCINTILLATIONYIELD2
@ kPROTONSCINTILLATIONYIELD2
@ kDEUTERONSCINTILLATIONYIELD1
@ kTRITONSCINTILLATIONTIMECONSTANT3
@ kTRITONSCINTILLATIONYIELD3
@ kSCINTILLATIONTIMECONSTANT3
@ kIONSCINTILLATIONTIMECONSTANT1
@ kIONSCINTILLATIONTIMECONSTANT3
@ kPROTONSCINTILLATIONYIELD3
@ kIONSCINTILLATIONTIMECONSTANT2
@ kALPHASCINTILLATIONTIMECONSTANT3
@ kELECTRONSCINTILLATIONYIELD1
@ kALPHASCINTILLATIONYIELD3
@ kSCINTILLATIONTIMECONSTANT2
@ kPROTONSCINTILLATIONYIELD1
@ kDEUTERONSCINTILLATIONTIMECONSTANT2
@ kPROTONSCINTILLATIONTIMECONSTANT1
@ kELECTRONSCINTILLATIONTIMECONSTANT1
G4PhysicsFreeVector G4MaterialPropertyVector
std::vector< G4Material * > G4MaterialTable
G4ThreeVector G4ParticleMomentum
G4long G4Poisson(G4double mean)
Definition G4Poisson.hh:50
G4ProcessType
@ fGeomBoundary
CLHEP::Hep3Vector G4ThreeVector
@ fSuspend
@ fAlive
@ fStopButAlive
double G4double
Definition G4Types.hh:83
bool G4bool
Definition G4Types.hh:86
int G4int
Definition G4Types.hh:85
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
#define G4UniformRand()
Definition Randomize.hh:52
Hep3Vector unit() const
Hep3Vector cross(const Hep3Vector &) const
static G4Alpha * AlphaDefinition()
Definition G4Alpha.cc:78
static G4Deuteron * DeuteronDefinition()
Definition G4Deuteron.cc:85
G4ParticleDefinition * GetDefinition() const
G4ThreeVector GetMomentum() const
G4bool ConstPropertyExists(const G4String &key) const
G4double GetConstProperty(const G4String &key) const
G4MaterialPropertyVector * GetProperty(const char *key) const
G4MaterialPropertiesTable * GetMaterialPropertiesTable() const
static std::size_t GetNumberOfMaterials()
std::size_t GetIndex() const
static G4MaterialTable * GetMaterialTable()
const G4String & GetName() const
static G4Neutron * NeutronDefinition()
Definition G4Neutron.cc:96
void SetScintByParticleType(G4bool)
void SetScintOffloadPhotons(G4bool)
G4bool GetScintOffloadPhotons() const
void SetScintTrackSecondariesFirst(G4bool)
G4int GetScintVerboseLevel() const
G4bool GetScintStackPhotons() const
static G4OpticalParameters * Instance()
void SetScintFiniteRiseTime(G4bool)
G4bool GetScintByParticleType() const
G4bool GetScintFiniteRiseTime() const
G4bool GetScintTrackInfo() const
G4bool GetScintTrackSecondariesFirst() const
const G4String & GetParticleType() const
const G4String & GetParticleName() const
static G4int GetModelID(const G4int modelIndex)
G4double GetMaxEnergy() const
G4double GetMaxValue() const
G4double Value(const G4double energy, std::size_t &lastidx) const
static G4Proton * ProtonDefinition()
Definition G4Proton.cc:85
static G4QuasiOpticalPhoton * QuasiOpticalPhotonDefinition()
G4QuasiScintillation(const G4String &procName="QausiScintillation", G4ProcessType type=fElectromagnetic)
G4VParticleChange * PostStepDoIt(const G4Track &aTrack, const G4Step &aStep) override
G4bool IsApplicable(const G4ParticleDefinition &aParticleType) override
void SetStackPhotons(const G4bool)
void SetScintillationTrackInfo(const G4bool trackType)
void ProcessDescription(std::ostream &) const override
G4double GetMeanFreePath(const G4Track &aTrack, G4double, G4ForceCondition *) override
void BuildPhysicsTable(const G4ParticleDefinition &aParticleType) override
G4VParticleChange * AtRestDoIt(const G4Track &aTrack, const G4Step &aStep) override
G4double GetMeanLifeTime(const G4Track &aTrack, G4ForceCondition *) override
void SetTrackSecondariesFirst(const G4bool state)
G4double GetScintillationYieldByParticleType(const G4Track &aTrack, const G4Step &aStep, G4double &yield1, G4double &yield2, G4double &yield3, G4double &timeconstant1, G4double &timeconstant2, G4double &timeconstant3)
void PreparePhysicsTable(const G4ParticleDefinition &part) override
void SetScintillationByParticleType(const G4bool)
void SetOffloadPhotons(const G4bool)
void SetFiniteRiseTime(const G4bool state)
G4StepStatus GetStepStatus() const
G4double GetVelocity() const
G4double GetGlobalTime() const
const G4ThreeVector & GetPosition() const
const G4TouchableHandle & GetTouchableHandle() const
G4double GetKineticEnergy() const
G4ThreeVector GetDeltaPosition() const
G4StepPoint * GetPreStepPoint() const
G4double GetStepLength() const
G4double GetTotalEnergyDeposit() const
G4StepPoint * GetPostStepPoint() const
G4TrackStatus GetTrackStatus() const
G4double GetVertexKineticEnergy() const
G4int GetTrackID() const
const G4ParticleDefinition * GetParticleDefinition() const
void SetAuxiliaryTrackInformation(G4int id, G4VAuxiliaryTrackInformation *info) const
Definition G4Track.cc:215
void SetTouchableHandle(const G4TouchableHandle &apValue)
G4Material * GetMaterial() const
const G4DynamicParticle * GetDynamicParticle() const
G4double GetKineticEnergy() const
void SetUserInformation(G4VUserTrackInformation *aValue) const
void SetCreatorModelID(const G4int id)
G4int GetParentID() const
void SetParentID(const G4int aValue)
static G4Triton * TritonDefinition()
Definition G4Triton.cc:85
G4ParticleChange aParticleChange
G4int verboseLevel
void SetProcessSubType(G4int)
virtual void DumpInfo() const
const G4String & GetProcessName() const
G4VRestDiscreteProcess(const G4String &, G4ProcessType aType=fNotDefined)
virtual G4VParticleChange * PostStepDoIt(const G4Track &, const G4Step &)
#define DBL_MAX
Definition templates.hh:62