14 #include "TPolyLine.h" 15 #include "TPolyLine3D.h" 16 #include "TPolyMarker.h" 17 #include "TPolyMarker3D.h" 18 #include "TRotation.h" 55 #include "nuevdb/EventDisplayBase/EventHolder.h" 56 #include "nuevdb/EventDisplayBase/View2D.h" 57 #include "nuevdb/EventDisplayBase/View3D.h" 63 #include "canvas/Persistency/Common/FindMany.h" 66 #include "cetlib_except/exception.h" 74 mf::LogWarning(
"RecoBaseDrawer") <<
"RecoBaseDrawer::" << fcn <<
" failed with message:\n" <<
e;
95 for (
size_t t = 0;
t < geo->
NTPC(); ++
t) {
96 unsigned int nplanes = geo->
Nplanes(
t);
144 for (
size_t imod = 0; imod < recoOpt->
fWireLabels.size(); ++imod) {
150 if (wires.
size() < 1)
continue;
152 for (
size_t i = 0; i < wires.
size(); ++i) {
154 uint32_t
channel = wires[i]->Channel();
158 std::vector<geo::WireID> wireids = geo->
ChannelToWire(channel);
162 for (
auto const& wid : wireids) {
163 if (wid.planeID() != pid)
continue;
165 double wire = 1. * wid.Wire;
168 std::vector<float> wirSig = wires[i]->Signal();
169 if (wirSig.size() == 0)
continue;
172 while (itr != wirSig.end()) {
176 while (ticksUsed < ticksPerPoint && itr != wirSig.end()) {
178 adcsum += (1. * (*itr));
183 double adc = adcsum / ticksPerPoint;
184 double tdc = tdcsum / ticksPerPoint;
186 if (TMath::Abs(adc) < rawOpt->
fMinSignal)
continue;
187 if (tdc > rawOpt->
fTicks)
continue;
193 co = cst->
CalQ(sigType).GetColor(adc);
196 if (sf > 1.0) sf = 1.0;
199 if (wire < minw) minw = wire;
200 if (wire > maxw) maxw = wire;
201 if (tdc < mint) mint = tdc;
202 if (tdc > maxt) maxt = tdc;
205 TBox& b1 = view->AddBox(wire - sf * 0.5,
206 tdc - sf * 0.5 * ticksPerPoint,
208 tdc + sf * 0.5 * ticksPerPoint);
209 b1.SetFillStyle(1001);
211 b1.SetBit(kCannotPick);
214 TBox& b1 = view->AddBox(tdc - sf * 0.5 * ticksPerPoint,
216 tdc + sf * 0.5 * ticksPerPoint,
218 b1.SetFillStyle(1001);
220 b1.SetBit(kCannotPick);
233 double startTick(50.);
234 double endTick((rawOpt->
fTicks - 50.) * ticksPerPoint);
236 for (
size_t wireNo = 0; wireNo < geo->
Nwires(pid); wireNo++) {
241 double wire = 1. * wireNo;
242 TLine&
line = view->AddLine(wire, startTick, wire, endTick);
243 line.SetLineColor(kGray);
244 line.SetLineWidth(1.0);
245 line.SetBit(kCannotPick);
270 if (recoOpt->
fDrawHits == 0)
return nHitsDrawn;
276 for (
size_t imod = 0; imod < recoOpt->
fHitLabels.size(); ++imod) {
279 std::vector<const recob::Hit*> hits;
280 this->
GetHits(evt, which, hits, plane);
283 for (
auto itr : hits) {
285 if (itr->WireID().TPC != rawOpt->
fTPC || itr->WireID().Cryostat != rawOpt->
fCryostat)
290 fRawCharge[itr->WireID().Plane] += itr->PeakAmplitude();
316 bool drawConnectingLines,
324 unsigned int wold = 0;
331 for (
const auto&
hit : hits) {
336 std::vector<geo::WireID> wireIDs;
341 wireIDs.push_back(
hit->WireID());
344 for (
const auto& wireID : wireIDs) {
345 if (wireID.TPC != rawOpt->
fTPC || wireID.Cryostat != rawOpt->
fCryostat)
continue;
347 if (std::isnan(
hit->PeakTime()) || std::isnan(
hit->Integral())) {
348 std::cout <<
"====>> Found hit with a NAN, channel: " <<
hit->Channel()
349 <<
", start/end: " <<
hit->StartTick() <<
"/" <<
hit->EndTick()
350 <<
", chisquare: " <<
hit->GoodnessOfFit() <<
std::endl;
353 if (
hit->PeakTime() > rawOpt->
fTicks)
continue;
360 float rms = 0.5 *
hit->RMS();
363 TBox& b1 = view->AddBox(w - 0.5, time - rms, w + 0.5, time + rms);
364 if (drawConnectingLines && nHitsDrawn > 0) {
365 TLine&
l = view->AddLine(w, time, wold, timeold);
366 l.SetLineColor(color);
367 l.SetBit(kCannotPick);
370 b1.SetBit(kCannotPick);
371 b1.SetLineColor(color);
372 b1.SetLineWidth(lineWidth);
375 TBox& b1 = view->AddBox(time - rms, w - 0.5, time + rms, w + 0.5);
376 if (drawConnectingLines && nHitsDrawn > 0) {
377 TLine&
l = view->AddLine(time, w, timeold, wold);
378 l.SetLineColor(color);
379 l.SetBit(kCannotPick);
382 b1.SetBit(kCannotPick);
383 b1.SetLineColor(color);
384 b1.SetLineWidth(lineWidth);
404 unsigned int wold(0);
408 for (
const auto&
hit : hits) {
414 w =
hit->WireID().Wire;
421 if (nHitsDrawn > 0) {
422 TLine&
l = view->AddLine(w, time + 100, wold, timeold + 100);
425 if (cosmicscore > 0.5) l.SetLineColor(kMagenta);
426 l.SetBit(kCannotPick);
430 if (nHitsDrawn > 0) {
431 TLine&
l = view->AddLine(time + 20, w, timeold + 20, wold);
433 if (cosmicscore > 0.5) l.SetLineStyle(2);
434 l.SetBit(kCannotPick);
453 if ((
unsigned int)plane >
fWireMin.size()) {
455 <<
" Requested plane " << plane <<
" is larger than those available ";
465 minw = (minw - 30 < 0) ? 0 : minw - 30;
466 mint = (mint - 10 < 0) ? 0 : mint - 10;
468 int fTicks = rawOpt->
fTicks;
470 maxw = (maxw + 10 > (
int)geo->
Nwires(plane)) ? geo->
Nwires(plane) : maxw + 10;
471 maxt = (maxt + 10 > fTicks) ? fTicks : maxt + 10;
505 for (
size_t iep = 0; iep < ep2d.
size(); ++iep) {
507 if (ep2d[iep]->
View() != gview)
continue;
516 double x = ep2d[iep]->WireID().Wire;
517 double y = ep2d[iep]->DriftTime();
520 x = ep2d[iep]->DriftTime();
521 y = ep2d[iep]->WireID().Wire;
524 TMarker& strt = view->AddMarker(x, y, color, 30, 2.0);
525 strt.SetMarkerColor(color);
529 char const* txt = s.c_str();
530 TText& vtxID = view->AddText(x, y + 20, txt);
531 vtxID.SetTextColor(color);
532 vtxID.SetTextSize(0.05);
558 for (
size_t imod = 0; imod < recoOpt->
fOpFlashLabels.size(); ++imod) {
564 if (opflashes.
size() < 1)
continue;
566 int NFlashes = opflashes.
size();
569 MF_LOG_VERBATIM(
"RecoBaseDrawer") <<
"Total " << NFlashes <<
" flashes.";
572 for (
size_t iof = 0; iof < opflashes.
size(); ++iof) {
573 if (opflashes[iof]->TotalPE() < recoOpt->
fFlashMinPE)
continue;
574 if (opflashes[iof]->Time() < recoOpt->
fFlashTMin)
continue;
575 if (opflashes[iof]->Time() > recoOpt->
fFlashTMax)
continue;
578 <<
"Flash t: " << opflashes[iof]->Time() <<
"\t y,z : " << opflashes[iof]->YCenter()
579 <<
", " << opflashes[iof]->ZCenter() <<
" \t PE :" << opflashes[iof]->TotalPE();
583 float wire0 = FLT_MAX;
584 float wire1 = FLT_MIN;
587 std::vector<TVector3> points;
588 points.push_back(TVector3(0,
589 opflashes[iof]->YCenter() - opflashes[iof]->YWidth(),
590 opflashes[iof]->ZCenter() - opflashes[iof]->ZWidth()));
591 points.push_back(TVector3(0,
592 opflashes[iof]->YCenter() - opflashes[iof]->YWidth(),
593 opflashes[iof]->ZCenter() + opflashes[iof]->ZWidth()));
594 points.push_back(TVector3(0,
595 opflashes[iof]->YCenter() + opflashes[iof]->YWidth(),
596 opflashes[iof]->ZCenter() - opflashes[iof]->ZWidth()));
597 points.push_back(TVector3(0,
598 opflashes[iof]->YCenter() + opflashes[iof]->YWidth(),
599 opflashes[iof]->ZCenter() + opflashes[iof]->ZWidth()));
601 for (
size_t i = 0; i < points.size(); ++i) {
609 if (wireID.
Wire < wire0) wire0 = wireID.
Wire;
610 if (wireID.
Wire > wire1) wire1 = wireID.
Wire;
613 TLine&
line = view->AddLine(flashtick, wire0, flashtick, wire1);
614 line.SetLineWidth(2);
615 line.SetLineStyle(2);
616 line.SetLineColor(Color);
619 TLine&
line = view->AddLine(wire0, flashtick, wire1, flashtick);
620 line.SetLineWidth(2);
621 line.SetLineStyle(2);
622 line.SetLineColor(Color);
644 for (
size_t imod = 0; imod < recoOpt->
fSeedLabels.size(); ++imod) {
650 if (seeds.
size() < 1)
continue;
653 for (
size_t isd = 0; isd < seeds.
size(); ++isd) {
656 double SeedPointErr[3];
657 double SeedDirErr[3];
661 seeds[isd]->GetPoint(SeedPoint, SeedPointErr);
662 seeds[isd]->GetDirection(SeedDir, SeedDirErr);
664 SeedEnd1[0] = SeedPoint[0] + SeedDir[0];
665 SeedEnd1[1] = SeedPoint[1] + SeedDir[1];
666 SeedEnd1[2] = SeedPoint[2] + SeedDir[2];
668 SeedEnd2[0] = SeedPoint[0] - SeedDir[0];
669 SeedEnd2[1] = SeedPoint[1] - SeedDir[1];
670 SeedEnd2[2] = SeedPoint[2] - SeedDir[2];
675 unsigned int wirepoint = 0;
676 unsigned int wireend1 = 0;
677 unsigned int wireend2 = 0;
682 wirepoint = atoi(e.explain_self().substr(e.explain_self().find(
"#") + 1, 5).c_str());
688 wireend1 = atoi(e.explain_self().substr(e.explain_self().find(
"#") + 1, 5).c_str());
694 wireend2 = atoi(e.explain_self().substr(e.explain_self().find(
"#") + 1, 5).c_str());
697 double x = wirepoint;
699 double x1 = wireend1;
701 double x2 = wireend2;
713 TMarker& strt = view->AddMarker(x, y, color, 4, 1.5);
714 TLine&
line = view->AddLine(x1, y1, x2, y2);
715 strt.SetMarkerColor(color);
716 line.SetLineColor(color);
717 line.SetLineWidth(2.0);
739 static bool first =
true;
742 <<
"******** DrawSlices: 0 = none, 1 = color coded, 2 = color coded + ID at slice center\n";
743 std::cout <<
" 3 = open circle at slice center with size proportional to the AspectRatio. " 745 std::cout <<
" at the slice ends with connecting dotted lines\n";
749 unsigned int t = rawOpt->
fTPC;
752 for (
size_t imod = 0; imod < recoOpt->
fSliceLabels.size(); ++imod) {
756 if (slices.
size() < 1)
continue;
757 art::FindMany<recob::Hit> fmh(slices, evt, which);
758 for (
size_t isl = 0; isl < slices.
size(); ++isl) {
763 std::vector<const recob::Hit*> hits = fmh.at(isl);
764 std::vector<const recob::Hit*> hits_on_plane;
765 for (
auto hit : hits) {
766 if (
hit->WireID().Plane == plane) { hits_on_plane.push_back(
hit); }
768 if (this->
Hit2D(hits_on_plane, color, view,
false,
false) < 1)
continue;
771 slices[isl]->Center().
X(), slices[isl]->Center().
Y(), slices[isl]->Center().
Z());
775 char const* txt = s.c_str();
776 TText& slcID = view->AddText(wire, tick, txt);
777 slcID.SetTextSize(0.05);
778 slcID.SetTextColor(color);
784 slices[isl]->Center().
X(), slices[isl]->Center().
Y(), slices[isl]->Center().
Z());
787 float markerSize = 1;
788 if (slices[isl]->AspectRatio() > 0) {
789 markerSize = 1 / slices[isl]->AspectRatio();
790 if (markerSize > 3) markerSize = 3;
792 TMarker& ctr = view->AddMarker(wire, tick, color, 24, markerSize);
793 ctr.SetMarkerColor(color);
795 TPolyLine& pline = view->AddPolyLine(2, color, 2, 3);
797 slices[isl]->End0Pos().
X(), slices[isl]->End0Pos().
Y(), slices[isl]->End0Pos().
Z());
800 TMarker& end0 = view->AddMarker(wire, tick, color, 20, 1.0);
801 end0.SetMarkerColor(color);
802 pline.SetPoint(0, wire, tick);
804 slices[isl]->End1Pos().
X(), slices[isl]->End1Pos().
Y(), slices[isl]->End1Pos().
Z());
807 TMarker& end1 = view->AddMarker(wire, tick, color, 20, 1.0);
808 end1.SetMarkerColor(color);
809 pline.SetPoint(1, wire, tick);
841 static bool first =
true;
843 std::cout <<
"******** DrawClusters: 0 = none, 1 = cluster hits, 2 = unique marker, 3 = " 844 "cluster hits with connecting lines.\n";
845 std::cout <<
" 4 = with T<cluster or trajectory ID> P<PFParticle ID> color-matched. " 846 "Unmatched cluster IDs shown in black.\n";
847 std::cout <<
" Color scheme: By cluster ID in each plane or by PFParticle ID (Self) if a " 848 "PFParticle - Cluster association exists.\n";
852 for (
size_t imod = 0; imod < recoOpt->
fClusterLabels.size(); ++imod) {
858 if (clust.
size() < 1)
continue;
864 std::vector<art::Ptr<recob::SpacePoint>> spacePointVec;
868 if (spacePointVec.size() > 0) {
870 art::FindManyP<recob::Hit> spHitAssnVec(spacePointVec, evt, which);
872 if (spHitAssnVec.isValid()) {
874 std::vector<const recob::Hit*> freeHitVec;
877 for (
const auto& spacePointPtr : spacePointVec) {
878 if (spacePointPtr->Chisq() < -99.) {
880 const std::vector<art::Ptr<recob::Hit>>& hitVec =
881 spHitAssnVec.at(spacePointPtr.key());
883 for (
const auto& hitPtr : hitVec) {
884 if (hitPtr.get()->WireID().Plane != plane)
continue;
886 freeHitVec.push_back(hitPtr.get());
892 this->
Hit2D(freeHitVec, kGray, view,
false,
false,
false);
897 art::FindMany<recob::Hit> fmh(clust, evt, which);
898 art::FindManyP<recob::PFParticle> fmc(clust, evt, which);
900 for (
size_t ic = 0; ic < clust.
size(); ++ic) {
903 if (clust[ic]->
Plane().
Plane != plane)
continue;
908 bool pfpAssociation =
false;
909 int pfpIndex = INT_MAX;
910 float cosmicscore = FLT_MIN;
913 std::vector<art::Ptr<recob::PFParticle>> pfplist = fmc.at(ic);
915 if (!pfplist.empty()) {
916 clusterIdx = pfplist[0]->Self();
918 pfpAssociation =
true;
919 pfpIndex = pfplist[0]->Self();
922 art::FindManyP<anab::CosmicTag> fmct(pfplist, evt, which);
923 if (fmct.isValid()) {
924 std::vector<art::Ptr<anab::CosmicTag>> ctlist = fmct.at(0);
925 if (!ctlist.empty()) {
927 cosmicscore = ctlist[0]->CosmicScore();
934 std::vector<const recob::Hit*> hits = fmh.at(ic);
943 if (this->
Hit2D(hits, color, view,
false, drawConnectingLines) < 1)
continue;
946 this->
Hit2D(hits, view, cosmicscore);
956 if (pfpIndex != INT_MAX) s = s +
" P" +
std::to_string(pfpIndex + 1);
957 char const* txt = s.c_str();
958 double wire = 0.5 * (clust[ic]->StartWire() + clust[ic]->EndWire());
959 double tick = 20 + 0.5 * (clust[ic]->StartTick() + clust[ic]->EndTick());
960 TText& clID = view->AddText(wire, tick, txt);
961 clID.SetTextSize(0.05);
962 if (pfpAssociation) { clID.SetTextColor(color); }
964 clID.SetTextColor(kBlack);
971 std::vector<double> tpts, wpts;
980 TPolyLine& p1 = view->AddPolyLine(wpts.size(), lcolor, width, style);
981 TPolyLine& p2 = view->AddPolyLine(wpts.size(), lcolor, width, style);
983 p1.SetFillStyle(3003);
984 p1.SetFillColor(fcolor);
985 for (
size_t i = 0; i < wpts.size(); ++i) {
987 p1.SetPoint(i, wpts[i], tpts[i]);
988 p2.SetPoint(i, wpts[i], tpts[i]);
991 p1.SetPoint(i, tpts[i], wpts[i]);
992 p2.SetPoint(i, tpts[i], wpts[i]);
1002 double wirePitch = geo->
WirePitch(gview);
1013 clust[ic]->StartWire(),
1014 clust[ic]->StartTick(),
1015 clust[ic]->EndWire(),
1016 clust[ic]->EndTick(),
1017 std::tan((clust[ic]->StartAngle() + clust[ic]->EndAngle()) / 2.) * wirePitch /
1018 driftvelocity / timetick,
1046 double slope1 = slope;
1054 slope1 = 1. / slope;
1059 double deltaX = 0.5 * (x2 -
x1);
1060 double xm = x1 + deltaX;
1061 double ym = y1 + deltaX * slope;
1063 TMarker& strt = view->AddMarker(xm, ym, color, kFullCircle, 1.0);
1064 strt.SetMarkerColor(color);
1067 double stublen = 2. * deltaX;
1068 TLine&
l = view->AddLine(x1, y1, x1 + stublen, y1 + slope1 * stublen);
1069 l.SetLineColor(color);
1090 double slope1 = slope;
1097 slope1 = 1. / slope;
1102 TMarker& strt = view->AddMarker(x1, y1, color, kFullStar, 2.0);
1103 strt.SetMarkerColor(color);
1106 double stublen = 300.0;
1107 TLine&
l = view->AddLine(x1, y1, x1 + stublen, y1 + slope1 * stublen);
1108 l.SetLineColor(color);
1131 double cosx1 = cosx;
1132 double cosy1 = cosy;
1142 TMarker& strt = view->AddMarker(x1, y1, color, kFullStar, 2.0);
1143 strt.SetMarkerColor(color);
1146 double stublen = 300.0;
1147 TLine&
l = view->AddLine(x1, y1, x1 + stublen * cosx1, y1 + stublen * cosy1);
1148 l.SetLineColor(color);
1166 std::vector<double>& wpts,
1167 std::vector<double>& tpts,
1173 std::map<unsigned int, double> wlo, whi;
1175 for (
size_t j = 0; j < hits.size(); ++j) {
1177 if (hits[j]->
WireID().Plane != plane || hits[j]->WireID().TPC != rawOpt->
fTPC ||
1178 hits[j]->WireID().Cryostat != rawOpt->
fCryostat)
1181 wlo[hits[j]->WireID().Wire] = hits[j]->PeakTime();
1182 whi[hits[j]->WireID().Wire] = hits[j]->PeakTime();
1188 for (
size_t j = 0; j < hits.size(); ++j) {
1189 t = hits[j]->PeakTime();
1191 if (t < wlo[hits[j]->
WireID().
Wire]) wlo[hits[j]->WireID().Wire] =
t;
1192 if (t > whi[hits[j]->
WireID().
Wire]) whi[hits[j]->WireID().Wire] =
t;
1199 for (; itr != itrEnd; ++itr) {
1200 unsigned int w = itr->first;
1203 wpts.push_back(1. * w - 0.1);
1204 tpts.push_back(t - 0.1);
1205 wpts.push_back(1. * w + 0.1);
1206 tpts.push_back(t - 0.1);
1211 std::map<unsigned int, double>::reverse_iterator ritr(whi.rbegin());
1212 std::map<unsigned int, double>::reverse_iterator ritrEnd(whi.rend());
1213 for (; ritr != ritrEnd; ++ritr) {
1214 unsigned int w = ritr->first;
1217 wpts.push_back(1. * w + 0.1);
1218 tpts.push_back(t + 0.1);
1219 wpts.push_back(1. * w - 0.1);
1220 tpts.push_back(t + 0.1);
1224 wpts.push_back(wpts[0]);
1225 tpts.push_back(tpts[0]);
1233 std::vector<const recob::Hit*>& hits,
1236 TVector3
const& startPos,
1237 TVector3
const& startDir,
1246 unsigned int t = rawOpt->
fTPC;
1248 geo::Point_t localPos(startPos.X(), startPos.Y(), startPos.Z());
1255 if (cscore < 0.6) color = kMagenta;
1258 else if (cscore < -10000) {
1263 if (cscore < -1000) {
1264 this->
Hit2D(hits, color, view,
false,
false, lineWidth);
1268 char const* txt = s.c_str();
1271 TText& shwID = view->AddText(wire, tick, txt);
1273 shwID.SetTextSize(0.1);
1277 this->
Hit2D(hits, color, view,
false,
false, lineWidth);
1284 double tick1 = detProp.
ConvertXToTicks((startPos + startDir).
X(), planeID);
1288 double ds = sqrt(
pow(tick0 - tick1, 2) +
pow(wire0 - wire1, 2));
1291 cost = (tick1 - tick0) / ds;
1292 cosw = (wire1 - wire0) / ds;
1304 std::vector<const recob::Hit*>& hits,
1315 unsigned int t = rawOpt->
fTPC;
1318 this->
Hit2D(hits, color, view,
false,
true, lineWidth);
1320 const auto& startPos = track->
Vertex();
1324 double local[3] = {0.};
1325 double world[3] = {0.};
1327 world[1] = startPos.Y();
1328 world[2] = startPos.Z();
1337 wire = 1. * atoi(e.explain_self().substr(e.explain_self().find(
"#") + 1, 5).c_str());
1351 double rotang = 3.1416 - thetawire;
1352 double yprime = std::cos(rotang) * startDir.Y() + std::sin(rotang) * startDir.Z();
1353 double dTdW = startDir.X() * wirePitch / driftvelocity / timetick / yprime;
1360 TPolyLine& pl = view->AddPolyLine(0, 1, 1, 0);
1363 for (
size_t idx = 0; idx < nTrackHits; idx++) {
1368 world[1] = hitPos.Y();
1369 world[2] = hitPos.Z();
1373 double wireHit = 0.;
1375 wireHit = 1. * geo->
NearestWire(world, plane, t, c);
1378 wireHit = 1. * atoi(e.explain_self().substr(e.explain_self().find(
"#") + 1, 5).c_str());
1382 if (tpc == t && cryo == c) { pl.SetPoint(vidx++, wireHit, tickHit); }
1410 unsigned int tpc = rawOpt->
fTPC;
1415 for (
size_t imod = 0; imod < recoOpt->
fTrackLabels.size(); ++imod) {
1421 if (track.
vals().size() < 1)
continue;
1423 art::FindMany<recob::Hit> fmh(track, evt, which);
1427 art::FindManyP<anab::CosmicTag> cosmicTrackTags(track, evt, whichTag);
1429 auto tracksProxy = proxy::getCollection<proxy::Tracks>(
evt, which);
1433 for (
size_t t = 0;
t < track.
vals().size(); ++
t) {
1435 if (track.
vals().at(
t)->NumberTrajectoryPoints() == 0) {
1436 std::cout <<
"***** Track with no trajectory points ********" <<
std::endl;
1443 track.
vals().at(
t)->End().Y(),
1444 track.
vals().at(
t)->End().Z());
1448 track.
vals().at(
t)->ID() &
1451 char const* txt = s.c_str();
1452 TText& trkID = view->AddText(wire, tick, txt);
1454 trkID.SetTextSize(0.1);
1458 if (cosmicTrackTags.isValid()) {
1459 if (cosmicTrackTags.at(
t).size() > 0) {
1465 std::vector<const recob::Hit*> hits;
1466 if (track.
vals().at(
t)->NumberTrajectoryPoints() == fmh.at(
t).size()) {
1467 auto tp = tracksProxy[
t];
1468 for (
auto point : tp.points()) {
1469 if (!point.isPointValid())
continue;
1470 hits.push_back(point.hit());
1478 while (itr < hits.end()) {
1479 if ((*itr)->View() != gview)
1491 if (Score < 0.6) color = kMagenta;
1494 else if (Score < -10000) {
1498 this->
DrawTrack2D(clockData, detProp, hits, view, plane, aTrack, color, lineWidth);
1504 static bool first =
true;
1507 std::cout <<
"DrawShower options: \n";
1508 std::cout <<
" 1 = Hits in shower color-coded by the shower ID\n";
1509 std::cout <<
" 2 = Same as 1 + shower axis and circle representing the shower cone\n";
1510 std::cout <<
" Black cone = shower start dE/dx < 1 MeV/cm (< 1/2 MIP)\n";
1511 std::cout <<
" Blue cone = shower start dE/dx < 3 MeV/cm (~1 MIP)\n";
1512 std::cout <<
" Green cone = shower start 3 MeV/cm < dE/dx < 5 MeV/cm (~2 MIP)\n";
1513 std::cout <<
" Red cone = shower start 5 MeV/cm < dE/dx (>2 MIP)\n";
1516 for (
size_t imod = 0; imod < recoOpt->
fShowerLabels.size(); ++imod) {
1521 if (shower.
vals().size() < 1)
continue;
1523 art::FindMany<recob::Hit> fmh(shower, evt, which);
1527 for (
size_t s = 0;
s < shower.
vals().size(); ++
s) {
1529 std::vector<const recob::Hit*> hits = fmh.at(
s);
1532 while (itr < hits.end()) {
1533 if ((*itr)->View() != gview)
1541 if (!shower.
vals().at(
s)->has_length())
continue;
1542 if (!shower.
vals().at(
s)->has_open_angle())
continue;
1544 TVector3 startPos = shower.
vals().at(
s)->ShowerStart();
1545 TVector3
dir = shower.
vals().at(
s)->Direction();
1546 double length = shower.
vals().at(
s)->Length();
1547 double openAngle = shower.
vals().at(
s)->OpenAngle();
1550 TVector3 endPos = startPos + length *
dir;
1559 TLine& coneLine = view->AddLine(swire, stick, ewire, etick);
1561 std::vector<double> dedxVec = shower.
vals().at(
s)->dEdx();
1565 if (plane < dedxVec.size()) {
1566 if (dedxVec[plane] > 1 && dedxVec[plane] < 3) {
1570 else if (dedxVec[plane] < 5) {
1579 coneLine.SetLineColor(color);
1582 double radius = length * openAngle;
1583 auto coneRim =
Circle3D(endPos, dir, radius);
1584 TPolyLine& pline = view->AddPolyLine(coneRim.size(),
color, 2, 0);
1586 for (
unsigned short ipt = 0; ipt < coneRim.size(); ++ipt) {
1587 geo::Point_t localPos(coneRim[ipt][0], coneRim[ipt][1], coneRim[ipt][2]);
1591 pline.SetPoint(ipt, wire, tick);
1598 shower.
vals().at(
s)->ShowerStart(),
1599 shower.
vals().at(
s)->Direction(),
1631 unsigned int tpc = rawOpt->
fTPC;
1641 if (trackCol.
vals().size() < 1)
continue;
1644 std::unique_ptr<art::Assns<recob::Vertex, recob::Track>> vertexTrackAssociations(
1653 if (vertexTrackAssnsHandle->size() < 1)
continue;
1656 art::FindMany<recob::Hit> fmh(trackCol, evt, which);
1658 art::FindManyP<anab::CosmicTag> cosmicTrackTags(
1661 auto tracksProxy = proxy::getCollection<proxy::Tracks>(
evt, which);
1667 std::cout <<
"==> Neutrino Candidate drawing for tagger " 1671 for (
const auto& vertexTrackAssn : *vertexTrackAssnsHandle) {
1675 if (vertex->
ID() != lastVtxIdx) {
1686 TMarker& strt = view->AddMarker(wire, time, color, 24, 3.0);
1687 strt.SetMarkerColor(color);
1689 std::cout <<
" --> Drawing vertex id: " << vertex->
ID() <<
std::endl;
1692 lastVtxIdx = vertex->
ID();
1697 double x = track->
End().X();
1702 tid = track->
ID() & 65535;
1704 std::cout <<
" --> Drawing Track id: " << tid <<
std::endl;
1707 char const* txt = s.c_str();
1709 TText& trkID = view->AddText(wire, tick, txt);
1710 trkID.SetTextColor(color);
1711 trkID.SetTextSize(0.1);
1713 float cosmicScore = -999;
1714 if (cosmicTrackTags.isValid()) {
1715 if (cosmicTrackTags.at(track.
key()).
size() > 0) {
1721 std::vector<const recob::Hit*> hits;
1723 auto tp = tracksProxy[track.
key()];
1724 for (
auto point : tp.points()) {
1725 if (!point.isPointValid())
continue;
1726 hits.push_back(point.hit());
1730 hits = fmh.at(track.
key());
1734 while (itr < hits.end()) {
1735 if ((*itr)->View() != gview)
1743 if (cosmicScore > 0.1) {
1745 if (cosmicScore < 0.6) color = kMagenta;
1748 else if (cosmicScore < -10000) {
1773 static bool first =
true;
1776 std::cout <<
"******** DrawVertices: Open circles color coded across all planes. Set " 1777 "DrawVertices > 1 to display the vertex ID\n";
1781 for (
size_t imod = 0; imod < recoOpt->
fVertexLabels.size(); ++imod) {
1787 if (vertex.
size() < 1)
continue;
1789 double local[3] = {0., 0., 0.};
1790 double world[3] = {0., 0., 0.};
1793 double minxyz[3], maxxyz[3];
1801 for (
size_t v = 0; v < vertex.
size(); ++v) {
1804 vertex[v]->XYZ(xyz);
1805 if (xyz[0] < minxyz[0] || xyz[0] > maxxyz[0])
continue;
1806 if (xyz[1] < minxyz[1] || xyz[1] > maxxyz[1])
continue;
1807 if (xyz[2] < minxyz[2] || xyz[2] > maxxyz[2])
continue;
1816 TMarker& strt = view->AddMarker(wire, time, color, 24, 1.0);
1817 strt.SetMarkerColor(color);
1822 char const* txt = s.c_str();
1823 TText& vtxID = view->AddText(wire, time + 30, txt);
1824 vtxID.SetTextColor(color);
1825 vtxID.SetTextSize(0.05);
1846 for (
unsigned int imod = 0; imod < recoOpt->
fEventLabels.size(); ++imod) {
1852 if (event.
size() < 1)
continue;
1854 art::FindMany<recob::Hit> fmh(event, evt, which);
1856 for (
size_t e = 0;
e <
event.size(); ++
e) {
1857 std::vector<const recob::Hit*> hits;
1863 while (itr < hits.end()) {
1864 if ((*itr)->View() != gview)
1885 std::vector<art::InputTag>
labels;
1887 for (
size_t imod = 0; imod < recoOpt->
fSeedLabels.size(); ++imod)
1890 for (
size_t imod = 0; imod < labels.size(); ++imod) {
1898 if (seeds.
size() < 1)
continue;
1900 TPolyMarker3D& pmrk = view->AddPolyMarker3D(seeds.
size(),
color, 4, 1);
1902 for (
size_t iseed = 0; iseed != seeds.
size(); ++iseed) {
1903 double pt[3], pterr[3],
dir[3], direrr[3];
1904 seeds.
at(iseed)->GetPoint(pt, pterr);
1905 seeds.
at(iseed)->GetDirection(dir, direrr);
1907 double end1[3], end2[3];
1908 for (
int i = 0; i != 3; ++i) {
1909 end1[i] = pt[i] + dir[i];
1910 end2[i] = pt[i] - dir[i];
1913 TPolyLine3D& pline = view->AddPolyLine3D(2, color, 2, 0);
1915 pmrk.SetPoint(iseed, pt[0], pt[1], pt[2]);
1916 pline.SetPoint(0, end1[0], end1[1], end1[2]);
1917 pline.SetPoint(1, end2[0], end2[1], end2[2]);
1931 std::vector<art::InputTag>
labels;
1933 for (
size_t imod = 0; imod < recoOpt->
fSeedLabels.size(); ++imod)
1936 for (
size_t imod = 0; imod < labels.size(); ++imod) {
1944 for (
size_t iseed = 0; iseed != seeds.
size(); ++iseed) {
1945 double pt[3], pterr[3],
dir[3], direrr[3];
1946 seeds.
at(iseed)->GetPoint(pt, pterr);
1947 seeds.
at(iseed)->GetDirection(dir, direrr);
1949 double end1[3], end2[3];
1950 for (
int i = 0; i != 3; ++i) {
1951 end1[i] = pt[i] + dir[i];
1952 end2[i] = pt[i] - dir[i];
1956 TMarker& strt = view->AddMarker(pt[1], pt[0], color, 4, 1.5);
1957 TLine&
line = view->AddLine(end1[1], end1[0], end2[1], end2[0]);
1960 line.SetLineWidth(2.0);
1963 TMarker& strt = view->AddMarker(pt[2], pt[0], color, 4, 1.5);
1964 TLine&
line = view->AddLine(end1[2], end1[0], end2[2], end2[0]);
1967 line.SetLineWidth(2.0);
1972 <<
"projection is not YZ as expected\n";
1974 TMarker& strt = view->AddMarker(pt[2], pt[1], color, 4, 1.5);
1975 TLine&
line = view->AddLine(end1[2], end1[1], end2[2], end2[1]);
1978 line.SetLineWidth(2.0);
1993 std::vector<art::InputTag>
labels;
1999 for (
size_t imod = 0; imod < labels.size(); ++imod) {
2002 std::vector<art::Ptr<recob::SpacePoint>> spts;
2004 int color = 10 * imod + 11;
2042 <<
"RecoBaseDrawer: number PFParticles to draw: " << pfParticleVec.
size() <<
std::endl;
2045 if (pfParticleVec.
size() < 1)
continue;
2048 std::vector<art::Ptr<recob::SpacePoint>> spacePointVec;
2052 std::vector<art::Ptr<recob::Edge>> edgeVec;
2056 if (spacePointVec.empty())
continue;
2059 art::FindManyP<recob::SpacePoint> edgeSpacePointAssnsVec(edgeVec, evt, assns);
2060 art::FindManyP<recob::SpacePoint> spacePointAssnVec(pfParticleVec, evt, assns);
2061 art::FindManyP<recob::Hit> spHitAssnVec(spacePointVec, evt, assns);
2062 art::FindManyP<recob::Edge> edgeAssnsVec(pfParticleVec, evt, assns);
2065 if (!spacePointAssnVec.isValid())
continue;
2068 art::FindMany<recob::PCAxis> pcAxisAssnVec(pfParticleVec, evt, which);
2075 art::FindMany<anab::CosmicTag> pfCosmicAssns(pfParticleVec, evt, cosmicTagLabel);
2081 art::FindMany<recob::Track> pfTrackAssns(pfParticleVec, evt, trackTagLabel);
2084 for (
size_t idx = 0; idx < pfParticleVec.
size(); idx++) {
2090 if (!pfParticle->IsPrimary())
continue;
2098 edgeSpacePointAssnsVec,
2116 bool usePlane[] = {
false,
false,
false};
2117 float peakTimeVec[] = {0., 0., 0.};
2118 float peakSigmaVec[] = {0., 0., 0.};
2120 float weightSum(0.);
2123 std::map<size_t, double> planeOffsetMap;
2125 planeOffsetMap[0] = 0.;
2126 planeOffsetMap[1] = 4.;
2127 planeOffsetMap[2] = 8.;
2129 for (
const auto&
hit : hitVec) {
2132 float peakTime =
hit->PeakTime() - planeOffsetMap[
hit->WireID().Plane];
2133 float peakRMS =
hit->RMS();
2135 aveSum += peakTime / (peakRMS * peakRMS);
2136 weightSum += 1. / (peakRMS * peakRMS);
2138 peakTimeVec[
hit->WireID().Plane] = peakTime;
2139 peakSigmaVec[
hit->WireID().Plane] = peakRMS;
2140 usePlane[
hit->WireID().Plane] =
true;
2143 aveSum /= weightSum;
2145 for (
int idx = 0; idx < 3; idx++) {
2146 if (usePlane[idx]) {
2147 float deltaTime = peakTimeVec[idx] - aveSum;
2148 float sigmaPeakTimeSq = peakSigmaVec[idx] * peakSigmaVec[idx];
2150 hitChiSq += deltaTime * deltaTime / sigmaPeakTimeSq;
2161 const art::FindManyP<recob::Edge>& edgeAssnsVec,
2162 const art::FindManyP<recob::SpacePoint>& spacePointAssnVec,
2163 const art::FindManyP<recob::SpacePoint>& edgeSPAssnVec,
2164 const art::FindManyP<recob::Hit>& spHitAssnVec,
2165 const art::FindMany<recob::Track>& trackAssnVec,
2166 const art::FindMany<recob::PCAxis>& pcAxisAssnVec,
2167 const art::FindMany<anab::CosmicTag>& cosmicTagAssnVec,
2175 const std::vector<art::Ptr<recob::SpacePoint>>& hitsVec(spacePointAssnVec.at(pfPart.
key()));
2179 bool isCosmic(
false);
2184 std::vector<const anab::CosmicTag*> pfCosmicTagVec = cosmicTagAssnVec.at(pfPart.
key());
2186 if (!pfCosmicTagVec.empty()) {
2189 if (cosmicTag->
CosmicScore() > 0.6) isCosmic =
true;
2194 if (isCosmic) colorIdx = 12;
2280 const std::vector<art::Ptr<recob::Edge>>& edgeVec(edgeAssnsVec.at(pfPart.
key()));
2282 if (!edgeVec.empty()) {
2283 TPolyMarker3D&
pm = view->AddPolyMarker3D(
2284 2 * edgeVec.size(), colorIdx, kFullDotMedium, 1.25);
2286 for (
const auto& edge : edgeVec) {
2288 const std::vector<art::Ptr<recob::SpacePoint>>& spacePointVec(
2289 edgeSPAssnVec.at(edge.key()));
2291 if (spacePointVec.size() != 2) {
2292 std::cout <<
"Space Point vector associated to edge is not of size 2: " 2300 TVector3 startPoint(firstSP->
XYZ()[0], firstSP->
XYZ()[1], firstSP->
XYZ()[2]);
2301 TVector3 endPoint(secondSP->
XYZ()[0], secondSP->
XYZ()[1], secondSP->
XYZ()[2]);
2302 TVector3 lineVec(endPoint - startPoint);
2304 pm.SetNextPoint(startPoint[0], startPoint[1], startPoint[2]);
2305 pm.SetNextPoint(endPoint[0], endPoint[1], endPoint[2]);
2307 double length = lineVec.Mag();
2310 std::cout <<
"Edge length is zero, index 1: " << edge->FirstPointID()
2311 <<
", index 2: " << edge->SecondPointID() <<
std::endl;
2315 double minLen =
std::max(2.01, length);
2317 if (minLen > length) {
2320 startPoint += -0.5 * (minLen - length) * lineVec;
2321 endPoint += 0.5 * (minLen - length) * lineVec;
2325 TPolyLine3D& pl = view->AddPolyLine3D(2, colorIdx, 4, 1);
2327 pl.SetPoint(0, startPoint[0], startPoint[1], startPoint[2]);
2328 pl.SetPoint(1, endPoint[0], endPoint[1], endPoint[2]);
2338 if (trackAssnVec.isValid()) {
2339 std::vector<const recob::Track*> trackVec(trackAssnVec.at(pfPart.
key()));
2341 if (!trackVec.empty()) {
2342 for (
const auto& track : trackVec)
2343 DrawTrack3D(*track, view, colorIdx, kFullDotLarge, 0.5);
2349 std::vector<const recob::PCAxis*> pcaVec(pcAxisAssnVec.at(pfPart.
key()));
2351 if (!pcaVec.empty()) {
2355 int lineWidth[2] = {2, 1};
2356 int lineStyle[2] = {1, 13};
2357 int lineColor[2] = {colorIdx, 18};
2359 int markStyle[2] = {kFullDotLarge, kFullDotLarge};
2360 double markSize[2] = {0.5, 0.2};
2363 if (!isCosmic) lineColor[1] = colorIdx;
2367 if (pcaVec.size() > 1 && pcaVec.front()->getID() > pcaVec.back()->getID())
2370 for (
const auto& pca : pcaVec) {
2372 const double* avePosition = pca->getAvePosition();
2376 TPolyMarker3D& pmrk =
2377 view->AddPolyMarker3D(7, lineColor[pcaIdx], markStyle[pcaIdx], markSize[pcaIdx]);
2379 pmrk.SetPoint(pmrkIdx++, avePosition[0], avePosition[1], avePosition[2]);
2382 for (
int dimIdx = 0; dimIdx < 3; dimIdx++) {
2384 TPolyLine3D& pl = view->AddPolyLine3D(
2385 numPoints, lineColor[pcaIdx], lineWidth[pcaIdx], lineStyle[pcaIdx]);
2388 double eigenValue = pca->getEigenValues()[dimIdx];
2391 if (eigenValue > 0) {
2393 eigenValue = 3. * sqrt(eigenValue);
2396 const std::vector<double>& eigenVector = pca->getEigenVectors()[dimIdx];
2399 double xl = avePosition[0] - 0.5 * eigenValue * eigenVector[0];
2400 double yl = avePosition[1] - 0.5 * eigenValue * eigenVector[1];
2401 double zl = avePosition[2] - 0.5 * eigenValue * eigenVector[2];
2403 pl.SetPoint(0, xl, yl, zl);
2404 pmrk.SetPoint(pmrkIdx++, xl, yl, zl);
2407 double xu = avePosition[0] + 0.5 * eigenValue * eigenVector[0];
2408 double yu = avePosition[1] + 0.5 * eigenValue * eigenVector[1];
2409 double zu = avePosition[2] + 0.5 * eigenValue * eigenVector[2];
2411 pl.SetPoint(1, xu, yu, zu);
2412 pmrk.SetPoint(pmrkIdx++, xu, yu, zu);
2432 for (
const auto& daughterIdx : pfPart->
Daughters()) {
2460 for (
size_t imod = 0; imod < recoOpt->
fEdgeLabels.size(); ++imod) {
2464 std::vector<art::Ptr<recob::Edge>> edgeVec;
2465 this->
GetEdges(evt, which, edgeVec);
2468 <<
"RecoBaseDrawer: number Edges to draw: " << edgeVec.size() <<
std::endl;
2470 if (!edgeVec.empty()) {
2472 std::vector<art::Ptr<recob::SpacePoint>> spacePointVec;
2478 TPolyMarker3D&
pm = view->AddPolyMarker3D(
2479 spacePointVec.size(), colorIdx, kFullDotMedium, 0.5);
2481 for (
const auto& spacePoint : spacePointVec) {
2482 TVector3 spPosition(spacePoint->XYZ()[0], spacePoint->XYZ()[1], spacePoint->XYZ()[2]);
2484 pm.SetNextPoint(spPosition[0], spPosition[1], spPosition[2]);
2488 for (
const auto& edge : edgeVec) {
2492 if (firstSP->
ID() != edge->FirstPointID() || secondSP->
ID() != edge->SecondPointID()) {
2494 <<
"Edge: Space point index mismatch, first: " << firstSP->
ID() <<
", " 2495 << edge->FirstPointID() <<
", second: " << secondSP->
ID() <<
", " 2500 TVector3 startPoint(firstSP->
XYZ()[0], firstSP->
XYZ()[1], firstSP->
XYZ()[2]);
2501 TVector3 endPoint(secondSP->
XYZ()[0], secondSP->
XYZ()[1], secondSP->
XYZ()[2]);
2502 TVector3 lineVec(endPoint - startPoint);
2504 double length = lineVec.Mag();
2516 TPolyMarker3D& fakeLine = view->AddPolyMarker3D(10, 5, kFullDotMedium, 1.0);
2520 for (
int idx = 1; idx <= 10; idx++) {
2521 TVector3 plotPoint = startPoint + 0.1 * double(idx) * length * lineVec;
2523 fakeLine.SetNextPoint(plotPoint[0], plotPoint[1], plotPoint[2]);
2534 std::vector<art::Ptr<recob::SpacePoint>> spacePointVec;
2538 <<
"RecoBaseDrawer: number Extreme points to draw: " << spacePointVec.size() <<
std::endl;
2540 if (!spacePointVec.empty()) {
2542 int colorIdx(kYellow);
2544 TPolyMarker3D&
pm = view->AddPolyMarker3D(
2545 spacePointVec.size(), colorIdx, kFullDotLarge, 1.0);
2547 for (
const auto& spacePoint : spacePointVec) {
2548 TVector3 spPosition(spacePoint->XYZ()[0], spacePoint->XYZ()[1], spacePoint->XYZ()[2]);
2550 pm.SetNextPoint(spPosition[0], spPosition[1], spPosition[2]);
2574 for (
size_t imod = 0; imod < recoOpt->
fTrackLabels.size(); ++imod) {
2583 trackView.
fill(trackVec);
2587 art::FindMany<anab::CosmicTag> cosmicTagAssnVec(trackVec, evt, cosmicTagLabel);
2589 for (
const auto& track : trackVec) {
2591 int marker = kFullDotLarge;
2597 if (cosmicTagAssnVec.isValid()) {
2598 std::vector<const anab::CosmicTag*> tkCosmicTagVec = cosmicTagAssnVec.at(track.key());
2600 if (!tkCosmicTagVec.empty()) {
2621 for (
size_t imod = 0; imod < recoOpt->
fShowerLabels.size(); ++imod) {
2626 for (
size_t s = 0;
s < shower.
vals().size(); ++
s) {
2652 const art::Event*
evt = evdb::EventHolder::Instance()->GetEvent();
2655 auto handles = evt->
getMany<std::vector<recob::Track>>();
2657 for (
auto ih : handles) {
2662 art::FindManyP<recob::SpacePoint> fmsp(handle, *evt, which);
2664 if (fmsp.isValid() && fmsp.size() > 0) {
2665 int n = handle->size();
2666 float spSize = 0.5 *
size;
2668 for (
int i = 0; i <
n; ++i) {
2670 if (&*p == &track) {
2671 std::vector<art::Ptr<recob::SpacePoint>> spts = fmsp.at(i);
2684 int lineSize =
size;
2686 if (lineSize < 1) lineSize = 1;
2690 TPolyMarker3D& pmStart = view->AddPolyMarker3D(1, 0, marker, 2. * size);
2693 pmStart.SetPoint(0, firstPos.X(), firstPos.Y(), firstPos.Z());
2698 for (
int p = 0;
p < np; ++
p) {
2708 for (
int p = 0;
p < np; ++
p) {
2722 for (
int p = 1;
p < np; ++
p) {
2725 TPolyLine3D& pl = view->AddPolyLine3D(2, (color + 1) %
evd::kNCOLS, size, 7);
2728 auto deltaPos = nextPos - startPos;
2729 double arcLen = deltaPos.Dot(
2732 if (arcLen < 0.) arcLen = 3.;
2734 auto endPoint = startPos + arcLen * startDir;
2736 pl.SetPoint(0, startPos.X(), startPos.Y(), startPos.Z());
2737 pl.SetPoint(1, endPoint.X(), endPoint.Y(), endPoint.Z());
2757 const art::Event*
evt = evdb::EventHolder::Instance()->GetEvent();
2760 auto handles = evt->
getMany<std::vector<recob::Shower>>();
2762 bool noSpts =
false;
2764 for (
auto ih : handles) {
2770 art::FindManyP<recob::SpacePoint> fmsp(handle, *evt, which);
2772 int n = handle->size();
2773 for (
int i = 0; i <
n; ++i) {
2775 if (&*p == &shower) {
2777 std::vector<art::Ptr<recob::SpacePoint>> spts;
2792 std::cout <<
"No space points associated with the shower. Drawing a cone instead\n";
2794 auto& dedx = shower.
dEdx();
2795 if (!dedx.empty()) {
2797 for (
auto& dedxInPln : dedx)
2798 dedxAve += dedxInPln;
2799 dedxAve /= (double)dedx.size();
2803 if (dedxAve > 3 && dedxAve < 5) color = kGreen;
2809 TPolyLine3D& pl = view->AddPolyLine3D(coneRim.size(),
color, 2, 0);
2810 for (
unsigned short ipt = 0; ipt < coneRim.size(); ++ipt) {
2811 auto& pt = coneRim[ipt];
2812 pl.SetPoint(ipt, pt[0], pt[1], pt[2]);
2815 for (
unsigned short ipt = 0; ipt < coneRim.size(); ++ipt) {
2816 TPolyLine3D& panel = view->AddPolyLine3D(2, color, 2, 0);
2817 panel.SetPoint(0, startPos.X(), startPos.Y(), startPos.Z());
2818 panel.SetPoint(1, coneRim[ipt][0], coneRim[ipt][1], coneRim[ipt][2]);
2827 std::vector<std::array<double, 3>>
2834 r.RotateX(axisDir.X());
2835 r.RotateY(axisDir.Y());
2836 r.RotateZ(axisDir.Z());
2837 constexpr
unsigned short nRimPts = 16;
2838 std::vector<std::array<double, 3>> rimPts(nRimPts + 1);
2839 for (
unsigned short iang = 0; iang < nRimPts; ++iang) {
2840 double rimAngle = iang * 2 *
M_PI / (
float)nRimPts;
2841 TVector3 rim = {0, 0, 1};
2842 rim.SetX(radius * cos(rimAngle));
2843 rim.SetY(radius * sin(rimAngle));
2847 for (
unsigned short ixyz = 0; ixyz < 3; ++ixyz)
2848 rimPts[iang][ixyz] = rim[ixyz];
2851 rimPts[nRimPts] = rimPts[0];
2866 for (
size_t imod = 0; imod < recoOpt->
fVertexLabels.size(); ++imod) {
2872 art::FindManyP<recob::Track> fmt(vertex, evt, which);
2873 art::FindManyP<recob::Shower> fms(vertex, evt, which);
2875 for (
size_t v = 0; v < vertex.
size(); ++v) {
2877 if (fmt.isValid()) {
2878 std::vector<art::Ptr<recob::Track>>
tracks = fmt.at(v);
2881 for (
size_t t = 0;
t < tracks.size(); ++
t)
2882 this->
DrawTrack3D(*(tracks[
t]), view, vertex[v]->ID());
2885 if (fms.isValid()) {
2886 std::vector<art::Ptr<recob::Shower>>
showers = fms.at(v);
2888 for (
size_t s = 0;
s < showers.size(); ++
s)
2892 double xyz[3] = {0.};
2893 vertex[v]->XYZ(xyz);
2896 pm.SetPoint(0, xyz[0], xyz[1], xyz[2]);
2915 for (
size_t imod = 0; imod < recoOpt->
fEventLabels.size(); ++imod) {
2921 if (event.
size() < 1)
continue;
2923 art::FindManyP<recob::Vertex> fmvp(event, evt, which);
2924 art::FindMany<recob::Vertex> fmv(event, evt, which);
2926 for (
size_t e = 0;
e <
event.size(); ++
e) {
2929 std::vector<art::Ptr<recob::Vertex>>
vertex = fmvp.at(
e);
2931 if (vertex.size() < 1)
continue;
2933 art::FindManyP<recob::Track> fmt(vertex, evt, recoOpt->
fVertexLabels[0]);
2934 art::FindManyP<recob::Shower> fms(vertex, evt, recoOpt->
fVertexLabels[0]);
2936 for (
size_t v = 0; v < vertex.size(); ++v) {
2940 std::vector<art::Ptr<recob::Track>>
tracks = fmt.at(v);
2941 std::vector<art::Ptr<recob::Shower>>
showers = fms.at(v);
2944 for (
size_t t = 0;
t < tracks.size(); ++
t)
2947 for (
size_t s = 0;
s < showers.size(); ++
s)
2952 double xyz[3] = {0.};
2953 std::vector<const recob::Vertex*> vts = fmv.at(
e);
2955 event[
e]->PrimaryVertex(vts)->XYZ(xyz);
2958 pm.SetPoint(0, xyz[0], xyz[1], xyz[2]);
2976 for (
size_t imod = 0; imod < recoOpt->
fSliceLabels.size(); ++imod) {
2980 if (slices.
size() < 1)
continue;
2981 art::FindManyP<recob::SpacePoint> fmsp(slices, evt, which);
2982 for (
size_t isl = 0; isl < slices.
size(); ++isl) {
2985 std::vector<art::Ptr<recob::SpacePoint>> spts = fmsp.at(isl);
3009 for (
size_t i = 0; i < geo->
NTPC(); ++i) {
3010 double local[3] = {0., 0., 0.};
3011 double world[3] = {0., 0., 0.};
3018 for (
size_t imod = 0; imod < recoOpt->
fOpFlashLabels.size(); ++imod) {
3024 if (opflashes.
size() < 1)
continue;
3026 int NFlashes = opflashes.
size();
3029 for (
int iof = 0; iof < NFlashes; ++iof) {
3031 if (opflashes[iof]->TotalPE() < recoOpt->
fFlashMinPE)
continue;
3032 if (opflashes[iof]->Time() < recoOpt->
fFlashTMin)
continue;
3033 if (opflashes[iof]->Time() > recoOpt->
fFlashTMax)
continue;
3035 double YCentre = opflashes[iof]->YCenter();
3036 double YHalfWidth = opflashes[iof]->YWidth();
3037 double ZCentre = opflashes[iof]->ZCenter();
3038 double ZHalfWidth = opflashes[iof]->ZWidth();
3043 TBox& b1 = view->AddBox(YCentre - YHalfWidth, minx, YCentre + YHalfWidth, maxx);
3044 b1.SetFillStyle(3004 + (iof % 3));
3045 b1.SetFillColor(Colour);
3051 TLine&
line = view->AddLine(ZCentre - ZHalfWidth, xflash, ZCentre + ZHalfWidth, xflash);
3052 line.SetLineWidth(2);
3053 line.SetLineStyle(2);
3054 line.SetLineColor(Colour);
3057 TBox& b1 = view->AddBox(
3058 ZCentre - ZHalfWidth, YCentre - YHalfWidth, ZCentre + ZHalfWidth, YCentre + YHalfWidth);
3059 b1.SetFillStyle(3004 + (iof % 3));
3060 b1.SetFillColor(Colour);
3061 view->AddMarker(ZCentre, YCentre, Colour, 4, 1.5);
3074 for (
size_t v = 0; v < vertex.
size(); ++v) {
3076 double xyz[3] = {0.};
3077 vertex[v]->XYZ(xyz);
3082 TMarker& strt = view->AddMarker(xyz[1], xyz[0], color, marker, 1.0);
3083 strt.SetMarkerColor(color);
3086 TMarker& strt = view->AddMarker(xyz[2], xyz[0], color, marker, 1.0);
3087 strt.SetMarkerColor(color);
3090 TMarker& strt = view->AddMarker(xyz[2], xyz[1], color, marker, 1.0);
3091 strt.SetMarkerColor(color);
3105 for (
size_t imod = 0; imod < recoOpt->
fVertexLabels.size(); ++imod) {
3133 std::vector<art::InputTag>
labels;
3139 for (
size_t imod = 0; imod < labels.size(); ++imod) {
3142 std::vector<art::Ptr<recob::SpacePoint>> spts;
3174 if (pfParticleVec.
size() < 1)
continue;
3177 art::FindMany<recob::SpacePoint> spacePointAssnVec(pfParticleVec, evt, which);
3180 if (!spacePointAssnVec.isValid())
continue;
3183 art::FindMany<recob::PCAxis> pcAxisAssnVec(pfParticleVec, evt, which);
3185 if (!pcAxisAssnVec.isValid())
continue;
3188 for (
size_t idx = 0; idx < pfParticleVec.
size(); idx++) {
3194 if (!pfParticle->IsPrimary())
continue;
3198 pfParticle, pfParticleVec, spacePointAssnVec, pcAxisAssnVec, 0, proj, view);
3208 const art::FindMany<recob::SpacePoint>& spacePointAssnVec,
3209 const art::FindMany<recob::PCAxis>& pcAxisAssnVec,
3217 const std::vector<const recob::SpacePoint*>& hitsVec(spacePointAssnVec.at(pfPart->
Self()));
3224 if (!hitsVec.empty()) {
3225 std::vector<const recob::SpacePoint*> hitPosVec;
3226 std::vector<const recob::SpacePoint*> skeletonPosVec;
3227 std::vector<const recob::SpacePoint*> skelEdgePosVec;
3228 std::vector<const recob::SpacePoint*> edgePosVec;
3229 std::vector<const recob::SpacePoint*> seedPosVec;
3230 std::vector<const recob::SpacePoint*> pairPosVec;
3232 for (
const auto& spacePoint : hitsVec) {
3233 if (spacePoint->Chisq() > 0.)
3234 hitPosVec.push_back(spacePoint);
3235 else if (spacePoint->Chisq() == -1.)
3236 skeletonPosVec.push_back(spacePoint);
3237 else if (spacePoint->Chisq() == -3.)
3238 skelEdgePosVec.push_back(spacePoint);
3239 else if (spacePoint->Chisq() == -4.)
3240 seedPosVec.push_back(spacePoint);
3241 else if (spacePoint->Chisq() > -10.)
3242 edgePosVec.push_back(spacePoint);
3244 pairPosVec.push_back(spacePoint);
3250 TPolyMarker& pm1 = view->AddPolyMarker(hitPosVec.size(), colorIdx, kFullDotMedium, 1);
3251 for (
const auto* spacePoint : hitPosVec) {
3252 const double*
pos = spacePoint->XYZ();
3255 pm1.SetPoint(hitIdx++, pos[0], pos[1]);
3257 pm1.SetPoint(hitIdx++, pos[2], pos[0]);
3259 pm1.SetPoint(hitIdx++, pos[2], pos[1]);
3264 TPolyMarker& pm2 = view->AddPolyMarker(edgePosVec.size(), 28, kFullDotMedium, 1);
3265 for (
const auto* spacePoint : edgePosVec) {
3266 const double*
pos = spacePoint->XYZ();
3269 pm2.SetPoint(hitIdx++, pos[0], pos[1]);
3271 pm2.SetPoint(hitIdx++, pos[2], pos[0]);
3273 pm2.SetPoint(hitIdx++, pos[2], pos[1]);
3278 TPolyMarker& pm3 = view->AddPolyMarker(pairPosVec.size(), 2, kFullDotMedium, 1);
3279 for (
const auto* spacePoint : pairPosVec) {
3280 const double*
pos = spacePoint->XYZ();
3283 pm3.SetPoint(hitIdx++, pos[0], pos[1]);
3285 pm3.SetPoint(hitIdx++, pos[2], pos[0]);
3287 pm3.SetPoint(hitIdx++, pos[2], pos[1]);
3293 TPolyMarker& pm4 = view->AddPolyMarker(skeletonPosVec.size(), 1, kFullDotMedium, 1);
3294 for (
const auto* spacePoint : skeletonPosVec) {
3295 const double*
pos = spacePoint->XYZ();
3298 pm4.SetPoint(hitIdx++, pos[0], pos[1]);
3300 pm4.SetPoint(hitIdx++, pos[2], pos[0]);
3302 pm4.SetPoint(hitIdx++, pos[2], pos[1]);
3307 TPolyMarker& pm5 = view->AddPolyMarker(skelEdgePosVec.size(), 3, kFullDotMedium, 1);
3308 for (
const auto* spacePoint : skelEdgePosVec) {
3309 const double*
pos = spacePoint->XYZ();
3312 pm5.SetPoint(hitIdx++, pos[0], pos[1]);
3314 pm5.SetPoint(hitIdx++, pos[2], pos[0]);
3316 pm5.SetPoint(hitIdx++, pos[2], pos[1]);
3321 TPolyMarker& pm6 = view->AddPolyMarker(seedPosVec.size(), 6, kFullDotMedium, 1);
3322 for (
const auto* spacePoint : seedPosVec) {
3323 const double*
pos = spacePoint->XYZ();
3326 pm6.SetPoint(hitIdx++, pos[0], pos[1]);
3328 pm6.SetPoint(hitIdx++, pos[2], pos[0]);
3330 pm6.SetPoint(hitIdx++, pos[2], pos[1]);
3335 if (pcAxisAssnVec.isValid()) {
3336 std::vector<const recob::PCAxis*> pcaVec(pcAxisAssnVec.at(pfPart->
Self()));
3338 if (!pcaVec.empty()) {
3341 int lineWidth[2] = {3, 1};
3342 int lineStyle[2] = {1, 13};
3343 int lineColor[2] = {colorIdx, 18};
3344 int markStyle[2] = {4, 4};
3349 if (pcaVec.size() > 1 && pcaVec.front()->getID() > pcaVec.back()->getID())
3352 for (
const auto& pca : pcaVec) {
3354 const double* avePosition = pca->getAvePosition();
3358 TPolyMarker& pmrk = view->AddPolyMarker(7, lineColor[pcaIdx], markStyle[pcaIdx], 1);
3361 pmrk.SetPoint(pmrkIdx++, avePosition[0], avePosition[1]);
3363 pmrk.SetPoint(pmrkIdx++, avePosition[2], avePosition[0]);
3365 pmrk.SetPoint(pmrkIdx++, avePosition[2], avePosition[1]);
3368 for (
int dimIdx = 0; dimIdx < 3; dimIdx++) {
3371 view->AddPolyLine(numPoints, lineColor[pcaIdx], lineWidth[pcaIdx], lineStyle[pcaIdx]);
3374 double eigenValue = pca->getEigenValues()[dimIdx];
3377 if (eigenValue > 0) {
3379 eigenValue = 3. * sqrt(eigenValue);
3382 const std::vector<double>& eigenVector = pca->getEigenVectors()[dimIdx];
3385 double xl = avePosition[0] - 0.5 * eigenValue * eigenVector[0];
3386 double yl = avePosition[1] - 0.5 * eigenValue * eigenVector[1];
3387 double zl = avePosition[2] - 0.5 * eigenValue * eigenVector[2];
3390 pl.SetPoint(0, xl, yl);
3391 pmrk.SetPoint(pmrkIdx++, xl, yl);
3394 pl.SetPoint(0, zl, xl);
3395 pmrk.SetPoint(pmrkIdx++, zl, xl);
3398 pl.SetPoint(0, zl, yl);
3399 pmrk.SetPoint(pmrkIdx++, zl, yl);
3403 double xu = avePosition[0] + 0.5 * eigenValue * eigenVector[0];
3404 double yu = avePosition[1] + 0.5 * eigenValue * eigenVector[1];
3405 double zu = avePosition[2] + 0.5 * eigenValue * eigenVector[2];
3408 pl.SetPoint(1, xu, yu);
3409 pmrk.SetPoint(pmrkIdx++, xu, yu);
3412 pl.SetPoint(1, zu, xu);
3413 pmrk.SetPoint(pmrkIdx++, zu, xu);
3416 pl.SetPoint(1, zu, yu);
3417 pmrk.SetPoint(pmrkIdx++, zu, yu);
3434 for (
const auto& daughterIdx : pfPart->
Daughters()) {
3467 for (
size_t imod = 0; imod < recoOpt->
fTrackLabels.size(); ++imod) {
3472 for (
size_t t = 0;
t < track.
vals().size(); ++
t) {
3474 int color = ptrack->
ID() & 65535;
3486 for (
size_t imod = 0; imod < recoOpt->
fShowerLabels.size(); ++imod) {
3491 for (
size_t s = 0;
s < shower.
vals().size(); ++
s) {
3521 std::map<int, std::vector<art::Ptr<recob::SpacePoint>>> spmap;
3523 for (
auto& pspt : spts) {
3535 spcolor = 100 - 2.5 * pspt->Chisq();
3536 if (spcolor < 51) spcolor = 51;
3537 if (spcolor > 100) spcolor = 100;
3539 spmap[spcolor].push_back(pspt);
3546 for (
auto icolor : spmap) {
3547 int spcolor = icolor.first;
3548 std::vector<art::Ptr<recob::SpacePoint>>& psps = icolor.second;
3552 TPolyMarker&
pm = view->AddPolyMarker(psps.size(), spcolor, kFullCircle, msize);
3553 for (
size_t s = 0;
s < psps.size(); ++
s) {
3555 const double* xyz = spt.
XYZ();
3557 case evd::kXY: pm.SetPoint(
s, xyz[0], xyz[1]);
break;
3558 case evd::kXZ: pm.SetPoint(
s, xyz[2], xyz[0]);
break;
3559 case evd::kYZ: pm.SetPoint(
s, xyz[2], xyz[1]);
break;
3562 << __func__ <<
": unknown projection #" << ((
int)proj) <<
"\n";
3588 const art::Event*
evt = evdb::EventHolder::Instance()->GetEvent();
3591 auto handles = evt->
getMany<std::vector<recob::Track>>();
3592 for (
auto ih : handles) {
3596 art::FindManyP<recob::SpacePoint> fmsp(handle, *evt, which);
3598 int n = handle->size();
3599 for (
int i = 0; i <
n; ++i) {
3601 if (&*p == &track) {
3602 std::vector<art::Ptr<recob::SpacePoint>> spts = fmsp.at(i);
3620 TPolyLine& pl = view->AddPolyLine(vp,
evd::kColor[color % evd::kNCOLS], 2, 0);
3621 for (
int p = 0;
p < np; ++
p) {
3626 pm.SetPoint(
p,
pos.X(),
pos.Y());
3627 pl.SetPoint(
p,
pos.X(),
pos.Y());
3630 pm.SetPoint(
p,
pos.Z(),
pos.X());
3631 pl.SetPoint(
p,
pos.Z(),
pos.X());
3634 pm.SetPoint(
p,
pos.Z(),
pos.Y());
3635 pl.SetPoint(
p,
pos.Z(),
pos.Y());
3639 << __func__ <<
": unknown projection #" << ((
int)proj) <<
"\n";
3648 char const* txt = s.c_str();
3649 double x = track.
End().X();
3650 double y = track.
End().Y();
3651 double z = track.
End().Z();
3653 TText& trkID = view->AddText(x, y, txt);
3654 trkID.SetTextColor(
evd::kColor[tid % evd::kNCOLS]);
3655 trkID.SetTextSize(0.03);
3658 TText& trkID = view->AddText(z, x, txt);
3659 trkID.SetTextColor(
evd::kColor[tid % evd::kNCOLS]);
3660 trkID.SetTextSize(0.03);
3663 TText& trkID = view->AddText(z, y, txt);
3664 trkID.SetTextColor(
evd::kColor[tid % evd::kNCOLS]);
3665 trkID.SetTextSize(0.03);
3685 const art::Event*
evt = evdb::EventHolder::Instance()->GetEvent();
3688 auto handles = evt->
getMany<std::vector<recob::Shower>>();
3689 for (
auto ih : handles) {
3693 art::FindManyP<recob::SpacePoint> fmsp(handle, *evt, which);
3694 if (!fmsp.isValid())
continue;
3695 int n = handle->size();
3696 for (
int i = 0; i <
n; ++i) {
3698 if (&*p == &shower) {
3723 << __func__ <<
": unknown projection #" << ((
int)proj) <<
"\n";
3726 if (fmsp.isValid()) {
3727 std::vector<art::Ptr<recob::SpacePoint>> spts = fmsp.at(i);
3752 for (
unsigned int i = 0; i < wcol->size(); ++i) {
3759 writeErrMsg(
"GetWires", e);
3762 return wires.
size();
3769 std::vector<const recob::Hit*>& hits,
3777 std::vector<const recob::Hit*>
temp;
3781 for (
const auto&
hit : temp) {
3785 const std::vector<geo::WireID>& wireIDs = geo->
ChannelToWire(
hit->Channel());
3788 for (
const auto& wireID : wireIDs) {
3789 if (wireID.Plane == plane && wireID.TPC == rawOpt->
fTPC &&
3791 hits.push_back(
hit);
3796 writeErrMsg(
"GetHits", e);
3816 for (
unsigned int i = 0; i < slcCol->size(); ++i) {
3823 writeErrMsg(
"GetSlices", e);
3826 return slices.
size();
3843 for (
unsigned int i = 0; i < clcol->size(); ++i) {
3850 writeErrMsg(
"GetClusters", e);
3853 return clust.
size();
3869 for (
unsigned int i = 0; i < clcol->size(); ++i) {
3876 writeErrMsg(
"GetPFParticles", e);
3879 return clust.
size();
3895 for (
unsigned int i = 0; i < epcol->size(); ++i) {
3902 writeErrMsg(
"GetEndPoint2D", e);
3922 for (
unsigned int i = 0; i < opflashcol->size(); ++i) {
3926 temp.
swap(opflashes);
3929 writeErrMsg(
"GetOpFlashes", e);
3932 return opflashes.
size();
3949 for (
unsigned int i = 0; i < seedcol->size(); ++i) {
3956 writeErrMsg(
"GetSeeds", e);
3959 return seeds.
size();
3987 for (
unsigned int i = 0; i < edgeCol->size(); ++i)
3988 edges.emplace_back(edgeCol, i);
3990 return edges.size();
4003 writeErrMsg(
"GetTracks", e);
4006 return track.
vals().size();
4019 writeErrMsg(
"GetShowers", e);
4022 return shower.
vals().size();
4038 for (
size_t i = 0; i < vcol->size(); ++i) {
4045 writeErrMsg(
"GetVertices", e);
4048 return vertex.
size();
4064 for (
size_t i = 0; i < ecol->size(); ++i) {
4071 writeErrMsg(
"GetEvents", e);
4074 return event.size();
4081 unsigned int cryostat,
4085 std::vector<const recob::Hit*>
temp;
4086 int NumberOfHitsBeforeThisPlane = 0;
4090 for (
size_t t = 0;
t < temp.size(); ++
t) {
4091 if (temp[
t]->
WireID().Cryostat == cryostat && temp[
t]->WireID().TPC == tpc &&
4092 temp[
t]->WireID().Plane == plane)
4094 NumberOfHitsBeforeThisPlane++;
4096 return NumberOfHitsBeforeThisPlane;
4111 float maxSig(std::numeric_limits<float>::lowest());
4112 bool setLimits(
false);
4117 for (
size_t imod = 0; imod < recoOpt->
fWireLabels.size(); ++imod) {
4123 for (
size_t i = 0; i < wires.
size(); ++i) {
4125 std::vector<geo::WireID> wireids = geo->
ChannelToWire(wires[i]->Channel());
4127 bool goodWID =
false;
4128 for (
auto const& wid : wireids) {
4130 if (wid.Plane == plane && wid.Wire == wire && wid.TPC == rawOpt->
fTPC &&
4134 if (!goodWID)
continue;
4136 std::vector<float> wirSig = wires[i]->Signal();
4137 for (
unsigned int ii = 0; ii < wirSig.size(); ++ii) {
4140 minSig =
std::min(minSig, wirSig[ii]);
4141 maxSig =
std::max(maxSig, wirSig[ii]);
4149 histo->SetMaximum(1.2 * maxSig);
4150 histo->SetMinimum(1.2 * minSig);
4167 for (
size_t imod = 0; imod < recoOpt->
fWireLabels.size(); ++imod) {
4173 for (
unsigned int i = 0; i < wires.
size(); ++i) {
4175 std::vector<geo::WireID> wireids = geo->
ChannelToWire(wires[i]->Channel());
4177 bool goodWID =
false;
4178 for (
auto const& wid : wireids) {
4180 if (wid.Plane == plane && wid.TPC == rawOpt->
fTPC && wid.Cryostat == rawOpt->
fCryostat)
4183 if (!goodWID)
continue;
4184 std::vector<float> wirSig = wires[i]->Signal();
4185 for (
unsigned int ii = 0; ii < wirSig.size(); ++ii)
4186 histo->Fill(wirSig[ii]);
4204 std::vector<double>& htau1,
4205 std::vector<double>& htau2,
4206 std::vector<double>& hitamplitudes,
4207 std::vector<double>& hpeaktimes,
4208 std::vector<int>& hstartT,
4209 std::vector<int>& hendT,
4210 std::vector<int>& hNMultiHit,
4211 std::vector<int>& hLocalHitIndex)
4220 for (
size_t imod = 0; imod < recoOpt->
fWireLabels.size(); ++imod) {
4226 for (
size_t i = 0; i < wires.
size(); ++i) {
4228 std::vector<geo::WireID> wireids = geo->
ChannelToWire(wires[i]->Channel());
4230 bool goodWID =
false;
4231 for (
auto const& wid : wireids) {
4232 if (wid.Plane == plane && wid.Wire == wire && wid.TPC == rawOpt->
fTPC &&
4237 if (!goodWID)
continue;
4239 std::vector<float> wirSig = wires[i]->Signal();
4240 for (
unsigned int ii = 0; ii < wirSig.size(); ++ii)
4241 histo->Fill(1. * ii, wirSig[ii]);
4246 for (
size_t imod = 0; imod < recoOpt->
fHitLabels.size(); ++imod) {
4249 std::vector<const recob::Hit*> hits;
4250 this->
GetHits(evt, which, hits, plane);
4253 const auto& fitParams = hitResults->vectors();
4257 for (
size_t i = 0; i < hits.size(); ++i) {
4259 if (hits[i]->
WireID().Wire != wire)
continue;
4261 hpeaktimes.push_back(fitParams[FitParamsOffset + i][0]);
4262 htau1.push_back(fitParams[FitParamsOffset + i][1]);
4263 htau2.push_back(fitParams[FitParamsOffset + i][2]);
4264 hitamplitudes.push_back(fitParams[FitParamsOffset + i][3]);
4265 hstartT.push_back(hits[i]->StartTick());
4266 hendT.push_back(hits[i]->EndTick());
4267 hNMultiHit.push_back(hits[i]->Multiplicity());
4268 hLocalHitIndex.push_back(hits[i]->LocalIndex());
ISpacePointDrawerPtr fSpacePointDrawer
int fDraw2DSlopeEndPoints
virtual bool IsBad(raw::ChannelID_t channel) const =0
Returns whether the specified channel is bad in the current run.
void SpacePointOrtho(const art::Event &evt, evd::OrthoProj_t proj, double msize, evdb::View2D *view)
geo::Length_t WireCoordinate(double YPos, double ZPos, geo::PlaneID const &planeid) const
Returns the index of the nearest wire to the specified position.
void XYZ(double *xyz) const
Legacy method to access vertex position, preserved to avoid breaking code. Please try to use Vertex::...
void DrawShowerOrtho(const recob::Shower &shower, int color, evd::OrthoProj_t proj, double msize, evdb::View2D *view)
void SpacePoint3D(const art::Event &evt, evdb::View3D *view)
void reserve(size_type n)
int GetTracks(const art::Event &evt, const art::InputTag &which, art::View< recob::Track > &track)
std::vector< double > fRawCharge
Sum of Raw Charge.
const std::vector< size_t > & Daughters() const
Returns the collection of daughter particles.
fhicl::ParameterSet fSpacePointDrawerParams
FHICL parameters for SpacePoint drawing.
void FillTQHisto(const art::Event &evt, unsigned int plane, unsigned int wire, TH1F *histo)
const TVector3 & ShowerStart() const
int fScaleDigitsByCharge
scale the size of the digit by the charge
void PFParticleOrtho(const art::Event &evt, evd::OrthoProj_t proj, double msize, evdb::View2D *view)
std::vector< art::InputTag > fEndPoint2DLabels
module labels that produced end point 2d objects
An object to define a "edge" which is used to connect space points in a triangulation algorithm...
unsigned int fTPC
TPC number to draw, typically set by TWQProjectionView.
void DrawProng2D(detinfo::DetectorPropertiesData const &detProp, std::vector< const recob::Hit * > &hits, evdb::View2D *view, unsigned int plane, TVector3 const &startPos, TVector3 const &startDir, int id, float cscore=-5)
geo::Length_t DetHalfWidth(geo::TPCID const &tpcid) const
Returns the half width of the active volume of the specified TPC.
int NumDaughters() const
Returns the number of daughter particles flowing from this one.
std::vector< art::InputTag > fTrkVtxCosmicLabels
module labels that tagged track as CR (Track/Vertex module)
ISpacePointDrawerPtr fAllSpacePointDrawer
std::vector< art::InputTag > fOpFlashLabels
module labels that produced events
Encapsulate the construction of a single cyostat.
size_t Self() const
Returns the index of this particle.
double rms(sqlite3 *db, std::string const &table_name, std::string const &column_name)
bool has_length() const
Returns whether the shower has a valid length.
void Prong3D(const art::Event &evt, evdb::View3D *view)
AdcChannelData::View View
float SpacePointChiSq(const std::vector< art::Ptr< recob::Hit >> &) const
std::vector< art::InputTag > fTrackLabels
module labels that produced tracks
WireGeo const & Wire(unsigned int iwire) const
void DrawPFParticle3D(const art::Ptr< recob::PFParticle > &pfPart, const art::PtrVector< recob::PFParticle > &pfParticleVec, const std::vector< art::Ptr< recob::SpacePoint >> &spacePointVec, const art::FindManyP< recob::Edge > &edgeAssnsVec, const art::FindManyP< recob::SpacePoint > &spacePointAssnsVec, const art::FindManyP< recob::SpacePoint > &edgeSPAssnVec, const art::FindManyP< recob::Hit > &spHitAssnVec, const art::FindMany< recob::Track > &trackAssnVec, const art::FindMany< recob::PCAxis > &pcAxisAssnVec, const art::FindMany< anab::CosmicTag > &cosmicTagAssnVec, int depth, evdb::View3D *view)
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
void swap(PtrVector &other)
int GetSpacePoints(const art::Event &evt, const art::InputTag &which, std::vector< art::Ptr< recob::SpacePoint >> &spts)
int fDrawRawDataOrCalibWires
0 for raw
double GetXTicksOffset(int p, int t, int c) const
void SeedOrtho(const art::Event &evt, evd::OrthoProj_t proj, evdb::View2D *view)
std::vector< art::InputTag > fTrkVtxTrackLabels
module labels that produced tracks (Track/Vertex module)
int fColorSpacePointsByChisq
Generate space point colors by chisquare?
Point_t const & LocationAtPoint(size_t i) const
The data type to uniquely identify a Plane.
Geometry information for a single TPC.
void Vertex3D(const art::Event &evt, evdb::View3D *view)
bool HasValidPoint(size_t i) const
void Event3D(const art::Event &evt, evdb::View3D *view)
static std::unique_ptr< FVectorReader > create(const art::Event &evt, const art::InputTag &tag)
size_t NumberTrajectoryPoints() const
Various functions related to the presence and the number of (valid) points.
Vector_t VertexDirection() const
void ProngOrtho(const art::Event &evt, evd::OrthoProj_t proj, double msize, evdb::View2D *view)
int GetClusters(const art::Event &evt, const art::InputTag &which, art::PtrVector< recob::Cluster > &clust)
Plane(const Point_t &planePos, const Vector_t &planeDir)
Constructor from reference position on the plane and direction orthogonal to the plane.
std::vector< geo::WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
void DrawShower3D(const recob::Shower &shower, int color, evdb::View3D *view)
WireID_t Wire
Index of the wire within its plane.
void DrawSpacePointOrtho(std::vector< art::Ptr< recob::SpacePoint >> &spts, int color, evd::OrthoProj_t proj, double msize, evdb::View2D *view, int mode=0)
0: track, 1: shower
void Edge3D(const art::Event &evt, evdb::View3D *view)
SigType_t SignalType(geo::PlaneID const &pid) const
Returns the type of signal on the channels of specified TPC plane.
void fill(PtrVector< T > &pv) const
int GetEvents(const art::Event &evt, const art::InputTag &which, art::PtrVector< recob::Event > &event)
int fDrawSliceSpacePoints
double fFlashTMin
Minimal time for a flash to be displayed.
int fDrawTrackTrajectoryPoints
void Prong2D(const art::Event &evt, detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, evdb::View2D *view, unsigned int plane)
double ThetaZ() const
Returns angle of wire with respect to z axis in the Y-Z plane in radians.
geo::Length_t WirePitch(geo::PlaneID const &planeid) const
Returns the distance between two consecutive wires.
std::vector< art::InputTag > fExtremePointLabels
module labels that produced Extreme Points
std::vector< art::InputTag > fCosmicTagLabels
module labels that produced cosmic tags
unsigned int Nwires(unsigned int p, unsigned int tpc=0, unsigned int cstat=0) const
Returns the total number of wires in the specified plane.
art framework interface to geometry description
std::vector< double > fConvertedCharge
Sum of Charge Converted using Birks' formula.
bool has_open_angle() const
Returns whether the shower has a valid opening angle.
double fFlashTMax
Maximum time for a flash to be displayed.
void Slice2D(const art::Event &evt, detinfo::DetectorPropertiesData const &detProp, evdb::View2D *view, unsigned int plane)
void Cluster2D(const art::Event &evt, detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, evdb::View2D *view, unsigned int plane)
void DrawTrackVertexAssns2D(const art::Event &evt, detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, evdb::View2D *view, unsigned int plane)
Offers proxy::Tracks and proxy::Track class for recob::Track access.
bool isValid() const noexcept
geo::TPCID FindTPCAtPosition(double const worldLoc[3]) const
Returns the ID of the TPC at specified location.
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
unsigned int CountValidPoints() const
void Seed3D(const art::Event &evt, evdb::View3D *view)
int CountHits(const art::Event &evt, const art::InputTag &which, unsigned int cryostat, unsigned int tpc, unsigned int plane)
View_t View() const
Which coordinate does this plane measure.
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
unsigned int Nplanes(unsigned int tpc=0, unsigned int cstat=0) const
Returns the total number of wire planes in the specified TPC.
std::vector< art::InputTag > fWireLabels
module labels that produced wires
void Seed2D(const art::Event &evt, detinfo::DetectorPropertiesData const &detProp, evdb::View2D *view, unsigned int plane)
int GetEndPoint2D(const art::Event &evt, const art::InputTag &which, art::PtrVector< recob::EndPoint2D > &ep2d)
const std::vector< double > & dEdx() const
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
void push_back(Ptr< U > const &p)
void FillTQHistoDP(const art::Event &evt, unsigned int plane, unsigned int wire, TH1F *histo, std::vector< double > &htau1, std::vector< double > &htau2, std::vector< double > &hitamplitudes, std::vector< double > &hpeaktimes, std::vector< int > &hstartT, std::vector< int > &hendT, std::vector< int > &hNMultiHit, std::vector< int > &hLocalHitIndex)
Collection of exceptions for Geometry system.
unsigned int fCryostat
Cryostat number to draw, typically set by TWQProjectionView.
enum geo::_plane_sigtype SigType_t
Provenance const * provenance() const
void PFParticle3D(const art::Event &evt, evdb::View3D *view)
std::vector< Handle< PROD > > getMany(SelectorBase const &selector=MatchAllSelector{}) const
std::vector< art::InputTag > fPFParticleLabels
module labels that produced PFParticles
std::vector< art::InputTag > fVertexLabels
module labels that produced vertices
key_type key() const noexcept
void Draw2DSlopeEndPoints(double xStart, double yStart, double xEnd, double yEnd, double slope, int color, evdb::View2D *view)
geo::WireID::WireID_t NearestWire(geo::Point_t const &point, geo::PlaneID const &planeid) const
Returns the index of wire closest to position in the specified TPC.
Point_t const & Vertex() const
const evdb::ColorScale & CalQ(geo::SigType_t st) const
std::vector< art::InputTag > fEdgeLabels
module labels that produced Edge objects
double fMinSignal
minimum ADC count to display a time bin
double fTicks
number of TDC ticks to display, ie # fTicks past fStartTick
int Hit2D(const art::Event &evt, detinfo::DetectorPropertiesData const &detProp, evdb::View2D *view, unsigned int plane)
tick_as<> tick
Tick number, represented by std::ptrdiff_t.
double ConvertXToTicks(double X, int p, int t, int c) const
int GetSlices(const art::Event &evt, const art::InputTag &which, art::PtrVector< recob::Slice > &slices)
void Slice3D(const art::Event &evt, evdb::View3D *view)
geo::Length_t DetLength(geo::TPCID const &tpcid) const
Returns the length of the active volume of the specified TPC.
CryostatGeo const & Cryostat(geo::CryostatID const &cryoid) const
Returns the specified cryostat.
void DrawTrack2D(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, std::vector< const recob::Hit * > &hits, evdb::View2D *view, unsigned int plane, const recob::Track *track, int color, int lineWidth)
std::vector< int > fWireMax
highest wire in interesting region for each plane
int GetHits(const art::Event &evt, const art::InputTag &which, std::vector< const recob::Hit * > &hits, unsigned int plane)
std::vector< std::array< double, 3 > > Circle3D(const TVector3 &pos, const TVector3 &axisDir, const double &radius)
int GetWires(const art::Event &evt, const art::InputTag &which, art::PtrVector< recob::Wire > &wires)
fhicl::ParameterSet fAllSpacePointDrawerParams
FHICL parameters for SpacePoint drawing.
std::vector< art::InputTag > fSliceLabels
module labels that produced slices
const TVector3 & Direction() const
int GetOpFlashes(const art::Event &evt, const art::InputTag &which, art::PtrVector< recob::OpFlash > &opflash)
int GetSeeds(const art::Event &evt, const art::InputTag &which, art::PtrVector< recob::Seed > &seed)
double ElectronsToADC() const
int GetShowers(const art::Event &evt, const art::InputTag &which, art::View< recob::Shower > &shower)
reference at(size_type n)
Class providing information about the quality of channels.
static int max(int a, int b)
double DriftVelocity(double efield=0., double temperature=0.) const
cm/us
double fFlashMinPE
Minimal PE for a flash to be displayed.
std::vector< int > fWireMin
lowest wire in interesting region for each plane
std::vector< art::InputTag > fSeedLabels
module labels that produced events
static const int kColor[kNCOLS]
void GetChargeSum(int plane, double &charge, double &convcharge)
std::vector< TCSlice > slices
Detector simulation of raw signals on wires.
Encapsulate the geometry of a wire.
double ConvertTicksToX(double ticks, int p, int t, int c) const
unsigned int NTPC(unsigned int cstat=0) const
Returns the total number of TPCs in the specified cryostat.
std::vector< art::InputTag > fSpacePointLabels
module labels that produced space points
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)
std::vector< TrajPoint > seeds
void DrawTrack3D(const recob::Track &track, evdb::View3D *view, int color, int marker=1, float size=2.)
bool fDrawTrackVertexAssns
raw::ChannelID_t PlaneWireToChannel(WireID const &wireid) const
Returns the ID of the TPC channel connected to the specified wire.
int fDrawTrackSpacePoints
int fTicksPerPoint
number of ticks to include in one point
Declaration of signal hit object.
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Encapsulate the construction of a single detector plane.
auto isValid() const noexcept
bool fSeeBadChannels
Allow "bad" channels to be viewed.
Contains all timing reference information for the detector.
const TPCGeo & TPC(unsigned int itpc) const
Return the itpc'th TPC in the cryostat.
#define MF_LOG_VERBATIM(category)
static unsigned int reverse(QString &chars, unsigned char *level, unsigned int a, unsigned int b)
MaybeLogger_< ELseverityLevel::ELsev_success, false > LogDebug
void FillQHisto(const art::Event &evt, unsigned int plane, TH1F *histo)
double BirksCorrection(double dQdX) const
dQ/dX in electrons/cm, returns dE/dX in MeV/cm.
int ID() const
Return vertex id.
void line(double t, double *p, double &x, double &y, double &z)
int GetPFParticles(const art::Event &evt, const art::InputTag &which, art::PtrVector< recob::PFParticle > &pfpart)
void EndPoint2D(const art::Event &evt, evdb::View2D *view, unsigned int plane)
unsigned int Nwires() const
Number of wires in this plane.
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
void Wire2D(const art::Event &evt, evdb::View2D *view, unsigned int plane)
Provides recob::Track data product.
int fAxisOrientation
0 = TDC values on y-axis, wire number on x-axis, 1 = swapped
Interface for experiment-specific channel quality info provider.
void DrawPFParticleOrtho(const art::Ptr< recob::PFParticle > &pfPart, const art::PtrVector< recob::PFParticle > &pfParticleVec, const art::FindMany< recob::SpacePoint > &spacePointAssnsVec, const art::FindMany< recob::PCAxis > &pcAxisAssnVec, int depth, evd::OrthoProj_t proj, evdb::View2D *view)
Exception thrown on invalid wire number.
const Double32_t * XYZ() const
Point_t const & End() const
geo::WireID NearestWireID(geo::Point_t const &point, geo::PlaneID const &planeid) const
Returns the ID of wire closest to position in the specified TPC.
Declaration of basic channel signal object.
void OpFlash2D(const art::Event &evt, detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, evdb::View2D *view, unsigned int plane)
int GetRegionOfInterest(int plane, int &minw, int &maxw, int &mint, int &maxt)
Vector_t DirectionAtPoint(size_t i) const
void Event2D(const art::Event &evt, evdb::View2D *view, unsigned int plane)
TPCGeo const & TPC(unsigned int const tpc=0, unsigned int const cstat=0) const
Returns the specified TPC.
void GetClusterOutlines(std::vector< const recob::Hit * > &hits, std::vector< double > &tpts, std::vector< double > &wpts, unsigned int plane)
std::size_t getView(std::string const &moduleLabel, std::string const &productInstanceName, std::string const &processName, std::vector< ELEMENT const * > &result) const
PlaneGeo const & Plane(geo::View_t view) const
Return the plane in the tpc with View_t view.
void OpFlashOrtho(const art::Event &evt, detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, evd::OrthoProj_t proj, evdb::View2D *view)
std::vector< art::InputTag > fHitLabels
module labels that produced hits
std::vector< art::InputTag > fShowerLabels
module labels that produced showers
unsigned int ChannelID_t
Type representing the ID of a readout channel.
void Vertex2D(const art::Event &evt, detinfo::DetectorPropertiesData const &detProp, evdb::View2D *view, unsigned int plane)
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
TPCID_t TPC
Index of the TPC within its cryostat.
Interface for experiment-specific service for channel quality info.
std::vector< art::InputTag > fTrkVtxFilterLabels
module labels that filtered event (Track/Vertex module)
void DrawTrackOrtho(const recob::Track &track, int color, evd::OrthoProj_t proj, double msize, evdb::View2D *view)
static const int kColor2[kNCOLS]
geo::WireID suggestedWireID() const
Returns a better wire ID.
double sampling_rate(DetectorClocksData const &data)
Returns the period of the TPC readout electronics clock.
recob::tracking::Plane Plane
LArSoft geometry interface.
geo::CryostatID::CryostatID_t FindCryostatAtPosition(geo::Point_t const &worldLoc) const
Returns the index of the cryostat at specified location.
std::vector< int > fTimeMax
highest time in interesting region for each plane
std::string to_string(ModuleType const mt)
std::vector< art::InputTag > fClusterLabels
module labels that produced clusters
void LocalToWorld(const double *tpc, double *world) const
Transform point from local TPC frame to world frame.
std::vector< art::InputTag > fEventLabels
module labels that produced events
int GetVertices(const art::Event &evt, const art::InputTag &which, art::PtrVector< recob::Vertex > &vertex)
void LocalToWorld(const double *plane, double *world) const
Transform point from local plane frame to world frame.
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track:
void VertexOrtho(const art::PtrVector< recob::Vertex > &vertex, evd::OrthoProj_t proj, evdb::View2D *view, int marker)
cet::coded_exception< error, detail::translate > exception
int GetEdges(const art::Event &evt, const art::InputTag &which, std::vector< art::Ptr< recob::Edge >> &edges)
QTextStream & endl(QTextStream &s)
Event finding and building.
Encapsulate the construction of a single detector plane.
std::vector< int > fTimeMin
lowest time in interesting region for each plane