Geant4 10.7.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 ()
 
virtual void PrintStatistics () const
 
void Configure (G4OpticalProcessIndex, G4bool)
 
void SetTrackSecondariesFirst (G4OpticalProcessIndex, G4bool)
 
void SetMaxNumPhotonsPerStep (G4int)
 
void SetMaxBetaChangePerStep (G4double)
 
void SetCerenkovStackPhotons (G4bool)
 
void SetCerenkovTrackSecondariesFirst (G4bool)
 
void SetCerenkovVerbosity (G4int)
 
void SetScintillationYieldFactor (G4double)
 
void SetScintillationExcitationRatio (G4double)
 
void SetScintillationByParticleType (G4bool)
 
void SetScintillationTrackInfo (G4bool)
 
void SetScintillationTrackSecondariesFirst (G4bool)
 
void SetFiniteRiseTime (G4bool)
 
void SetScintillationStackPhotons (G4bool)
 
void SetScintillationVerbosity (G4int)
 
void SetScintillationEnhancedTimeConstants (G4bool)
 
void SetWLSTimeProfile (G4String)
 
void SetWLSVerbosity (G4int)
 
void SetWLS2TimeProfile (G4String)
 
void SetWLS2Verbosity (G4int)
 
void SetBoundaryVerbosity (G4int)
 
void SetInvokeSD (G4bool)
 
void SetAbsorptionVerbosity (G4int)
 
void SetRayleighVerbosity (G4int)
 
void SetMieVerbosity (G4int)
 
- 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
 
G4int GetInstanceID () const
 
virtual void TerminateWorker ()
 

Protected Member Functions

virtual void ConstructParticle ()
 
virtual void ConstructProcess ()
 
- Protected Member Functions inherited from G4VPhysicsConstructor
G4bool RegisterProcess (G4VProcess *process, G4ParticleDefinition *particle)
 
G4ParticleTable::G4PTblDicIteratorGetParticleIterator () const
 
PhysicsBuilder_V GetBuilders () const
 
void AddBuilder (G4PhysicsBuilderInterface *bld)
 

Additional Inherited Members

- Static Public Member Functions inherited from G4VPhysicsConstructor
static const G4VPCManagerGetSubInstanceManager ()
 
- Protected Types inherited from G4VPhysicsConstructor
using PhysicsBuilder_V = G4VPCData::PhysicsBuilders_V
 
- Protected Attributes inherited from G4VPhysicsConstructor
G4int verboseLevel
 
G4String namePhysics
 
G4int typePhysics
 
G4ParticleTabletheParticleTable
 
G4int g4vpcInstanceID
 
- Static Protected Attributes inherited from G4VPhysicsConstructor
static G4RUN_DLL G4VPCManager subInstanceManager
 

Detailed Description

Definition at line 50 of file G4OpticalPhysics.hh.

Constructor & Destructor Documentation

◆ G4OpticalPhysics()

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

◆ ~G4OpticalPhysics()

G4OpticalPhysics::~G4OpticalPhysics ( )
virtual

Definition at line 70 of file G4OpticalPhysics.cc.

71{}

Member Function Documentation

◆ Configure()

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

Definition at line 170 of file G4OpticalPhysics.cc.

170 {
172 if (index == kCerenkov) params->SetProcessActivation("Cerenkov", val);
173 else if (index == kScintillation) params->SetProcessActivation("Scintillation", val);
174 else if (index == kAbsorption) params->SetProcessActivation("Absorption", val);
175 else if (index == kRayleigh) params->SetProcessActivation("Rayleigh", val);
176 else if (index == kMieHG) params->SetProcessActivation("MieHG", val);
177 else if (index == kBoundary) params->SetProcessActivation("Boundary", val);
178 else if (index == kWLS) params->SetProcessActivation("WLS", val);
179 else if (index == kWLS2) params->SetProcessActivation("WLS2", val);
180}
@ kWLS
Wave Length Shifting process index.
@ kScintillation
Scintillation process index.
@ kWLS2
Second Wave Length Shifting process index.
@ kRayleigh
Rayleigh scattering process index.
@ kAbsorption
Absorption process index.
@ kBoundary
Boundary process index.
@ kCerenkov
Cerenkov process index.
@ kMieHG
Mie scattering process index.
void SetProcessActivation(const G4String &, G4bool)

