20 #include "TPolyLine3D.h" 37 const Eigen::Vector3f&,
38 const Eigen::Vector3f&,
69 if (!mcParticleHandle.
isValid())
return;
72 using TrackToMcParticleMap = std::map<int, const simb::MCParticle*>;
74 TrackToMcParticleMap trackToMcParticleMap;
76 for (
const auto& mcParticle : *mcParticleHandle)
77 trackToMcParticleMap[mcParticle.TrackId()] = &mcParticle;
84 if (simPhotonsHandle.
isValid() && simPhotonsHandle->size() > 0) {
86 <<
"Starting loop over " << simPhotonsHandle->size() <<
" SimPhotons, " << std::endl;
93 using MCPartToOnePhotonMap =
94 std::map<const simb::MCParticle*, std::vector<const sim::OnePhoton*>>;
95 using ChanToMCPartToOnePhotonMap = std::map<int, MCPartToOnePhotonMap>;
97 ChanToMCPartToOnePhotonMap chanToMCPartToOnePhotonMap;
100 for (
const auto& simPhoton : *simPhotonsHandle) {
101 MCPartToOnePhotonMap& mcPartToOnePhotonMap =
102 chanToMCPartToOnePhotonMap[simPhoton.OpChannel()];
104 for (
const auto& onePhoton : simPhoton) {
106 trackToMcParticleMap.find(onePhoton.MotherTrackID);
108 if (trackMCItr == trackToMcParticleMap.end())
continue;
110 mcPartToOnePhotonMap[trackMCItr->second].push_back(&onePhoton);
115 std::map<int, float> channelToEnergyMap;
118 float maxEnergy = std::numeric_limits<float>::lowest();
119 float minEnergy = std::numeric_limits<float>::max();
122 for (
const auto& chanToMCPartToOnePhoton : chanToMCPartToOnePhotonMap) {
126 for (
const auto& mcPartToOnePhoton : chanToMCPartToOnePhoton.second) {
135 for (
const auto& onePhoton : mcPartToOnePhoton.second) {
160 totalE += onePhoton->Energy;
164 channelToEnergyMap[chanToMCPartToOnePhoton.first] = totalE;
166 maxEnergy = std::max(maxEnergy, totalE);
167 minEnergy = std::min(minEnergy, totalE);
171 float yzWidthScale(1. / (maxEnergy - minEnergy));
172 float energyDepositScale(
176 for (
const auto& channelToEnergy : channelToEnergyMap) {
179 0.95 * std::max(
float(0.), std::min(
float(1.), yzWidthScale * channelToEnergy.second));
187 float zWidth = widthFactor * opHitGeo.
HalfW();
188 float yWidth = widthFactor * opHitGeo.
HalfH();
191 Eigen::Vector3f coordsLo(
192 opHitPos.X() - xWidth, opHitPos.Y() - yWidth, opHitPos.Z() - zWidth);
193 Eigen::Vector3f coordsHi(
194 opHitPos.X() + xWidth, opHitPos.Y() + yWidth, opHitPos.Z() + zWidth);
206 const Eigen::Vector3f& coordsLo,
207 const Eigen::Vector3f& coordsHi,
212 TPolyLine3D& top = view->
AddPolyLine3D(5, color, width, style);
213 top.SetPoint(0, coordsLo[0], coordsHi[1], coordsLo[2]);
214 top.SetPoint(1, coordsHi[0], coordsHi[1], coordsLo[2]);
215 top.SetPoint(2, coordsHi[0], coordsHi[1], coordsHi[2]);
216 top.SetPoint(3, coordsLo[0], coordsHi[1], coordsHi[2]);
217 top.SetPoint(4, coordsLo[0], coordsHi[1], coordsLo[2]);
219 TPolyLine3D& side = view->
AddPolyLine3D(5, color, width, style);
220 side.SetPoint(0, coordsHi[0], coordsHi[1], coordsLo[2]);
221 side.SetPoint(1, coordsHi[0], coordsLo[1], coordsLo[2]);
222 side.SetPoint(2, coordsHi[0], coordsLo[1], coordsHi[2]);
223 side.SetPoint(3, coordsHi[0], coordsHi[1], coordsHi[2]);
224 side.SetPoint(4, coordsHi[0], coordsHi[1], coordsLo[2]);
226 TPolyLine3D& side2 = view->
AddPolyLine3D(5, color, width, style);
227 side2.SetPoint(0, coordsLo[0], coordsHi[1], coordsLo[2]);
228 side2.SetPoint(1, coordsLo[0], coordsLo[1], coordsLo[2]);
229 side2.SetPoint(2, coordsLo[0], coordsLo[1], coordsHi[2]);
230 side2.SetPoint(3, coordsLo[0], coordsHi[1], coordsHi[2]);
231 side2.SetPoint(4, coordsLo[0], coordsHi[1], coordsLo[2]);
233 TPolyLine3D& bottom = view->
AddPolyLine3D(5, color, width, style);
234 bottom.SetPoint(0, coordsLo[0], coordsLo[1], coordsLo[2]);
235 bottom.SetPoint(1, coordsHi[0], coordsLo[1], coordsLo[2]);
236 bottom.SetPoint(2, coordsHi[0], coordsLo[1], coordsHi[2]);
237 bottom.SetPoint(3, coordsLo[0], coordsLo[1], coordsHi[2]);
238 bottom.SetPoint(4, coordsLo[0], coordsLo[1], coordsLo[2]);
art::InputTag fG4ModuleLabel
module label producing sim::SimChannel objects
int GetColor(double x) const
std::vector< double > fRecoQHigh
high edge of ADC values for drawing raw digits
std::vector< double > fRecoQLow
low edge of ADC values for drawing raw digits
bool isValid() const noexcept
The color scales used by the event display.
TPolyLine3D & AddPolyLine3D(int n, int c, int w, int s)
bool fShowSimPhotonInfo
Display SimPhoton info in 3D display.
Simulation objects for optical detectors.
art::InputTag fSimPhotonLabel
and for SimPhotons
const evdb::ColorScale & CalQ(geo::SigType_t st) const
geo::Point_t const & GetCenter() const
std::size_t color(std::string const &procname)
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
MaybeLogger_< ELseverityLevel::ELsev_success, false > LogDebug
A collection of 3D drawable objects.
OpDetGeo const & OpDetGeoFromOpChannel(unsigned int OpChannel) const
Returns the geo::OpDetGeo object for the given channel number.
art framework interface to geometry description
Signal from collection planes.