25 #include "TPolyLine3D.h" 40 const Eigen::Vector3f&,
41 const Eigen::Vector3f&,
54 auto const clock_data =
60 std::vector<geo::PlaneID> planeIDVec;
70 std::vector<float> opHitPEVec;
73 for (
size_t idx = 0; idx < recoOpt->
fOpFlashLabels.size(); idx++) {
76 event.getByLabel(opFlashProducer, opFlashHandle);
78 if (!opFlashHandle.
isValid())
continue;
79 if (opFlashHandle->size() == 0)
continue;
84 for (
size_t idx = 0; idx < opFlashHandle->size(); idx++)
90 if (opHitAssnVec.size() == 0)
continue;
93 for (
const auto& opFlashPtr : opFlashVec) {
94 std::cout <<
"--> opFlash PE: " << opFlashPtr->TotalPE() <<
", Time: " << opFlashPtr->Time()
95 <<
", width: " << opFlashPtr->TimeWidth() <<
", y/w: " << opFlashPtr->YCenter()
96 <<
"/" << opFlashPtr->YWidth() <<
", Z/w: " << opFlashPtr->ZCenter() <<
"/" 97 << opFlashPtr->ZWidth() << std::endl;
99 if (opFlashPtr->TotalPE() < recoOpt->
fFlashMinPE)
continue;
100 if (opFlashPtr->Time() < recoOpt->
fFlashTMin)
continue;
101 if (opFlashPtr->Time() > recoOpt->
fFlashTMax)
continue;
104 const std::vector<art::Ptr<recob::OpHit>>& opHitVec = opHitAssnVec.at(opFlashPtr.key());
106 for (
const auto& opHit : opHitVec)
107 opHitPEVec.push_back(opHit->PE());
112 if (!opHitPEVec.empty()) {
114 std::sort(opHitPEVec.begin(), opHitPEVec.end());
116 float minTotalPE = opHitPEVec.front();
117 float maxTotalPE = opHitPEVec[0.9 * opHitPEVec.size()];
121 (maxTotalPE - minTotalPE));
125 for (
size_t idx = 0; idx < recoOpt->
fOpFlashLabels.size(); idx++) {
128 event.getByLabel(opFlashProducer, opFlashHandle);
130 if (!opFlashHandle.
isValid())
continue;
131 if (opFlashHandle->size() == 0)
continue;
136 for (
size_t idx = 0; idx < opFlashHandle->size(); idx++)
142 if (opHitAssnVec.size() == 0)
continue;
145 for (
const auto& opFlashPtr : opFlashVec) {
147 if (opFlashPtr->TotalPE() < recoOpt->
fFlashMinPE)
continue;
148 if (opFlashPtr->Time() < recoOpt->
fFlashTMin)
continue;
149 if (opFlashPtr->Time() > recoOpt->
fFlashTMax)
continue;
152 const std::vector<art::Ptr<recob::OpHit>> opHitVec = opHitAssnVec.at(opFlashPtr.key());
156 float flashTick = opFlashPtr->Time() /
sampling_rate(clock_data) * 1e3 +
157 det_prop.GetXTicksOffset(planeIDVec[idx]);
158 float flashWidth = opFlashPtr->TimeWidth() /
sampling_rate(clock_data) * 1e3 +
159 det_prop.GetXTicksOffset(planeIDVec[idx]);
162 float flashXpos = det_prop.ConvertTicksToX(flashTick, planeIDVec[idx]);
163 float flashXWid = det_prop.ConvertTicksToX(flashWidth, planeIDVec[idx]);
166 for (
const auto& opHit : opHitVec) {
167 unsigned int opChannel = opHit->OpChannel();
168 const geo::OpDetGeo& opHitGeo = wireReadoutGeom.OpDetGeoFromOpChannel(opChannel);
170 float zWidth = opHitGeo.
HalfW();
171 float yWidth = opHitGeo.
HalfH();
173 Eigen::Vector3f opHitLo(
174 opHitPos.X() - flashXWid, opHitPos.Y() - yWidth, opHitPos.Z() - zWidth);
175 Eigen::Vector3f opHitHi(
176 opHitPos.X() + flashXWid, opHitPos.Y() + yWidth, opHitPos.Z() + zWidth);
179 flashXpos = opHitPos.X();
182 opHitPEScale * std::min(maxTotalPE,
float(opHit->PE()));
189 std::cout <<
" == flashtick: " << flashTick <<
", flashwidth: " << flashWidth
190 <<
", flashXpos: " << flashXpos <<
", wid: " << flashXWid
191 <<
", opHitPEScale: " << opHitPEScale << std::endl;
193 Eigen::Vector3f coordsLo(flashXpos - flashXWid,
194 opFlashPtr->YCenter() - opFlashPtr->YWidth(),
195 opFlashPtr->ZCenter() - opFlashPtr->ZWidth());
196 Eigen::Vector3f coordsHi(flashXpos + flashXWid,
197 opFlashPtr->YCenter() + opFlashPtr->YWidth(),
198 opFlashPtr->ZCenter() + opFlashPtr->ZWidth());
207 const Eigen::Vector3f& coordsLo,
208 const Eigen::Vector3f& coordsHi,
213 TPolyLine3D& top = view->
AddPolyLine3D(5, color, width, style);
214 top.SetPoint(0, coordsLo[0], coordsHi[1], coordsLo[2]);
215 top.SetPoint(1, coordsHi[0], coordsHi[1], coordsLo[2]);
216 top.SetPoint(2, coordsHi[0], coordsHi[1], coordsHi[2]);
217 top.SetPoint(3, coordsLo[0], coordsHi[1], coordsHi[2]);
218 top.SetPoint(4, coordsLo[0], coordsHi[1], coordsLo[2]);
220 TPolyLine3D& side = view->
AddPolyLine3D(5, color, width, style);
221 side.SetPoint(0, coordsHi[0], coordsHi[1], coordsLo[2]);
222 side.SetPoint(1, coordsHi[0], coordsLo[1], coordsLo[2]);
223 side.SetPoint(2, coordsHi[0], coordsLo[1], coordsHi[2]);
224 side.SetPoint(3, coordsHi[0], coordsHi[1], coordsHi[2]);
225 side.SetPoint(4, coordsHi[0], coordsHi[1], coordsLo[2]);
227 TPolyLine3D& side2 = view->
AddPolyLine3D(5, color, width, style);
228 side2.SetPoint(0, coordsLo[0], coordsHi[1], coordsLo[2]);
229 side2.SetPoint(1, coordsLo[0], coordsLo[1], coordsLo[2]);
230 side2.SetPoint(2, coordsLo[0], coordsLo[1], coordsHi[2]);
231 side2.SetPoint(3, coordsLo[0], coordsHi[1], coordsHi[2]);
232 side2.SetPoint(4, coordsLo[0], coordsHi[1], coordsLo[2]);
234 TPolyLine3D& bottom = view->
AddPolyLine3D(5, color, width, style);
235 bottom.SetPoint(0, coordsLo[0], coordsLo[1], coordsLo[2]);
236 bottom.SetPoint(1, coordsHi[0], coordsLo[1], coordsLo[2]);
237 bottom.SetPoint(2, coordsHi[0], coordsLo[1], coordsHi[2]);
238 bottom.SetPoint(3, coordsLo[0], coordsLo[1], coordsHi[2]);
239 bottom.SetPoint(4, coordsLo[0], coordsLo[1], coordsLo[2]);
std::vector< art::InputTag > fOpFlashLabels
module labels that produced events
Point_t const & GetCenter() const
The data type to uniquely identify a Plane.
cout<< "Opened file "<< fin<< " ixs= "<< ixs<< endl;if(ixs==0) hhh=(TH1F *) fff-> Get("h1")
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.
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.
A collection of 3D drawable objects.
double sampling_rate(DetectorClocksData const &data)
Returns the period of the TPC readout electronics clock.
Event finding and building.
Signal from collection planes.