Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4OpticalPhysics Class Reference

#include <G4OpticalPhysics.hh>

+ Inheritance diagram for G4OpticalPhysics:

Public Member Functions

 G4OpticalPhysics (G4int verbose=0, const G4String &name="Optical")
 
virtual ~G4OpticalPhysics ()
 
void Configure (G4OpticalProcessIndex, G4bool)
 
virtual G4ScintillationGetScintillationProcess ()
 
virtual G4CerenkovGetCerenkovProcess ()
 
virtual G4OpWLSGetOpWLSProcess ()
 
virtual G4OpAbsorptionGetOpAbsorptionProcess ()
 
virtual G4OpRayleighGetOpRayleighProcess ()
 
virtual G4OpMieHGGetOpMieHGProcess ()
 
virtual G4OpBoundaryProcessGetOpBoundaryProcess ()
 
void SetProcessVerbose (G4int, G4int)
 
void SetMaxNumPhotonsPerStep (G4int)
 
void SetMaxBetaChangePerStep (G4double)
 
void SetScintillationYieldFactor (G4double)
 
void SetScintillationExcitationRatio (G4double)
 
void SetWLSTimeProfile (G4String)
 
void SetScintillationByParticleType (G4bool)
 
void AddScintillationSaturation (G4EmSaturation *)
 
void SetTrackSecondariesFirst (G4OpticalProcessIndex, G4bool)
 
void SetFiniteRiseTime (G4bool)
 
- Public Member Functions inherited from G4VPhysicsConstructor
 G4VPhysicsConstructor (const G4String &="")
 
 G4VPhysicsConstructor (const G4String &name, G4int physics_type)
 
virtual ~G4VPhysicsConstructor ()
 
virtual void ConstructParticle ()=0
 
virtual void ConstructProcess ()=0
 
void SetPhysicsName (const G4String &="")
 
const G4StringGetPhysicsName () const
 
void SetPhysicsType (G4int)
 
G4int GetPhysicsType () const
 
void SetVerboseLevel (G4int value)
 
G4int GetVerboseLevel () const
 

Protected Member Functions

virtual void ConstructParticle ()
 
virtual void ConstructProcess ()
 
- Protected Member Functions inherited from G4VPhysicsConstructor
G4bool RegisterProcess (G4VProcess *process, G4ParticleDefinition *particle)
 

Additional Inherited Members

- Protected Attributes inherited from G4VPhysicsConstructor
G4int verboseLevel
 
G4String namePhysics
 
G4int typePhysics
 
G4ParticleTabletheParticleTable
 
G4ParticleTable::G4PTblDicIteratortheParticleIterator
 
G4PhysicsListHelperthePLHelper
 

Detailed Description

Definition at line 69 of file G4OpticalPhysics.hh.

Constructor & Destructor Documentation

◆ G4OpticalPhysics()

G4OpticalPhysics::G4OpticalPhysics ( G4int  verbose = 0,
const G4String name = "Optical" 
)

Definition at line 53 of file G4OpticalPhysics.cc.

55
56 wasActivated(false),
57
58 fScintillationProcess(NULL),
59 fCerenkovProcess(NULL),
60 fOpWLSProcess(NULL),
61 fOpAbsorptionProcess(NULL),
62 fOpRayleighScatteringProcess(NULL),
63 fOpMieHGScatteringProcess(NULL),
64 fOpBoundaryProcess(NULL),
65 fMaxNumPhotons(100),
66 fMaxBetaChange(10.0),
67 fYieldFactor(1.),
68 fExcitationRatio(0.0),
69 fProfile("delta"),
70 fFiniteRiseTime(false),
71 fScintillationByParticleType(false)
72{
73 verboseLevel = verbose;
74 fMessenger = new G4OpticalPhysicsMessenger(this);
75
76 for ( G4int i=0; i<kNoProcess; i++ ) {
77 fProcesses.push_back(NULL);
78 fProcessUse.push_back(true);
79 fProcessVerbose.push_back(verbose);
80 fProcessTrackSecondariesFirst.push_back(true);
81 }
82}
@ kNoProcess
Number of processes, no selected process.
int G4int
Definition: G4Types.hh:66

