23 #include "TPolyMarker3D.h" 73 if (!mcParticleHandle.
isValid())
return;
76 using TrackToMcParticleMap = std::map<int, const simb::MCParticle*>;
78 TrackToMcParticleMap trackToMcParticleMap;
80 for (
const auto& mcParticle : *mcParticleHandle)
81 trackToMcParticleMap[mcParticle.TrackId()] = &mcParticle;
92 if (simEnergyDepositHandle.
isValid() && simEnergyDepositHandle->size() > 0) {
94 <<
"Starting loop over " << simEnergyDepositHandle->size() <<
" SimEnergyDeposits, " 100 using MCPartToSimEnergyMap =
101 std::map<const simb::MCParticle*, std::vector<const sim::SimEnergyDeposit*>>;
103 MCPartToSimEnergyMap mcPartToSimEnergyMap;
106 for (
const auto& simEnergyDeposit : *simEnergyDepositHandle) {
108 trackToMcParticleMap.find(simEnergyDeposit.TrackID());
110 if (trackMCItr == trackToMcParticleMap.end())
continue;
112 mcPartToSimEnergyMap[trackMCItr->second].push_back(&simEnergyDeposit);
117 std::map<int, std::vector<sim::SimEnergyDeposit::Point_t>> colorToPositionMap;
120 for (
const auto& mcPartToSimEnergy : mcPartToSimEnergyMap) {
124 double g4Ticks(clockData.TPCG4Time2Tick(mcPartToSimEnergy.first->T()) -
127 double xPosMinTick(0.);
128 double xPosMaxTick(std::numeric_limits<double>::max());
130 for (
const auto& simEnergyDeposit : mcPartToSimEnergy.second) {
140 xPosMinTick = detProp.ConvertTicksToX(0, planeID);
141 xPosMaxTick = detProp.ConvertTicksToX(detProp.NumberTimeSamples(), planeID);
142 xOffset = detProp.ConvertTicksToX(g4Ticks, planeID) - xPosMinTick;
144 if (xPosMaxTick < xPosMinTick) std::swap(xPosMinTick, xPosMaxTick);
156 for (
const auto& pair : colorToPositionMap) {
157 int colorIdx(pair.first);
158 int markerIdx(kFullDotMedium);
161 TPolyMarker3D& pm = view->
AddPolyMarker3D(1, colorIdx, markerIdx, markerSize);
164 std::vector<double> posArrayVec;
167 posArrayVec.resize(3 * pair.second.size());
169 for (
const auto& point : pair.second) {
170 posArrayVec[3 * hitCount] = point.X();
171 posArrayVec[3 * hitCount + 1] = point.Y();
172 posArrayVec[3 * hitCount + 2] = point.Z();
176 pm.SetPolyMarker(hitCount, posArrayVec.data(), markerIdx);
195 if (simEnergyDepositHandle.
isValid() && simEnergyDepositHandle->size() > 0) {
197 <<
"Starting loop over " << simEnergyDepositHandle->size() <<
" SimEnergyDeposits, " 201 auto const clockData =
209 std::map<int, std::vector<sim::SimEnergyDeposit::Point_t>> colorToPositionMap;
212 for (
const auto& simEnergyDeposit : *simEnergyDepositHandle) {
218 double depTime = simEnergyDeposit.T();
221 double g4Ticks = clockData.TPCG4Time2Tick(depTime) -
trigger_offset(clockData);
222 double xPosMinTick = detProp.ConvertTicksToX(0, planeID);
223 double xOffset = detProp.ConvertTicksToX(g4Ticks, planeID) - xPosMinTick;
234 for (
const auto& pair : colorToPositionMap) {
235 int colorIdx(pair.first);
236 int markerIdx(kFullDotMedium);
239 TPolyMarker3D& pm = view->
AddPolyMarker3D(1, colorIdx, markerIdx, markerSize);
242 std::vector<double> posArrayVec;
245 posArrayVec.resize(3 * pair.second.size());
247 for (
const auto& point : pair.second) {
248 posArrayVec[3 * hitCount] = point.X();
249 posArrayVec[3 * hitCount + 1] = point.Y();
250 posArrayVec[3 * hitCount + 2] = point.Z();
254 pm.SetPolyMarker(hitCount, posArrayVec.data(), markerIdx);
The data type to uniquely identify a Plane.
art::InputTag fG4ModuleLabel
module label producing sim::SimChannel objects
bool isValid() const noexcept
T get(std::string const &key) const
static int ColorFromPDG(int pdgcode)
The data type to uniquely identify a TPC.
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
MaybeLogger_< ELseverityLevel::ELsev_success, false > LogDebug
contains information for a single step in the detector simulation
int trigger_offset(DetectorClocksData const &data)
A collection of 3D drawable objects.
TPCID PositionToTPCID(Point_t const &point) const
Returns the ID of the TPC at specified location.
art framework interface to geometry description
TPolyMarker3D & AddPolyMarker3D(int n, int c, int st, double sz)
art::InputTag fSimEnergyLabel
Also for SimEnergyDeposits.