Geant4  10.02.p01
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 85428 2014-10-29 08:28:14Z 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  theScintProcess->SetScintillationYieldFactor(1.);
78  theScintProcess->SetScintillationExcitationRatio(0.0);
79  theScintProcess->SetTrackSecondariesFirst(true);
80 
81  G4Cerenkov* theCerenkovProcess= new G4Cerenkov();
82 
83  G4OpAbsorption* theAbsorptionProcess= new G4OpAbsorption();
84  G4OpRayleigh* theRayleighScattering = new G4OpRayleigh();
85  G4OpMieHG* theMieHGScatteringProcess = new G4OpMieHG();
86  G4OpBoundaryProcess* theBoundaryProcess = new G4OpBoundaryProcess();
87  G4OpWLS* theWLSProcess=new G4OpWLS();
88  theWLSProcess->UseTimeProfile("delta");
89 
90  G4ProcessManager* pManager =
92 
93  if (!pManager) {
94  std::ostringstream o;
95  o << "Optical Photon without a Process Manager";
96  G4Exception("F04OpticalPhysics::ConstructProcess()","",
97  FatalException,o.str().c_str());
98  }
99 
100  pManager->AddDiscreteProcess(theAbsorptionProcess);
101  pManager->AddDiscreteProcess(theRayleighScattering);
102  pManager->AddDiscreteProcess(theMieHGScatteringProcess);
103 
104  pManager->AddDiscreteProcess(theBoundaryProcess);
105 
106  pManager->AddDiscreteProcess(theWLSProcess);
107 
108  aParticleIterator->reset();
109 
110  while( (*aParticleIterator)() ){
111 
112  G4ParticleDefinition* particle = aParticleIterator->value();
113  G4String particleName = particle->GetParticleName();
114 
115  pManager = particle->GetProcessManager();
116  if (!pManager) {
117  std::ostringstream o;
118  o << "Particle " << particleName << "without a Process Manager";
119  G4Exception("F04OpticalPhysics::ConstructProcess()","",
120  FatalException,o.str().c_str());
121  }
122 
123  if(theCerenkovProcess->IsApplicable(*particle)){
124  pManager->AddProcess(theCerenkovProcess);
125  pManager->SetProcessOrdering(theCerenkovProcess,idxPostStep);
126  }
127  if(theScintProcess->IsApplicable(*particle)){
128  pManager->AddProcess(theScintProcess);
129  pManager->SetProcessOrderingToLast(theScintProcess,idxAtRest);
130  pManager->SetProcessOrderingToLast(theScintProcess,idxPostStep);
131  }
132 
133  }
134 }
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
void UseTimeProfile(const G4String name)
Definition: G4OpWLS.cc:417
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
void SetScintillationExcitationRatio(const G4double ratio)
static G4OpticalPhoton * OpticalPhoton()
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:135