Geant4  10.02.p03
G4OpticalPhysics Class Reference

#include <G4OpticalPhysics.hh>

Inheritance diagram for G4OpticalPhysics:
Collaboration diagram for G4OpticalPhysics:

Public Member Functions

 G4OpticalPhysics (G4int verbose=0, const G4String &name="Optical")
 
virtual ~G4OpticalPhysics ()
 
void Configure (G4OpticalProcessIndex, G4bool)
 
void SetMaxNumPhotonsPerStep (G4int)
 
void SetMaxBetaChangePerStep (G4double)
 
void SetScintillationYieldFactor (G4double)
 
void SetScintillationExcitationRatio (G4double)
 
void SetWLSTimeProfile (G4String)
 
void SetScintillationByParticleType (G4bool)
 
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 ()
 
void SetPhysicsName (const G4String &="")
 
const G4StringGetPhysicsName () const
 
void SetPhysicsType (G4int)
 
G4int GetPhysicsType () const
 
void SetVerboseLevel (G4int value)
 
G4int GetVerboseLevel () const
 
G4int GetInstanceID () const
 

Protected Member Functions

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

Private Member Functions

 G4OpticalPhysics (const G4OpticalPhysics &right)
 Not implemented. More...
 
G4OpticalPhysicsoperator= (const G4OpticalPhysics &right)
 Not implemented. More...
 
void PrintStatistics () const
 

Private Attributes

G4OpticalPhysicsMessengerfMessenger
 
std::vector< G4boolfProcessUse
 
std::vector< G4boolfProcessTrackSecondariesFirst
 
G4int fMaxNumPhotons
 max number of Cerenkov photons per step More...
 
G4double fMaxBetaChange
 max change of beta per step More...
 
G4double fYieldFactor
 scintillation yield factor More...
 
G4double fExcitationRatio
 scintillation excitation ratio More...
 
G4String fProfile
 the WLS process time profile More...
 
G4bool fFiniteRiseTime
 
G4bool fScintillationByParticleType
 

Additional Inherited Members

- Static Public Member Functions inherited from G4VPhysicsConstructor
static const G4VPCManagerGetSubInstanceManager ()
 
- 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 61 of file G4OpticalPhysics.hh.

Constructor & Destructor Documentation

◆ G4OpticalPhysics() [1/2]

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

Definition at line 64 of file G4OpticalPhysics.cc.

65  : G4VPhysicsConstructor(name),
66 
67  fMaxNumPhotons(100),
68  fMaxBetaChange(10.0),
69  fYieldFactor(1.),
70  fExcitationRatio(0.0),
71  fProfile("delta"),
72  fFiniteRiseTime(false),
74 {
75  verboseLevel = verbose;
77 
78  for ( G4int i=0; i<kNoProcess; i++ ) {
79  fProcessUse.push_back(true);
80  fProcessTrackSecondariesFirst.push_back(true);
81  }
82 }
Number of processes, no selected process.
G4OpticalPhysicsMessenger * fMessenger
int G4int
Definition: G4Types.hh:78
std::vector< G4bool > fProcessTrackSecondariesFirst
G4double fMaxBetaChange
max change of beta per step
std::vector< G4bool > fProcessUse
G4double fYieldFactor
scintillation yield factor
G4int fMaxNumPhotons
max number of Cerenkov photons per step
G4double fExcitationRatio
scintillation excitation ratio
G4VPhysicsConstructor(const G4String &="")
G4String fProfile
the WLS process time profile
G4bool fScintillationByParticleType

◆ ~G4OpticalPhysics()

G4OpticalPhysics::~G4OpticalPhysics ( )
virtual

Definition at line 86 of file G4OpticalPhysics.cc.

87 {
88  delete fMessenger;
89 }
G4OpticalPhysicsMessenger * fMessenger

◆ G4OpticalPhysics() [2/2]

G4OpticalPhysics::G4OpticalPhysics ( const G4OpticalPhysics right)
private

Not implemented.

Member Function Documentation

◆ Configure()

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

Definition at line 438 of file G4OpticalPhysics.cc.

