Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 //
28 //
29 //
30 //
31 //
32 
33 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
34 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
35 
36 #include "G4LossTableManager.hh"
37 #include "G4EmSaturation.hh"
38 
39 #include "WLSOpticalPhysics.hh"
40 
42  : G4VPhysicsConstructor("Optical")
43 {
44  theWLSProcess = NULL;
45  theScintProcess = NULL;
46  theCerenkovProcess = NULL;
47  theBoundaryProcess = NULL;
48  theAbsorptionProcess = NULL;
49  theRayleighScattering = NULL;
50  theMieHGScatteringProcess = NULL;
51 
52  AbsorptionOn = toggle;
53 }
54 
56 
57 //#include "G4ParticleDefinition.hh"
58 //#include "G4ParticleTable.hh"
59 
60 #include "G4OpticalPhoton.hh"
61 
63 {
65 }
66 
67 #include "G4ProcessManager.hh"
68 
70 {
71  G4cout << "WLSOpticalPhysics:: Add Optical Physics Processes"
72  << G4endl;
73 
74  theWLSProcess = new G4OpWLS();
75 
76  theScintProcess = new G4Scintillation();
77  theScintProcess->SetScintillationYieldFactor(1.);
78  theScintProcess->SetTrackSecondariesFirst(true);
79 
80  theCerenkovProcess = new G4Cerenkov();
81  theCerenkovProcess->SetMaxNumPhotonsPerStep(300);
82  theCerenkovProcess->SetTrackSecondariesFirst(true);
83 
84  theAbsorptionProcess = new G4OpAbsorption();
85  theRayleighScattering = new G4OpRayleigh();
86  theMieHGScatteringProcess = new G4OpMieHG();
87  theBoundaryProcess = new G4OpBoundaryProcess();
88 
89  G4ProcessManager* pManager =
91 
92  if (!pManager) {
93  std::ostringstream o;
94  o << "Optical Photon without a Process Manager";
95  G4Exception("WLSOpticalPhysics::ConstructProcess()","",
96  FatalException,o.str().c_str());
97  }
98 
99  if (AbsorptionOn) pManager->AddDiscreteProcess(theAbsorptionProcess);
100 
101  //pManager->AddDiscreteProcess(theRayleighScattering);
102  //pManager->AddDiscreteProcess(theMieHGScatteringProcess);
103 
104  pManager->AddDiscreteProcess(theBoundaryProcess);
105 
106  theWLSProcess->UseTimeProfile("delta");
107  //theWLSProcess->UseTimeProfile("exponential");
108 
109  pManager->AddDiscreteProcess(theWLSProcess);
110 
111  theScintProcess->SetScintillationYieldFactor(1.);
112  theScintProcess->SetScintillationExcitationRatio(0.0);
113  theScintProcess->SetTrackSecondariesFirst(true);
114 
115  // Use Birks Correction in the Scintillation process
116 
118  theScintProcess->AddSaturation(emSaturation);
119 
121  while ( (*theParticleIterator)() ){
122 
124  G4String particleName = particle->GetParticleName();
125 
126  pManager = particle->GetProcessManager();
127  if (!pManager) {
128  std::ostringstream o;
129  o << "Particle " << particleName << "without a Process Manager";
130  G4Exception("WLSOpticalPhysics::ConstructProcess()","",
131  FatalException,o.str().c_str());
132  }
133 
134  if(theCerenkovProcess->IsApplicable(*particle)){
135  pManager->AddProcess(theCerenkovProcess);
136  pManager->SetProcessOrdering(theCerenkovProcess,idxPostStep);
137  }
138  if(theScintProcess->IsApplicable(*particle)){
139  pManager->AddProcess(theScintProcess);
140  pManager->SetProcessOrderingToLast(theScintProcess,idxAtRest);
141  pManager->SetProcessOrderingToLast(theScintProcess,idxPostStep);
142  }
143 
144  }
145 }
146 
148 {
149  theCerenkovProcess->SetMaxNumPhotonsPerStep(MaxNumber);
150 }