LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
OpticalPhysics.cxx
Go to the documentation of this file.
1 // Adapted for LArSoft by Ben Jones, MIT, Sept 09
2 //
3 // This class is based upon the default Geant4 optical physics constructor.
4 // However, for optical physics in LArSoft:
5 //
6 // - Cerenkov light can be enabled or disabled as required
7 //
8 // - The default geant4 reflection process is swapped for a simpler
9 // custom boundary process in LArG4
10 //
11 // Parameters relating to the physics in this constructor can be set
12 // in the Utilities/LArParameters service.
13 //
14 //
15 //
16 // ********************************************************************
17 // * License and Disclaimer *
18 // * *
19 // * The Geant4 software is copyright of the Copyright Holders of *
20 // * the Geant4 Collaboration. It is provided under the terms and *
21 // * conditions of the Geant4 Software License, included in the file *
22 // * LICENSE and available at http://cern.ch/geant4/license . These *
23 // * include a list of copyright holders. *
24 // * *
25 // * Neither the authors of this software system, nor their employing *
26 // * institutes,nor the agencies providing financial support for this *
27 // * work make any representation or warranty, express or implied, *
28 // * regarding this software system or assume any liability for its *
29 // * use. Please see the license in the file LICENSE and URL above *
30 // * for the full disclaimer and the limitation of liability. *
31 // * *
32 // * This code implementation is the result of the scientific and *
33 // * technical work of the GEANT4 collaboration. *
34 // * By using, copying, modifying or distributing the software (or *
35 // * any work based on the software) you agree to acknowledge its *
36 // * use in resulting scientific publications, and indicate your *
37 // * acceptance of all terms of the Geant4 Software license. *
38 // ********************************************************************
39 //
40 
41 #ifndef LARG4_OPTICALPHYSICS_CXX
42 #define LARG4_OPTICALPHYSICS_CXX 1
43 
47 
50 
51 #include "Geant4/G4ParticleDefinition.hh"
52 #include "Geant4/G4ParticleTable.hh"
53 #include "Geant4/G4ProcessManager.hh"
54 #include "Geant4/G4LossTableManager.hh"
55 #include "Geant4/G4EmProcessOptions.hh"
56 
57 #include "Geant4/G4ComptonScattering.hh"
58 #include "Geant4/G4GammaConversion.hh"
59 #include "Geant4/G4PhotoElectricEffect.hh"
60 
61 #include "Geant4/G4AdjointhMultipleScattering.hh"
62 #include "Geant4/G4eMultipleScattering.hh"
63 #include "Geant4/G4hMultipleScattering.hh"
64 #include "Geant4/G4MuMultipleScattering.hh"
65 #include "Geant4/G4VMultipleScattering.hh"
66 
67 #include "Geant4/G4eIonisation.hh"
68 #include "Geant4/G4eBremsstrahlung.hh"
69 #include "Geant4/G4eplusAnnihilation.hh"
70 
71 #include "Geant4/G4MuIonisation.hh"
72 #include "Geant4/G4MuBremsstrahlung.hh"
73 #include "Geant4/G4MuPairProduction.hh"
74 #include "Geant4/G4hBremsstrahlung.hh"
75 #include "Geant4/G4hPairProduction.hh"
76 
77 #include "Geant4/G4hIonisation.hh"
78 #include "Geant4/G4ionIonisation.hh"
79 
80 #include "Geant4/G4Gamma.hh"
81 #include "Geant4/G4Electron.hh"
82 #include "Geant4/G4Positron.hh"
83 #include "Geant4/G4MuonPlus.hh"
84 #include "Geant4/G4MuonMinus.hh"
85 #include "Geant4/G4PionPlus.hh"
86 #include "Geant4/G4PionMinus.hh"
87 #include "Geant4/G4KaonPlus.hh"
88 #include "Geant4/G4KaonMinus.hh"
89 #include "Geant4/G4Proton.hh"
90 #include "Geant4/G4AntiProton.hh"
91 #include "Geant4/G4Deuteron.hh"
92 #include "Geant4/G4Triton.hh"
93 #include "Geant4/G4He3.hh"
94 #include "Geant4/G4Alpha.hh"
95 #include "Geant4/G4GenericIon.hh"
96 #include "Geant4/G4OpticalPhoton.hh"
97 
98 #include "Geant4/G4Cerenkov.hh"
99 #include "Geant4/G4Scintillation.hh"
100 #include "Geant4/G4OpAbsorption.hh"
101 #include "Geant4/G4OpWLS.hh"
102 #include "Geant4/G4OpRayleigh.hh"
103 
104 #include "Geant4/G4LossTableManager.hh"
105 #include "Geant4/G4EmSaturation.hh"
106 
108 
109 //Register optical physics in custom physics list
110 
111 namespace larg4 {
112 
113  CustomPhysicsFactory<OpticalPhysics> optical_factory("Optical");
114 
115  //-----------------------------------------------------------
116  OpticalPhysics::OpticalPhysics(G4int ver, const G4String& name)
117  : G4VPhysicsConstructor(name), verbose(ver)
118  {
119  G4LossTableManager::Instance();
120  mf::LogInfo("OpticalPhysics") << "OBJECT BEING CONSTRUCTED IN OPTICAL PHYSICS";
121  }
122 
123 
124  //-----------------------------------------------------------
126  {}
127 
128  //-----------------------------------------------------------
130  {
131  LOG_DEBUG("OpticalPhysics") << "PARTICLES BEING CONSTRUCTED IN OPTICAL PHYSICS";
132  // optical photon
133  G4OpticalPhoton::OpticalPhotonDefinition();
134 
135  // gamma
136  G4Gamma::Gamma();
137 
138  // leptons
139  G4Electron::Electron();
140  G4Positron::Positron();
141  G4MuonPlus::MuonPlus();
142  G4MuonMinus::MuonMinus();
143 
144  // mesons
145  G4PionPlus::PionPlusDefinition();
146  G4PionMinus::PionMinusDefinition();
147  G4KaonPlus::KaonPlusDefinition();
148  G4KaonMinus::KaonMinusDefinition();
149 
150  // barions
151  G4Proton::Proton();
152  G4AntiProton::AntiProton();
153 
154  // ions
155  G4Deuteron::Deuteron();
156  G4Triton::Triton();
157  G4He3::He3();
158  G4Alpha::Alpha();
159  G4GenericIon::GenericIonDefinition();
160  }
161 
162  //-----------------------------------------------------------
164  {
165 
166  const detinfo::LArProperties* larp = lar::providerFrom<detinfo::LArPropertiesService>();
167  const detinfo::DetectorProperties* detp = lar::providerFrom<detinfo::DetectorPropertiesService>();
168 
169  // Add standard EM Processes
170  LOG_DEBUG("OpticalPhysics") << "PROCESSES BEING CONSTRUCTED IN OPTICAL PHYSICS";
171 
172  fTheCerenkovProcess = new G4Cerenkov("Cerenkov");
173  fTheScintillationProcess = new G4Scintillation("Scintillation");
174  fTheAbsorptionProcess = new G4OpAbsorption();
175  fTheRayleighScatteringProcess = new G4OpRayleigh();
176  if(detp->SimpleBoundary())
178  else
179  fTheBoundaryProcess_g4 = new G4OpBoundaryProcess();
180  fTheWLSProcess = new G4OpWLS();
181 
182 
183 
184  fTheCerenkovProcess->SetMaxNumPhotonsPerStep(700);
185  fTheCerenkovProcess->SetMaxBetaChangePerStep(10.0);
186  fTheCerenkovProcess->SetTrackSecondariesFirst(false);
187 
188  fTheScintillationProcess->SetScintillationYieldFactor(1.);
189  fTheScintillationProcess->SetTrackSecondariesFirst(false);
190 
191  // Use Birks Correction in the Scintillation process
192 
193  G4EmSaturation* emSaturation = G4LossTableManager::Instance()->EmSaturation();
194  fTheScintillationProcess->AddSaturation(emSaturation);
195 
196 
197  bool CerenkovLightEnabled = larp->CerenkovLightEnabled();
198 
199  mf::LogInfo("OpticalPhysics")<<"Cerenkov light enabled : " << CerenkovLightEnabled;
200  static G4ParticleTable* fParticleTable = G4ParticleTable::GetParticleTable();
201  G4ParticleTable::G4PTblDicIterator* aParticleIterator;
202  aParticleIterator=fParticleTable->GetIterator();
203 
204  aParticleIterator->reset();
205  while( (*aParticleIterator)() ){
206  G4ParticleDefinition* particle = aParticleIterator->value();
207  G4ProcessManager* pmanager = particle->GetProcessManager();
208  G4String particleName = particle->GetParticleName();
209  if (fTheCerenkovProcess->IsApplicable(*particle)&&CerenkovLightEnabled) {
210  pmanager->AddProcess(fTheCerenkovProcess);
211  pmanager->SetProcessOrdering(fTheCerenkovProcess,idxPostStep);
212  // mf::LogInfo("OpticalPhysics")<<"OpticalPhysics : Cerenkov applicable : " << particleName;
213  }
214  if (fTheScintillationProcess->IsApplicable(*particle)) {
215  pmanager->AddProcess(fTheScintillationProcess);
216  pmanager->SetProcessOrderingToLast(fTheScintillationProcess, idxAtRest);
217  pmanager->SetProcessOrderingToLast(fTheScintillationProcess, idxPostStep);
218  // mf::LogInfo("OpticalPhysics")<<"OpticalPhysics : Scintillation applicable : " << particleName;
219  }
220 
221  if (particleName == "opticalphoton") {
222  mf::LogInfo("OpticalPhysics") << " AddDiscreteProcess to OpticalPhoton ";
223  pmanager->AddDiscreteProcess(fTheAbsorptionProcess);
224  pmanager->AddDiscreteProcess(fTheRayleighScatteringProcess);
225  if(detp->SimpleBoundary())
226  pmanager->AddDiscreteProcess(fTheBoundaryProcess);
227  else
228  pmanager->AddDiscreteProcess(fTheBoundaryProcess_g4);
229  pmanager->AddDiscreteProcess(fTheWLSProcess);
230  }
231  }
232 
233  }
234 }
235 
236 #endif
virtual bool CerenkovLightEnabled() const =0
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
CustomPhysicsFactory< OpticalPhysics > optical_factory("Optical")
Geant4 interface.
Discrete process for reflection and diffusion at optical interfaces.
OpticalPhysics(G4int ver=0, const G4String &name="G4Optical")
OpBoundaryProcessSimple * fTheBoundaryProcess
G4Cerenkov * fTheCerenkovProcess
G4OpBoundaryProcess * fTheBoundaryProcess_g4
virtual void ConstructParticle()
#define LOG_DEBUG(id)
G4OpAbsorption * fTheAbsorptionProcess
virtual void ConstructProcess()
G4OpRayleigh * fTheRayleighScatteringProcess
G4Scintillation * fTheScintillationProcess