Geant4 11.4.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")
 ~G4OpticalPhysics () override=default
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 ()
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" )

Definition at line 62 of file G4OpticalPhysics.cc.

Referenced by G4OpticalPhysics(), and operator=().

◆ ~G4OpticalPhysics()

G4OpticalPhysics::~G4OpticalPhysics ( )
overridedefault

◆ G4OpticalPhysics() [2/2]

G4OpticalPhysics::G4OpticalPhysics ( const G4OpticalPhysics & right)
delete

Member Function Documentation

◆ ConstructParticle()

void G4OpticalPhysics::ConstructParticle ( )
overrideprotectedvirtual

Implements G4VPhysicsConstructor.

Definition at line 76 of file G4OpticalPhysics.cc.

77{
79 // Add G4QuasiOpticalPhoton to support offloading optical photon generation
81}
static G4OpticalPhoton * OpticalPhotonDefinition()
static G4QuasiOpticalPhoton * QuasiOpticalPhotonDefinition()

◆ ConstructProcess()

void G4OpticalPhysics::ConstructProcess ( )
overrideprotectedvirtual

Implements G4VPhysicsConstructor.

Definition at line 84 of file G4OpticalPhysics.cc.

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

◆ operator=()

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

◆ PrintStatistics()

void G4OpticalPhysics::PrintStatistics ( ) const

Definition at line 70 of file G4OpticalPhysics.cc.

Referenced by ConstructProcess().


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