◆ ConstructParticle()

void G4OpticalPhysics::ConstructParticle ( )
protectedvirtual

Implements G4VPhysicsConstructor.

Definition at line 80 of file G4OpticalPhysics.cc.

81{
83}
static G4OpticalPhoton * OpticalPhotonDefinition()

◆ ConstructProcess()

void G4OpticalPhysics::ConstructProcess ( )
protectedvirtual

Implements G4VPhysicsConstructor.

Definition at line 86 of file G4OpticalPhysics.cc.

87{
88 if(verboseLevel>0)
89 G4cout <<"G4OpticalPhysics:: Add Optical Physics Processes"<< G4endl;
90
91 auto params = G4OpticalParameters::Instance();
92
93 // Add Optical Processes
94
96 if (!pManager) {
98 ed << "Optical Photon without a Process Manager";
99 G4Exception("G4OpticalPhysics::ConstructProcess()","",
100 FatalException,ed);
101 return;
102 }
103
104 G4OpAbsorption* absorption = new G4OpAbsorption();
105 if (params->GetProcessActivation("OpAbsorption")) pManager->AddDiscreteProcess(absorption);
106
107 G4OpRayleigh* rayleigh = new G4OpRayleigh();
108 if (params->GetProcessActivation("OpRayleigh")) pManager->AddDiscreteProcess(rayleigh);
109
110 G4OpMieHG* mie = new G4OpMieHG();
111 if (params->GetProcessActivation("OpMieHG")) pManager->AddDiscreteProcess(mie);
112
114 if (params->GetProcessActivation("OpBoundary")) pManager->AddDiscreteProcess(boundary);
115
116 G4OpWLS* wls = new G4OpWLS();
117 if (params->GetProcessActivation("OpWLS")) pManager->AddDiscreteProcess(wls);
118
119 G4OpWLS2* wls2 = new G4OpWLS2();
120 if (params->GetProcessActivation("OpWLS2")) pManager->AddDiscreteProcess(wls2);
121
122 G4Scintillation* scint = new G4Scintillation();
124 scint->AddSaturation(emSaturation);
125
126 G4Cerenkov* cerenkov = new G4Cerenkov();
127
128 auto myParticleIterator=GetParticleIterator();
129 myParticleIterator->reset();
130
131 while( (*myParticleIterator)() ){
132
133 G4ParticleDefinition* particle = myParticleIterator->value();
134 G4String particleName = particle->GetParticleName();
135
136 pManager = particle->GetProcessManager();
137 if (!pManager) {
139 ed << "Particle " << particleName << "without a Process Manager";
140 G4Exception("G4OpticalPhysics::ConstructProcess()","",
141 FatalException, ed);
142 return; // else coverity complains for pManager use below
143 }
144
145 if (cerenkov->IsApplicable(*particle) && params->GetProcessActivation("Cerenkov")) {
146 pManager->AddProcess(cerenkov);
147 pManager->SetProcessOrdering(cerenkov,idxPostStep);
148 }
149 if (scint->IsApplicable(*particle) && params->GetProcessActivation("Scintillation")) {
150 pManager->AddProcess(scint);
151 pManager->SetProcessOrderingToLast(scint,idxAtRest);
152 pManager->SetProcessOrderingToLast(scint,idxPostStep);
153 }
154 if (boundary->IsApplicable(*particle) && params->GetProcessActivation("OpBoundary")) {
155 pManager->SetProcessOrderingToLast(boundary,idxPostStep);
156 }
157 }
158
159
160 if (verboseLevel > 1) PrintStatistics();
161 if (verboseLevel > 0)
162 G4cout << "### " << namePhysics << " physics constructed." << G4endl;
163}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
@ idxPostStep
@ idxAtRest
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
G4bool IsApplicable(const G4ParticleDefinition &aParticleType) override
Definition: G4Cerenkov.cc:102
static G4LossTableManager * Instance()
G4EmSaturation * EmSaturation()
virtual G4bool IsApplicable(const G4ParticleDefinition &aParticleType) override
static G4OpticalPhoton * OpticalPhoton()
virtual void PrintStatistics() const
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 AddSaturation(G4EmSaturation *sat)
G4bool IsApplicable(const G4ParticleDefinition &aParticleType) override
G4ParticleTable::G4PTblDicIterator * GetParticleIterator() const

