21 #include "TPolyLine3D.h" 36 const Eigen::Vector3f&,
37 const Eigen::Vector3f&,
56 if (!mcParticleHandle.
isValid())
return;
59 using TrackToMcParticleMap = std::map<int, const simb::MCParticle*>;
61 TrackToMcParticleMap trackToMcParticleMap;
63 for (
const auto& mcParticle : *mcParticleHandle)
64 trackToMcParticleMap[mcParticle.TrackId()] = &mcParticle;
71 if (simPhotonsHandle.
isValid() && simPhotonsHandle->size() > 0) {
73 <<
"Starting loop over " << simPhotonsHandle->size() <<
" SimPhotons, " << std::endl;
79 using MCPartToOnePhotonMap =
80 std::map<const simb::MCParticle*, std::vector<const sim::OnePhoton*>>;
81 using ChanToMCPartToOnePhotonMap = std::map<int, MCPartToOnePhotonMap>;
83 ChanToMCPartToOnePhotonMap chanToMCPartToOnePhotonMap;
86 for (
const auto& simPhoton : *simPhotonsHandle) {
87 MCPartToOnePhotonMap& mcPartToOnePhotonMap =
88 chanToMCPartToOnePhotonMap[simPhoton.OpChannel()];
90 for (
const auto& onePhoton : simPhoton) {
92 trackToMcParticleMap.find(onePhoton.MotherTrackID);
94 if (trackMCItr == trackToMcParticleMap.end())
continue;
96 mcPartToOnePhotonMap[trackMCItr->second].push_back(&onePhoton);
101 std::map<int, float> channelToEnergyMap;
104 float maxEnergy = std::numeric_limits<float>::lowest();
105 float minEnergy = std::numeric_limits<float>::max();
108 for (
const auto& chanToMCPartToOnePhoton : chanToMCPartToOnePhotonMap) {
112 for (
const auto& mcPartToOnePhoton : chanToMCPartToOnePhoton.second) {
115 for (
const auto& onePhoton : mcPartToOnePhoton.second) {
116 totalE += onePhoton->Energy;
120 channelToEnergyMap[chanToMCPartToOnePhoton.first] = totalE;
122 maxEnergy = std::max(maxEnergy, totalE);
123 minEnergy = std::min(minEnergy, totalE);
127 float yzWidthScale(1. / (maxEnergy - minEnergy));
128 float energyDepositScale(
133 for (
const auto& channelToEnergy : channelToEnergyMap) {
136 0.95 * std::max(
float(0.), std::min(
float(1.), yzWidthScale * channelToEnergy.second));
142 wireReadoutGeom.OpDetGeoFromOpChannel(channelToEnergy.first);
145 float zWidth = widthFactor * opHitGeo.
HalfW();
146 float yWidth = widthFactor * opHitGeo.
HalfH();
149 Eigen::Vector3f coordsLo(
150 opHitPos.X() - xWidth, opHitPos.Y() - yWidth, opHitPos.Z() - zWidth);
151 Eigen::Vector3f coordsHi(
152 opHitPos.X() + xWidth, opHitPos.Y() + yWidth, opHitPos.Z() + zWidth);
162 const Eigen::Vector3f& coordsLo,
163 const Eigen::Vector3f& coordsHi,
168 TPolyLine3D& top = view->
AddPolyLine3D(5, color, width, style);
169 top.SetPoint(0, coordsLo[0], coordsHi[1], coordsLo[2]);
170 top.SetPoint(1, coordsHi[0], coordsHi[1], coordsLo[2]);
171 top.SetPoint(2, coordsHi[0], coordsHi[1], coordsHi[2]);
172 top.SetPoint(3, coordsLo[0], coordsHi[1], coordsHi[2]);
173 top.SetPoint(4, coordsLo[0], coordsHi[1], coordsLo[2]);
175 TPolyLine3D& side = view->
AddPolyLine3D(5, color, width, style);
176 side.SetPoint(0, coordsHi[0], coordsHi[1], coordsLo[2]);
177 side.SetPoint(1, coordsHi[0], coordsLo[1], coordsLo[2]);
178 side.SetPoint(2, coordsHi[0], coordsLo[1], coordsHi[2]);
179 side.SetPoint(3, coordsHi[0], coordsHi[1], coordsHi[2]);
180 side.SetPoint(4, coordsHi[0], coordsHi[1], coordsLo[2]);
182 TPolyLine3D& side2 = view->
AddPolyLine3D(5, color, width, style);
183 side2.SetPoint(0, coordsLo[0], coordsHi[1], coordsLo[2]);
184 side2.SetPoint(1, coordsLo[0], coordsLo[1], coordsLo[2]);
185 side2.SetPoint(2, coordsLo[0], coordsLo[1], coordsHi[2]);
186 side2.SetPoint(3, coordsLo[0], coordsHi[1], coordsHi[2]);
187 side2.SetPoint(4, coordsLo[0], coordsHi[1], coordsLo[2]);
189 TPolyLine3D& bottom = view->
AddPolyLine3D(5, color, width, style);
190 bottom.SetPoint(0, coordsLo[0], coordsLo[1], coordsLo[2]);
191 bottom.SetPoint(1, coordsHi[0], coordsLo[1], coordsLo[2]);
192 bottom.SetPoint(2, coordsHi[0], coordsLo[1], coordsHi[2]);
193 bottom.SetPoint(3, coordsLo[0], coordsLo[1], coordsHi[2]);
194 bottom.SetPoint(4, coordsLo[0], coordsLo[1], coordsLo[2]);
Point_t const & GetCenter() const
art::InputTag fG4ModuleLabel
module label producing sim::SimChannel objects
cout<< "Opened file "<< fin<< " ixs= "<< ixs<< endl;if(ixs==0) hhh=(TH1F *) fff-> Get("h1")
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
Encapsulate the geometry of an optical detector.
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.
Signal from collection planes.