◆ ~G4OpticalPhysics()

G4OpticalPhysics::~G4OpticalPhysics ( )
virtual

Definition at line 86 of file G4OpticalPhysics.cc.

87{
88 delete fMessenger;
89
90 if (wasActivated) {
91
92 if (fScintillationProcess) delete fScintillationProcess;
93 if (fCerenkovProcess) delete fCerenkovProcess;
94 if (fOpWLSProcess) delete fOpWLSProcess;
95
96 if (fOpAbsorptionProcess) delete fOpAbsorptionProcess;
97 if (fOpRayleighScatteringProcess) delete fOpRayleighScatteringProcess;
98 if (fOpMieHGScatteringProcess) delete fOpMieHGScatteringProcess;
99 if (fOpBoundaryProcess) delete fOpBoundaryProcess;
100
101 }
102}

Member Function Documentation

◆ AddScintillationSaturation()

void G4OpticalPhysics::AddScintillationSaturation ( G4EmSaturation saturation)

Adds Birks Saturation to the G4Scintillation Process

Definition at line 302 of file G4OpticalPhysics.cc.

303{
304/// Adds Birks Saturation to the G4Scintillation Process
305
306 if(fScintillationProcess)
307 fScintillationProcess->AddSaturation(saturation);
308}
void AddSaturation(G4EmSaturation *sat)

◆ Configure()

void G4OpticalPhysics::Configure ( G4OpticalProcessIndex  index,
G4bool  isUse 
)

Definition at line 339 of file G4OpticalPhysics.cc.

340{
341 // Configure the physics constructor to use/not use a selected process.
342 // This method can only be called in PreInit> phase (before execution of
343 // ConstructProcess). The process is not added to particle's process manager
344 // and so it cannot be re-activated later in Idle> phase with the command
345 // /process/activate.
346
347 if ( index >= kNoProcess ) return;
348 if ( fProcessUse[index] == isUse ) return;
349 fProcessUse[index] = isUse;
350}

◆ ConstructParticle()

void G4OpticalPhysics::ConstructParticle ( )
protectedvirtual

Instantiate particles.

Implements G4VPhysicsConstructor.

Definition at line 140 of file G4OpticalPhysics.cc.

141{
142/// Instantiate particles.
143
144 // optical photon
146}
static G4OpticalPhoton * OpticalPhotonDefinition()

◆ ConstructProcess()

void G4OpticalPhysics::ConstructProcess ( )
protectedvirtual

Implements G4VPhysicsConstructor.

Definition at line 153 of file G4OpticalPhysics.cc.