◆ PrintStatistics()

void G4OpticalPhysics::PrintStatistics ( ) const
virtual

Definition at line 74 of file G4OpticalPhysics.cc.

Referenced by ConstructProcess().

◆ SetAbsorptionVerbosity()

void G4OpticalPhysics::SetAbsorptionVerbosity ( G4int  val)

Definition at line 344 of file G4OpticalPhysics.cc.

344 {
347 ed << "Method G4OpticalPhysics::SetAbsorptionVerbosity is deprecated." << G4endl
348 << "Use G4OpticalParameters::SetAbsorptionVerboseLevel(G4int) instead.";
349 PrintWarning(ed);
350}
void SetAbsorptionVerboseLevel(G4int)

◆ SetBoundaryVerbosity()

void G4OpticalPhysics::SetBoundaryVerbosity ( G4int  val)

Definition at line 328 of file G4OpticalPhysics.cc.

328 {
331 ed << "Method G4OpticalPhysics::SetBoundaryVerbosity is deprecated." << G4endl
332 << "Use G4OpticalParameters::SetBoundaryVerboseLevel(G4int) instead.";
333 PrintWarning(ed);
334}
void SetBoundaryVerboseLevel(G4int)

◆ SetCerenkovStackPhotons()

void G4OpticalPhysics::SetCerenkovStackPhotons ( G4bool  val)

Definition at line 210 of file G4OpticalPhysics.cc.

210 {
213 ed << "Method G4OpticalPhysics::SetCerenkovStackPhotons is deprecated." << G4endl
214 << "Use G4OpticalParameters::SetCerenkovStackPhotons(G4int) "
215 << "instead.";
216 PrintWarning(ed);
217}
void SetCerenkovStackPhotons(G4bool)

◆ SetCerenkovTrackSecondariesFirst()

void G4OpticalPhysics::SetCerenkovTrackSecondariesFirst ( G4bool  val)

Definition at line 219 of file G4OpticalPhysics.cc.

219 {
222 ed << "Method G4OpticalPhysics::SetCerenkovTrackSecondariesFirst is deprecated." << G4endl
223 << "Use G4OpticalParameters::SetCerenkovTrackSecondariesFirst(G4int) instead.";
224 PrintWarning(ed);
225}
void SetCerenkovTrackSecondariesFirst(G4bool)

◆ SetCerenkovVerbosity()

void G4OpticalPhysics::SetCerenkovVerbosity ( G4int  val)

Definition at line 227 of file G4OpticalPhysics.cc.

227 {
230 ed << "Method G4OpticalPhysics::SetCerenkovVerbosity is deprecated." << G4endl
231 << "Use G4OpticalParameters::SetCerenkovVerbosity(G4int) instead.";
232 PrintWarning(ed);
233}
void SetCerenkovVerboseLevel(G4int)

◆ SetFiniteRiseTime()

void G4OpticalPhysics::SetFiniteRiseTime ( G4bool  val)

Definition at line 276 of file G4OpticalPhysics.cc.

276 {
279 ed << "Method G4OpticalPhysics::SetFiniteRiseTime is deprecated." << G4endl
280 << "Use G4OpticalParameters::SetScintFiniteRiseTime(G4bool) instead.";
281 PrintWarning(ed);
282}
void SetScintFiniteRiseTime(G4bool)

◆ SetInvokeSD()

