Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 SetScintillationTrackInfo (G4bool)
 
void SetTrackSecondariesFirst (G4OpticalProcessIndex, G4bool)
 
void SetFiniteRiseTime (G4bool)
 
void SetCerenkovStackPhotons (G4bool)
 
void SetScintillationStackPhotons (G4bool)
 
void SetInvokeSD (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
 

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::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),
73  fScintillationByParticleType(false),
74  fScintillationTrackInfo(false),
75  fInvokeSD(true),
76  fCerenkovStackPhotons(true),
77  fScintillationStackPhotons(true)
78 {
79  verboseLevel = verbose;
80  fMessenger = new G4OpticalPhysicsMessenger(this);
81 
82  for ( G4int i=0; i<kNoProcess; i++ ) {
83  fProcessUse.push_back(true);
84  fProcessTrackSecondariesFirst.push_back(true);
85  }
86 }
Number of processes, no selected process.
int G4int
Definition: G4Types.hh:78
G4VPhysicsConstructor(const G4String &="")
G4OpticalPhysics::~G4OpticalPhysics ( )
virtual

Definition at line 90 of file G4OpticalPhysics.cc.

91 {
92  delete fMessenger;
93 }

Member Function Documentation

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

Definition at line 475 of file G4OpticalPhysics.cc.

476 {
477  // Configure the physics constructor to use/not use a selected process.
478  // This method can only be called in PreInit> phase (before execution of
479  // ConstructProcess). The process is not added to particle's process manager
480  // and so it cannot be re-activated later in Idle> phase with the command
481  // /process/activate.
482 
483  if ( index >= kNoProcess ) return;
484  if ( fProcessUse[index] == isUse ) return;
485  fProcessUse[index] = isUse;
486 }
Number of processes, no selected process.

Here is the caller graph for this function:

void G4OpticalPhysics::ConstructParticle ( )
protectedvirtual

Instantiate particles.

Implements G4VPhysicsConstructor.

Definition at line 141 of file G4OpticalPhysics.cc.

142 {
144 
145  // optical photon
147 }
static G4OpticalPhoton * OpticalPhotonDefinition()

Here is the call graph for this function:

void G4OpticalPhysics::ConstructProcess ( )
protectedvirtual

Implements G4VPhysicsConstructor.

Definition at line 268 of file G4OpticalPhysics.cc.

