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);
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
bool fShowSimPhotonInfo
Display SimPhoton info in 3D display.
art::InputTag fSimPhotonLabel
and for SimPhotons
const evdb::ColorScale & CalQ(geo::SigType_t st) const
geo::Point_t const & GetCenter() const
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
OpDetGeo const & OpDetGeoFromOpChannel(unsigned int OpChannel) const
Returns the geo::OpDetGeo object for the given channel number.
Signal from collection planes.