8 #include <utl/ErrorLogger.h>
9 #include <utl/RandomEngine.h>
11 #include <fwk/RandomEngineRegistry.h>
12 #include <fwk/RunController.h>
15 #include <G4HCofThisEvent.hh>
16 #include <G4SDManager.hh>
18 #include <G4TouchableHistory.hh>
20 #include <G4Trajectory.hh>
21 #include <G4TrajectoryContainer.hh>
22 #include <G4VHitsCollection.hh>
24 #include <CLHEP/Random/RandPoisson.h>
25 #include <CLHEP/Random/RandExponential.h>
27 #include <utl/AugerUnits.h>
28 #include <utl/PhysicalConstants.h>
29 #include <G4SystemOfUnits.hh>
30 #include <G4ThreeVector.hh>
38 using CLHEP::RandPoisson;
39 using CLHEP::RandExponential;
42 namespace G4StationSimulatorOG {
44 G4ScintillatorAction::G4ScintillatorAction(
const G4String& name) :
45 G4VSensitiveDetector(name),
75 const double time = step->GetPreStepPoint()->GetGlobalTime() * (
utl::ns /
CLHEP::ns);
86 const double refEnergy = scin.GetReferenceEnergy();
89 const double attLength = scin.GetAttenuationLength();
90 const double barLeakExpCoeff = scin.GetBarLeakageExpCoefficient();
91 const double barLeakMaxRatio = scin.GetBarLeakageMaxRatio();
94 const double effRefractiveIndex = scin.GetEffectiveRefractiveIndex();
95 const double fiberExpDecayConst = scin.GetFiberExpDecayConstant();
96 const double barExpDecayConst = scin.GetBarExpDecayConstant();
99 const std::vector<double>& fiberDistances = scin.GetDistancesToPMT(position);
101 const std::pair<double, double>& barDistances = scin.GetDistancesToBarEnds(position);
104 for (
double d : fiberDistances) {
106 const double att = exp(-d / attLength);
108 const double leakInner = 1 - barLeakMaxRatio * exp(-barDistances.first / barLeakExpCoeff);
110 const double leakOuter = 1 - barLeakMaxRatio * exp(-barDistances.second / barLeakExpCoeff);
112 const double npeMean = 0.5 * eDep / refEnergy * refPENumber * att * leakInner * leakOuter;
113 const auto rand = &RandomEngineRegistry::GetInstance().Get(RandomEngineRegistry::eDetector).GetEngine();
114 const unsigned int npe = CLHEP::RandPoisson::shoot(rand, npeMean);
115 for (
unsigned int i = 0; i < npe; ++i) {
116 const double scinDelay = CLHEP::RandExponential::shoot(rand, barExpDecayConst);
117 const double fiberDelay = CLHEP::RandExponential::shoot(rand, fiberExpDecayConst);
119 const double peTime = time + scinDelay + fiberDelay + pathDelay;
void AddPhoton(const int nPMT, const double peTime) const
peTime in Auger units!
Detector description interface for Station-related data.
virtual G4bool ProcessHits(G4Step *const step, G4TouchableHistory *const rOHist) override
const sdet::Station & GetDetectorStation() const
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
Auger Software Run Control.
utl::CoordinateSystemPtr GetLocalCoordinateSystem() const
Get the Auger reference system centered on the tank.
const Scintillator & GetScintillator() const
G4StationSimulator & fG4StationSimulator
constexpr double kSpeedOfLight
double GetReferencePENumber() const
class that handles Geant4 SD Station simulation adopted from G4TankSimulator
bool HasScintillator() const