439 {
440  // Configure the physics constructor to use/not use a selected process.
441  // This method can only be called in PreInit> phase (before execution of
442  // ConstructProcess). The process is not added to particle's process manager
443  // and so it cannot be re-activated later in Idle> phase with the command
444  // /process/activate.
445 
446  if ( index >= kNoProcess ) return;
447  if ( fProcessUse[index] == isUse ) return;
448  fProcessUse[index] = isUse;
449 }
Number of processes, no selected process.
Int_t index
std::vector< G4bool > fProcessUse
Here is the caller graph for this function:

◆ ConstructParticle()

void G4OpticalPhysics::ConstructParticle ( void  )
protectedvirtual

Instantiate particles.

Implements G4VPhysicsConstructor.

Definition at line 137 of file G4OpticalPhysics.cc.

138 {
140 
141  // optical photon
143 }
static G4OpticalPhoton * OpticalPhotonDefinition()
Here is the call graph for this function:

◆ ConstructProcess()

void G4OpticalPhysics::ConstructProcess ( void  )
protectedvirtual

Implements G4VPhysicsConstructor.

Definition at line 257 of file G4OpticalPhysics.cc.

258 {
259 // Construct optical processes.
260 
261  if(verboseLevel>0)
262  G4cout <<"G4OpticalPhysics:: Add Optical Physics Processes"<< G4endl;
263 
264  // A vector of optical processes
265  std::vector<G4VProcess*> OpProcesses;
266 
267  for ( G4int i=0; i<kNoProcess; i++ ) OpProcesses.push_back(NULL);
268 
269  // Add Optical Processes
270 
271  G4OpAbsorption* OpAbsorptionProcess = new G4OpAbsorption();
272  UIhelpers::buildCommands(OpAbsorptionProcess,DIR_CMDS"/absorption/",GUIDANCE" for absorption process");
273  OpProcesses[kAbsorption] = OpAbsorptionProcess;
274 
275  G4OpRayleigh* OpRayleighScatteringProcess = new G4OpRayleigh();
276  UIhelpers::buildCommands(OpRayleighScatteringProcess,DIR_CMDS"/rayleigh/",GUIDANCE" for Reyleigh scattering process");
277  OpProcesses[kRayleigh] = OpRayleighScatteringProcess;
278 
279  G4OpMieHG* OpMieHGScatteringProcess = new G4OpMieHG();
280  UIhelpers::buildCommands(OpMieHGScatteringProcess,DIR_CMDS"/mie/",GUIDANCE" for Mie cattering process");
281  OpProcesses[kMieHG] = OpMieHGScatteringProcess;
282 
283  G4OpBoundaryProcess* OpBoundaryProcess = new G4OpBoundaryProcess();
284  UIhelpers::buildCommands(OpBoundaryProcess,DIR_CMDS"/boundary/",GUIDANCE" for boundary process");
285  OpProcesses[kBoundary] = OpBoundaryProcess;
286 
287  G4OpWLS* OpWLSProcess = new G4OpWLS();
288  OpWLSProcess->UseTimeProfile(fProfile);
289  UIhelpers::buildCommands(OpWLSProcess);
290  OpProcesses[kWLS] = OpWLSProcess;
291 
292  G4ProcessManager * pManager = 0;
294 
295  if (!pManager) {
296  std::ostringstream o;
297  o << "Optical Photon without a Process Manager";
298  G4Exception("G4OpticalPhysics::ConstructProcess()","",
299  FatalException,o.str().c_str());
300  return;
301  }
302 
303  for ( G4int i=kAbsorption; i<=kWLS; i++ ) {
304  if ( fProcessUse[i] ) {
305  pManager->AddDiscreteProcess(OpProcesses[i]);
306  }
307  }
308 
309  G4Scintillation* ScintillationProcess = new G4Scintillation();
310  ScintillationProcess->SetScintillationYieldFactor(fYieldFactor);
311  ScintillationProcess->SetScintillationExcitationRatio(fExcitationRatio);
312  ScintillationProcess->SetFiniteRiseTime(fFiniteRiseTime);
316  ScintillationProcess->AddSaturation(emSaturation);
317  UIhelpers::buildCommands(ScintillationProcess);
318  OpProcesses[kScintillation] = ScintillationProcess;
319 
320  G4Cerenkov* CerenkovProcess = new G4Cerenkov();
321  CerenkovProcess->SetMaxNumPhotonsPerStep(fMaxNumPhotons);
322  CerenkovProcess->SetMaxBetaChangePerStep(fMaxBetaChange);
324  UIhelpers::buildCommands(CerenkovProcess);
325  OpProcesses[kCerenkov] = CerenkovProcess;
326 
327  auto myParticleIterator=GetParticleIterator();
328  myParticleIterator->reset();
329 
330  while( (*myParticleIterator)() ){
331 
332  G4ParticleDefinition* particle = myParticleIterator->value();
333  G4String particleName = particle->GetParticleName();
334 
335  pManager = particle->GetProcessManager();
336  if (!pManager) {
337  std::ostringstream o;
338  o << "Particle " << particleName << "without a Process Manager";
339  G4Exception("G4OpticalPhysics::ConstructProcess()","",
340  FatalException,o.str().c_str());
341  return; // else coverity complains for pManager use below
342  }
343 
344  if( CerenkovProcess->IsApplicable(*particle) &&
346  pManager->AddProcess(CerenkovProcess);
347  pManager->SetProcessOrdering(CerenkovProcess,idxPostStep);
348  }
349  if( ScintillationProcess->IsApplicable(*particle) &&
351  pManager->AddProcess(ScintillationProcess);
352  pManager->SetProcessOrderingToLast(ScintillationProcess,idxAtRest);
353  pManager->SetProcessOrderingToLast(ScintillationProcess,idxPostStep);
354  }
355 
356  }
357 
358  // Add verbose
359  for ( G4int i=0; i<kNoProcess; i++ ) {
360  if ( fProcessUse[i] ) OpProcesses[i]->SetVerboseLevel(verboseLevel);
361  }
362 
363  if (verboseLevel > 1) PrintStatistics();
364  if (verboseLevel > 0)
365  G4cout << "### " << namePhysics << " physics constructed." << G4endl;
366 }
void SetScintillationByParticleType(const G4bool)
void SetMaxBetaChangePerStep(const G4double d)
Definition: G4Cerenkov.cc:151
static G4LossTableManager * Instance()
void SetFiniteRiseTime(const G4bool state)
Number of processes, no selected process.
void SetTrackSecondariesFirst(const G4bool state)
Definition: G4Cerenkov.cc:146
G4int AddDiscreteProcess(G4VProcess *aProcess, G4int ord=ordDefault)
Scintillation process index.
G4bool IsApplicable(const G4ParticleDefinition &aParticleType)
G4ProcessManager * GetProcessManager() const
Mie scattering process index.
Absorption process index.
int G4int
Definition: G4Types.hh:78
#define DIR_CMDS
std::vector< G4bool > fProcessTrackSecondariesFirst
G4double fMaxBetaChange
max change of beta per step
void UseTimeProfile(const G4String name)
Definition: G4OpWLS.cc:417
void SetScintillationYieldFactor(const G4double yieldfactor)
std::vector< G4bool > fProcessUse
const G4String & GetParticleName() const
G4double fYieldFactor
scintillation yield factor
G4GLOB_DLL std::ostream G4cout
void AddSaturation(G4EmSaturation *)
G4int AddProcess(G4VProcess *aProcess, G4int ordAtRestDoIt=ordInActive, G4int ordAlongSteptDoIt=ordInActive, G4int ordPostStepDoIt=ordInActive)
G4EmSaturation * EmSaturation()
G4int fMaxNumPhotons
max number of Cerenkov photons per step
void SetMaxNumPhotonsPerStep(const G4int NumPhotons)
Definition: G4Cerenkov.cc:156
G4double fExcitationRatio
scintillation excitation ratio
void SetProcessOrdering(G4VProcess *aProcess, G4ProcessVectorDoItIndex idDoIt, G4int ordDoIt=ordDefault)
Wave Length Shifting process index.
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
void SetScintillationExcitationRatio(const G4double ratio)
static G4OpticalPhoton * OpticalPhoton()
Boundary process index.
void SetTrackSecondariesFirst(const G4bool state)
void SetProcessOrderingToLast(G4VProcess *aProcess, G4ProcessVectorDoItIndex idDoIt)
void buildCommands(T *proc, const char *dir, const char *guidance)
Cerenkov process index.
#define G4endl
Definition: G4ios.hh:61
Rayleigh scattering process index.
G4ParticleTable::G4PTblDicIterator * GetParticleIterator() const
#define GUIDANCE
void PrintStatistics() const
G4String fProfile
the WLS process time profile
G4bool fScintillationByParticleType
G4bool IsApplicable(const G4ParticleDefinition &aParticleType)
Definition: G4Cerenkov.cc:135
Here is the call graph for this function:

