Geant4 11.1.1
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")
 
 ~G4OpticalPhysics () override
 
void PrintStatistics () const
 
 G4OpticalPhysics (const G4OpticalPhysics &right)=delete
 
G4OpticalPhysicsoperator= (const G4OpticalPhysics &right)=delete
 
- 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
 
G4int GetInstanceID () const
 
virtual void TerminateWorker ()
 
void SetVerboseLevel (G4int value)
 
G4int GetVerboseLevel () const
 

Protected Member Functions

void ConstructParticle () override
 
void ConstructProcess () override
 
- 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 = 0
 
G4String namePhysics = ""
 
G4int typePhysics = 0
 
G4ParticleTabletheParticleTable = nullptr
 
G4int g4vpcInstanceID = 0
 
- 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() [1/2]

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

◆ ~G4OpticalPhysics()

G4OpticalPhysics::~G4OpticalPhysics ( )
override

Definition at line 68 of file G4OpticalPhysics.cc.

68{}

◆ G4OpticalPhysics() [2/2]

G4OpticalPhysics::G4OpticalPhysics ( const G4OpticalPhysics right)
delete

Member Function Documentation

◆ ConstructParticle()

void G4OpticalPhysics::ConstructParticle ( )
overrideprotectedvirtual

Implements G4VPhysicsConstructor.

Definition at line 77 of file G4OpticalPhysics.cc.

78{
80}
static G4OpticalPhoton * OpticalPhotonDefinition()

◆ ConstructProcess()

void G4OpticalPhysics::ConstructProcess ( )
overrideprotectedvirtual

Implements G4VPhysicsConstructor.

Definition at line 83 of file G4OpticalPhysics.cc.

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

◆ operator=()

G4OpticalPhysics & G4OpticalPhysics::operator= ( const G4OpticalPhysics right)
delete

◆ PrintStatistics()

void G4OpticalPhysics::PrintStatistics ( ) const

Definition at line 71 of file G4OpticalPhysics.cc.

Referenced by ConstructProcess().


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