18 #include "TPolyLine3D.h" 35 const Eigen::Vector3f&,
36 const Eigen::Vector3f&,
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);
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
void GetCenter(double *xyz, double localz=0.0) const
art framework interface to geometry description
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.
Simulation objects for optical detectors.
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.
std::size_t color(std::string const &procname)
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.