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  //-----------------------------------------------------------
93  void
95  {
96  MF_LOG_DEBUG("OpticalPhysics") << "PARTICLES BEING CONSTRUCTED IN OPTICAL PHYSICS";
97  // optical photon
98  G4OpticalPhoton::OpticalPhotonDefinition();
99 
100  // gamma
101  G4Gamma::Gamma();
102 
103  // leptons
104  G4Electron::Electron();
105  G4Positron::Positron();
106  G4MuonPlus::MuonPlus();
107  G4MuonMinus::MuonMinus();
108 
109  // mesons
110  G4PionPlus::PionPlusDefinition();
111  G4PionMinus::PionMinusDefinition();
112  G4KaonPlus::KaonPlusDefinition();
113  G4KaonMinus::KaonMinusDefinition();
114 
115  // barions
116  G4Proton::Proton();
117  G4AntiProton::AntiProton();
118 
119  // ions
120  G4Deuteron::Deuteron();
121  G4Triton::Triton();
122  G4He3::He3();
123  G4Alpha::Alpha();
124  G4GenericIon::GenericIonDefinition();
125  }
126 
127  //-----------------------------------------------------------
128  void
130  {
131  const detinfo::LArProperties* larp = lar::providerFrom<detinfo::LArPropertiesService>();
132 
133  // Add standard EM Processes
134  MF_LOG_DEBUG("OpticalPhysics") << "PROCESSES BEING CONSTRUCTED IN OPTICAL PHYSICS";
135 
136  fTheCerenkovProcess = new G4Cerenkov("Cerenkov");
137  fTheScintillationProcess = new G4Scintillation("Scintillation");
138  fTheAbsorptionProcess = new G4OpAbsorption();
139  fTheRayleighScatteringProcess = new G4OpRayleigh();
140  if (fSimpleBoundary)
142  else
143  fTheBoundaryProcess_g4 = new G4OpBoundaryProcess();
144  fTheWLSProcess = new G4OpWLS();
145 
146  fTheCerenkovProcess->SetMaxNumPhotonsPerStep(700);
147  fTheCerenkovProcess->SetMaxBetaChangePerStep(10.0);
148  fTheCerenkovProcess->SetTrackSecondariesFirst(false);
149 
150  fTheScintillationProcess->SetScintillationYieldFactor(1.);
151  fTheScintillationProcess->SetTrackSecondariesFirst(false);
152 
153  // Use Birks Correction in the Scintillation process
154 
155  G4EmSaturation* emSaturation = G4LossTableManager::Instance()->EmSaturation();
156  fTheScintillationProcess->AddSaturation(emSaturation);
157 
158  bool CerenkovLightEnabled = larp->CerenkovLightEnabled();
159 
160  mf::LogInfo("OpticalPhysics") << "Cerenkov light enabled : " << CerenkovLightEnabled;
161  static G4ParticleTable* fParticleTable = G4ParticleTable::GetParticleTable();
162  G4ParticleTable::G4PTblDicIterator* aParticleIterator;
163  aParticleIterator = fParticleTable->GetIterator();
164 
165  aParticleIterator->reset();
166  while ((*aParticleIterator)()) {
167  G4ParticleDefinition* particle = aParticleIterator->value();
168  G4ProcessManager* pmanager = particle->GetProcessManager();
169  G4String particleName = particle->GetParticleName();
170  if (fTheCerenkovProcess->IsApplicable(*particle) && CerenkovLightEnabled) {
171  pmanager->AddProcess(fTheCerenkovProcess);
172  pmanager->SetProcessOrdering(fTheCerenkovProcess, idxPostStep);
173  }
174  if (fTheScintillationProcess->IsApplicable(*particle)) {
175  pmanager->AddProcess(fTheScintillationProcess);
176  pmanager->SetProcessOrderingToLast(fTheScintillationProcess, idxAtRest);
177  pmanager->SetProcessOrderingToLast(fTheScintillationProcess, idxPostStep);
178  }
179 
180  if (particleName == "opticalphoton") {
181  mf::LogInfo("OpticalPhysics") << " AddDiscreteProcess to OpticalPhoton ";
182  pmanager->AddDiscreteProcess(fTheAbsorptionProcess);
183  pmanager->AddDiscreteProcess(fTheRayleighScatteringProcess);
184  if (fSimpleBoundary)
185  pmanager->AddDiscreteProcess(fTheBoundaryProcess);
186  else
187  pmanager->AddDiscreteProcess(fTheBoundaryProcess_g4);
188  pmanager->AddDiscreteProcess(fTheWLSProcess);
189  }
190  }
191  }
192 }
virtual bool CerenkovLightEnabled() const =0
static QCString name
Definition: declinfo.cpp:673
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