19 #include "canvas/Persistency/Common/FindManyP.h" 21 #include "TPolyLine3D.h" 36 const Eigen::Vector3f&,
37 const Eigen::Vector3f&,
56 auto const clock_data =
62 std::vector<geo::PlaneID> planeIDVec;
72 std::vector<float> opHitPEVec;
75 for (
size_t idx = 0; idx < recoOpt->
fOpFlashLabels.size(); idx++) {
78 event.getByLabel(opFlashProducer, opFlashHandle);
80 if (!opFlashHandle.
isValid())
continue;
81 if (opFlashHandle->size() == 0)
continue;
86 for (
size_t idx = 0; idx < opFlashHandle->size(); idx++)
90 art::FindManyP<recob::OpHit> opHitAssnVec(opFlashVec, event, opFlashProducer);
92 if (opHitAssnVec.size() == 0)
continue;
95 for (
const auto& opFlashPtr : opFlashVec) {
96 std::cout <<
"--> opFlash PE: " << opFlashPtr->TotalPE() <<
", Time: " << opFlashPtr->Time()
97 <<
", width: " << opFlashPtr->TimeWidth() <<
", y/w: " << opFlashPtr->YCenter()
98 <<
"/" << opFlashPtr->YWidth() <<
", Z/w: " << opFlashPtr->ZCenter() <<
"/" 101 if (opFlashPtr->TotalPE() < recoOpt->
fFlashMinPE)
continue;
102 if (opFlashPtr->Time() < recoOpt->
fFlashTMin)
continue;
103 if (opFlashPtr->Time() > recoOpt->
fFlashTMax)
continue;
106 const std::vector<art::Ptr<recob::OpHit>>& opHitVec = opHitAssnVec.at(opFlashPtr.key());
108 for (
const auto& opHit : opHitVec)
109 opHitPEVec.push_back(opHit->PE());
114 if (!opHitPEVec.empty()) {
116 std::sort(opHitPEVec.begin(), opHitPEVec.end());
118 float minTotalPE = opHitPEVec.front();
119 float maxTotalPE = opHitPEVec[0.9 * opHitPEVec.size()];
123 (maxTotalPE - minTotalPE));
126 for (
size_t idx = 0; idx < recoOpt->
fOpFlashLabels.size(); idx++) {
129 event.getByLabel(opFlashProducer, opFlashHandle);
131 if (!opFlashHandle.
isValid())
continue;
132 if (opFlashHandle->size() == 0)
continue;
137 for (
size_t idx = 0; idx < opFlashHandle->size(); idx++)
141 art::FindManyP<recob::OpHit> opHitAssnVec(opFlashVec, event, opFlashProducer);
143 if (opHitAssnVec.size() == 0)
continue;
146 for (
const auto& opFlashPtr : opFlashVec) {
148 if (opFlashPtr->TotalPE() < recoOpt->
fFlashMinPE)
continue;
149 if (opFlashPtr->Time() < recoOpt->
fFlashTMin)
continue;
150 if (opFlashPtr->Time() > recoOpt->
fFlashTMax)
continue;
153 const std::vector<art::Ptr<recob::OpHit>> opHitVec = opHitAssnVec.at(opFlashPtr.key());
157 float flashTick = opFlashPtr->Time() /
sampling_rate(clock_data) * 1e3 +
158 det_prop.GetXTicksOffset(planeIDVec[idx]);
159 float flashWidth = opFlashPtr->TimeWidth() /
sampling_rate(clock_data) * 1e3 +
160 det_prop.GetXTicksOffset(planeIDVec[idx]);
163 float flashXpos = det_prop.ConvertTicksToX(flashTick, planeIDVec[idx]);
164 float flashXWid = det_prop.ConvertTicksToX(flashWidth, planeIDVec[idx]);
167 for (
const auto& opHit : opHitVec) {
168 unsigned int opChannel = opHit->OpChannel();
171 float zWidth = opHitGeo.
HalfW();
172 float yWidth = opHitGeo.
HalfH();
174 Eigen::Vector3f opHitLo(
175 opHitPos.X() - flashXWid, opHitPos.Y() - yWidth, opHitPos.Z() - zWidth);
176 Eigen::Vector3f opHitHi(
177 opHitPos.X() + flashXWid, opHitPos.Y() + yWidth, opHitPos.Z() + zWidth);
180 flashXpos = opHitPos.X();
183 opHitPEScale *
std::min(maxTotalPE,
float(opHit->PE()));
190 std::cout <<
" == flashtick: " << flashTick <<
", flashwidth: " << flashWidth
191 <<
", flashXpos: " << flashXpos <<
", wid: " << flashXWid
192 <<
", opHitPEScale: " << opHitPEScale <<
std::endl;
195 Eigen::Vector3f coordsLo(flashXpos - flashXWid,
196 opFlashPtr->YCenter() - opFlashPtr->YWidth(),
197 opFlashPtr->ZCenter() - opFlashPtr->ZWidth());
198 Eigen::Vector3f coordsHi(flashXpos + flashXWid,
199 opFlashPtr->YCenter() + opFlashPtr->YWidth(),
200 opFlashPtr->ZCenter() + opFlashPtr->ZWidth());
212 const Eigen::Vector3f& coordsLo,
213 const Eigen::Vector3f& coordsHi,
218 TPolyLine3D&
top = view->AddPolyLine3D(5, color, width, style);
219 top.SetPoint(0, coordsLo[0], coordsHi[1], coordsLo[2]);
220 top.SetPoint(1, coordsHi[0], coordsHi[1], coordsLo[2]);
221 top.SetPoint(2, coordsHi[0], coordsHi[1], coordsHi[2]);
222 top.SetPoint(3, coordsLo[0], coordsHi[1], coordsHi[2]);
223 top.SetPoint(4, coordsLo[0], coordsHi[1], coordsLo[2]);
225 TPolyLine3D& side = view->AddPolyLine3D(5, color, width, style);
226 side.SetPoint(0, coordsHi[0], coordsHi[1], coordsLo[2]);
227 side.SetPoint(1, coordsHi[0], coordsLo[1], coordsLo[2]);
228 side.SetPoint(2, coordsHi[0], coordsLo[1], coordsHi[2]);
229 side.SetPoint(3, coordsHi[0], coordsHi[1], coordsHi[2]);
230 side.SetPoint(4, coordsHi[0], coordsHi[1], coordsLo[2]);
232 TPolyLine3D& side2 = view->AddPolyLine3D(5, color, width, style);
233 side2.SetPoint(0, coordsLo[0], coordsHi[1], coordsLo[2]);
234 side2.SetPoint(1, coordsLo[0], coordsLo[1], coordsLo[2]);
235 side2.SetPoint(2, coordsLo[0], coordsLo[1], coordsHi[2]);
236 side2.SetPoint(3, coordsLo[0], coordsHi[1], coordsHi[2]);
237 side2.SetPoint(4, coordsLo[0], coordsHi[1], coordsLo[2]);
239 TPolyLine3D&
bottom = view->AddPolyLine3D(5, color, width, style);
240 bottom.SetPoint(0, coordsLo[0], coordsLo[1], coordsLo[2]);
241 bottom.SetPoint(1, coordsHi[0], coordsLo[1], coordsLo[2]);
242 bottom.SetPoint(2, coordsHi[0], coordsLo[1], coordsHi[2]);
243 bottom.SetPoint(3, coordsLo[0], coordsLo[1], coordsHi[2]);
244 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.
void GetCenter(double *xyz, double localz=0.0) const
double fFlashTMin
Minimal time for a flash to be displayed.
art framework interface to geometry description
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
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.
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)
double sampling_rate(DetectorClocksData const &data)
Returns the period of the TPC readout electronics clock.
LArSoft geometry interface.
OpDetGeo const & OpDetGeoFromOpChannel(unsigned int OpChannel) const
Returns the geo::OpDetGeo object for the given channel number.
QTextStream & endl(QTextStream &s)
Event finding and building.
Signal from collection planes.