G4TankSimulatorOG/G4TankPMTAction.cc
Go to the documentation of this file.
1 #include "G4TankPMTAction.h"
2 #include "G4TankEventAction.h"
3 #include "G4TankSimulator.h"
4 #include "G4TankSteppingAction.h"
5 
6 #include <sevt/PMT.h>
7 #include <sevt/PMTSimData.h>
8 #include <sevt/SEvent.h>
9 #include <sevt/Station.h>
10 #include <sevt/StationSimData.h>
11 
12 #include <utl/ErrorLogger.h>
13 #include <utl/Particle.h>
14 #include <utl/ParticleCases.h>
15 #include <utl/Trace.h>
16 
17 #include <fwk/RunController.h>
18 
19 #include <G4Event.hh>
20 #include <G4HCofThisEvent.hh>
21 #include <G4SDManager.hh>
22 #include <G4Step.hh>
23 #include <G4TouchableHistory.hh>
24 #include <G4Track.hh>
25 #include <G4Trajectory.hh>
26 #include <G4TrajectoryContainer.hh>
27 #include <G4VHitsCollection.hh>
28 
29 #include <iostream>
30 
31 using namespace std;
32 using namespace G4TankSimulatorOG;
33 using namespace sevt;
34 using namespace utl;
35 using namespace fwk;
36 
37 
38 G4TankPMTAction::G4TankPMTAction(const G4String name, const int pmtIndex) :
39  G4VSensitiveDetector(name),
40  fPMTIndex(pmtIndex)
41 {
42  if (fPMTIndex < 1 || fPMTIndex > 3) {
43  FATAL("G4PMTAction() : invalid PMT index.");
44  exit(EXIT_FAILURE);
45  }
46 
48  dynamic_cast<G4TankSimulator*>(&RunController::GetInstance().GetModule("G4TankSimulatorOG"));
49 }
50 
51 
52 G4bool
53 G4TankPMTAction::ProcessHits(G4Step* theStep, G4TouchableHistory* /*R0Hist*/)
54 {
55  const double time = theStep->GetPreStepPoint()->GetGlobalTime();
56 
57  // get current particle from G4TankStepping action.
58  // use to reject hits registered in sensitive volume
59  // in case the particle is not a photon
60  const int currentParticle = G4TankSteppingAction::GetCurrentParticleId();
61 
62  // This is related to bug #156
63  if (time >= 1*utl::second || currentParticle)
64  return true;
65 
67 
68  return true;
69 }
constexpr double second
Definition: AugerUnits.h:145
void AddPhoton(const int nPMT, const double peTime) const
#define FATAL(message)
Macro for logging fatal messages.
Definition: ErrorLogger.h:167
int exit
Definition: dump1090.h:237
class that handles Geant4 SD simulation
G4bool ProcessHits(G4Step *theStep, G4TouchableHistory *R0Hist)

, generated on Tue Sep 26 2023.