void G4OpticalPhysics::SetInvokeSD ( G4bool  val)

Definition at line 336 of file G4OpticalPhysics.cc.

336 {
339 ed << "Method G4OpticalPhysics::SetInvokeSD is deprecated." << G4endl
340 << "Use G4OpticalParameters::SetBoundaryInvokeSD(G4bool) instead.";
341 PrintWarning(ed);
342}
void SetBoundaryInvokeSD(G4bool)

◆ SetMaxBetaChangePerStep()

void G4OpticalPhysics::SetMaxBetaChangePerStep ( G4double  val)

Definition at line 202 of file G4OpticalPhysics.cc.

202 {
205 ed << "Method G4OpticalPhysics::SetMaxBetaChangePerStep is deprecated." << G4endl
206 << "Use G4OpticalParameters::SetCerenkovMaxBetaChange(G4double) instead.";
207 PrintWarning(ed);
208}
void SetCerenkovMaxBetaChange(G4double)

◆ SetMaxNumPhotonsPerStep()

void G4OpticalPhysics::SetMaxNumPhotonsPerStep ( G4int  val)

Definition at line 194 of file G4OpticalPhysics.cc.

194 {
197 ed << "Method G4OpticalPhysics::SetMaxNumPhotonsPerStep is deprecated." << G4endl
198 << "Use G4OpticalParameters::SetCerenkovMaxPhotonsPerStep(G4int) instead.";
199 PrintWarning(ed);
200}
void SetCerenkovMaxPhotonsPerStep(G4int)

◆ SetMieVerbosity()

void G4OpticalPhysics::SetMieVerbosity ( G4int  val)

Definition at line 360 of file G4OpticalPhysics.cc.

360 {
363 ed << "Method G4OpticalPhysics::SetMieVerbosity is deprecated." << G4endl
364 << "Use G4OpticalParameters::SetMieVerboseLevel(G4int) instead.";
365 PrintWarning(ed);
366}

◆ SetRayleighVerbosity()

void G4OpticalPhysics::SetRayleighVerbosity ( G4int  val)

Definition at line 352 of file G4OpticalPhysics.cc.

352 {
355 ed << "Method G4OpticalPhysics::SetRayleighVerbosity is deprecated." << G4endl
356 << "Use G4OpticalParameters::SetRayleighVerboseLevel(G4int) instead.";
357 PrintWarning(ed);
358}
void SetRayleighVerboseLevel(G4int)

◆ SetScintillationByParticleType()

void G4OpticalPhysics::SetScintillationByParticleType ( G4bool  val)

Definition at line 252 of file G4OpticalPhysics.cc.

252 {
255 ed << "Method G4OpticalPhysics::SetScintillationByParticleType is deprecated." << G4endl
256 << "Use G4OpticalParameters::SetScintByParticleType(G4bool) instead.";
257 PrintWarning(ed);
258}
void SetScintByParticleType(G4bool)

◆ SetScintillationEnhancedTimeConstants()

void G4OpticalPhysics::SetScintillationEnhancedTimeConstants ( G4bool  val)

Definition at line 300 of file G4OpticalPhysics.cc.

300 {
303 ed << "Method G4OpticalPhysics::SetScintillationEnhanceTimeConstants is deprecated." << G4endl
304 << "Use G4OpticalParameters::SetScintEnhancedTimeConstants(G4bool) instead.";
305 PrintWarning(ed);
306}
void SetScintEnhancedTimeConstants(G4bool)

◆ SetScintillationExcitationRatio()

void G4OpticalPhysics::SetScintillationExcitationRatio ( G4double  val)

Definition at line 244 of file G4OpticalPhysics.cc.

244 {
247 ed << "Method G4OpticalPhysics::SetScintillationExcitationRatio is deprecated." << G4endl
248 << "Use G4OpticalParameters::SetScintExcitationRatio(G4double) instead.";
249 PrintWarning(ed);
250}
void SetScintExcitationRatio(G4double)

◆ SetScintillationStackPhotons()

