9#include <beast/srsensor/simulation/SensitiveDetector.h>
10#include <beast/srsensor/dataobjects/SrsensorSimHit.h>
12#include <framework/datastore/StoreArray.h>
13#include <framework/datastore/RelationArray.h>
27 Simulation::SensitiveDetectorBase(
"SrsensorSensitiveDetector",
Const::invalidDetector)
49 const G4Track& track = *
step->GetTrack();
50 const int trackID = track.GetTrackID();
51 const double depEnergy =
step->GetTotalEnergyDeposit() * CLHEP::MeV;
52 const double nielEnergy =
step->GetNonIonizingEnergyDeposit() * CLHEP::MeV;
53 const G4ThreeVector G4tkPos =
step->GetTrack()->GetPosition();
55 tkPos[0] = G4tkPos.x() * CLHEP::cm;
56 tkPos[1] = G4tkPos.y() * CLHEP::cm;
57 tkPos[2] = G4tkPos.z() * CLHEP::cm;
58 const G4ThreeVector G4tkMom =
step->GetTrack()->GetMomentum();
60 tkMom[0] = G4tkMom.x() * CLHEP::MeV;
61 tkMom[1] = G4tkMom.y() * CLHEP::MeV;
62 tkMom[2] = G4tkMom.z() * CLHEP::MeV;
63 const G4ThreeVector G4tkMomDir =
step->GetTrack()->GetMomentumDirection();
65 tkMomDir[0] = G4tkMomDir.x() * CLHEP::MeV;
66 tkMomDir[1] = G4tkMomDir.y() * CLHEP::MeV;
67 tkMomDir[2] = G4tkMomDir.z() * CLHEP::MeV;
68 const int tkPDG =
step->GetTrack()->GetDefinition()->GetPDGEncoding();
69 const double tkKEnergy =
step->GetTrack()->GetKineticEnergy();
70 const int detNb =
step->GetTrack()->GetVolume()->GetCopyNo();
71 const double GlTime =
step->GetPreStepPoint()->GetGlobalTime();
73 if (depEnergy < CLHEP::eV)
return false;
95 relMCSimHit.
add(trackID, hit->getArrayIndex(), 1.0);
This class provides a set of constants for the framework.
Low-level class to create/modify relations between StoreArrays.
void add(index_type from, index_type to, weight_type weight=1.0)
Add a new element to the relation.
static void registerMCParticleRelation(const std::string &name, RelationArray::EConsolidationAction ignoreAction=RelationArray::c_negativeWeight)
Register an relation involving MCParticles.
ClassSrsensorSimHit - Geant4 simulated hit for the Srsensor detector.
bool registerInDataStore(DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut)
Register the object/array in the DataStore.
Accessor to arrays stored in the data store.
T * appendNew()
Construct a new T object at the end of the array.
SensitiveDetector()
Constructor.
bool step(G4Step *step, G4TouchableHistory *) override
Step processing method.
Abstract base class for different kinds of events.