24 #include "TPolyLine3D.h" 39 const Eigen::Vector3f&,
40 const Eigen::Vector3f&,
58 auto const clock_data =
64 std::vector<geo::PlaneID> planeIDVec;
74 std::vector<float> opHitPEVec;
77 for (
size_t idx = 0; idx < recoOpt->
fOpFlashLabels.size(); idx++) {
80 event.getByLabel(opFlashProducer, opFlashHandle);
82 if (!opFlashHandle.
isValid())
continue;
83 if (opFlashHandle->size() == 0)
continue;
88 for (
size_t idx = 0; idx < opFlashHandle->size(); idx++)
94 if (opHitAssnVec.size() == 0)
continue;
97 for (
const auto& opFlashPtr : opFlashVec) {
98 std::cout <<
"--> opFlash PE: " << opFlashPtr->TotalPE() <<
", Time: " << opFlashPtr->Time()
99 <<
", width: " << opFlashPtr->TimeWidth() <<
", y/w: " << opFlashPtr->YCenter()
100 <<
"/" << opFlashPtr->YWidth() <<
", Z/w: " << opFlashPtr->ZCenter() <<
"/" 101 << opFlashPtr->ZWidth() << std::endl;
103 if (opFlashPtr->TotalPE() < recoOpt->
fFlashMinPE)
continue;
104 if (opFlashPtr->Time() < recoOpt->
fFlashTMin)
continue;
105 if (opFlashPtr->Time() > recoOpt->
fFlashTMax)
continue;
108 const std::vector<art::Ptr<recob::OpHit>>& opHitVec = opHitAssnVec.at(opFlashPtr.key());
110 for (
const auto& opHit : opHitVec)
111 opHitPEVec.push_back(opHit->PE());
116 if (!opHitPEVec.empty()) {
118 std::sort(opHitPEVec.begin(), opHitPEVec.end());
120 float minTotalPE = opHitPEVec.front();
121 float maxTotalPE = opHitPEVec[0.9 * opHitPEVec.size()];
125 (maxTotalPE - minTotalPE));
128 for (
size_t idx = 0; idx < recoOpt->
fOpFlashLabels.size(); idx++) {
131 event.getByLabel(opFlashProducer, opFlashHandle);
133 if (!opFlashHandle.
isValid())
continue;
134 if (opFlashHandle->size() == 0)
continue;
139 for (
size_t idx = 0; idx < opFlashHandle->size(); idx++)
145 if (opHitAssnVec.size() == 0)
continue;
148 for (
const auto& opFlashPtr : opFlashVec) {
150 if (opFlashPtr->TotalPE() < recoOpt->
fFlashMinPE)
continue;
151 if (opFlashPtr->Time() < recoOpt->
fFlashTMin)
continue;
152 if (opFlashPtr->Time() > recoOpt->
fFlashTMax)
continue;
155 const std::vector<art::Ptr<recob::OpHit>> opHitVec = opHitAssnVec.at(opFlashPtr.key());
159 float flashTick = opFlashPtr->Time() /
sampling_rate(clock_data) * 1e3 +
160 det_prop.GetXTicksOffset(planeIDVec[idx]);
161 float flashWidth = opFlashPtr->TimeWidth() /
sampling_rate(clock_data) * 1e3 +
162 det_prop.GetXTicksOffset(planeIDVec[idx]);
165 float flashXpos = det_prop.ConvertTicksToX(flashTick, planeIDVec[idx]);
166 float flashXWid = det_prop.ConvertTicksToX(flashWidth, planeIDVec[idx]);
169 for (
const auto& opHit : opHitVec) {
170 unsigned int opChannel = opHit->OpChannel();
173 float zWidth = opHitGeo.
HalfW();
174 float yWidth = opHitGeo.
HalfH();
176 Eigen::Vector3f opHitLo(
177 opHitPos.X() - flashXWid, opHitPos.Y() - yWidth, opHitPos.Z() - zWidth);
178 Eigen::Vector3f opHitHi(
179 opHitPos.X() + flashXWid, opHitPos.Y() + yWidth, opHitPos.Z() + zWidth);
182 flashXpos = opHitPos.X();
185 opHitPEScale * std::min(maxTotalPE,
float(opHit->PE()));
192 std::cout <<
" == flashtick: " << flashTick <<
", flashwidth: " << flashWidth
193 <<
", flashXpos: " << flashXpos <<
", wid: " << flashXWid
194 <<
", opHitPEScale: " << opHitPEScale << std::endl;
197 Eigen::Vector3f coordsLo(flashXpos - flashXWid,
198 opFlashPtr->YCenter() - opFlashPtr->YWidth(),
199 opFlashPtr->ZCenter() - opFlashPtr->ZWidth());
200 Eigen::Vector3f coordsHi(flashXpos + flashXWid,
201 opFlashPtr->YCenter() + opFlashPtr->YWidth(),
202 opFlashPtr->ZCenter() + opFlashPtr->ZWidth());
213 const Eigen::Vector3f& coordsLo,
214 const Eigen::Vector3f& coordsHi,
219 TPolyLine3D& top = view->
AddPolyLine3D(5, color, width, style);
220 top.SetPoint(0, coordsLo[0], coordsHi[1], coordsLo[2]);
221 top.SetPoint(1, coordsHi[0], coordsHi[1], coordsLo[2]);
222 top.SetPoint(2, coordsHi[0], coordsHi[1], coordsHi[2]);
223 top.SetPoint(3, coordsLo[0], coordsHi[1], coordsHi[2]);
224 top.SetPoint(4, coordsLo[0], coordsHi[1], coordsLo[2]);
226 TPolyLine3D& side = view->
AddPolyLine3D(5, color, width, style);
227 side.SetPoint(0, coordsHi[0], coordsHi[1], coordsLo[2]);
228 side.SetPoint(1, coordsHi[0], coordsLo[1], coordsLo[2]);
229 side.SetPoint(2, coordsHi[0], coordsLo[1], coordsHi[2]);
230 side.SetPoint(3, coordsHi[0], coordsHi[1], coordsHi[2]);
231 side.SetPoint(4, coordsHi[0], coordsHi[1], coordsLo[2]);
233 TPolyLine3D& side2 = view->
AddPolyLine3D(5, color, width, style);
234 side2.SetPoint(0, coordsLo[0], coordsHi[1], coordsLo[2]);
235 side2.SetPoint(1, coordsLo[0], coordsLo[1], coordsLo[2]);
236 side2.SetPoint(2, coordsLo[0], coordsLo[1], coordsHi[2]);
237 side2.SetPoint(3, coordsLo[0], coordsHi[1], coordsHi[2]);
238 side2.SetPoint(4, coordsLo[0], coordsHi[1], coordsLo[2]);
240 TPolyLine3D& bottom = view->
AddPolyLine3D(5, color, width, style);
241 bottom.SetPoint(0, coordsLo[0], coordsLo[1], coordsLo[2]);
242 bottom.SetPoint(1, coordsHi[0], coordsLo[1], coordsLo[2]);
243 bottom.SetPoint(2, coordsHi[0], coordsLo[1], coordsHi[2]);
244 bottom.SetPoint(3, coordsLo[0], coordsLo[1], coordsHi[2]);
245 bottom.SetPoint(4, coordsLo[0], coordsLo[1], coordsLo[2]);
std::vector< art::InputTag > fOpFlashLabels
module labels that produced events
The data type to uniquely identify a Plane.
int GetColor(double x) const
double fFlashTMin
Minimal time for a flash to be displayed.
std::vector< double > fRecoQHigh
high edge of ADC values for drawing raw digits
double fFlashTMax
Maximum time for a flash to be displayed.
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)
void push_back(Ptr< U > const &p)
const evdb::ColorScale & CalQ(geo::SigType_t st) const
double fFlashMinPE
Minimal PE for a flash to be displayed.
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.
A collection of 3D drawable objects.
double sampling_rate(DetectorClocksData const &data)
Returns the period of the TPC readout electronics clock.
Namespace collecting geometry-related classes utilities.
OpDetGeo const & OpDetGeoFromOpChannel(unsigned int OpChannel) const
Returns the geo::OpDetGeo object for the given channel number.
art framework interface to geometry description
Event finding and building.
Signal from collection planes.