Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 //
28 //
29 //
30 #include "globals.hh"
31 
32 #include "G4Scintillation.hh"
33 #include "G4Cerenkov.hh"
34 
35 #include "G4OpAbsorption.hh"
36 #include "G4OpRayleigh.hh"
37 #include "G4OpMieHG.hh"
38 #include "G4OpBoundaryProcess.hh"
39 #include "G4OpWLS.hh"
40 
41 #include "F04OpticalPhysics.hh"
42 
43 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
44 
46  : G4VPhysicsConstructor("Optical") {}
47 
48 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
49 
51 
52 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
53 
54 #include "G4ParticleDefinition.hh"
55 #include "G4ParticleTable.hh"
56 
57 #include "G4OpticalPhoton.hh"
58 
60 {
62 }
63 
64 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
65 
66 #include "G4ProcessManager.hh"
67 
69 {
70  G4cout << "F04OpticalPhysics:: Add Optical Physics Processes"
71  << G4endl;
72 
73  G4Scintillation* theScintProcess = new G4Scintillation();
74  G4Cerenkov* theCerenkovProcess= new G4Cerenkov();
75 
76  G4OpAbsorption* theAbsorptionProcess= new G4OpAbsorption();
77  G4OpRayleigh* theRayleighScattering = new G4OpRayleigh();
78  G4OpMieHG* theMieHGScatteringProcess = new G4OpMieHG();
79  G4OpBoundaryProcess* theBoundaryProcess = new G4OpBoundaryProcess();
80  G4OpWLS* theWLSProcess=new G4OpWLS();
81 
82  G4ProcessManager* pManager =
84 
85  if (!pManager) {
86  std::ostringstream o;
87  o << "Optical Photon without a Process Manager";
88  G4Exception("F04OpticalPhysics::ConstructProcess()","",
89  FatalException,o.str().c_str());
90  }
91 
92  pManager->AddDiscreteProcess(theAbsorptionProcess);
93  pManager->AddDiscreteProcess(theRayleighScattering);
94  pManager->AddDiscreteProcess(theMieHGScatteringProcess);
95 
96  pManager->AddDiscreteProcess(theBoundaryProcess);
97 
98  theWLSProcess->UseTimeProfile("delta");
99 // theWLSProcess->UseTimeProfile("exponential");
100 
101  pManager->AddDiscreteProcess(theWLSProcess);
102 
103  theScintProcess->SetScintillationYieldFactor(1.);
104  theScintProcess->SetScintillationExcitationRatio(0.0);
105  theScintProcess->SetTrackSecondariesFirst(true);
106 
108 
109  while( (*theParticleIterator)() ){
110 
112  G4String particleName = particle->GetParticleName();
113 
114  pManager = particle->GetProcessManager();
115  if (!pManager) {
116  std::ostringstream o;
117  o << "Particle " << particleName << "without a Process Manager";
118  G4Exception("F04OpticalPhysics::ConstructProcess()","",
119  FatalException,o.str().c_str());
120  }
121 
122  if(theCerenkovProcess->IsApplicable(*particle)){
123  pManager->AddProcess(theCerenkovProcess);
124  pManager->SetProcessOrdering(theCerenkovProcess,idxPostStep);
125  }
126  if(theScintProcess->IsApplicable(*particle)){
127  pManager->AddProcess(theScintProcess);
128  pManager->SetProcessOrderingToLast(theScintProcess,idxAtRest);
129  pManager->SetProcessOrderingToLast(theScintProcess,idxPostStep);
130  }
131 
132  }
133 }