52 art::ServiceHandle<evd::RecoDrawingOptions> recoOpt;
54 if (recoOpt->fDrawOpFlashes == 0)
return;
57 art::ServiceHandle<geo::Geometry> geo;
58 auto const clock_data =
59 art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(event);
61 art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataFor(event, clock_data);
62 art::ServiceHandle<evd::ColorDrawingOptions> cst;
64 std::vector<geo::PlaneID> planeIDVec;
71 art::Handle<std::vector<recob::OpFlash>> opFlashHandle;
74 std::vector<float> opHitPEVec;
77 for (
size_t idx = 0; idx < recoOpt->fOpFlashLabels.size(); idx++) {
78 art::InputTag opFlashProducer = recoOpt->fOpFlashLabels[idx];
80 event.getByLabel(opFlashProducer, opFlashHandle);
82 if (!opFlashHandle.isValid())
continue;
83 if (opFlashHandle->size() == 0)
continue;
86 art::PtrVector<recob::OpFlash> opFlashVec;
88 for (
size_t idx = 0; idx < opFlashHandle->size(); idx++)
89 opFlashVec.push_back(art::Ptr<recob::OpFlash>(opFlashHandle, idx));
92 art::FindManyP<recob::OpHit> opHitAssnVec(opFlashVec, event, opFlashProducer);
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++) {
129 art::InputTag opFlashProducer = recoOpt->fOpFlashLabels[idx];
131 event.getByLabel(opFlashProducer, opFlashHandle);
133 if (!opFlashHandle.isValid())
continue;
134 if (opFlashHandle->size() == 0)
continue;
137 art::PtrVector<recob::OpFlash> opFlashVec;
139 for (
size_t idx = 0; idx < opFlashHandle->size(); idx++)
140 opFlashVec.push_back(art::Ptr<recob::OpFlash>(opFlashHandle, idx));
143 art::FindManyP<recob::OpHit> opHitAssnVec(opFlashVec, event, opFlashProducer);
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();
171 const geo::OpDetGeo& opHitGeo = geo->OpDetGeoFromOpChannel(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());
The data type to uniquely identify a Plane.
void GetCenter(double *xyz, double localz=0.0) const
double sampling_rate(DetectorClocksData const &data)
Returns the period of the TPC readout electronics clock.
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
BEGIN_PROLOG could also be cout
Signal from collection planes.