269 {
270 // Construct optical processes.
271 
272  if(verboseLevel>0)
273  G4cout <<"G4OpticalPhysics:: Add Optical Physics Processes"<< G4endl;
274 
275  // A vector of optical processes
276  std::vector<G4VProcess*> OpProcesses;
277 
278  for ( G4int i=0; i<kNoProcess; i++ ) OpProcesses.push_back(NULL);
279 
280  // Add Optical Processes
281 
282  G4OpAbsorption* OpAbsorptionProcess = new G4OpAbsorption();
283  UIhelpers::buildCommands(OpAbsorptionProcess,DIR_CMDS"/absorption/",GUIDANCE" for absorption process");
284  OpProcesses[kAbsorption] = OpAbsorptionProcess;
285 
286  G4OpRayleigh* OpRayleighScatteringProcess = new G4OpRayleigh();
287  UIhelpers::buildCommands(OpRayleighScatteringProcess,DIR_CMDS"/rayleigh/",GUIDANCE" for Reyleigh scattering process");
288  OpProcesses[kRayleigh] = OpRayleighScatteringProcess;
289 
290  G4OpMieHG* OpMieHGScatteringProcess = new G4OpMieHG();
291  UIhelpers::buildCommands(OpMieHGScatteringProcess,DIR_CMDS"/mie/",GUIDANCE" for Mie cattering process");
292  OpProcesses[kMieHG] = OpMieHGScatteringProcess;
293 
294  G4OpBoundaryProcess* OpBoundaryProcess = new G4OpBoundaryProcess();
295  UIhelpers::buildCommands(OpBoundaryProcess,DIR_CMDS"/boundary/",GUIDANCE" for boundary process");
296  OpBoundaryProcess->SetInvokeSD(fInvokeSD);
297  OpProcesses[kBoundary] = OpBoundaryProcess;
298 
299  G4OpWLS* OpWLSProcess = new G4OpWLS();
300  OpWLSProcess->UseTimeProfile(fProfile);
301  UIhelpers::buildCommands(OpWLSProcess);
302  OpProcesses[kWLS] = OpWLSProcess;
303 
304  G4ProcessManager * pManager = 0;
306 
307  if (!pManager) {
308  std::ostringstream o;
309  o << "Optical Photon without a Process Manager";
310  G4Exception("G4OpticalPhysics::ConstructProcess()","",
311  FatalException,o.str().c_str());
312  return;
313  }
314 
315  for ( G4int i=kAbsorption; i<=kWLS; i++ ) {
316  if ( fProcessUse[i] ) {
317  pManager->AddDiscreteProcess(OpProcesses[i]);
318  }
319  }
320 
321  G4Scintillation* ScintillationProcess = new G4Scintillation();
322  ScintillationProcess->SetScintillationYieldFactor(fYieldFactor);
323  ScintillationProcess->SetScintillationExcitationRatio(fExcitationRatio);
324  ScintillationProcess->SetFiniteRiseTime(fFiniteRiseTime);
325  ScintillationProcess->SetScintillationByParticleType(fScintillationByParticleType);
326  ScintillationProcess->SetScintillationTrackInfo(fScintillationTrackInfo);
327  ScintillationProcess->SetTrackSecondariesFirst(fProcessTrackSecondariesFirst[kScintillation]);
328  ScintillationProcess->SetStackPhotons(fScintillationStackPhotons);
330  ScintillationProcess->AddSaturation(emSaturation);
331  UIhelpers::buildCommands(ScintillationProcess);
332  OpProcesses[kScintillation] = ScintillationProcess;
333 
334  G4Cerenkov* CerenkovProcess = new G4Cerenkov();
335  CerenkovProcess->SetMaxNumPhotonsPerStep(fMaxNumPhotons);
336  CerenkovProcess->SetMaxBetaChangePerStep(fMaxBetaChange);
337  CerenkovProcess->SetTrackSecondariesFirst(fProcessTrackSecondariesFirst[kCerenkov]);
338  CerenkovProcess->SetStackPhotons(fCerenkovStackPhotons);
339  UIhelpers::buildCommands(CerenkovProcess);
340  OpProcesses[kCerenkov] = CerenkovProcess;
341 
342  auto myParticleIterator=GetParticleIterator();
343  myParticleIterator->reset();
344 
345  while( (*myParticleIterator)() ){
346 
347  G4ParticleDefinition* particle = myParticleIterator->value();
348  G4String particleName = particle->GetParticleName();
349 
350  pManager = particle->GetProcessManager();
351  if (!pManager) {
352  std::ostringstream o;
353  o << "Particle " << particleName << "without a Process Manager";
354  G4Exception("G4OpticalPhysics::ConstructProcess()","",
355  FatalException,o.str().c_str());
356  return; // else coverity complains for pManager use below
357  }
358 
359  if( CerenkovProcess->IsApplicable(*particle) &&
360  fProcessUse[kCerenkov] ) {
361  pManager->AddProcess(CerenkovProcess);
362  pManager->SetProcessOrdering(CerenkovProcess,idxPostStep);
363  }
364  if( ScintillationProcess->IsApplicable(*particle) &&
365  fProcessUse[kScintillation] ){
366  pManager->AddProcess(ScintillationProcess);
367  pManager->SetProcessOrderingToLast(ScintillationProcess,idxAtRest);
368  pManager->SetProcessOrderingToLast(ScintillationProcess,idxPostStep);
369  }
370 
371  }
372 
373  // Add verbose
374  for ( G4int i=0; i<kNoProcess; i++ ) {
375  if ( fProcessUse[i] ) OpProcesses[i]->SetVerboseLevel(verboseLevel);
376  }
377 
378  if (verboseLevel > 1) PrintStatistics();
379  if (verboseLevel > 0)
380  G4cout << "### " << namePhysics << " physics constructed." << G4endl;
381 }
void SetScintillationByParticleType(const G4bool)
void SetMaxBetaChangePerStep(const G4double d)
Definition: G4Cerenkov.cc:150
void SetScintillationTrackInfo(const G4bool trackType)
static G4LossTableManager * Instance()
void SetFiniteRiseTime(const G4bool state)
Number of processes, no selected process.
void SetTrackSecondariesFirst(const G4bool state)
Definition: G4Cerenkov.cc:145
G4int AddDiscreteProcess(G4VProcess *aProcess, G4int ord=ordDefault)
Scintillation process index.
Mie scattering process index.
Absorption process index.
int G4int
Definition: G4Types.hh:78
#define DIR_CMDS
const G4String & GetParticleName() const
void UseTimeProfile(const G4String name)
Definition: G4OpWLS.cc:417
G4ParticleTable::G4PTblDicIterator * GetParticleIterator() const
void SetScintillationYieldFactor(const G4double yieldfactor)
void SetStackPhotons(const G4bool)
Definition: G4Cerenkov.hh:251
void SetStackPhotons(const G4bool)
G4GLOB_DLL std::ostream G4cout
G4int AddProcess(G4VProcess *aProcess, G4int ordAtRestDoIt=ordInActive, G4int ordAlongSteptDoIt=ordInActive, G4int ordPostStepDoIt=ordInActive)
G4EmSaturation * EmSaturation()
void SetMaxNumPhotonsPerStep(const G4int NumPhotons)
Definition: G4Cerenkov.cc:155
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)
G4ProcessManager * GetProcessManager() const
void buildCommands(T *proc, const char *dir, const char *guidance)
G4bool IsApplicable(const G4ParticleDefinition &aParticleType) override
Definition: G4Cerenkov.cc:133
Cerenkov process index.
#define G4endl
Definition: G4ios.hh:61
Rayleigh scattering process index.
#define GUIDANCE
G4bool IsApplicable(const G4ParticleDefinition &aParticleType) override
void AddSaturation(G4EmSaturation *sat)