154{
155// Construct optical processes.
156
157 if (wasActivated) return;
158
159 if(verboseLevel>0)
160 G4cout <<"G4OpticalPhysics:: Add Optical Physics Processes"<< G4endl;
161
162 // Add Optical Processes
163
164 fProcesses[kAbsorption] = fOpAbsorptionProcess = new G4OpAbsorption();
165 fProcesses[kRayleigh] = fOpRayleighScatteringProcess = new G4OpRayleigh();
166 fProcesses[kMieHG] = fOpMieHGScatteringProcess = new G4OpMieHG();
167
168 fProcesses[kBoundary] = fOpBoundaryProcess = new G4OpBoundaryProcess();
169
170 fProcesses[kWLS] = fOpWLSProcess = new G4OpWLS();
171 fOpWLSProcess->UseTimeProfile(fProfile);
172
173 G4ProcessManager * pManager = 0;
175
176 if (!pManager) {
177 std::ostringstream o;
178 o << "Optical Photon without a Process Manager";
179 G4Exception("G4OpticalPhysics::ConstructProcess()","",
180 FatalException,o.str().c_str());
181 return;
182 }
183
184 for ( G4int i=kAbsorption; i<=kWLS; i++ ) {
185 if ( fProcessUse[i] ) {
186 pManager->AddDiscreteProcess(fProcesses[i]);
187 }
188 }
189
190 fProcesses[kScintillation] = fScintillationProcess = new G4Scintillation();
191 fScintillationProcess->SetScintillationYieldFactor(fYieldFactor);
192 fScintillationProcess->SetScintillationExcitationRatio(fExcitationRatio);
193 fScintillationProcess->SetFiniteRiseTime(fFiniteRiseTime);
194 fScintillationProcess->SetScintillationByParticleType(fScintillationByParticleType);
195 fScintillationProcess->
196 SetTrackSecondariesFirst(fProcessTrackSecondariesFirst[kScintillation]);
197
198 // Use Birks Correction in the Scintillation process
199
201 fScintillationProcess->AddSaturation(emSaturation);
202
203 fProcesses[kCerenkov] = fCerenkovProcess = new G4Cerenkov();
204 fCerenkovProcess->SetMaxNumPhotonsPerStep(fMaxNumPhotons);
205 fCerenkovProcess->SetMaxBetaChangePerStep(fMaxBetaChange);
206 fCerenkovProcess->
207 SetTrackSecondariesFirst(fProcessTrackSecondariesFirst[kCerenkov]);
208
210
211 while( (*theParticleIterator)() ){
212
214 G4String particleName = particle->GetParticleName();
215
216 pManager = particle->GetProcessManager();
217 if (!pManager) {
218 std::ostringstream o;
219 o << "Particle " << particleName << "without a Process Manager";
220 G4Exception("G4OpticalPhysics::ConstructProcess()","",
221 FatalException,o.str().c_str());
222 return; // else coverity complains for pManager use below
223 }
224
225 if( fCerenkovProcess->IsApplicable(*particle) &&
226 fProcessUse[kCerenkov] ) {
227 pManager->AddProcess(fCerenkovProcess);
228 pManager->SetProcessOrdering(fCerenkovProcess,idxPostStep);
229 }
230 if( fScintillationProcess->IsApplicable(*particle) &&
231 fProcessUse[kScintillation] ){
232 pManager->AddProcess(fScintillationProcess);
233 pManager->SetProcessOrderingToLast(fScintillationProcess,idxAtRest);
234 pManager->SetProcessOrderingToLast(fScintillationProcess,idxPostStep);
235 }
236
237 }
238
239 // Add verbose
240 for ( G4int i=0; i<kNoProcess; i++ ) {
241 fProcesses[i]->SetVerboseLevel(fProcessVerbose[i]);
242 }
243
244 if (verboseLevel > 1) PrintStatistics();
245 if (verboseLevel > 0)
246 G4cout << "### " << namePhysics << " physics constructed." << G4endl;
247
248 wasActivated = true;
249
250}
@ FatalException
@ kWLS
Wave Length Shifting process index.
@ kScintillation
Scintillation process index.
@ kRayleigh
Rayleigh scattering process index.
@ kAbsorption
Absorption process index.
@ kBoundary
Boundary process index.
@ kCerenkov
Cerenkov process index.
@ kMieHG
Mie scattering process index.
@ idxPostStep
@ idxAtRest
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout
void SetMaxBetaChangePerStep(const G4double d)
Definition: G4Cerenkov.hh:229
G4bool IsApplicable(const G4ParticleDefinition &aParticleType)
Definition: G4Cerenkov.hh:214
void SetMaxNumPhotonsPerStep(const G4int NumPhotons)
Definition: G4Cerenkov.hh:235
static G4LossTableManager * Instance()
G4EmSaturation * EmSaturation()
void UseTimeProfile(const G4String name)
Definition: G4OpWLS.cc:385
static G4OpticalPhoton * OpticalPhoton()
void SetTrackSecondariesFirst(G4OpticalProcessIndex, G4bool)
G4ProcessManager * GetProcessManager() const
const G4String & GetParticleName() const
void SetProcessOrdering(G4VProcess *aProcess, G4ProcessVectorDoItIndex idDoIt, G4int ordDoIt=ordDefault)
G4int AddDiscreteProcess(G4VProcess *aProcess, G4int ord=ordDefault)
G4int AddProcess(G4VProcess *aProcess, G4int ordAtRestDoIt=ordInActive, G4int ordAlongSteptDoIt=ordInActive, G4int ordPostStepDoIt=ordInActive)
void SetProcessOrderingToLast(G4VProcess *aProcess, G4ProcessVectorDoItIndex idDoIt)
void SetScintillationYieldFactor(const G4double yieldfactor)
G4bool IsApplicable(const G4ParticleDefinition &aParticleType)
void SetScintillationExcitationRatio(const G4double excitationratio)
void SetFiniteRiseTime(const G4bool state)
void SetScintillationByParticleType(const G4bool)
G4ParticleTable::G4PTblDicIterator * theParticleIterator
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41

