Geant4_10
WLSOpticalPhysics.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // $Id: WLSOpticalPhysics.cc 69561 2013-05-08 12:25:56Z gcosmo $
27 //
30 //
31 
32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
33 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
34 
35 #include "G4LossTableManager.hh"
36 #include "G4EmSaturation.hh"
37 
38 #include "WLSOpticalPhysics.hh"
39 
41  : G4VPhysicsConstructor("Optical")
42 {
43  fWLSProcess = NULL;
44  fScintProcess = NULL;
45  fCerenkovProcess = NULL;
46  fBoundaryProcess = NULL;
47  fAbsorptionProcess = NULL;
48  fRayleighScattering = NULL;
49  fMieHGScatteringProcess = NULL;
50 
51  fAbsorptionOn = toggle;
52 }
53 
55 
56 #include "G4OpticalPhoton.hh"
57 
59 {
61 }
62 
63 #include "G4ProcessManager.hh"
64 
66 {
67  G4cout << "WLSOpticalPhysics:: Add Optical Physics Processes"
68  << G4endl;
69 
70  fWLSProcess = new G4OpWLS();
71 
72  fScintProcess = new G4Scintillation();
73  fScintProcess->SetScintillationYieldFactor(1.);
74  fScintProcess->SetTrackSecondariesFirst(true);
75 
76  fCerenkovProcess = new G4Cerenkov();
77  fCerenkovProcess->SetMaxNumPhotonsPerStep(300);
78  fCerenkovProcess->SetTrackSecondariesFirst(true);
79 
80  fAbsorptionProcess = new G4OpAbsorption();
81  fRayleighScattering = new G4OpRayleigh();
82  fMieHGScatteringProcess = new G4OpMieHG();
83  fBoundaryProcess = new G4OpBoundaryProcess();
84 
85  G4ProcessManager* pManager =
87 
88  if (!pManager) {
89  std::ostringstream o;
90  o << "Optical Photon without a Process Manager";
91  G4Exception("WLSOpticalPhysics::ConstructProcess()","",
92  FatalException,o.str().c_str());
93  }
94 
95  if (fAbsorptionOn) pManager->AddDiscreteProcess(fAbsorptionProcess);
96 
97  //pManager->AddDiscreteProcess(fRayleighScattering);
98  //pManager->AddDiscreteProcess(fMieHGScatteringProcess);
99 
100  pManager->AddDiscreteProcess(fBoundaryProcess);
101 
102  fWLSProcess->UseTimeProfile("delta");
103  //fWLSProcess->UseTimeProfile("exponential");
104 
105  pManager->AddDiscreteProcess(fWLSProcess);
106 
107  fScintProcess->SetScintillationYieldFactor(1.);
108  fScintProcess->SetScintillationExcitationRatio(0.0);
109  fScintProcess->SetTrackSecondariesFirst(true);
110 
111  // Use Birks Correction in the Scintillation process
112 
114  fScintProcess->AddSaturation(emSaturation);
115 
116  aParticleIterator->reset();
117  while ( (*aParticleIterator)() ){
118 
119  G4ParticleDefinition* particle = aParticleIterator->value();
120  G4String particleName = particle->GetParticleName();
121 
122  pManager = particle->GetProcessManager();
123  if (!pManager) {
124  std::ostringstream o;
125  o << "Particle " << particleName << "without a Process Manager";
126  G4Exception("WLSOpticalPhysics::ConstructProcess()","",
127  FatalException,o.str().c_str());
128  }
129 
130  if(fCerenkovProcess->IsApplicable(*particle)){
131  pManager->AddProcess(fCerenkovProcess);
132  pManager->SetProcessOrdering(fCerenkovProcess,idxPostStep);
133  }
134  if(fScintProcess->IsApplicable(*particle)){
135  pManager->AddProcess(fScintProcess);
136  pManager->SetProcessOrderingToLast(fScintProcess,idxAtRest);
137  pManager->SetProcessOrderingToLast(fScintProcess,idxPostStep);
138  }
139 
140  }
141 }
142 
144 {
145  fCerenkovProcess->SetMaxNumPhotonsPerStep(maxNumber);
146 }
virtual ~WLSOpticalPhysics()
static G4LossTableManager * Instance()
void SetTrackSecondariesFirst(const G4bool state)
Definition: G4Cerenkov.hh:217
void SetScintillationExcitationRatio(const G4double excitationratio)
G4int AddDiscreteProcess(G4VProcess *aProcess, G4int ord=ordDefault)
G4bool IsApplicable(const G4ParticleDefinition &aParticleType)
void SetNbOfPhotonsCerenkov(G4int)
G4ProcessManager * GetProcessManager() const
int G4int
Definition: G4Types.hh:78
const G4String & GetParticleName() const
void UseTimeProfile(const G4String name)
Definition: G4OpWLS.cc:418
virtual void ConstructProcess()
void SetScintillationYieldFactor(const G4double yieldfactor)
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
#define aParticleIterator
G4int AddProcess(G4VProcess *aProcess, G4int ordAtRestDoIt=ordInActive, G4int ordAlongSteptDoIt=ordInActive, G4int ordPostStepDoIt=ordInActive)
G4EmSaturation * EmSaturation()
void SetMaxNumPhotonsPerStep(const G4int NumPhotons)
Definition: G4Cerenkov.hh:229
void SetProcessOrdering(G4VProcess *aProcess, G4ProcessVectorDoItIndex idDoIt, G4int ordDoIt=ordDefault)
Definition of the WLSOpticalPhysics class.
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
static G4OpticalPhoton * OpticalPhoton()
void SetTrackSecondariesFirst(const G4bool state)
void SetProcessOrderingToLast(G4VProcess *aProcess, G4ProcessVectorDoItIndex idDoIt)
virtual void ConstructParticle()
#define G4endl
Definition: G4ios.hh:61
static G4OpticalPhoton * OpticalPhotonDefinition()
WLSOpticalPhysics(G4bool toggle=true)
void AddSaturation(G4EmSaturation *sat)
G4bool IsApplicable(const G4ParticleDefinition &aParticleType)
Definition: G4Cerenkov.cc:128