Here is the call graph for this function:

void G4OpticalPhysics::SetCerenkovStackPhotons ( G4bool  stackingFlag)

Definition at line 465 of file G4OpticalPhysics.cc.

466 {
467  fCerenkovStackPhotons = stackingFlag;
468 }

Here is the caller graph for this function:

void G4OpticalPhysics::SetFiniteRiseTime ( G4bool  finiteRiseTime)

Definition at line 454 of file G4OpticalPhysics.cc.

455 {
456  fFiniteRiseTime = finiteRiseTime;
457  //G4Scintillation::SetFiniteRiseTime(finiteRiseTime);
458 }

Here is the caller graph for this function:

void G4OpticalPhysics::SetInvokeSD ( G4bool  invokeSD)

Definition at line 460 of file G4OpticalPhysics.cc.

461 {
462  fInvokeSD = invokeSD;
463 }

Here is the caller graph for this function:

void G4OpticalPhysics::SetMaxBetaChangePerStep ( G4double  maxBetaChange)

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

Definition at line 407 of file G4OpticalPhysics.cc.

408 {
410 
411  fMaxBetaChange = maxBetaChange;
412 // G4Cerenkov::SetMaxBetaChangePerStep(maxBetaChange);
413 }

Here is the caller graph for this function:

void G4OpticalPhysics::SetMaxNumPhotonsPerStep ( G4int  maxNumPhotons)

Limit step to the specified maximum number of Cherenkov photons

Definition at line 399 of file G4OpticalPhysics.cc.

400 {
402 
403  fMaxNumPhotons = maxNumPhotons;
404 // G4Cerenkov::SetMaxNumPhotonsPerStep(maxNumPhotons);
405 }

Here is the caller graph for this function:

void G4OpticalPhysics::SetScintillationByParticleType ( G4bool  scintillationByParticleType)

Definition at line 428 of file G4OpticalPhysics.cc.

429 {
430  fScintillationByParticleType = scintillationByParticleType;
431  //G4Scintillation::SetScintillationByParticleType(scintillationByParticleType);
432 }

Here is the caller graph for this function:

void G4OpticalPhysics::SetScintillationExcitationRatio ( G4double  excitationRatio)

Set the scintillation excitation ratio

Definition at line 391 of file G4OpticalPhysics.cc.

392 {
394 
395  fExcitationRatio = excitationRatio;
396 // G4Scintillation::SetScintillationExcitationRatio(excitationRatio);
397 }
void G4OpticalPhysics::SetScintillationStackPhotons ( G4bool  stackingFlag)

Definition at line 470 of file G4OpticalPhysics.cc.

471 {
472  fScintillationStackPhotons = stackingFlag;
473 }

Here is the caller graph for this function:

void G4OpticalPhysics::SetScintillationTrackInfo ( G4bool  scintillationTrackInfo)

Definition at line 435 of file G4OpticalPhysics.cc.

436 {
437  fScintillationTrackInfo = scintillationTrackInfo;
438  //G4Scintillation::SetScintillationTrackInfo(scintillationTrackInfo);
439 }

Here is the caller graph for this function:

void G4OpticalPhysics::SetScintillationYieldFactor ( G4double  yieldFactor)

Set the scintillation yield factor

Definition at line 383 of file G4OpticalPhysics.cc.

384 {
386 
387  fYieldFactor = yieldFactor;
388  //G4Scintillation::SetScintillationYieldFactor(yieldFactor);
389 }

Here is the caller graph for this function:

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

Definition at line 441 of file G4OpticalPhysics.cc.

443 {
444  if ( index >= kNoProcess ) return;
445  if ( fProcessTrackSecondariesFirst[index] == trackSecondariesFirst ) return;
446  fProcessTrackSecondariesFirst[index] = trackSecondariesFirst;
447 
448 // if ( index == kCerenkov )
449 // G4Cerenkov::SetTrackSecondariesFirst(trackSecondariesFirst);
450 // if ( index == kScintillation)
451 // G4Scintillation::SetTrackSecondariesFirst(trackSecondariesFirst);
452 }
Number of processes, no selected process.

Here is the caller graph for this function:

void G4OpticalPhysics::SetWLSTimeProfile ( G4String  profile)

Set the WLS time profile (delta or exponential)

Definition at line 415 of file G4OpticalPhysics.cc.

416 {
418  fProfile = profile;
419 }

Here is the caller graph for this function:


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