G4StationStackingAction.cc
Go to the documentation of this file.
2 #include "G4StationSimulator.h"
3 
4 #include <fwk/RandomEngineRegistry.h>
5 #include <fwk/RunController.h>
6 
7 #include <sdet/Station.h>
8 #include <sdet/PMT.h>
9 
10 #include <sevt/SEvent.h>
11 #include <sevt/Station.h>
12 
13 #include <utl/TabulatedFunction.h>
14 
15 #include <G4Track.hh>
16 #include <G4TrackingManager.hh>
17 #include <G4TrackStatus.hh>
18 #include <G4OpticalPhoton.hh>
19 
20 using namespace sdet;
21 using namespace fwk;
22 
23 
24 namespace G4StationSimulatorOG {
25 
26  G4ClassificationOfNewTrack
27  G4StationStackingAction::ClassifyNewTrack(const G4Track* const track)
28  {
29  // NOTE: for now, we assume that each pmt has the same collection
30  // and quantum efficiencies
31 
32  if (track->GetDefinition() != G4OpticalPhoton::OpticalPhoton())
33  return fWaiting; // let G4 handle everything but photons
34 
35  // optical photons at this point
36 
37  const sevt::Station& station = G4StationSimulator::fgCurrent.GetEventStation();
38 
39  // if SimulatorSignature is G4StationSimulatorFullTrackOG, the quantum and
40  // collection efficiencies are taken into account in G4TankPMTAction.cc
41  // (for each PMT type accordingly), ie all photons are tracked by G4 until
42  // they hit one of the PMTs (or get absorbed)
43 
44  const auto signature = station.GetSimData().GetSimulatorSignature();
45  if (signature == "G4StationSimulatorFullTrackOG")
46  return fWaiting; // let G4 handle all the photons
47 
48  // if SimulatorSignature is G4StationSimulatorFullOG randomly kill photons
49  // according to a maximal envelope of the quantum and collection
50  // efficiencies of PMTs to speed up simulation, currently only two
51  // different PMTs: large (id=1) and small (id=4) WCD PMT
52 
53  const double energy = track->GetKineticEnergy() * (utl::MeV / CLHEP::MeV);
54 
55  // large PMT
56  const auto& dStation = G4StationSimulator::fgCurrent.GetDetectorStation();
57  const auto& pmt = dStation.GetPMT(1);
58  const double eff =
59  pmt.GetCollectionEfficiency() * pmt.GetQuantumEfficiency().InterpolateY(energy, 1);
60 
61  const auto rand = &RandomEngineRegistry::GetInstance().Get(RandomEngineRegistry::eDetector).GetEngine();
62  const double keep = CLHEP::RandFlat::shoot(rand, 0, 1);
63 
64  if (!dStation.HasSmallPMT())
65  return (keep > eff) ? fKill : fWaiting;
66 
67  // small PMT
68  const auto& pmtSmall = dStation.GetPMT(4);
69  const double effSmall =
70  pmtSmall.GetCollectionEfficiency() * pmtSmall.GetQuantumEfficiency().InterpolateY(energy, 1);
71 
72  return (keep > std::max(eff, effSmall)) ? fKill : fWaiting;
73  }
74 
75 }
constexpr double MeV
Definition: AugerUnits.h:184
#define max(a, b)
class to hold data at Station level
sevt::StationSimData & GetSimData()
Get simulated data at station level.
const std::string & GetSimulatorSignature() const
Get name of the tank simulator module used to simulate this station.

, generated on Tue Sep 26 2023.