7 #include <sevt/PMTSimData.h>
8 #include <sevt/SEvent.h>
9 #include <sevt/Station.h>
10 #include <sevt/StationSimData.h>
12 #include <det/Detector.h>
13 #include <sdet/SDetector.h>
15 #include <utl/ErrorLogger.h>
16 #include <utl/Particle.h>
17 #include <utl/ParticleCases.h>
18 #include <utl/Trace.h>
21 #include <fwk/RandomEngineRegistry.h>
22 #include <fwk/RunController.h>
25 #include <G4HCofThisEvent.hh>
26 #include <G4SDManager.hh>
28 #include <G4TouchableHistory.hh>
30 #include <G4Trajectory.hh>
31 #include <G4TrajectoryContainer.hh>
32 #include <G4VHitsCollection.hh>
44 namespace G4StationSimulatorOG {
46 G4TankPMTAction::G4TankPMTAction(
const G4String& name,
const int pmtIndex) :
47 G4VSensitiveDetector(name),
53 if (pmtIndex < 1 || pmtIndex > 5) {
54 FATAL(
"G4PMTAction() : invalid PMT index.");
73 const double energy = step->GetPreStepPoint()->GetKineticEnergy() * (
utl::MeV /
CLHEP::MeV);
78 if (station.GetSimData().GetSimulatorSignature() ==
"G4StationSimulatorFullTrackOG") {
85 if (energy < qeff.XFront() || energy > qeff.XBack())
88 const double eff = pmt.GetCollectionEfficiency() * qeff.
InterpolateY(energy, 1);
89 const auto rand = &RandomEngineRegistry::GetInstance().Get(RandomEngineRegistry::eDetector).GetEngine();
90 if (CLHEP::RandFlat::shoot(rand, 0, 1) > eff)
99 if (dStation.HasSmallPMT()) {
101 const auto& pmt = dStation.GetPMT(
fPMTIndex);
102 const auto& qeff = pmt.GetQuantumEfficiency();
103 if (energy < qeff.XFront() || energy > qeff.XBack())
105 const double eff = pmt.GetCollectionEfficiency() * qeff.InterpolateY(energy, 1);
107 const auto& pmtLarge = dStation.GetPMT(1);
108 const double effLarge =
109 pmtLarge.GetCollectionEfficiency() * pmtLarge.GetQuantumEfficiency().InterpolateY(energy, 1);
110 const auto& pmtSmall = dStation.GetPMT(4);
111 const double effSmall =
112 pmtSmall.GetCollectionEfficiency() * pmtSmall.GetQuantumEfficiency().InterpolateY(energy, 1);
113 const double effMax =
std::max(effSmall, effLarge);
117 const auto rand = &RandomEngineRegistry::GetInstance().Get(RandomEngineRegistry::eDetector).GetEngine();
118 if (effMax * CLHEP::RandFlat::shoot(rand, 0, 1) > eff)
void AddPhoton(const int nPMT, const double peTime) const
peTime in Auger units!
G4StationSimulator & fG4StationSimulator
sevt::Station & GetEventStation() const
#define FATAL(message)
Macro for logging fatal messages.
const PMT & GetPMT(const int id) const
Get specified PMT by id.
const sdet::Station & GetDetectorStation() const
static int GetCurrentParticleId()
Auger Software Run Control.
double InterpolateY(const double x, const unsigned int polyDegree) const
Interpolate the Y value with a polyDegree polynomial.
class that handles Geant4 SD Station simulation adopted from G4TankSimulator
const utl::TabulatedFunction & GetQuantumEfficiency() const
Quantum efficiency.
struct particle_info particle[80]
G4bool ProcessHits(G4Step *const step, G4TouchableHistory *const rOHist) override