9#include <beast/qcsmonitor/simulation/SensitiveDetector.h>
10#include <beast/qcsmonitor/dataobjects/QcsmonitorSimHit.h>
12#include <framework/datastore/StoreArray.h>
13#include <framework/datastore/RelationArray.h>
17#include <G4Version.hh>
25 namespace qcsmonitor {
28 Simulation::SensitiveDetectorBase(
"QcsmonitorSensitiveDetector",
Const::invalidDetector)
64#if G4VERSION_NUMBER < 1010
79 const G4StepPoint& preStep = *
step->GetPreStepPoint();
80 const G4StepPoint& postStep = *
step->GetPostStepPoint();
82 G4Track& track = *
step->GetTrack();
99 const double depEnergy =
step->GetTotalEnergyDeposit() ;
101 step->GetStepLength(), depEnergy, 0.);
116 if (track.GetNextVolume() != track.GetVolume() || track.GetTrackStatus() >= fStopAndKill) {
117 int pdgCode = track.GetDefinition()->GetPDGEncoding();
125 m_cellID = track.GetVolume()->GetCopyNo();
148 ROOT::Math::XYZVector posAve)
157 RelationArray qcsmonitorSimHitRel(mcParticles, QcsmonitorHits);
158 ROOT::Math::XYZVector momentum(mom.getX() / CLHEP::GeV, mom.getY() / CLHEP::GeV, mom.getZ() / CLHEP::GeV);
159 QcsmonitorHits.
appendNew(cellId, trackID, pid, tof / CLHEP::ns, edep / CLHEP::GeV, momentum, posAve);
160 int simhitNumber = QcsmonitorHits.
getEntries() - 1;
161 B2DEBUG(150,
"HitNumber: " << simhitNumber);
162 qcsmonitorSimHitRel.
add(trackID, simhitNumber);
163 return (simhitNumber);
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.
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.
int getEntries() const
Get the number of objects in the array.
int m_thetaID
The current phi ID in an event.
double m_energyDeposit
particle energy at the entrance in volume
int m_EvnetNumber
The current number of created hits in an event.
int saveSimHit(const G4int cellId, const G4int trackID, const G4int pid, const G4double tof, const G4double edep, G4ThreeVector mom, ROOT::Math::XYZVector WightedPos)
Save QcsmonitorSimHit into datastore.
int TimeIndex
Hit Energy of StoreArray.
int m_trackID
The current number of created hits in an event.
int m_hitNum
members of SensitiveDetector
int firstcall
flight time to diode sensor
double m_endTime
global time
double T_ave
position alongthe vector of crystal axis
double local_pos
vector of crystal axis
double m_WightedTime
global time
G4ThreeVector m_momentum
Wighted step Position.
int m_cellID
The current theta ID in an event.
double m_startEnergy
global time
double m_startTime
momentum of track
G4EmSaturation * saturationEngine
The current cellID in an event.
int iECLCell
length of the track in the volume
double m_trackLength
energy deposited in volume
int m_oldEvnetNumber
The current number of created hits in an event.
G4ThreeVector m_startPos
track id
ROOT::Math::XYZVector m_WightedPos
Position of poststep.
~SensitiveDetector()
Destructor.
G4ThreeVector m_endPos
Position of prestep.
SensitiveDetector()
Constructor.
int m_phiID
flag of first call
bool step(G4Step *step, G4TouchableHistory *) override
Step processing method.
Abstract base class for different kinds of events.