LArSoft  v09_90_00
Liquid Argon Software toolkit - https://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 
46 
49 
51 
52 #include "Geant4/G4LossTableManager.hh"
53 #include "Geant4/G4ParticleDefinition.hh"
54 #include "Geant4/G4ParticleTable.hh"
55 #include "Geant4/G4ProcessManager.hh"
56 
57 #include "Geant4/G4Alpha.hh"
58 #include "Geant4/G4AntiProton.hh"
59 #include "Geant4/G4Deuteron.hh"
60 #include "Geant4/G4Electron.hh"
61 #include "Geant4/G4Gamma.hh"
62 #include "Geant4/G4GenericIon.hh"
63 #include "Geant4/G4He3.hh"
64 #include "Geant4/G4KaonMinus.hh"
65 #include "Geant4/G4KaonPlus.hh"
66 #include "Geant4/G4MuonMinus.hh"
67 #include "Geant4/G4MuonPlus.hh"
68 #include "Geant4/G4OpticalPhoton.hh"
69 #include "Geant4/G4PionMinus.hh"
70 #include "Geant4/G4PionPlus.hh"
71 #include "Geant4/G4Positron.hh"
72 #include "Geant4/G4Proton.hh"
73 #include "Geant4/G4Triton.hh"
74 
75 #include "Geant4/G4Cerenkov.hh"
76 #include "Geant4/G4OpAbsorption.hh"
77 #include "Geant4/G4OpRayleigh.hh"
78 #include "Geant4/G4OpWLS.hh"
79 
80 namespace larg4 {
81 
82  //-----------------------------------------------------------
83  FastOpticalPhysics::FastOpticalPhysics(G4int /*verbose*/, const G4String& name)
84  : G4VPhysicsConstructor(name)
85  {
86  G4LossTableManager::Instance();
87  mf::LogInfo("FastOpticalPhysics") << "OBJECT BEING CONSTRUCTED IN OPTICAL PHYSICS";
88  }
89 
90  //-----------------------------------------------------------
92  {
93  MF_LOG_DEBUG("FastOpticalPhysics") << "PARTICLES BEING CONSTRUCTED IN FAST OPTICAL PHYSICS";
94  // optical photon
95  G4OpticalPhoton::OpticalPhotonDefinition();
96 
97  // gamma
98  G4Gamma::Gamma();
99 
100  // leptons
101  G4Electron::Electron();
102  G4Positron::Positron();
103  G4MuonPlus::MuonPlus();
104  G4MuonMinus::MuonMinus();
105 
106  // mesons
107  G4PionPlus::PionPlusDefinition();
108  G4PionMinus::PionMinusDefinition();
109  G4KaonPlus::KaonPlusDefinition();
110  G4KaonMinus::KaonMinusDefinition();
111 
112  // barions
113  G4Proton::Proton();
114  G4AntiProton::AntiProton();
115 
116  // ions
117  G4Deuteron::Deuteron();
118  G4Triton::Triton();
119  G4He3::He3();
120  G4Alpha::Alpha();
121  G4GenericIon::GenericIonDefinition();
122  }
123 
124  //-----------------------------------------------------------
126  {
127  // Add standard EM Processes
128  MF_LOG_DEBUG("FastOpticalPhysics") << "PROCESSES BEING CONSTRUCTED IN OPTICAL PHYSICS";
129 
130  fTheCerenkovProcess = new G4Cerenkov("Cerenkov");
131  fTheAbsorptionProcess = new G4OpAbsorption();
132  fTheRayleighScatteringProcess = new G4OpRayleigh();
134  fTheWLSProcess = new G4OpWLS();
135  fTheScintillationProcess = std::make_unique<OpFastScintillation>("FastScintillation");
136 
137  fTheCerenkovProcess->SetMaxNumPhotonsPerStep(700);
138  fTheCerenkovProcess->SetMaxBetaChangePerStep(10.0);
139  fTheCerenkovProcess->SetTrackSecondariesFirst(false);
140 
141  const detinfo::LArProperties* larp = lar::providerFrom<detinfo::LArPropertiesService>();
142  bool CerenkovEnabled = larp->CerenkovLightEnabled();
143 
144  mf::LogInfo("FastOpticalPhysics") << "Cerenkov enabled : " << CerenkovEnabled;
145  static G4ParticleTable* fParticleTable = G4ParticleTable::GetParticleTable();
146  G4ParticleTable::G4PTblDicIterator* aParticleIterator;
147  aParticleIterator = fParticleTable->GetIterator();
148  aParticleIterator->reset();
149  while ((*aParticleIterator)()) {
150  G4ParticleDefinition* particle = aParticleIterator->value();
151  G4ProcessManager* pmanager = particle->GetProcessManager();
152  G4String particleName = particle->GetParticleName();
153 
154  if (fTheCerenkovProcess->IsApplicable(*particle) && CerenkovEnabled) {
155  pmanager->AddProcess(fTheCerenkovProcess);
156  pmanager->SetProcessOrdering(fTheCerenkovProcess, idxPostStep);
157  }
158  if (fTheScintillationProcess->IsApplicable(*particle)) {
159  auto ptr = fTheScintillationProcess.get();
160  pmanager->AddProcess(ptr);
161  pmanager->SetProcessOrderingToLast(ptr, idxAtRest);
162  pmanager->SetProcessOrderingToLast(ptr, idxPostStep);
163  }
164 
165  if (particleName == "opticalphoton") {
166  mf::LogInfo("FastOptical") << " AddDiscreteProcess to OpticalPhoton ";
167  pmanager->AddDiscreteProcess(fTheAbsorptionProcess);
168  pmanager->AddDiscreteProcess(fTheRayleighScatteringProcess);
169  pmanager->AddDiscreteProcess(fTheBoundaryProcess);
170  pmanager->AddDiscreteProcess(fTheWLSProcess);
171  }
172  }
173  }
174 }
virtual bool CerenkovLightEnabled() const =0
Utilities related to art service access.
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
G4OpAbsorption * fTheAbsorptionProcess
Geant4 interface.
Discrete process for reflection and diffusion at optical interfaces.
std::unique_ptr< OpFastScintillation > fTheScintillationProcess
OpBoundaryProcessSimple * fTheBoundaryProcess
G4OpRayleigh * fTheRayleighScatteringProcess
FastOpticalPhysics(G4int ver=0, const G4String &name="FastOptical")
#define MF_LOG_DEBUG(id)