LArSoft  v09_90_00
Liquid Argon Software toolkit - https://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 
42 #include "Geant4/G4Alpha.hh"
43 #include "Geant4/G4AntiProton.hh"
44 #include "Geant4/G4Cerenkov.hh"
45 #include "Geant4/G4Deuteron.hh"
46 #include "Geant4/G4Electron.hh"
47 #include "Geant4/G4Gamma.hh"
48 #include "Geant4/G4GenericIon.hh"
49 #include "Geant4/G4He3.hh"
50 #include "Geant4/G4KaonMinus.hh"
51 #include "Geant4/G4KaonPlus.hh"
52 #include "Geant4/G4LossTableManager.hh"
53 #include "Geant4/G4MuonMinus.hh"
54 #include "Geant4/G4MuonPlus.hh"
55 #include "Geant4/G4OpAbsorption.hh"
56 #include "Geant4/G4OpBoundaryProcess.hh"
57 #include "Geant4/G4OpRayleigh.hh"
58 #include "Geant4/G4OpWLS.hh"
59 #include "Geant4/G4OpticalPhoton.hh"
60 #include "Geant4/G4ParticleDefinition.hh"
61 #include "Geant4/G4ParticleTable.hh"
62 #include "Geant4/G4PionMinus.hh"
63 #include "Geant4/G4PionPlus.hh"
64 #include "Geant4/G4Positron.hh"
65 #include "Geant4/G4ProcessManager.hh"
66 #include "Geant4/G4Proton.hh"
67 #include "Geant4/G4Scintillation.hh"
68 #include "Geant4/G4Triton.hh"
69 
77 
78 //Register optical physics in custom physics list
79 
80 namespace larg4 {
81 
82  //-----------------------------------------------------------
84  G4int const /*ver*/,
85  G4String const& name)
86  : G4VPhysicsConstructor(name), fSimpleBoundary{detProp.SimpleBoundary()}
87  {
88  G4LossTableManager::Instance();
89  mf::LogInfo("OpticalPhysics") << "OBJECT BEING CONSTRUCTED IN OPTICAL PHYSICS";
90  }
91 
92  //-----------------------------------------------------------
94  {
95  MF_LOG_DEBUG("OpticalPhysics") << "PARTICLES BEING CONSTRUCTED IN OPTICAL PHYSICS";
96  // optical photon
97  G4OpticalPhoton::OpticalPhotonDefinition();
98 
99  // gamma
100  G4Gamma::Gamma();
101 
102  // leptons
103  G4Electron::Electron();
104  G4Positron::Positron();
105  G4MuonPlus::MuonPlus();
106  G4MuonMinus::MuonMinus();
107 
108  // mesons
109  G4PionPlus::PionPlusDefinition();
110  G4PionMinus::PionMinusDefinition();
111  G4KaonPlus::KaonPlusDefinition();
112  G4KaonMinus::KaonMinusDefinition();
113 
114  // barions
115  G4Proton::Proton();
116  G4AntiProton::AntiProton();
117 
118  // ions
119  G4Deuteron::Deuteron();
120  G4Triton::Triton();
121  G4He3::He3();
122  G4Alpha::Alpha();
123  G4GenericIon::GenericIonDefinition();
124  }
125 
126  //-----------------------------------------------------------
128  {
129  const detinfo::LArProperties* larp = lar::providerFrom<detinfo::LArPropertiesService>();
130 
131  // Add standard EM Processes
132  MF_LOG_DEBUG("OpticalPhysics") << "PROCESSES BEING CONSTRUCTED IN OPTICAL PHYSICS";
133 
134  fTheCerenkovProcess = new G4Cerenkov("Cerenkov");
135  fTheScintillationProcess = new G4Scintillation("Scintillation");
136  fTheAbsorptionProcess = new G4OpAbsorption();
137  fTheRayleighScatteringProcess = new G4OpRayleigh();
138  if (fSimpleBoundary)
140  else
141  fTheBoundaryProcess_g4 = new G4OpBoundaryProcess();
142  fTheWLSProcess = new G4OpWLS();
143 
144  fTheCerenkovProcess->SetMaxNumPhotonsPerStep(700);
145  fTheCerenkovProcess->SetMaxBetaChangePerStep(10.0);
146  fTheCerenkovProcess->SetTrackSecondariesFirst(false);
147 
148  fTheScintillationProcess->SetScintillationYieldFactor(1.);
149  fTheScintillationProcess->SetTrackSecondariesFirst(false);
150 
151  // Use Birks Correction in the Scintillation process
152 
153  G4EmSaturation* emSaturation = G4LossTableManager::Instance()->EmSaturation();
154  fTheScintillationProcess->AddSaturation(emSaturation);
155 
156  bool CerenkovLightEnabled = larp->CerenkovLightEnabled();
157 
158  mf::LogInfo("OpticalPhysics") << "Cerenkov light enabled : " << CerenkovLightEnabled;
159  static G4ParticleTable* fParticleTable = G4ParticleTable::GetParticleTable();
160  G4ParticleTable::G4PTblDicIterator* aParticleIterator;
161  aParticleIterator = fParticleTable->GetIterator();
162 
163  aParticleIterator->reset();
164  while ((*aParticleIterator)()) {
165  G4ParticleDefinition* particle = aParticleIterator->value();
166  G4ProcessManager* pmanager = particle->GetProcessManager();
167  G4String particleName = particle->GetParticleName();
168  if (fTheCerenkovProcess->IsApplicable(*particle) && CerenkovLightEnabled) {
169  pmanager->AddProcess(fTheCerenkovProcess);
170  pmanager->SetProcessOrdering(fTheCerenkovProcess, idxPostStep);
171  }
172  if (fTheScintillationProcess->IsApplicable(*particle)) {
173  pmanager->AddProcess(fTheScintillationProcess);
174  pmanager->SetProcessOrderingToLast(fTheScintillationProcess, idxAtRest);
175  pmanager->SetProcessOrderingToLast(fTheScintillationProcess, idxPostStep);
176  }
177 
178  if (particleName == "opticalphoton") {
179  mf::LogInfo("OpticalPhysics") << " AddDiscreteProcess to OpticalPhoton ";
180  pmanager->AddDiscreteProcess(fTheAbsorptionProcess);
181  pmanager->AddDiscreteProcess(fTheRayleighScatteringProcess);
182  if (fSimpleBoundary)
183  pmanager->AddDiscreteProcess(fTheBoundaryProcess);
184  else
185  pmanager->AddDiscreteProcess(fTheBoundaryProcess_g4);
186  pmanager->AddDiscreteProcess(fTheWLSProcess);
187  }
188  }
189  }
190 }
virtual bool CerenkovLightEnabled() const =0
Utilities related to art service access.
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
Geant4 interface.
void ConstructParticle() override
Discrete process for reflection and diffusion at optical interfaces.
OpBoundaryProcessSimple * fTheBoundaryProcess
G4Cerenkov * fTheCerenkovProcess
G4OpBoundaryProcess * fTheBoundaryProcess_g4
void ConstructProcess() override
#define MF_LOG_DEBUG(id)
OpticalPhysics(detinfo::DetectorPropertiesData const &detProp, G4int ver=0, G4String const &name="G4Optical")
G4OpAbsorption * fTheAbsorptionProcess
G4OpRayleigh * fTheRayleighScatteringProcess
G4Scintillation * fTheScintillationProcess