◆ operator=()

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

Not implemented.

◆ PrintStatistics()

void G4OpticalPhysics::PrintStatistics ( ) const
private

Definition at line 93 of file G4OpticalPhysics.cc.

94 {
95 // Print all processes activation and their parameters
96 
97  for ( G4int i=0; i<kNoProcess; i++ ) {
98  G4cout << " " << G4OpticalProcessName(i) << " process: ";
99  if ( ! fProcessUse[i] ) {
100  G4cout << "not used" << G4endl;
101  }
102  else {
103  G4cout << "used" << G4endl;
104  if ( i == kCerenkov ) {
105  G4cout << " Max number of photons per step: " << fMaxNumPhotons << G4endl;
106  G4cout << " Max beta change per step: " << fMaxBetaChange << G4endl;
108  G4cout << " Track secondaries first: activated" << G4endl;
109  }
110  else {
111  G4cout << " Track secondaries first: inactivated" << G4endl;
112  }
113  }
114  if ( i == kScintillation ) {
116  G4cout << " Scintillation by Particle Type: activated " << G4endl;
117  G4cout << " Yield factor: " << fYieldFactor << G4endl;
118  G4cout << " ExcitationRatio: " << fExcitationRatio << G4endl;
120  G4cout << " Track secondaries first: activated" << G4endl;
121  }
122  else {
123  G4cout << " Track secondaries first: inactivated" << G4endl;
124  }
125  }
126  if ( i == kWLS ) {
127  G4cout << " WLS process time profile: " << fProfile << G4endl;
128  }
129  }
130  }
131 }
Number of processes, no selected process.
Scintillation process index.
int G4int
Definition: G4Types.hh:78
std::vector< G4bool > fProcessTrackSecondariesFirst
G4double fMaxBetaChange
max change of beta per step
std::vector< G4bool > fProcessUse
G4double fYieldFactor
scintillation yield factor
G4GLOB_DLL std::ostream G4cout
G4int fMaxNumPhotons
max number of Cerenkov photons per step
G4double fExcitationRatio
scintillation excitation ratio
Wave Length Shifting process index.
G4String G4OpticalProcessName(G4int)
Return the name for a given optical process index.
Cerenkov process index.
#define G4endl
Definition: G4ios.hh:61
G4String fProfile
the WLS process time profile
G4bool fScintillationByParticleType
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetFiniteRiseTime()

