13 #include "messagefacility/MessageLogger/MessageLogger.h"
15 #include "CLHEP/Evaluator/Evaluator.h"
22 HepTool::Evaluator eval;
24 eval.setSystemOfUnits();
26 const std::string scaleExpression =
"MeV / " + energyUnitsScale;
59 std::vector<unsigned int> AuxDetChanNumber;
60 AuxDetChanNumber.reserve(
size(InputHitVector));
63 for(
auto const&
hit : InputHitVector)
66 std::vector<unsigned int>::iterator Chanitr
67 = std::find(AuxDetChanNumber.begin(), AuxDetChanNumber.end(),
hit.GetID());
69 if(Chanitr == AuxDetChanNumber.end()){
71 AuxDetChanNumber.push_back(
hit.GetID());
76 return AuxDetChanNumber;
84 std::vector<sim::AuxDetIDE> IDEvector;
87 size_t ad_id_no = 9999;
88 size_t ad_sen_id_no = 9999;
90 for (
auto const& auxDetHit : InputHitVector)
93 double xcoordinate = (auxDetHit.GetEntryX() + auxDetHit.GetExitX())/2.0;
94 double ycoordinate = (auxDetHit.GetEntryY() + auxDetHit.GetExitY())/2.0;
95 double zcoordinate = (auxDetHit.GetEntryZ() + auxDetHit.GetExitZ())/2.0;
96 double worldPos[3] = {xcoordinate,ycoordinate,zcoordinate};
98 if(auxDetHit.GetID() == inputchannel)
101 fGeo->FindAuxDetSensitiveAtPosition(worldPos, ad_id_no, ad_sen_id_no, 0.0001);
103 mf::LogDebug(
"GenericCRTUtility") <<
"Found an AuxDetHit with ID " << auxDetHit.GetID()
104 <<
" for AuxDet ID " << ad_id_no
105 <<
" Sens ID " << ad_sen_id_no << std::endl;
107 auto tempIDE = toAuxDetIDE(auxDetHit);
109 std::vector<sim::AuxDetIDE>::iterator IDEitr
110 = std::find(IDEvector.begin(), IDEvector.end(), tempIDE);
112 if(IDEitr != IDEvector.end()){
114 IDEitr->energyDeposited += tempIDE.energyDeposited;
115 IDEitr->exitX = tempIDE.exitX;
116 IDEitr->exitY = tempIDE.exitY;
117 IDEitr->exitZ = tempIDE.exitZ;
118 IDEitr->exitT = tempIDE.exitT;
119 IDEitr->exitMomentumX = tempIDE.exitMomentumX;
120 IDEitr->exitMomentumY = tempIDE.exitMomentumY;
121 IDEitr->exitMomentumZ = tempIDE.exitMomentumZ;
124 IDEvector.push_back(std::move(tempIDE));
133 mf::LogDebug(
"GenericCRTUtility") <<
"Returning AuxDetSimChannel for ID "
134 << ad_id_no <<
" " << ad_sen_id_no
135 <<
", with " << IDEvector.size() <<
" IDEs." << std::endl;
147 auto const auxDetChannels = GetAuxDetChannels(InputHitVector);
148 std::vector<sim::AuxDetSimChannel> auxDetVector;
149 auxDetVector.reserve(
size(auxDetChannels));
151 for (
auto const channelNum : auxDetChannels) {
152 auxDetVector.push_back(GetAuxDetSimChannelByNumber(InputHitVector, channelNum));
unsigned int GetTrackID() const
sim::AuxDetIDE toAuxDetIDE(sim::AuxDetHit const &InputHit) const
sim::AuxDetSimChannel GetAuxDetSimChannelByNumber(const std::vector< sim::AuxDetHit > &InputHitVector, unsigned int inputchannel) const
int trackID
Geant4 supplied track ID.
float exitMomentumZ
Exit Z-Momentum of particle.
std::vector< unsigned int > GetAuxDetChannels(const std::vector< sim::AuxDetHit > &InputHitVector) const
std::size_t size(FixedBins< T, C > const &) noexcept
float GetExitMomentumY() const
float exitY
Exit position Y of particle.
Collection of particles crossing one auxiliary detector cell.
float entryT
Entry time of particle.
std::vector< sim::AuxDetSimChannel > GetAuxDetSimChannels(const std::vector< sim::AuxDetHit > &InputHitVector) const
float exitMomentumX
Exit X-Momentum of particle.
GenericCRTUtility(const std::string energyUnitsScale)
float exitT
Exit time of particle.
float GetEnergyDeposited() const
float exitZ
Exit position Z of particle.
float entryZ
Entry position Z of particle.
float exitX
Exit position X of particle.
float energyDeposited
total energy deposited for this track ID and time
float entryX
Entry position X of particle.
float entryY
Entry position Y of particle.
float GetExitMomentumX() const
MC truth information to make RawDigits and do back tracking.
float exitMomentumY
Exit Y-Momentum of particle.
float GetExitMomentumZ() const