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