68 if (!mcParticleHandle.
isValid())
return;
71 using TrackToMcParticleMap = std::map<int, const simb::MCParticle*>;
73 TrackToMcParticleMap trackToMcParticleMap;
75 for (
const auto& mcParticle : *mcParticleHandle)
76 trackToMcParticleMap[mcParticle.TrackId()] = &mcParticle;
83 if (simPhotonsHandle.
isValid() && simPhotonsHandle->size() > 0) {
85 <<
"Starting loop over " << simPhotonsHandle->size() <<
" SimPhotons, " <<
std::endl;
92 using MCPartToOnePhotonMap =
93 std::map<const simb::MCParticle*, std::vector<const sim::OnePhoton*>>;
94 using ChanToMCPartToOnePhotonMap = std::map<int, MCPartToOnePhotonMap>;
96 ChanToMCPartToOnePhotonMap chanToMCPartToOnePhotonMap;
99 for (
const auto& simPhoton : *simPhotonsHandle) {
100 MCPartToOnePhotonMap& mcPartToOnePhotonMap =
101 chanToMCPartToOnePhotonMap[simPhoton.OpChannel()];
103 for (
const auto& onePhoton : simPhoton) {
105 trackToMcParticleMap.find(onePhoton.MotherTrackID);
107 if (trackMCItr == trackToMcParticleMap.end())
continue;
109 mcPartToOnePhotonMap[trackMCItr->second].push_back(&onePhoton);
114 std::map<int, float> channelToEnergyMap;
117 float maxEnergy = std::numeric_limits<float>::lowest();
121 for (
const auto& chanToMCPartToOnePhoton : chanToMCPartToOnePhotonMap) {
125 for (
const auto& mcPartToOnePhoton : chanToMCPartToOnePhoton.second) {
134 for (
const auto& onePhoton : mcPartToOnePhoton.second) {
159 totalE += onePhoton->Energy;
163 channelToEnergyMap[chanToMCPartToOnePhoton.first] = totalE;
165 maxEnergy =
std::max(maxEnergy, totalE);
166 minEnergy =
std::min(minEnergy, totalE);
170 float yzWidthScale(1. / (maxEnergy - minEnergy));
171 float energyDepositScale(
175 for (
const auto& channelToEnergy : channelToEnergyMap) {
178 0.95 *
std::max(
float(0.),
std::min(
float(1.), yzWidthScale* channelToEnergy.second));
186 float zWidth = widthFactor * opHitGeo.
HalfW();
187 float yWidth = widthFactor * opHitGeo.
HalfH();
190 Eigen::Vector3f coordsLo(
191 opHitPos.X() - xWidth, opHitPos.Y() - yWidth, opHitPos.Z() - zWidth);
192 Eigen::Vector3f coordsHi(
193 opHitPos.X() + xWidth, opHitPos.Y() + yWidth, opHitPos.Z() + zWidth);
art::InputTag fG4ModuleLabel
module label producing sim::SimChannel objects
void GetCenter(double *xyz, double localz=0.0) 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.
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
art::InputTag fSimPhotonLabel
and for SimPhotons
const evdb::ColorScale & CalQ(geo::SigType_t st) const
static int max(int a, int b)
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
MaybeLogger_< ELseverityLevel::ELsev_success, false > LogDebug
OpDetGeo const & OpDetGeoFromOpChannel(unsigned int OpChannel) const
Returns the geo::OpDetGeo object for the given channel number.
QTextStream & endl(QTextStream &s)
Signal from collection planes.