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());
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.
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.
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)
Signal from collection planes.