void G4OpticalPhysics::SetFiniteRiseTime ( G4bool  finiteRiseTime)

Definition at line 432 of file G4OpticalPhysics.cc.

433 {
434  fFiniteRiseTime = finiteRiseTime;
435  //G4Scintillation::SetFiniteRiseTime(finiteRiseTime);
436 }
Here is the caller graph for this function:

◆ SetMaxBetaChangePerStep()

void G4OpticalPhysics::SetMaxBetaChangePerStep ( G4double  maxBetaChange)

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

Definition at line 392 of file G4OpticalPhysics.cc.

393 {
395 
396  fMaxBetaChange = maxBetaChange;
397 // G4Cerenkov::SetMaxBetaChangePerStep(maxBetaChange);
398 }
G4double fMaxBetaChange
max change of beta per step
Here is the caller graph for this function:

◆ SetMaxNumPhotonsPerStep()

void G4OpticalPhysics::SetMaxNumPhotonsPerStep ( G4int  maxNumPhotons)

Limit step to the specified maximum number of Cherenkov photons

Definition at line 384 of file G4OpticalPhysics.cc.

385 {
387 
388  fMaxNumPhotons = maxNumPhotons;
389 // G4Cerenkov::SetMaxNumPhotonsPerStep(maxNumPhotons);
390 }
G4int fMaxNumPhotons
max number of Cerenkov photons per step
Here is the caller graph for this function:

◆ SetScintillationByParticleType()

void G4OpticalPhysics::SetScintillationByParticleType ( G4bool  scintillationByParticleType)

Definition at line 413 of file G4OpticalPhysics.cc.

