Geant4_10
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 68751 2013-04-05 10:21:24Z 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 
71 {
72  G4cout << "F04OpticalPhysics:: Add Optical Physics Processes"
73  << G4endl;
74 
75  G4Scintillation* theScintProcess = new G4Scintillation();
76  G4Cerenkov* theCerenkovProcess= new G4Cerenkov();
77 
78  G4OpAbsorption* theAbsorptionProcess= new G4OpAbsorption();
79  G4OpRayleigh* theRayleighScattering = new G4OpRayleigh();
80  G4OpMieHG* theMieHGScatteringProcess = new G4OpMieHG();
81  G4OpBoundaryProcess* theBoundaryProcess = new G4OpBoundaryProcess();
82  G4OpWLS* theWLSProcess=new G4OpWLS();
83 
84  G4ProcessManager* pManager =
86 
87  if (!pManager) {
88  std::ostringstream o;
89  o << "Optical Photon without a Process Manager";
90  G4Exception("F04OpticalPhysics::ConstructProcess()","",
91  FatalException,o.str().c_str());
92  }
93 
94  pManager->AddDiscreteProcess(theAbsorptionProcess);
95  pManager->AddDiscreteProcess(theRayleighScattering);
96  pManager->AddDiscreteProcess(theMieHGScatteringProcess);
97 
98  pManager->AddDiscreteProcess(theBoundaryProcess);
99 
100  theWLSProcess->UseTimeProfile("delta");
101 // theWLSProcess->UseTimeProfile("exponential");
102 
103  pManager->AddDiscreteProcess(theWLSProcess);
104 
105  theScintProcess->SetScintillationYieldFactor(1.);
106  theScintProcess->SetScintillationExcitationRatio(0.0);
107  theScintProcess->SetTrackSecondariesFirst(true);
108 
109  aParticleIterator->reset();
110 
111  while( (*aParticleIterator)() ){
112 
113  G4ParticleDefinition* particle = aParticleIterator->value();
114  G4String particleName = particle->GetParticleName();
115 
116  pManager = particle->GetProcessManager();
117  if (!pManager) {
118  std::ostringstream o;
119  o << "Particle " << particleName << "without a Process Manager";
120  G4Exception("F04OpticalPhysics::ConstructProcess()","",
121  FatalException,o.str().c_str());
122  }
123 
124  if(theCerenkovProcess->IsApplicable(*particle)){
125  pManager->AddProcess(theCerenkovProcess);
126  pManager->SetProcessOrdering(theCerenkovProcess,idxPostStep);
127  }
128  if(theScintProcess->IsApplicable(*particle)){
129  pManager->AddProcess(theScintProcess);
130  pManager->SetProcessOrderingToLast(theScintProcess,idxAtRest);
131  pManager->SetProcessOrderingToLast(theScintProcess,idxPostStep);
132  }
133 
134  }
135 }
void SetScintillationExcitationRatio(const G4double excitationratio)
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:418
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
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:128