void G4OpticalPhysics::SetScintillationStackPhotons ( G4bool  val)

Definition at line 284 of file G4OpticalPhysics.cc.

284 {
287 ed << "Method G4OpticalPhysics::SetScintillationStackPhotons is deprecated." << G4endl
288 << "Use G4OpticalParameters::SetScintStackPhotons(G4bool) instead.";
289 PrintWarning(ed);
290}
void SetScintStackPhotons(G4bool)

◆ SetScintillationTrackInfo()

void G4OpticalPhysics::SetScintillationTrackInfo ( G4bool  val)

Definition at line 260 of file G4OpticalPhysics.cc.

260 {
263 ed << "Method G4OpticalPhysics::SetScintillationTrackInfo is deprecated." << G4endl
264 << "Use G4OpticalParameters::SetScintTrackInfo(G4bool) instead.";
265 PrintWarning(ed);
266}

◆ SetScintillationTrackSecondariesFirst()

void G4OpticalPhysics::SetScintillationTrackSecondariesFirst ( G4bool  val)

Definition at line 268 of file G4OpticalPhysics.cc.

268 {
271 ed << "Method G4OpticalPhysics::SetScintillationTrackSecondariesFirst is deprecated." << G4endl
272 << "Use G4OpticalParameters::SetScintTrackSecondariesFirst(G4bool) instead.";
273 PrintWarning(ed);
274}
void SetScintTrackSecondariesFirst(G4bool)

◆ SetScintillationVerbosity()

void G4OpticalPhysics::SetScintillationVerbosity ( G4int  val)

Definition at line 292 of file G4OpticalPhysics.cc.

292 {
295 ed << "Method G4OpticalPhysics::SetScintillationVerbosity is deprecated." << G4endl
296 << "Use G4OpticalParameters::SetScintVerboseLevel(G4int) instead.";
297 PrintWarning(ed);
298}

◆ SetScintillationYieldFactor()

void G4OpticalPhysics::SetScintillationYieldFactor ( G4double  val)

Definition at line 236 of file G4OpticalPhysics.cc.

236 {
239 ed << "Method G4OpticalPhysics::SetScintillationYieldFactor is deprecated." << G4endl
240 << "Use G4OpticalParameters::SetScintYieldFactor(G4double) instead.";
241 PrintWarning(ed);
242}
void SetScintYieldFactor(G4double)

◆ SetTrackSecondariesFirst()

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

Definition at line 182 of file G4OpticalPhysics.cc.

182 {
183 if (index == kCerenkov)
185 else if (index == kScintillation)
188 ed << "Method G4OpticalPhysics::SetTrackSecondariesFirst is deprecated." << G4endl
189 << "Use G4OpticalParameters::Set[Cerenkov/Scint]TrackSecondariesFirst(G4bool) instead.";
190 PrintWarning(ed);
191}

◆ SetWLS2TimeProfile()

void G4OpticalPhysics::SetWLS2TimeProfile ( G4String  )

◆ SetWLS2Verbosity()

void G4OpticalPhysics::SetWLS2Verbosity ( G4int  )

◆ SetWLSTimeProfile()

void G4OpticalPhysics::SetWLSTimeProfile ( G4String  val)

Definition at line 311 of file G4OpticalPhysics.cc.

311 {
314 ed << "Method G4OpticalPhysics::SetWLSTimeProfile is deprecated." << G4endl
315 << "Use G4OpticalParameters::SetWLSTimeProfile(G4String) instead.";
316 PrintWarning(ed);
317}
void SetWLSTimeProfile(const G4String &)

◆ SetWLSVerbosity()

void G4OpticalPhysics::SetWLSVerbosity ( G4int  val)

Definition at line 319 of file G4OpticalPhysics.cc.

319 {
322 ed << "Method G4OpticalPhysics::SetWLSVerbosity is deprecated." << G4endl
323 << "Use G4OpticalParameters::SetWLSVerboseLevel(G4int) instead.";
324 PrintWarning(ed);
325}

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