414 {
415  fScintillationByParticleType = scintillationByParticleType;
416  //G4Scintillation::SetScintillationByParticleType(scintillationByParticleType);
417 }
G4bool fScintillationByParticleType
Here is the caller graph for this function:

◆ SetScintillationExcitationRatio()

void G4OpticalPhysics::SetScintillationExcitationRatio ( G4double  excitationRatio)

Set the scintillation excitation ratio

Definition at line 376 of file G4OpticalPhysics.cc.

377 {
379 
380  fExcitationRatio = excitationRatio;
381 // G4Scintillation::SetScintillationExcitationRatio(excitationRatio);
382 }
G4double fExcitationRatio
scintillation excitation ratio
Here is the caller graph for this function:

◆ SetScintillationYieldFactor()

void G4OpticalPhysics::SetScintillationYieldFactor ( G4double  yieldFactor)

Set the scintillation yield factor

Definition at line 368 of file G4OpticalPhysics.cc.

369 {
371 
372  fYieldFactor = yieldFactor;
373  //G4Scintillation::SetScintillationYieldFactor(yieldFactor);
374 }
G4double fYieldFactor
scintillation yield factor
Here is the caller graph for this function:

◆ SetTrackSecondariesFirst()

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

Definition at line 419 of file G4OpticalPhysics.cc.

421 {
422  if ( index >= kNoProcess ) return;
423  if ( fProcessTrackSecondariesFirst[index] == trackSecondariesFirst ) return;
424  fProcessTrackSecondariesFirst[index] = trackSecondariesFirst;
425 
426 // if ( index == kCerenkov )
427 // G4Cerenkov::SetTrackSecondariesFirst(trackSecondariesFirst);
428 // if ( index == kScintillation)
429 // G4Scintillation::SetTrackSecondariesFirst(trackSecondariesFirst);
430 }
Number of processes, no selected process.
Int_t index
std::vector< G4bool > fProcessTrackSecondariesFirst
Here is the caller graph for this function:

◆ SetWLSTimeProfile()

void G4OpticalPhysics::SetWLSTimeProfile ( G4String  profile)

Set the WLS time profile (delta or exponential)

Definition at line 400 of file G4OpticalPhysics.cc.

401 {
403  fProfile = profile;
404 }
function profile(XB)
Definition: hijing1.383.f:4674
G4String fProfile
the WLS process time profile
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ fExcitationRatio

G4double G4OpticalPhysics::fExcitationRatio
private

scintillation excitation ratio

Definition at line 123 of file G4OpticalPhysics.hh.

◆ fFiniteRiseTime

G4bool G4OpticalPhysics::fFiniteRiseTime
private

option to set a finite rise-time; Note: the G4Scintillation process expects the user to have set the constant material property FAST/SLOWSCINTILLATIONRISETIME

Definition at line 131 of file G4OpticalPhysics.hh.

◆ fMaxBetaChange

G4double G4OpticalPhysics::fMaxBetaChange
private

max change of beta per step

Definition at line 117 of file G4OpticalPhysics.hh.

◆ fMaxNumPhotons

G4int G4OpticalPhysics::fMaxNumPhotons
private

max number of Cerenkov photons per step

Definition at line 114 of file G4OpticalPhysics.hh.

◆ fMessenger

G4OpticalPhysicsMessenger* G4OpticalPhysics::fMessenger
private

Definition at line 104 of file G4OpticalPhysics.hh.

◆ fProcessTrackSecondariesFirst

std::vector<G4bool> G4OpticalPhysics::fProcessTrackSecondariesFirst
private

Definition at line 111 of file G4OpticalPhysics.hh.

◆ fProcessUse

std::vector<G4bool> G4OpticalPhysics::fProcessUse
private

Definition at line 107 of file G4OpticalPhysics.hh.

◆ fProfile

G4String G4OpticalPhysics::fProfile
private

the WLS process time profile

Definition at line 126 of file G4OpticalPhysics.hh.

◆ fScintillationByParticleType

G4bool G4OpticalPhysics::fScintillationByParticleType
private

option to allow for the light yield to be a function of particle type and deposited energy in case of non-linear light emission in scintillators

Definition at line 136 of file G4OpticalPhysics.hh.

◆ fYieldFactor

G4double G4OpticalPhysics::fYieldFactor
private

scintillation yield factor

Definition at line 120 of file G4OpticalPhysics.hh.


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