Geant4  10.00.p03
F04OpticalPhysics.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: F04OpticalPhysics.cc 79251 2014-02-20 16:16:23Z gcosmo $
27 //
30 //
31 
32 #include "globals.hh"
33 
34 #include "G4Scintillation.hh"
35 #include "G4Cerenkov.hh"
36 
37 #include "G4OpAbsorption.hh"
38 #include "G4OpRayleigh.hh"
39 #include "G4OpMieHG.hh"
40 #include "G4OpBoundaryProcess.hh"
41 #include "G4OpWLS.hh"
42 
43 #include "F04OpticalPhysics.hh"
44 
45 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
46 
48  : G4VPhysicsConstructor("Optical") {}
49 
50 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
51 
53 
54 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
55 
56 #include "G4ParticleDefinition.hh"
57 #include "G4ParticleTable.hh"
58 
59 #include "G4OpticalPhoton.hh"
60 
62 {
64 }
65 
66 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
67 
68 #include "G4ProcessManager.hh"
69 #include "G4Threading.hh"
70 
72 {
73  G4cout << "F04OpticalPhysics:: Add Optical Physics Processes"
74  << G4endl;
75 
76  G4Scintillation* theScintProcess = new G4Scintillation();
77  G4Cerenkov* theCerenkovProcess= new G4Cerenkov();
78 
79  G4OpAbsorption* theAbsorptionProcess= new G4OpAbsorption();
80  G4OpRayleigh* theRayleighScattering = new G4OpRayleigh();
81  G4OpMieHG* theMieHGScatteringProcess = new G4OpMieHG();
82  G4OpBoundaryProcess* theBoundaryProcess = new G4OpBoundaryProcess();
83  G4OpWLS* theWLSProcess=new G4OpWLS();
84 
85  G4ProcessManager* pManager =
87 
88  if (!pManager) {
89  std::ostringstream o;
90  o << "Optical Photon without a Process Manager";
91  G4Exception("F04OpticalPhysics::ConstructProcess()","",
92  FatalException,o.str().c_str());
93  }
94 
95  pManager->AddDiscreteProcess(theAbsorptionProcess);
96  pManager->AddDiscreteProcess(theRayleighScattering);
97  pManager->AddDiscreteProcess(theMieHGScatteringProcess);
98 
99  pManager->AddDiscreteProcess(theBoundaryProcess);
100 
101  pManager->AddDiscreteProcess(theWLSProcess);
102 
104  {
105  G4OpWLS::UseTimeProfile("delta");
106 // G4OpWLS::UseTimeProfile("exponential");
107 
111  }
112 
113  aParticleIterator->reset();
114 
115  while( (*aParticleIterator)() ){
116 
117  G4ParticleDefinition* particle = aParticleIterator->value();
118  G4String particleName = particle->GetParticleName();
119 
120  pManager = particle->GetProcessManager();
121  if (!pManager) {
122  std::ostringstream o;
123  o << "Particle " << particleName << "without a Process Manager";
124  G4Exception("F04OpticalPhysics::ConstructProcess()","",
125  FatalException,o.str().c_str());
126  }
127 
128  if(theCerenkovProcess->IsApplicable(*particle)){
129  pManager->AddProcess(theCerenkovProcess);
130  pManager->SetProcessOrdering(theCerenkovProcess,idxPostStep);
131  }
132  if(theScintProcess->IsApplicable(*particle)){
133  pManager->AddProcess(theScintProcess);
134  pManager->SetProcessOrderingToLast(theScintProcess,idxAtRest);
135  pManager->SetProcessOrderingToLast(theScintProcess,idxPostStep);
136  }
137 
138  }
139 }
G4int AddDiscreteProcess(G4VProcess *aProcess, G4int ord=ordDefault)
virtual void ConstructProcess()
virtual void ConstructParticle()
G4bool IsApplicable(const G4ParticleDefinition &aParticleType)
G4ProcessManager * GetProcessManager() const
Definition of the F04OpticalPhysics class.
const G4String & GetParticleName() const
static void UseTimeProfile(const G4String name)
Definition: G4OpWLS.cc:426
static void SetScintillationYieldFactor(const G4double yieldfactor)
G4GLOB_DLL std::ostream G4cout
#define aParticleIterator
G4int AddProcess(G4VProcess *aProcess, G4int ordAtRestDoIt=ordInActive, G4int ordAlongSteptDoIt=ordInActive, G4int ordPostStepDoIt=ordInActive)
virtual ~F04OpticalPhysics()
void SetProcessOrdering(G4VProcess *aProcess, G4ProcessVectorDoItIndex idDoIt, G4int ordDoIt=ordDefault)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4bool IsWorkerThread()
Definition: G4Threading.cc:104
static void SetScintillationExcitationRatio(const G4double ratio)
static G4OpticalPhoton * OpticalPhoton()
static void SetTrackSecondariesFirst(const G4bool state)
void SetProcessOrderingToLast(G4VProcess *aProcess, G4ProcessVectorDoItIndex idDoIt)
#define G4endl
Definition: G4ios.hh:61
static G4OpticalPhoton * OpticalPhotonDefinition()
G4bool IsApplicable(const G4ParticleDefinition &aParticleType)
Definition: G4Cerenkov.cc:132