◆ GetCerenkovProcess()

virtual G4Cerenkov * G4OpticalPhysics::GetCerenkovProcess ( )
inlinevirtual

Definition at line 97 of file G4OpticalPhysics.hh.

98 { return fCerenkovProcess; }

◆ GetOpAbsorptionProcess()

virtual G4OpAbsorption * G4OpticalPhysics::GetOpAbsorptionProcess ( )
inlinevirtual

Definition at line 101 of file G4OpticalPhysics.hh.

102 { return fOpAbsorptionProcess; }

◆ GetOpBoundaryProcess()

virtual G4OpBoundaryProcess * G4OpticalPhysics::GetOpBoundaryProcess ( )
inlinevirtual

Definition at line 107 of file G4OpticalPhysics.hh.

108 { return fOpBoundaryProcess; }

◆ GetOpMieHGProcess()

virtual G4OpMieHG * G4OpticalPhysics::GetOpMieHGProcess ( )
inlinevirtual

Definition at line 105 of file G4OpticalPhysics.hh.

106 { return fOpMieHGScatteringProcess; }

◆ GetOpRayleighProcess()

virtual G4OpRayleigh * G4OpticalPhysics::GetOpRayleighProcess ( )
inlinevirtual

Definition at line 103 of file G4OpticalPhysics.hh.

104 { return fOpRayleighScatteringProcess; }

◆ GetOpWLSProcess()

virtual G4OpWLS * G4OpticalPhysics::GetOpWLSProcess ( )
inlinevirtual

Definition at line 99 of file G4OpticalPhysics.hh.

99{ return fOpWLSProcess; }

◆ GetScintillationProcess()

virtual G4Scintillation * G4OpticalPhysics::GetScintillationProcess ( )
inlinevirtual

Definition at line 95 of file G4OpticalPhysics.hh.

96 { return fScintillationProcess; }

◆ SetFiniteRiseTime()

void G4OpticalPhysics::SetFiniteRiseTime ( G4bool  finiteRiseTime)

Definition at line 332 of file G4OpticalPhysics.cc.

333{
334 fFiniteRiseTime = finiteRiseTime;
335 if(fScintillationProcess)
336 fScintillationProcess->SetFiniteRiseTime(finiteRiseTime);
337}

Referenced by G4OpticalPhysicsMessenger::SetNewValue().

◆ SetMaxBetaChangePerStep()

void G4OpticalPhysics::SetMaxBetaChangePerStep ( G4double  maxBetaChange)

Limit step to the specified maximum change of beta of the parent particle

Definition at line 282 of file G4OpticalPhysics.cc.

283{
284/// Limit step to the specified maximum change of beta of the parent particle
285
286 fMaxBetaChange = maxBetaChange;
287
288 if(fCerenkovProcess)
289 fCerenkovProcess->SetMaxBetaChangePerStep(maxBetaChange);
290}

Referenced by G4OpticalPhysicsMessenger::SetNewValue().

◆ SetMaxNumPhotonsPerStep()

void G4OpticalPhysics::SetMaxNumPhotonsPerStep ( G4int  maxNumPhotons)

Limit step to the specified maximum number of Cherenkov photons

Definition at line 272 of file G4OpticalPhysics.cc.

273{
274/// Limit step to the specified maximum number of Cherenkov photons
275
276 fMaxNumPhotons = maxNumPhotons;
277
278 if(fCerenkovProcess)
279 fCerenkovProcess->SetMaxNumPhotonsPerStep(maxNumPhotons);
280}

Referenced by G4OpticalPhysicsMessenger::SetNewValue().

◆ SetProcessVerbose()

void G4OpticalPhysics::SetProcessVerbose ( G4int  index,
G4int  inputVerboseLevel 
)

Definition at line 352 of file G4OpticalPhysics.cc.

354{
355 // Set new verbose level to a selected process
356
357 if ( index >= kNoProcess ) return;
358 if ( fProcessVerbose[index] == inputVerboseLevel ) return;
359
360 fProcessVerbose[index] = inputVerboseLevel;
361
362 if ( fProcesses[index] ) fProcesses[index]->SetVerboseLevel(inputVerboseLevel);
363}

◆ SetScintillationByParticleType()

void G4OpticalPhysics::SetScintillationByParticleType ( G4bool  scintillationByParticleType)

Definition at line 310 of file G4OpticalPhysics.cc.

311{
312 fScintillationByParticleType = scintillationByParticleType;
313
314 if (fScintillationProcess)
315 fScintillationProcess->SetScintillationByParticleType(scintillationByParticleType);
316}

Referenced by G4OpticalPhysicsMessenger::SetNewValue().

◆ SetScintillationExcitationRatio()

void G4OpticalPhysics::SetScintillationExcitationRatio ( G4double  excitationRatio)

Set the scintillation excitation ratio

Definition at line 262 of file G4OpticalPhysics.cc.

263{
264/// Set the scintillation excitation ratio
265
266 fExcitationRatio = excitationRatio;
267
268 if(fScintillationProcess)
269 fScintillationProcess->SetScintillationExcitationRatio(excitationRatio);
270}

◆ SetScintillationYieldFactor()

void G4OpticalPhysics::SetScintillationYieldFactor ( G4double  yieldFactor)

Set the scintillation yield factor

Definition at line 252 of file G4OpticalPhysics.cc.

253{
254/// Set the scintillation yield factor
255
256 fYieldFactor = yieldFactor;
257
258 if(fScintillationProcess)
259 fScintillationProcess->SetScintillationYieldFactor(yieldFactor);
260}

Referenced by G4OpticalPhysicsMessenger::SetNewValue().

◆ SetTrackSecondariesFirst()

void G4OpticalPhysics::SetTrackSecondariesFirst ( G4OpticalProcessIndex  index,
G4bool  trackSecondariesFirst 
)

Definition at line 318 of file G4OpticalPhysics.cc.

320{
321 if ( index >= kNoProcess ) return;
322 if ( fProcessTrackSecondariesFirst[index] == trackSecondariesFirst ) return;
323 fProcessTrackSecondariesFirst[index] = trackSecondariesFirst;
324
325 if(fCerenkovProcess && index == kCerenkov )
326 fCerenkovProcess->SetTrackSecondariesFirst(trackSecondariesFirst);
327
328 if(fScintillationProcess && index == kScintillation)
329 fScintillationProcess->SetTrackSecondariesFirst(trackSecondariesFirst);
330}
void SetTrackSecondariesFirst(const G4bool state)
Definition: G4Cerenkov.hh:223
void SetTrackSecondariesFirst(const G4bool state)

Referenced by ConstructProcess(), and G4OpticalPhysicsMessenger::SetNewValue().

◆ SetWLSTimeProfile()

void G4OpticalPhysics::SetWLSTimeProfile ( G4String  profile)

Set the WLS time profile (delta or exponential)

Definition at line 292 of file G4OpticalPhysics.cc.

293{
294/// Set the WLS time profile (delta or exponential)
295
296 fProfile = profile;
297
298 if(fOpWLSProcess)
299 fOpWLSProcess->UseTimeProfile(fProfile);
300}

Referenced by G4OpticalPhysicsMessenger::SetNewValue().


The documentation for this class was generated from the following files: