14 #include "TPolyLine.h" 15 #include "TPolyLine3D.h" 16 #include "TPolyMarker.h" 17 #include "TPolyMarker3D.h" 18 #include "TRotation.h" 54 #include "larevt/CalibrationDBI/Interface/ChannelStatusProvider.h" 55 #include "larevt/CalibrationDBI/Interface/ChannelStatusService.h" 67 #include "cetlib_except/exception.h" 74 mf::LogWarning(
"RecoBaseDrawer") <<
"RecoBaseDrawer::" << fcn <<
" failed with message:\n" <<
e;
77 auto const& getWireReadoutGeom()
89 auto const& wireReadoutGeom = getWireReadoutGeom();
102 unsigned int nplanes = wireReadoutGeom.Nplanes(tpcid);
109 for (
auto const& plane : wireReadoutGeom.Iterate<
geo::PlaneGeo>(tpcid)) {
110 auto const p = plane.ID().Plane;
136 lariov::ChannelStatusProvider
const& channelStatus =
149 auto const& wireReadoutGeom = getWireReadoutGeom();
150 for (
size_t imod = 0; imod < recoOpt->
fWireLabels.size(); ++imod) {
156 if (wires.
empty())
continue;
158 for (
size_t i = 0; i < wires.
size(); ++i) {
160 uint32_t channel = wires[i]->Channel();
162 if (!rawOpt->
fSeeBadChannels && channelStatus.IsBad(channel))
continue;
164 std::vector<geo::WireID> wireids = wireReadoutGeom.ChannelToWire(channel);
168 for (
auto const& wid : wireids) {
169 if (wid.planeID() != pid)
continue;
171 double wire = 1. * wid.Wire;
174 std::vector<float> wirSig = wires[i]->Signal();
175 if (wirSig.size() == 0)
continue;
178 while (itr != wirSig.end()) {
182 while (ticksUsed < ticksPerPoint && itr != wirSig.end()) {
184 adcsum += (1. * (*itr));
189 double adc = adcsum / ticksPerPoint;
190 double tdc = tdcsum / ticksPerPoint;
192 if (TMath::Abs(adc) < rawOpt->
fMinSignal)
continue;
193 if (tdc > rawOpt->
fTicks)
continue;
202 if (sf > 1.0) sf = 1.0;
205 if (wire < minw) minw = wire;
206 if (wire > maxw) maxw = wire;
207 if (tdc < mint) mint = tdc;
208 if (tdc > maxt) maxt = tdc;
211 TBox& b1 = view->
AddBox(wire - sf * 0.5,
212 tdc - sf * 0.5 * ticksPerPoint,
214 tdc + sf * 0.5 * ticksPerPoint);
215 b1.SetFillStyle(1001);
217 b1.SetBit(kCannotPick);
220 TBox& b1 = view->
AddBox(tdc - sf * 0.5 * ticksPerPoint,
222 tdc + sf * 0.5 * ticksPerPoint,
224 b1.SetFillStyle(1001);
226 b1.SetBit(kCannotPick);
239 double startTick(50.);
240 double endTick((rawOpt->
fTicks - 50.) * ticksPerPoint);
242 for (
size_t wireNo = 0; wireNo < wireReadoutGeom.Nwires(pid); wireNo++) {
247 double wire = 1. * wireNo;
248 TLine& line = view->
AddLine(wire, startTick, wire, endTick);
249 line.SetLineColor(kGray);
250 line.SetLineWidth(1.0);
251 line.SetBit(kCannotPick);
274 if (recoOpt->
fDrawHits == 0)
return nHitsDrawn;
280 auto const wire_pitch = getWireReadoutGeom().Plane({0, 0, 0}).WirePitch();
281 for (
size_t imod = 0; imod < recoOpt->
fHitLabels.size(); ++imod) {
284 std::vector<const recob::Hit*>
hits;
285 GetHits(evt, which, hits, plane);
288 for (
auto itr : hits) {
290 if (itr->WireID().TPC != rawOpt->
fTPC || itr->WireID().Cryostat != rawOpt->
fCryostat)
295 fRawCharge[itr->WireID().Plane] += itr->PeakAmplitude();
296 double dQdX = itr->PeakAmplitude() / wire_pitch / detProp.
ElectronsToADC();
320 bool drawConnectingLines,
325 auto const& wireReadoutGeom = getWireReadoutGeom();
328 unsigned int wold = 0;
335 for (
const auto&
hit : hits) {
340 std::vector<geo::WireID> wireIDs;
343 wireIDs = wireReadoutGeom.ChannelToWire(
hit->Channel());
345 wireIDs.push_back(
hit->WireID());
348 for (
const auto& wireID : wireIDs) {
349 if (wireID.TPC != rawOpt->
fTPC || wireID.Cryostat != rawOpt->
fCryostat)
continue;
351 if (std::isnan(
hit->PeakTime()) || std::isnan(
hit->Integral())) {
352 std::cout <<
"====>> Found hit with a NAN, channel: " <<
hit->Channel()
353 <<
", start/end: " <<
hit->StartTick() <<
"/" <<
hit->EndTick()
354 <<
", chisquare: " <<
hit->GoodnessOfFit() << std::endl;
357 if (
hit->PeakTime() > rawOpt->
fTicks)
continue;
363 float time =
hit->PeakTime();
364 float rms = 0.5 *
hit->RMS();
367 TBox& b1 = view->
AddBox(w - 0.5, time - rms, w + 0.5, time + rms);
368 if (drawConnectingLines && nHitsDrawn > 0) {
369 TLine& l = view->
AddLine(w, time, wold, timeold);
370 l.SetLineColor(color);
371 l.SetBit(kCannotPick);
374 b1.SetBit(kCannotPick);
375 b1.SetLineColor(color);
376 b1.SetLineWidth(lineWidth);
379 TBox& b1 = view->
AddBox(time - rms, w - 0.5, time + rms, w + 0.5);
380 if (drawConnectingLines && nHitsDrawn > 0) {
381 TLine& l = view->
AddLine(time, w, timeold, wold);
382 l.SetLineColor(color);
383 l.SetBit(kCannotPick);
386 b1.SetBit(kCannotPick);
387 b1.SetLineColor(color);
388 b1.SetLineWidth(lineWidth);
409 unsigned int wold(0);
413 for (
const auto&
hit : hits) {
419 w =
hit->WireID().Wire;
423 float time =
hit->PeakTime();
426 if (nHitsDrawn > 0) {
427 TLine& l = view->
AddLine(w, time + 100, wold, timeold + 100);
430 if (cosmicscore > 0.5) l.SetLineColor(kMagenta);
431 l.SetBit(kCannotPick);
435 if (nHitsDrawn > 0) {
436 TLine& l = view->
AddLine(time + 20, w, timeold + 20, wold);
438 if (cosmicscore > 0.5) l.SetLineStyle(2);
439 l.SetBit(kCannotPick);
457 if ((
unsigned int)plane >
fWireMin.size()) {
459 <<
" Requested plane " << plane <<
" is larger than those available ";
469 minw = (minw - 30 < 0) ? 0 : minw - 30;
470 mint = (mint - 10 < 0) ? 0 : mint - 10;
472 int fTicks = rawOpt->
fTicks;
475 maxw = std::min(maxw + 10, (
int)getWireReadoutGeom().Nwires(planeid));
476 maxt = (maxt + 10 > fTicks) ? fTicks : maxt + 10;
500 geo::View_t gview = getWireReadoutGeom().Plane(planeid).View();
508 for (
size_t iep = 0; iep < ep2d.
size(); ++iep) {
510 if (ep2d[iep]->View() != gview)
continue;
519 double x = ep2d[iep]->WireID().Wire;
520 double y = ep2d[iep]->DriftTime();
523 x = ep2d[iep]->DriftTime();
524 y = ep2d[iep]->WireID().Wire;
527 TMarker& strt = view->
AddMarker(x, y, color, 30, 2.0);
528 strt.SetMarkerColor(color);
532 char const* txt = s.c_str();
533 TText& vtxID = view->
AddText(x, y + 20, txt);
534 vtxID.SetTextColor(color);
535 vtxID.SetTextSize(0.05);
558 auto const& planeg = getWireReadoutGeom().Plane(pid);
560 for (
size_t imod = 0; imod < recoOpt->
fOpFlashLabels.size(); ++imod) {
566 if (opflashes.
size() < 1)
continue;
568 int NFlashes = opflashes.
size();
571 MF_LOG_VERBATIM(
"RecoBaseDrawer") <<
"Total " << NFlashes <<
" flashes.";
574 for (
size_t iof = 0; iof < opflashes.
size(); ++iof) {
575 if (opflashes[iof]->TotalPE() < recoOpt->
fFlashMinPE)
continue;
576 if (opflashes[iof]->Time() < recoOpt->
fFlashTMin)
continue;
577 if (opflashes[iof]->Time() > recoOpt->
fFlashTMax)
continue;
580 <<
"Flash t: " << opflashes[iof]->Time() <<
"\t y,z : " << opflashes[iof]->YCenter()
581 <<
", " << opflashes[iof]->ZCenter() <<
" \t PE :" << opflashes[iof]->TotalPE();
585 float wire0 = FLT_MAX;
586 float wire1 = FLT_MIN;
589 std::vector<geo::Point_t> points;
590 points.emplace_back(0,
591 opflashes[iof]->YCenter() - opflashes[iof]->YWidth(),
592 opflashes[iof]->ZCenter() - opflashes[iof]->ZWidth());
593 points.emplace_back(0,
594 opflashes[iof]->YCenter() - opflashes[iof]->YWidth(),
595 opflashes[iof]->ZCenter() + opflashes[iof]->ZWidth());
596 points.emplace_back(0,
597 opflashes[iof]->YCenter() + opflashes[iof]->YWidth(),
598 opflashes[iof]->ZCenter() - opflashes[iof]->ZWidth());
599 points.emplace_back(0,
600 opflashes[iof]->YCenter() + opflashes[iof]->YWidth(),
601 opflashes[iof]->ZCenter() + opflashes[iof]->ZWidth());
603 for (
size_t i = 0; i < points.size(); ++i) {
606 wireID = planeg.NearestWireID(points[i]);
611 if (wireID.
Wire < wire0) wire0 = wireID.
Wire;
612 if (wireID.
Wire > wire1) wire1 = wireID.
Wire;
615 TLine& line = view->
AddLine(flashtick, wire0, flashtick, wire1);
616 line.SetLineWidth(2);
617 line.SetLineStyle(2);
618 line.SetLineColor(Color);
621 TLine& line = view->
AddLine(wire0, flashtick, wire1, flashtick);
622 line.SetLineWidth(2);
623 line.SetLineStyle(2);
624 line.SetLineColor(Color);
643 auto const& planeg = getWireReadoutGeom().Plane(planeID);
645 for (
size_t imod = 0; imod < recoOpt->
fSeedLabels.size(); ++imod) {
651 if (seeds.
size() < 1)
continue;
654 for (
size_t isd = 0; isd < seeds.
size(); ++isd) {
657 double SeedPointErr[3];
658 double SeedDirErr[3];
662 seeds[isd]->GetPoint(SeedPoint, SeedPointErr);
663 seeds[isd]->GetDirection(SeedDir, SeedDirErr);
665 SeedEnd1[0] = SeedPoint[0] + SeedDir[0];
666 SeedEnd1[1] = SeedPoint[1] + SeedDir[1];
667 SeedEnd1[2] = SeedPoint[2] + SeedDir[2];
669 SeedEnd2[0] = SeedPoint[0] - SeedDir[0];
670 SeedEnd2[1] = SeedPoint[1] - SeedDir[1];
671 SeedEnd2[2] = SeedPoint[2] - SeedDir[2];
676 unsigned int wirepoint = 0;
677 unsigned int wireend1 = 0;
678 unsigned int wireend2 = 0;
681 wirepoint = planeg.NearestWireID(
toPoint(SeedPoint)).Wire;
684 wirepoint = atoi(e.explain_self().substr(e.explain_self().find(
"#") + 1, 5).c_str());
687 wireend1 = planeg.NearestWireID(
toPoint(SeedEnd1)).Wire;
690 wireend1 = atoi(e.explain_self().substr(e.explain_self().find(
"#") + 1, 5).c_str());
693 wireend2 = planeg.NearestWireID(
toPoint(SeedEnd2)).Wire;
696 wireend2 = atoi(e.explain_self().substr(e.explain_self().find(
"#") + 1, 5).c_str());
699 double x = wirepoint;
701 double x1 = wireend1;
703 double x2 = wireend2;
715 TMarker& strt = view->
AddMarker(x, y, color, 4, 1.5);
716 TLine& line = view->
AddLine(x1, y1, x2, y2);
717 strt.SetMarkerColor(color);
718 line.SetLineColor(color);
719 line.SetLineWidth(2.0);
736 static bool first =
true;
739 <<
"******** DrawSlices: 0 = none, 1 = color coded, 2 = color coded + ID at slice center\n";
740 std::cout <<
" 3 = open circle at slice center with size proportional to the AspectRatio. " 742 std::cout <<
" at the slice ends with connecting dotted lines\n";
746 unsigned int t = rawOpt->
fTPC;
748 auto const& planeg = getWireReadoutGeom().Plane(planeID);
750 for (
size_t imod = 0; imod < recoOpt->
fSliceLabels.size(); ++imod) {
754 if (slices.
size() < 1)
continue;
756 for (
size_t isl = 0; isl < slices.
size(); ++isl) {
757 int slcID(
std::abs(slices[isl]->ID()));
761 std::vector<const recob::Hit*>
hits = fmh.at(isl);
762 std::vector<const recob::Hit*> hits_on_plane;
763 for (
auto hit : hits) {
764 if (
hit->WireID().Plane == plane) { hits_on_plane.push_back(
hit); }
766 if (
Hit2D(hits_on_plane, color, view,
false,
false) < 1)
continue;
769 slices[isl]->Center().
X(), slices[isl]->Center().
Y(), slices[isl]->Center().
Z());
771 double wire = planeg.WireCoordinate(slicePos);
773 char const* txt = s.c_str();
774 TText& slcID = view->
AddText(wire, tick, txt);
775 slcID.SetTextSize(0.05);
776 slcID.SetTextColor(color);
782 slices[isl]->Center().
X(), slices[isl]->Center().
Y(), slices[isl]->Center().
Z());
784 double wire = planeg.WireCoordinate(slicePos);
785 float markerSize = 1;
786 if (slices[isl]->AspectRatio() > 0) {
787 markerSize = 1 / slices[isl]->AspectRatio();
788 if (markerSize > 3) markerSize = 3;
790 TMarker& ctr = view->
AddMarker(wire, tick, color, 24, markerSize);
791 ctr.SetMarkerColor(color);
793 TPolyLine& pline = view->
AddPolyLine(2, color, 2, 3);
795 slices[isl]->End0Pos().
X(), slices[isl]->End0Pos().
Y(), slices[isl]->End0Pos().
Z());
797 wire = planeg.WireCoordinate(slicePos0);
798 TMarker& end0 = view->
AddMarker(wire, tick, color, 20, 1.0);
799 end0.SetMarkerColor(color);
800 pline.SetPoint(0, wire, tick);
802 slices[isl]->End1Pos().
X(), slices[isl]->End1Pos().
Y(), slices[isl]->End1Pos().
Z());
804 wire = planeg.WireCoordinate(slicePos1);
805 TMarker& end1 = view->
AddMarker(wire, tick, color, 20, 1.0);
806 end1.SetMarkerColor(color);
807 pline.SetPoint(1, wire, tick);
827 auto const& planeg = getWireReadoutGeom().Plane(planeid);
835 static bool first =
true;
837 std::cout <<
"******** DrawClusters: 0 = none, 1 = cluster hits, 2 = unique marker, 3 = " 838 "cluster hits with connecting lines.\n";
839 std::cout <<
" 4 = with T<cluster or trajectory ID> P<PFParticle ID> color-matched. " 840 "Unmatched cluster IDs shown in black.\n";
841 std::cout <<
" Color scheme: By cluster ID in each plane or by PFParticle ID (Self) if a " 842 "PFParticle - Cluster association exists.\n";
846 for (
size_t imod = 0; imod < recoOpt->
fClusterLabels.size(); ++imod) {
852 if (clust.
size() < 1)
continue;
858 std::vector<art::Ptr<recob::SpacePoint>> spacePointVec;
862 if (spacePointVec.size() > 0) {
866 if (spHitAssnVec.isValid()) {
868 std::vector<const recob::Hit*> freeHitVec;
871 for (
const auto& spacePointPtr : spacePointVec) {
872 if (spacePointPtr->Chisq() < -99.) {
874 const std::vector<art::Ptr<recob::Hit>>& hitVec =
875 spHitAssnVec.at(spacePointPtr.key());
877 for (
const auto& hitPtr : hitVec) {
878 if (hitPtr.get()->WireID().Plane != plane)
continue;
880 freeHitVec.push_back(hitPtr.get());
886 Hit2D(freeHitVec, kGray, view,
false,
false,
false);
894 for (
size_t ic = 0; ic < clust.
size(); ++ic) {
895 if (clust[ic]->
Plane().
Plane != plane)
continue;
898 int clusterIdx(
std::abs(clust[ic]->ID()));
900 bool pfpAssociation =
false;
901 int pfpIndex = INT_MAX;
902 float cosmicscore = FLT_MIN;
905 std::vector<art::Ptr<recob::PFParticle>> pfplist = fmc.at(ic);
907 if (!pfplist.empty()) {
908 clusterIdx = pfplist[0]->Self();
910 pfpAssociation =
true;
911 pfpIndex = pfplist[0]->Self();
915 if (fmct.isValid()) {
916 std::vector<art::Ptr<anab::CosmicTag>> ctlist = fmct.at(0);
917 if (!ctlist.empty()) { cosmicscore = ctlist[0]->CosmicScore(); }
923 std::vector<const recob::Hit*>
hits = fmh.at(ic);
932 if (
Hit2D(hits, color, view,
false, drawConnectingLines) < 1)
continue;
940 if (pfpIndex != INT_MAX) s = s +
" P" +
std::to_string(pfpIndex + 1);
941 char const* txt = s.c_str();
942 double wire = 0.5 * (clust[ic]->StartWire() + clust[ic]->EndWire());
943 double tick = 20 + 0.5 * (clust[ic]->StartTick() + clust[ic]->EndTick());
944 TText& clID = view->
AddText(wire, tick, txt);
945 clID.SetTextSize(0.05);
946 if (pfpAssociation) { clID.SetTextColor(color); }
948 clID.SetTextColor(kBlack);
955 std::vector<double> tpts, wpts;
964 TPolyLine& p1 = view->
AddPolyLine(wpts.size(), lcolor, width, style);
965 TPolyLine& p2 = view->
AddPolyLine(wpts.size(), lcolor, width, style);
967 p1.SetFillStyle(3003);
968 p1.SetFillColor(fcolor);
969 for (
size_t i = 0; i < wpts.size(); ++i) {
971 p1.SetPoint(i, wpts[i], tpts[i]);
972 p2.SetPoint(i, wpts[i], tpts[i]);
975 p1.SetPoint(i, tpts[i], wpts[i]);
976 p2.SetPoint(i, tpts[i], wpts[i]);
985 double wirePitch = planeg.WirePitch();
995 clust[ic]->StartTick(),
996 clust[ic]->EndWire(),
997 clust[ic]->EndTick(),
998 std::tan((clust[ic]->StartAngle() + clust[ic]->EndAngle()) / 2.) *
999 wirePitch / driftvelocity / timetick,
1024 double slope1 = slope;
1032 slope1 = 1. / slope;
1037 double deltaX = 0.5 * (x2 -
x1);
1038 double xm = x1 + deltaX;
1039 double ym = y1 + deltaX * slope;
1041 TMarker& strt = view->
AddMarker(xm, ym, color, kFullCircle, 1.0);
1042 strt.SetMarkerColor(color);
1044 double stublen = 2. * deltaX;
1045 TLine& l = view->
AddLine(x1, y1, x1 + stublen, y1 + slope1 * stublen);
1046 l.SetLineColor(color);
1064 double slope1 = slope;
1071 slope1 = 1. / slope;
1076 TMarker& strt = view->
AddMarker(x1, y1, color, kFullStar, 2.0);
1077 strt.SetMarkerColor(color);
1079 double stublen = 300.0;
1080 TLine& l = view->
AddLine(x1, y1, x1 + stublen, y1 + slope1 * stublen);
1081 l.SetLineColor(color);
1101 double cosx1 = cosx;
1102 double cosy1 = cosy;
1112 TMarker& strt = view->
AddMarker(x1, y1, color, kFullStar, 2.0);
1113 strt.SetMarkerColor(color);
1115 double stublen = 300.0;
1116 TLine& l = view->
AddLine(x1, y1, x1 + stublen * cosx1, y1 + stublen * cosy1);
1117 l.SetLineColor(color);
1132 std::vector<double>& wpts,
1133 std::vector<double>& tpts,
1139 std::map<unsigned int, double> wlo, whi;
1141 for (
size_t j = 0; j < hits.size(); ++j) {
1143 if (hits[j]->
WireID().Plane != plane || hits[j]->WireID().TPC != rawOpt->
fTPC ||
1144 hits[j]->WireID().Cryostat != rawOpt->
fCryostat)
1147 wlo[hits[j]->WireID().Wire] = hits[j]->PeakTime();
1148 whi[hits[j]->WireID().Wire] = hits[j]->PeakTime();
1154 for (
size_t j = 0; j < hits.size(); ++j) {
1155 t = hits[j]->PeakTime();
1157 if (t < wlo[hits[j]->
WireID().Wire]) wlo[hits[j]->WireID().Wire] = t;
1158 if (t > whi[hits[j]->
WireID().Wire]) whi[hits[j]->WireID().Wire] = t;
1165 for (; itr != itrEnd; ++itr) {
1166 unsigned int w = itr->first;
1169 wpts.push_back(1. * w - 0.1);
1170 tpts.push_back(t - 0.1);
1171 wpts.push_back(1. * w + 0.1);
1172 tpts.push_back(t - 0.1);
1177 std::map<unsigned int, double>::reverse_iterator ritr(whi.rbegin());
1178 std::map<unsigned int, double>::reverse_iterator ritrEnd(whi.rend());
1179 for (; ritr != ritrEnd; ++ritr) {
1180 unsigned int w = ritr->first;
1183 wpts.push_back(1. * w + 0.1);
1184 tpts.push_back(t + 0.1);
1185 wpts.push_back(1. * w - 0.1);
1186 tpts.push_back(t + 0.1);
1190 wpts.push_back(wpts[0]);
1191 tpts.push_back(tpts[0]);
1198 std::vector<const recob::Hit*>&
hits,
1201 TVector3
const& startPos,
1202 TVector3
const& startDir,
1210 unsigned int t = rawOpt->
fTPC;
1212 geo::Point_t localPos(startPos.X(), startPos.Y(), startPos.Z());
1213 auto const& planeg = getWireReadoutGeom().Plane(planeID);
1220 if (cscore < 0.6) color = kMagenta;
1223 else if (cscore < -10000) {
1228 if (cscore < -1000) {
1229 Hit2D(hits, color, view,
false,
false, lineWidth);
1233 char const* txt = s.c_str();
1235 double wire = planeg.WireCoordinate(localPos);
1236 TText& shwID = view->
AddText(wire, tick, txt);
1238 shwID.SetTextSize(0.1);
1242 Hit2D(hits, color, view,
false,
false, lineWidth);
1245 double wire0 = planeg.WireCoordinate(localPos);
1249 double tick1 = detProp.
ConvertXToTicks((startPos + startDir).
X(), planeID);
1250 double wire1 = planeg.WireCoordinate(localPos);
1253 double ds = sqrt(pow(tick0 - tick1, 2) + pow(wire0 - wire1, 2));
1256 cost = (tick1 - tick0) / ds;
1257 cosw = (wire1 - wire0) / ds;
1266 std::vector<const recob::Hit*>&
hits,
1277 auto const& planeg = getWireReadoutGeom().Plane(planeID);
1280 Hit2D(hits, color, view,
false,
true, lineWidth);
1282 const auto& startPos = track->
Vertex();
1287 auto world = planeg.toWorldCoords(local);
1288 world.SetY(startPos.Y());
1289 world.SetZ(startPos.Z());
1295 wire = 1. * planeg.NearestWireID(world).Wire;
1298 wire = 1. * atoi(e.explain_self().substr(e.explain_self().find(
"#") + 1, 5).c_str());
1302 double thetawire = planeg.Wire(0).ThetaZ();
1303 double wirePitch = planeg.WirePitch();
1312 double rotang = 3.1416 - thetawire;
1313 double yprime = std::cos(rotang) * startDir.Y() + std::sin(rotang) * startDir.Z();
1314 double dTdW = startDir.X() * wirePitch / driftvelocity / timetick / yprime;
1323 for (
size_t idx = 0; idx < nTrackHits; idx++) {
1328 world.SetY(hitPos.Y());
1329 world.SetZ(hitPos.Z());
1333 double wireHit = 0.;
1335 wireHit = 1. * planeg.NearestWireID(world).Wire;
1338 wireHit = 1. * atoi(e.explain_self().substr(e.explain_self().find(
"#") + 1, 5).c_str());
1341 if (tpcid.TPC == planeID.TPC && tpcid.Cryostat == planeID.Cryostat) {
1342 pl.SetPoint(vidx++, wireHit, tickHit);
1360 auto const& planeg = getWireReadoutGeom().Plane(planeID);
1370 for (
size_t imod = 0; imod < recoOpt->
fTrackLabels.size(); ++imod) {
1376 if (track.
vals().size() < 1)
continue;
1384 auto tracksProxy = proxy::getCollection<proxy::Tracks>(
evt, which);
1388 for (
size_t t = 0; t < track.
vals().size(); ++t) {
1390 if (track.
vals().at(t)->NumberTrajectoryPoints() == 0) {
1391 std::cout <<
"***** Track with no trajectory points ********" << std::endl;
1398 track.
vals().at(t)->End().Y(),
1399 track.
vals().at(t)->End().Z());
1401 double wire = planeg.WireCoordinate(trackPos);
1403 track.
vals().at(t)->ID() &
1406 char const* txt = s.c_str();
1407 TText& trkID = view->
AddText(wire, tick, txt);
1409 trkID.SetTextSize(0.1);
1413 if (cosmicTrackTags.isValid()) {
1414 if (cosmicTrackTags.at(t).size() > 0) {
1420 std::vector<const recob::Hit*>
hits;
1421 if (track.
vals().at(t)->NumberTrajectoryPoints() == fmh.at(t).size()) {
1422 auto tp = tracksProxy[t];
1423 for (
auto point : tp.points()) {
1424 if (!point.isPointValid())
continue;
1425 hits.push_back(point.hit());
1433 while (itr < hits.end()) {
1434 if ((*itr)->View() != gview)
1446 if (Score < 0.6) color = kMagenta;
1449 else if (Score < -10000) {
1453 DrawTrack2D(clockData, detProp, hits, view, plane, aTrack, color, lineWidth);
1459 static bool first =
true;
1462 std::cout <<
"DrawShower options: \n";
1463 std::cout <<
" 1 = Hits in shower color-coded by the shower ID\n";
1464 std::cout <<
" 2 = Same as 1 + shower axis and circle representing the shower cone\n";
1465 std::cout <<
" Black cone = shower start dE/dx < 1 MeV/cm (< 1/2 MIP)\n";
1466 std::cout <<
" Blue cone = shower start dE/dx < 3 MeV/cm (~1 MIP)\n";
1467 std::cout <<
" Green cone = shower start 3 MeV/cm < dE/dx < 5 MeV/cm (~2 MIP)\n";
1468 std::cout <<
" Red cone = shower start 5 MeV/cm < dE/dx (>2 MIP)\n";
1471 for (
size_t imod = 0; imod < recoOpt->
fShowerLabels.size(); ++imod) {
1476 if (shower.
vals().size() < 1)
continue;
1482 for (
size_t s = 0; s < shower.
vals().size(); ++s) {
1484 std::vector<const recob::Hit*>
hits = fmh.at(s);
1487 while (itr < hits.end()) {
1488 if ((*itr)->View() != gview)
1496 if (!shower.
vals().at(s)->has_length())
continue;
1497 if (!shower.
vals().at(s)->has_open_angle())
continue;
1499 TVector3 startPos = shower.
vals().at(s)->ShowerStart();
1500 TVector3
dir = shower.
vals().at(s)->Direction();
1501 double length = shower.
vals().at(s)->Length();
1502 double openAngle = shower.
vals().at(s)->OpenAngle();
1505 TVector3 endPos = startPos + length *
dir;
1510 double swire = planeg.WireCoordinate(localStart);
1512 double ewire = planeg.WireCoordinate(localEnd);
1514 TLine& coneLine = view->
AddLine(swire, stick, ewire, etick);
1516 std::vector<double> dedxVec = shower.
vals().at(s)->dEdx();
1519 if (plane < dedxVec.size()) {
1520 if (dedxVec[plane] > 1 && dedxVec[plane] < 3) {
1524 else if (dedxVec[plane] < 5) {
1533 coneLine.SetLineColor(color);
1536 double radius = length * openAngle;
1537 auto coneRim =
Circle3D(endPos, dir, radius);
1540 for (
unsigned short ipt = 0; ipt < coneRim.size(); ++ipt) {
1541 geo::Point_t localPos(coneRim[ipt][0], coneRim[ipt][1], coneRim[ipt][2]);
1542 double wire = planeg.WireCoordinate(localPos);
1544 pline.SetPoint(ipt, wire, tick);
1551 shower.
vals().at(s)->ShowerStart(),
1552 shower.
vals().at(s)->Direction(),
1574 auto const& planeg = getWireReadoutGeom().Plane(planeID);
1589 if (trackCol.
vals().size() < 1)
continue;
1592 std::unique_ptr<art::Assns<recob::Vertex, recob::Track>> vertexTrackAssociations(
1601 if (vertexTrackAssnsHandle->size() < 1)
continue;
1609 auto tracksProxy = proxy::getCollection<proxy::Tracks>(
evt, which);
1615 std::cout <<
"==> Neutrino Candidate drawing for tagger " 1619 for (
const auto& vertexTrackAssn : *vertexTrackAssnsHandle) {
1623 if (vertex->
ID() != lastVtxIdx) {
1631 double wire = planeg.WireCoordinate(localXYZ);
1634 TMarker& strt = view->
AddMarker(wire, time, color, 24, 3.0);
1635 strt.SetMarkerColor(color);
1637 std::cout <<
" --> Drawing vertex id: " << vertex->
ID() << std::endl;
1640 lastVtxIdx = vertex->
ID();
1645 double x = track->
End().X();
1648 double wire = planeg.WireCoordinate(trackEnd);
1650 tid = track->
ID() & 65535;
1652 std::cout <<
" --> Drawing Track id: " << tid << std::endl;
1655 char const* txt = s.c_str();
1657 TText& trkID = view->
AddText(wire, tick, txt);
1658 trkID.SetTextColor(color);
1659 trkID.SetTextSize(0.1);
1661 float cosmicScore = -999;
1662 if (cosmicTrackTags.isValid()) {
1663 if (cosmicTrackTags.at(track.
key()).
size() > 0) {
1669 std::vector<const recob::Hit*>
hits;
1671 auto tp = tracksProxy[track.
key()];
1672 for (
auto point : tp.points()) {
1673 if (!point.isPointValid())
continue;
1674 hits.push_back(point.hit());
1678 hits = fmh.at(track.
key());
1682 while (itr < hits.end()) {
1683 if ((*itr)->View() != gview)
1691 if (cosmicScore > 0.1) {
1693 if (cosmicScore < 0.6) color = kMagenta;
1696 else if (cosmicScore < -10000) {
1720 static bool first =
true;
1723 std::cout <<
"******** DrawVertices: Open circles color coded across all planes. Set " 1724 "DrawVertices > 1 to display the vertex ID\n";
1729 auto const& planeg = getWireReadoutGeom().Plane(planeID);
1731 for (
size_t imod = 0; imod < recoOpt->
fVertexLabels.size(); ++imod) {
1737 if (vertex.
size() < 1)
continue;
1741 double minxyz[3], maxxyz[3];
1742 minxyz[0] = world.X() - tpc.
HalfWidth();
1743 maxxyz[0] = world.X() + tpc.
HalfWidth();
1744 minxyz[1] = world.Y() - tpc.
HalfWidth();
1745 maxxyz[1] = world.Y() + tpc.
HalfWidth();
1746 minxyz[2] = world.Z() - tpc.
Length() / 2;
1747 maxxyz[2] = world.Z() + tpc.
Length() / 2;
1749 for (
size_t v = 0; v < vertex.
size(); ++v) {
1752 vertex[v]->XYZ(xyz);
1753 if (xyz[0] < minxyz[0] || xyz[0] > maxxyz[0])
continue;
1754 if (xyz[1] < minxyz[1] || xyz[1] > maxxyz[1])
continue;
1755 if (xyz[2] < minxyz[2] || xyz[2] > maxxyz[2])
continue;
1760 double wire = planeg.WireCoordinate(localPos);
1763 TMarker& strt = view->
AddMarker(wire, time, color, 24, 1.0);
1764 strt.SetMarkerColor(color);
1769 char const* txt = s.c_str();
1770 TText& vtxID = view->
AddText(wire, time + 30, txt);
1771 vtxID.SetTextColor(color);
1772 vtxID.SetTextSize(0.05);
1783 auto const& wireReadoutGeom = getWireReadoutGeom();
1789 geo::View_t gview = wireReadoutGeom.Plane(planeID).View();
1791 for (
unsigned int imod = 0; imod < recoOpt->
fEventLabels.size(); ++imod) {
1797 if (event.
size() < 1)
continue;
1801 for (
size_t e = 0;
e <
event.size(); ++
e) {
1802 std::vector<const recob::Hit*>
hits;
1808 while (itr < hits.end()) {
1809 if ((*itr)->View() != gview)
1829 std::vector<art::InputTag> labels;
1831 for (
size_t imod = 0; imod < recoOpt->
fSeedLabels.size(); ++imod)
1834 for (
size_t imod = 0; imod < labels.size(); ++imod) {
1842 if (seeds.
size() < 1)
continue;
1846 for (
size_t iseed = 0; iseed != seeds.
size(); ++iseed) {
1847 double pt[3], pterr[3],
dir[3], direrr[3];
1848 seeds.
at(iseed)->GetPoint(pt, pterr);
1849 seeds.
at(iseed)->GetDirection(dir, direrr);
1851 double end1[3], end2[3];
1852 for (
int i = 0; i != 3; ++i) {
1853 end1[i] = pt[i] + dir[i];
1854 end2[i] = pt[i] - dir[i];
1859 pmrk.SetPoint(iseed, pt[0], pt[1], pt[2]);
1860 pline.SetPoint(0, end1[0], end1[1], end1[2]);
1861 pline.SetPoint(1, end2[0], end2[1], end2[2]);
1874 std::vector<art::InputTag> labels;
1876 for (
size_t imod = 0; imod < recoOpt->
fSeedLabels.size(); ++imod)
1879 for (
size_t imod = 0; imod < labels.size(); ++imod) {
1887 for (
size_t iseed = 0; iseed != seeds.
size(); ++iseed) {
1888 double pt[3], pterr[3],
dir[3], direrr[3];
1889 seeds.
at(iseed)->GetPoint(pt, pterr);
1890 seeds.
at(iseed)->GetDirection(dir, direrr);
1892 double end1[3], end2[3];
1893 for (
int i = 0; i != 3; ++i) {
1894 end1[i] = pt[i] + dir[i];
1895 end2[i] = pt[i] - dir[i];
1899 TMarker& strt = view->
AddMarker(pt[1], pt[0], color, 4, 1.5);
1900 TLine& line = view->
AddLine(end1[1], end1[0], end2[1], end2[0]);
1903 line.SetLineWidth(2.0);
1906 TMarker& strt = view->
AddMarker(pt[2], pt[0], color, 4, 1.5);
1907 TLine& line = view->
AddLine(end1[2], end1[0], end2[2], end2[0]);
1910 line.SetLineWidth(2.0);
1915 <<
"projection is not YZ as expected\n";
1917 TMarker& strt = view->
AddMarker(pt[2], pt[1], color, 4, 1.5);
1918 TLine& line = view->
AddLine(end1[2], end1[1], end2[2], end2[1]);
1921 line.SetLineWidth(2.0);
1935 std::vector<art::InputTag> labels;
1941 for (
size_t imod = 0; imod < labels.size(); ++imod) {
1944 std::vector<art::Ptr<recob::SpacePoint>> spts;
1946 int color = 10 * imod + 11;
1983 <<
"RecoBaseDrawer: number PFParticles to draw: " << pfParticleVec.
size() << std::endl;
1986 if (pfParticleVec.
size() < 1)
continue;
1989 std::vector<art::Ptr<recob::SpacePoint>> spacePointVec;
1993 std::vector<art::Ptr<recob::Edge>> edgeVec;
1997 if (spacePointVec.empty())
continue;
2006 if (!spacePointAssnVec.isValid())
continue;
2025 for (
size_t idx = 0; idx < pfParticleVec.
size(); idx++) {
2031 if (!pfParticle->IsPrimary())
continue;
2039 edgeSpacePointAssnsVec,
2056 bool usePlane[] = {
false,
false,
false};
2057 float peakTimeVec[] = {0., 0., 0.};
2058 float peakSigmaVec[] = {0., 0., 0.};
2060 float weightSum(0.);
2063 std::map<size_t, double> planeOffsetMap;
2065 planeOffsetMap[0] = 0.;
2066 planeOffsetMap[1] = 4.;
2067 planeOffsetMap[2] = 8.;
2069 for (
const auto&
hit : hitVec) {
2072 float peakTime =
hit->PeakTime() - planeOffsetMap[
hit->WireID().Plane];
2073 float peakRMS =
hit->RMS();
2075 aveSum += peakTime / (peakRMS * peakRMS);
2076 weightSum += 1. / (peakRMS * peakRMS);
2078 peakTimeVec[
hit->WireID().Plane] = peakTime;
2079 peakSigmaVec[
hit->WireID().Plane] = peakRMS;
2080 usePlane[
hit->WireID().Plane] =
true;
2083 aveSum /= weightSum;
2085 for (
int idx = 0; idx < 3; idx++) {
2086 if (usePlane[idx]) {
2087 float deltaTime = peakTimeVec[idx] - aveSum;
2088 float sigmaPeakTimeSq = peakSigmaVec[idx] * peakSigmaVec[idx];
2090 hitChiSq += deltaTime * deltaTime / sigmaPeakTimeSq;
2115 const std::vector<art::Ptr<recob::SpacePoint>>& hitsVec(spacePointAssnVec.at(pfPart.
key()));
2119 bool isCosmic(
false);
2124 std::vector<const anab::CosmicTag*> pfCosmicTagVec = cosmicTagAssnVec.at(pfPart.
key());
2126 if (!pfCosmicTagVec.empty()) {
2129 if (cosmicTag->
CosmicScore() > 0.6) isCosmic =
true;
2134 if (isCosmic) colorIdx = 12;
2220 const std::vector<art::Ptr<recob::Edge>>& edgeVec(edgeAssnsVec.at(pfPart.
key()));
2222 if (!edgeVec.empty()) {
2224 2 * edgeVec.size(), colorIdx, kFullDotMedium, 1.25);
2226 for (
const auto& edge : edgeVec) {
2228 const std::vector<art::Ptr<recob::SpacePoint>>& spacePointVec(
2229 edgeSPAssnVec.at(edge.key()));
2231 if (spacePointVec.size() != 2) {
2232 std::cout <<
"Space Point vector associated to edge is not of size 2: " 2233 << spacePointVec.size() << std::endl;
2240 TVector3 startPoint(firstSP->
XYZ()[0], firstSP->
XYZ()[1], firstSP->
XYZ()[2]);
2241 TVector3 endPoint(secondSP->
XYZ()[0], secondSP->
XYZ()[1], secondSP->
XYZ()[2]);
2242 TVector3 lineVec(endPoint - startPoint);
2244 pm.SetNextPoint(startPoint[0], startPoint[1], startPoint[2]);
2245 pm.SetNextPoint(endPoint[0], endPoint[1], endPoint[2]);
2247 double length = lineVec.Mag();
2250 std::cout <<
"Edge length is zero, index 1: " << edge->FirstPointID()
2251 <<
", index 2: " << edge->SecondPointID() << std::endl;
2255 double minLen = std::max(2.01, length);
2257 if (minLen > length) {
2260 startPoint += -0.5 * (minLen - length) * lineVec;
2261 endPoint += 0.5 * (minLen - length) * lineVec;
2267 pl.SetPoint(0, startPoint[0], startPoint[1], startPoint[2]);
2268 pl.SetPoint(1, endPoint[0], endPoint[1], endPoint[2]);
2278 if (trackAssnVec.isValid()) {
2279 std::vector<const recob::Track*> trackVec(trackAssnVec.at(pfPart.
key()));
2281 if (!trackVec.empty()) {
2282 for (
const auto&
track : trackVec)
2289 std::vector<const recob::PCAxis*> pcaVec(pcAxisAssnVec.at(pfPart.
key()));
2291 if (!pcaVec.empty()) {
2295 int lineWidth[2] = {2, 1};
2296 int lineStyle[2] = {1, 13};
2297 int lineColor[2] = {colorIdx, 18};
2299 int markStyle[2] = {kFullDotLarge, kFullDotLarge};
2300 double markSize[2] = {0.5, 0.2};
2303 if (!isCosmic) lineColor[1] = colorIdx;
2307 if (pcaVec.size() > 1 && pcaVec.front()->getID() > pcaVec.back()->getID())
2308 std::reverse(pcaVec.begin(), pcaVec.end());
2310 for (
const auto& pca : pcaVec) {
2312 const double* avePosition = pca->getAvePosition();
2316 TPolyMarker3D& pmrk =
2317 view->
AddPolyMarker3D(7, lineColor[pcaIdx], markStyle[pcaIdx], markSize[pcaIdx]);
2319 pmrk.SetPoint(pmrkIdx++, avePosition[0], avePosition[1], avePosition[2]);
2322 for (
int dimIdx = 0; dimIdx < 3; dimIdx++) {
2325 numPoints, lineColor[pcaIdx], lineWidth[pcaIdx], lineStyle[pcaIdx]);
2328 double eigenValue = pca->getEigenValues()[dimIdx];
2331 if (eigenValue > 0) {
2333 eigenValue = 3. * sqrt(eigenValue);
2336 const std::vector<double>& eigenVector = pca->getEigenVectors()[dimIdx];
2339 double xl = avePosition[0] - 0.5 * eigenValue * eigenVector[0];
2340 double yl = avePosition[1] - 0.5 * eigenValue * eigenVector[1];
2341 double zl = avePosition[2] - 0.5 * eigenValue * eigenVector[2];
2343 pl.SetPoint(0, xl, yl, zl);
2344 pmrk.SetPoint(pmrkIdx++, xl, yl, zl);
2347 double xu = avePosition[0] + 0.5 * eigenValue * eigenVector[0];
2348 double yu = avePosition[1] + 0.5 * eigenValue * eigenVector[1];
2349 double zu = avePosition[2] + 0.5 * eigenValue * eigenVector[2];
2351 pl.SetPoint(1, xu, yu, zu);
2352 pmrk.SetPoint(pmrkIdx++, xu, yu, zu);
2372 for (
const auto& daughterIdx : pfPart->
Daughters()) {
2399 for (
size_t imod = 0; imod < recoOpt->
fEdgeLabels.size(); ++imod) {
2403 std::vector<art::Ptr<recob::Edge>> edgeVec;
2407 <<
"RecoBaseDrawer: number Edges to draw: " << edgeVec.size() << std::endl;
2409 if (!edgeVec.empty()) {
2411 std::vector<art::Ptr<recob::SpacePoint>> spacePointVec;
2418 spacePointVec.size(), colorIdx, kFullDotMedium, 0.5);
2420 for (
const auto& spacePoint : spacePointVec) {
2421 TVector3 spPosition(spacePoint->XYZ()[0], spacePoint->XYZ()[1], spacePoint->XYZ()[2]);
2423 pm.SetNextPoint(spPosition[0], spPosition[1], spPosition[2]);
2427 for (
const auto& edge : edgeVec) {
2431 if (firstSP->
ID() != edge->FirstPointID() || secondSP->
ID() != edge->SecondPointID()) {
2433 <<
"Edge: Space point index mismatch, first: " << firstSP->
ID() <<
", " 2434 << edge->FirstPointID() <<
", second: " << secondSP->
ID() <<
", " 2435 << edge->SecondPointID() << std::endl;
2439 TVector3 startPoint(firstSP->
XYZ()[0], firstSP->
XYZ()[1], firstSP->
XYZ()[2]);
2440 TVector3 endPoint(secondSP->
XYZ()[0], secondSP->
XYZ()[1], secondSP->
XYZ()[2]);
2441 TVector3 lineVec(endPoint - startPoint);
2443 double length = lineVec.Mag();
2455 TPolyMarker3D& fakeLine = view->
AddPolyMarker3D(10, 5, kFullDotMedium, 1.0);
2459 for (
int idx = 1; idx <= 10; idx++) {
2460 TVector3 plotPoint = startPoint + 0.1 * double(idx) * length * lineVec;
2462 fakeLine.SetNextPoint(plotPoint[0], plotPoint[1], plotPoint[2]);
2473 std::vector<art::Ptr<recob::SpacePoint>> spacePointVec;
2477 <<
"RecoBaseDrawer: number Extreme points to draw: " << spacePointVec.size() << std::endl;
2479 if (!spacePointVec.empty()) {
2481 int colorIdx(kYellow);
2484 spacePointVec.size(), colorIdx, kFullDotLarge, 1.0);
2486 for (
const auto& spacePoint : spacePointVec) {
2487 TVector3 spPosition(spacePoint->XYZ()[0], spacePoint->XYZ()[1], spacePoint->XYZ()[2]);
2489 pm.SetNextPoint(spPosition[0], spPosition[1], spPosition[2]);
2512 for (
size_t imod = 0; imod < recoOpt->
fTrackLabels.size(); ++imod) {
2521 trackView.
fill(trackVec);
2527 for (
const auto&
track : trackVec) {
2529 int marker = kFullDotLarge;
2535 if (cosmicTagAssnVec.isValid()) {
2536 std::vector<const anab::CosmicTag*> tkCosmicTagVec = cosmicTagAssnVec.at(
track.key());
2538 if (!tkCosmicTagVec.empty()) {
2559 for (
size_t imod = 0; imod < recoOpt->
fShowerLabels.size(); ++imod) {
2564 for (
size_t s = 0; s < shower.
vals().size(); ++s) {
2592 auto handles = evt->
getMany<std::vector<recob::Track>>();
2594 for (
auto ih : handles) {
2598 const std::string& which = handle.
provenance()->moduleLabel();
2601 if (fmsp.isValid() && fmsp.size() > 0) {
2602 int n = handle->size();
2603 float spSize = 0.5 *
size;
2605 for (
int i = 0; i <
n; ++i) {
2607 if (&*p == &track) {
2608 std::vector<art::Ptr<recob::SpacePoint>> spts = fmsp.at(i);
2621 int lineSize =
size;
2623 if (lineSize < 1) lineSize = 1;
2627 TPolyMarker3D& pmStart = view->
AddPolyMarker3D(1, 0, marker, 2. * size);
2630 pmStart.SetPoint(0, firstPos.X(), firstPos.Y(), firstPos.Z());
2635 for (
int p = 0; p < np; ++p) {
2639 pm.SetPoint(p, pos.X(), pos.Y(), pos.Z());
2645 for (
int p = 0; p < np; ++p) {
2650 pl.SetPoint(p, pos.X(), pos.Y(), pos.Z());
2659 for (
int p = 1; p < np; ++p) {
2665 auto deltaPos = nextPos - startPos;
2666 double arcLen = deltaPos.Dot(
2669 if (arcLen < 0.) arcLen = 3.;
2671 auto endPoint = startPos + arcLen * startDir;
2673 pl.SetPoint(0, startPos.X(), startPos.Y(), startPos.Z());
2674 pl.SetPoint(1, endPoint.X(), endPoint.Y(), endPoint.Z());
2696 auto handles = evt->
getMany<std::vector<recob::Shower>>();
2698 bool noSpts =
false;
2700 for (
auto ih : handles) {
2705 const std::string& which = handle.
provenance()->moduleLabel();
2708 int n = handle->size();
2709 for (
int i = 0; i <
n; ++i) {
2711 if (&*p == &shower) {
2713 std::vector<art::Ptr<recob::SpacePoint>> spts;
2728 std::cout <<
"No space points associated with the shower. Drawing a cone instead\n";
2730 auto& dedx = shower.
dEdx();
2731 if (!dedx.empty()) {
2733 for (
auto& dedxInPln : dedx)
2734 dedxAve += dedxInPln;
2735 dedxAve /= (double)dedx.size();
2739 if (dedxAve > 3 && dedxAve < 5) color = kGreen;
2746 for (
unsigned short ipt = 0; ipt < coneRim.size(); ++ipt) {
2747 auto&
pt = coneRim[ipt];
2748 pl.SetPoint(ipt,
pt[0],
pt[1],
pt[2]);
2751 for (
unsigned short ipt = 0; ipt < coneRim.size(); ++ipt) {
2753 panel.SetPoint(0, startPos.X(), startPos.Y(), startPos.Z());
2754 panel.SetPoint(1, coneRim[ipt][0], coneRim[ipt][1], coneRim[ipt][2]);
2764 const TVector3& axisDir,
2771 r.RotateX(axisDir.X());
2772 r.RotateY(axisDir.Y());
2773 r.RotateZ(axisDir.Z());
2774 constexpr
unsigned short nRimPts = 16;
2775 std::vector<std::array<double, 3>> rimPts(nRimPts + 1);
2776 for (
unsigned short iang = 0; iang < nRimPts; ++iang) {
2777 double rimAngle = iang * 2 * M_PI / (float)nRimPts;
2778 TVector3 rim = {0, 0, 1};
2779 rim.SetX(radius * cos(rimAngle));
2780 rim.SetY(radius * sin(rimAngle));
2784 for (
unsigned short ixyz = 0; ixyz < 3; ++ixyz)
2785 rimPts[iang][ixyz] = rim[ixyz];
2788 rimPts[nRimPts] = rimPts[0];
2802 for (
size_t imod = 0; imod < recoOpt->
fVertexLabels.size(); ++imod) {
2811 for (
size_t v = 0; v < vertex.
size(); ++v) {
2813 if (fmt.isValid()) {
2814 std::vector<art::Ptr<recob::Track>> tracks = fmt.at(v);
2817 for (
size_t t = 0; t < tracks.size(); ++t)
2821 if (fms.isValid()) {
2822 std::vector<art::Ptr<recob::Shower>> showers = fms.at(v);
2824 for (
size_t s = 0; s < showers.size(); ++s)
2828 double xyz[3] = {0.};
2829 vertex[v]->XYZ(xyz);
2832 pm.SetPoint(0, xyz[0], xyz[1], xyz[2]);
2850 for (
size_t imod = 0; imod < recoOpt->
fEventLabels.size(); ++imod) {
2856 if (event.
size() < 1)
continue;
2861 for (
size_t e = 0;
e <
event.size(); ++
e) {
2864 std::vector<art::Ptr<recob::Vertex>>
vertex = fmvp.at(
e);
2866 if (vertex.size() < 1)
continue;
2871 for (
size_t v = 0; v < vertex.size(); ++v) {
2875 std::vector<art::Ptr<recob::Track>> tracks = fmt.at(v);
2876 std::vector<art::Ptr<recob::Shower>> showers = fms.at(v);
2879 for (
size_t t = 0; t < tracks.size(); ++t)
2882 for (
size_t s = 0; s < showers.size(); ++s)
2887 double xyz[3] = {0.};
2888 std::vector<const recob::Vertex*> vts = fmv.at(
e);
2890 event[
e]->PrimaryVertex(vts)->XYZ(xyz);
2893 pm.SetPoint(0, xyz[0], xyz[1], xyz[2]);
2910 for (
size_t imod = 0; imod < recoOpt->
fSliceLabels.size(); ++imod) {
2914 if (slices.
size() < 1)
continue;
2916 for (
size_t isl = 0; isl < slices.
size(); ++isl) {
2917 int slcID =
std::abs(slices[isl]->ID());
2919 std::vector<art::Ptr<recob::SpacePoint>> spts = fmsp.at(isl);
2941 auto const world = tpc.GetCenter();
2942 if (minx > world.X() - tpc.HalfWidth()) minx = world.X() - tpc.HalfWidth();
2943 if (maxx < world.X() + tpc.HalfWidth()) maxx = world.X() + tpc.HalfWidth();
2948 for (
size_t imod = 0; imod < recoOpt->
fOpFlashLabels.size(); ++imod) {
2954 if (opflashes.
size() < 1)
continue;
2956 int NFlashes = opflashes.
size();
2959 for (
int iof = 0; iof < NFlashes; ++iof) {
2961 if (opflashes[iof]->TotalPE() < recoOpt->
fFlashMinPE)
continue;
2962 if (opflashes[iof]->Time() < recoOpt->
fFlashTMin)
continue;
2963 if (opflashes[iof]->Time() > recoOpt->
fFlashTMax)
continue;
2965 double YCentre = opflashes[iof]->YCenter();
2966 double YHalfWidth = opflashes[iof]->YWidth();
2967 double ZCentre = opflashes[iof]->ZCenter();
2968 double ZHalfWidth = opflashes[iof]->ZWidth();
2973 TBox& b1 = view->
AddBox(YCentre - YHalfWidth, minx, YCentre + YHalfWidth, maxx);
2974 b1.SetFillStyle(3004 + (iof % 3));
2975 b1.SetFillColor(Colour);
2982 TLine& line = view->
AddLine(ZCentre - ZHalfWidth, xflash, ZCentre + ZHalfWidth, xflash);
2983 line.SetLineWidth(2);
2984 line.SetLineStyle(2);
2985 line.SetLineColor(Colour);
2989 ZCentre - ZHalfWidth, YCentre - YHalfWidth, ZCentre + ZHalfWidth, YCentre + YHalfWidth);
2990 b1.SetFillStyle(3004 + (iof % 3));
2991 b1.SetFillColor(Colour);
2992 view->
AddMarker(ZCentre, YCentre, Colour, 4, 1.5);
3004 for (
size_t v = 0; v < vertex.
size(); ++v) {
3006 double xyz[3] = {0.};
3007 vertex[v]->XYZ(xyz);
3012 TMarker& strt = view->
AddMarker(xyz[1], xyz[0], color, marker, 1.0);
3013 strt.SetMarkerColor(color);
3016 TMarker& strt = view->
AddMarker(xyz[2], xyz[0], color, marker, 1.0);
3017 strt.SetMarkerColor(color);
3020 TMarker& strt = view->
AddMarker(xyz[2], xyz[1], color, marker, 1.0);
3021 strt.SetMarkerColor(color);
3034 for (
size_t imod = 0; imod < recoOpt->
fVertexLabels.size(); ++imod) {
3061 std::vector<art::InputTag> labels;
3067 for (
size_t imod = 0; imod < labels.size(); ++imod) {
3070 std::vector<art::Ptr<recob::SpacePoint>> spts;
3101 if (pfParticleVec.
size() < 1)
continue;
3107 if (!spacePointAssnVec.isValid())
continue;
3112 if (!pcAxisAssnVec.isValid())
continue;
3115 for (
size_t idx = 0; idx < pfParticleVec.
size(); idx++) {
3121 if (!pfParticle->IsPrimary())
continue;
3125 pfParticle, pfParticleVec, spacePointAssnVec, pcAxisAssnVec, 0, proj, view);
3144 const std::vector<const recob::SpacePoint*>& hitsVec(spacePointAssnVec.at(pfPart->
Self()));
3151 if (!hitsVec.empty()) {
3152 std::vector<const recob::SpacePoint*> hitPosVec;
3153 std::vector<const recob::SpacePoint*> skeletonPosVec;
3154 std::vector<const recob::SpacePoint*> skelEdgePosVec;
3155 std::vector<const recob::SpacePoint*> edgePosVec;
3156 std::vector<const recob::SpacePoint*> seedPosVec;
3157 std::vector<const recob::SpacePoint*> pairPosVec;
3159 for (
const auto& spacePoint : hitsVec) {
3160 if (spacePoint->Chisq() > 0.)
3161 hitPosVec.push_back(spacePoint);
3162 else if (spacePoint->Chisq() == -1.)
3163 skeletonPosVec.push_back(spacePoint);
3164 else if (spacePoint->Chisq() == -3.)
3165 skelEdgePosVec.push_back(spacePoint);
3166 else if (spacePoint->Chisq() == -4.)
3167 seedPosVec.push_back(spacePoint);
3168 else if (spacePoint->Chisq() > -10.)
3169 edgePosVec.push_back(spacePoint);
3171 pairPosVec.push_back(spacePoint);
3177 TPolyMarker& pm1 = view->
AddPolyMarker(hitPosVec.size(), colorIdx, kFullDotMedium, 1);
3178 for (
const auto* spacePoint : hitPosVec) {
3179 const double* pos = spacePoint->XYZ();
3182 pm1.SetPoint(hitIdx++, pos[0], pos[1]);
3184 pm1.SetPoint(hitIdx++, pos[2], pos[0]);
3186 pm1.SetPoint(hitIdx++, pos[2], pos[1]);
3191 TPolyMarker& pm2 = view->
AddPolyMarker(edgePosVec.size(), 28, kFullDotMedium, 1);
3192 for (
const auto* spacePoint : edgePosVec) {
3193 const double* pos = spacePoint->XYZ();
3196 pm2.SetPoint(hitIdx++, pos[0], pos[1]);
3198 pm2.SetPoint(hitIdx++, pos[2], pos[0]);
3200 pm2.SetPoint(hitIdx++, pos[2], pos[1]);
3205 TPolyMarker& pm3 = view->
AddPolyMarker(pairPosVec.size(), 2, kFullDotMedium, 1);
3206 for (
const auto* spacePoint : pairPosVec) {
3207 const double* pos = spacePoint->XYZ();
3210 pm3.SetPoint(hitIdx++, pos[0], pos[1]);
3212 pm3.SetPoint(hitIdx++, pos[2], pos[0]);
3214 pm3.SetPoint(hitIdx++, pos[2], pos[1]);
3220 TPolyMarker& pm4 = view->
AddPolyMarker(skeletonPosVec.size(), 1, kFullDotMedium, 1);
3221 for (
const auto* spacePoint : skeletonPosVec) {
3222 const double* pos = spacePoint->XYZ();
3225 pm4.SetPoint(hitIdx++, pos[0], pos[1]);
3227 pm4.SetPoint(hitIdx++, pos[2], pos[0]);
3229 pm4.SetPoint(hitIdx++, pos[2], pos[1]);
3234 TPolyMarker& pm5 = view->
AddPolyMarker(skelEdgePosVec.size(), 3, kFullDotMedium, 1);
3235 for (
const auto* spacePoint : skelEdgePosVec) {
3236 const double* pos = spacePoint->XYZ();
3239 pm5.SetPoint(hitIdx++, pos[0], pos[1]);
3241 pm5.SetPoint(hitIdx++, pos[2], pos[0]);
3243 pm5.SetPoint(hitIdx++, pos[2], pos[1]);
3248 TPolyMarker& pm6 = view->
AddPolyMarker(seedPosVec.size(), 6, kFullDotMedium, 1);
3249 for (
const auto* spacePoint : seedPosVec) {
3250 const double* pos = spacePoint->XYZ();
3253 pm6.SetPoint(hitIdx++, pos[0], pos[1]);
3255 pm6.SetPoint(hitIdx++, pos[2], pos[0]);
3257 pm6.SetPoint(hitIdx++, pos[2], pos[1]);
3262 if (pcAxisAssnVec.isValid()) {
3263 std::vector<const recob::PCAxis*> pcaVec(pcAxisAssnVec.at(pfPart->
Self()));
3265 if (!pcaVec.empty()) {
3268 int lineWidth[2] = {3, 1};
3269 int lineStyle[2] = {1, 13};
3270 int lineColor[2] = {colorIdx, 18};
3271 int markStyle[2] = {4, 4};
3276 if (pcaVec.size() > 1 && pcaVec.front()->getID() > pcaVec.back()->getID())
3277 std::reverse(pcaVec.begin(), pcaVec.end());
3279 for (
const auto& pca : pcaVec) {
3281 const double* avePosition = pca->getAvePosition();
3285 TPolyMarker& pmrk = view->
AddPolyMarker(7, lineColor[pcaIdx], markStyle[pcaIdx], 1);
3288 pmrk.SetPoint(pmrkIdx++, avePosition[0], avePosition[1]);
3290 pmrk.SetPoint(pmrkIdx++, avePosition[2], avePosition[0]);
3292 pmrk.SetPoint(pmrkIdx++, avePosition[2], avePosition[1]);
3295 for (
int dimIdx = 0; dimIdx < 3; dimIdx++) {
3298 view->
AddPolyLine(numPoints, lineColor[pcaIdx], lineWidth[pcaIdx], lineStyle[pcaIdx]);
3301 double eigenValue = pca->getEigenValues()[dimIdx];
3304 if (eigenValue > 0) {
3306 eigenValue = 3. * sqrt(eigenValue);
3309 const std::vector<double>& eigenVector = pca->getEigenVectors()[dimIdx];
3312 double xl = avePosition[0] - 0.5 * eigenValue * eigenVector[0];
3313 double yl = avePosition[1] - 0.5 * eigenValue * eigenVector[1];
3314 double zl = avePosition[2] - 0.5 * eigenValue * eigenVector[2];
3317 pl.SetPoint(0, xl, yl);
3318 pmrk.SetPoint(pmrkIdx++, xl, yl);
3321 pl.SetPoint(0, zl, xl);
3322 pmrk.SetPoint(pmrkIdx++, zl, xl);
3325 pl.SetPoint(0, zl, yl);
3326 pmrk.SetPoint(pmrkIdx++, zl, yl);
3330 double xu = avePosition[0] + 0.5 * eigenValue * eigenVector[0];
3331 double yu = avePosition[1] + 0.5 * eigenValue * eigenVector[1];
3332 double zu = avePosition[2] + 0.5 * eigenValue * eigenVector[2];
3335 pl.SetPoint(1, xu, yu);
3336 pmrk.SetPoint(pmrkIdx++, xu, yu);
3339 pl.SetPoint(1, zu, xu);
3340 pmrk.SetPoint(pmrkIdx++, zu, xu);
3343 pl.SetPoint(1, zu, yu);
3344 pmrk.SetPoint(pmrkIdx++, zu, yu);
3361 for (
const auto& daughterIdx : pfPart->
Daughters()) {
3393 for (
size_t imod = 0; imod < recoOpt->
fTrackLabels.size(); ++imod) {
3398 for (
size_t t = 0; t < track.
vals().size(); ++t) {
3400 int color = ptrack->
ID() & 65535;
3412 for (
size_t imod = 0; imod < recoOpt->
fShowerLabels.size(); ++imod) {
3417 for (
size_t s = 0; s < shower.
vals().size(); ++s) {
3446 std::map<int, std::vector<art::Ptr<recob::SpacePoint>>> spmap;
3448 for (
auto& pspt : spts) {
3460 spcolor = 100 - 2.5 * pspt->Chisq();
3461 if (spcolor < 51) spcolor = 51;
3462 if (spcolor > 100) spcolor = 100;
3464 spmap[spcolor].push_back(pspt);
3471 for (
auto icolor : spmap) {
3472 int spcolor = icolor.first;
3473 std::vector<art::Ptr<recob::SpacePoint>>& psps = icolor.second;
3477 TPolyMarker& pm = view->
AddPolyMarker(psps.size(), spcolor, kFullCircle, msize);
3478 for (
size_t s = 0; s < psps.size(); ++s) {
3480 const double* xyz = spt.
XYZ();
3482 case evd::kXY: pm.SetPoint(s, xyz[0], xyz[1]);
break;
3483 case evd::kXZ: pm.SetPoint(s, xyz[2], xyz[0]);
break;
3484 case evd::kYZ: pm.SetPoint(s, xyz[2], xyz[1]);
break;
3487 << __func__ <<
": unknown projection #" << ((int)proj) <<
"\n";
3515 auto handles = evt->
getMany<std::vector<recob::Track>>();
3516 for (
auto ih : handles) {
3519 const std::string& which = handle.
provenance()->moduleLabel();
3522 int n = handle->size();
3523 for (
int i = 0; i <
n; ++i) {
3525 if (&*p == &track) {
3526 std::vector<art::Ptr<recob::SpacePoint>> spts = fmsp.at(i);
3545 for (
int p = 0; p < np; ++p) {
3550 pm.SetPoint(p, pos.X(), pos.Y());
3551 pl.SetPoint(p, pos.X(), pos.Y());
3554 pm.SetPoint(p, pos.Z(), pos.X());
3555 pl.SetPoint(p, pos.Z(), pos.X());
3558 pm.SetPoint(p, pos.Z(), pos.Y());
3559 pl.SetPoint(p, pos.Z(), pos.Y());
3563 << __func__ <<
": unknown projection #" << ((int)proj) <<
"\n";
3572 char const* txt = s.c_str();
3573 double x = track.
End().X();
3574 double y = track.
End().Y();
3575 double z = track.
End().Z();
3577 TText& trkID = view->
AddText(x, y, txt);
3578 trkID.SetTextColor(
evd::kColor[tid % evd::kNCOLS]);
3579 trkID.SetTextSize(0.03);
3582 TText& trkID = view->
AddText(z, x, txt);
3583 trkID.SetTextColor(
evd::kColor[tid % evd::kNCOLS]);
3584 trkID.SetTextSize(0.03);
3587 TText& trkID = view->
AddText(z, y, txt);
3588 trkID.SetTextColor(
evd::kColor[tid % evd::kNCOLS]);
3589 trkID.SetTextSize(0.03);
3611 auto handles = evt->
getMany<std::vector<recob::Shower>>();
3612 for (
auto ih : handles) {
3615 const std::string& which = handle.
provenance()->moduleLabel();
3617 if (!fmsp.isValid())
continue;
3618 int n = handle->size();
3619 for (
int i = 0; i <
n; ++i) {
3621 if (&*p == &shower) {
3646 << __func__ <<
": unknown projection #" << ((int)proj) <<
"\n";
3649 if (fmsp.isValid()) {
3650 std::vector<art::Ptr<recob::SpacePoint>> spts = fmsp.at(i);
3674 for (
unsigned int i = 0; i < wcol->size(); ++i) {
3681 writeErrMsg(
"GetWires", e);
3684 return wires.
size();
3690 std::vector<const recob::Hit*>&
hits,
3694 auto const& wireReadoutGeom = getWireReadoutGeom();
3698 std::vector<const recob::Hit*> temp;
3702 for (
const auto&
hit : temp) {
3706 const std::vector<geo::WireID>& wireIDs = wireReadoutGeom.ChannelToWire(
hit->Channel());
3709 for (
const auto& wireID : wireIDs) {
3710 if (wireID.Plane == plane && wireID.TPC == rawOpt->
fTPC &&
3712 hits.push_back(
hit);
3717 writeErrMsg(
"GetHits", e);
3736 for (
unsigned int i = 0; i < slcCol->size(); ++i) {
3743 writeErrMsg(
"GetSlices", e);
3746 return slices.
size();
3762 for (
unsigned int i = 0; i < clcol->size(); ++i) {
3769 writeErrMsg(
"GetClusters", e);
3772 return clust.
size();
3787 for (
unsigned int i = 0; i < clcol->size(); ++i) {
3794 writeErrMsg(
"GetPFParticles", e);
3797 return clust.
size();
3812 for (
unsigned int i = 0; i < epcol->size(); ++i) {
3819 writeErrMsg(
"GetEndPoint2D", e);
3838 for (
unsigned int i = 0; i < opflashcol->size(); ++i) {
3842 temp.
swap(opflashes);
3845 writeErrMsg(
"GetOpFlashes", e);
3848 return opflashes.
size();
3864 for (
unsigned int i = 0; i < seedcol->size(); ++i) {
3871 writeErrMsg(
"GetSeeds", e);
3874 return seeds.
size();
3900 for (
unsigned int i = 0; i < edgeCol->size(); ++i)
3901 edges.emplace_back(edgeCol, i);
3903 return edges.size();
3915 writeErrMsg(
"GetTracks", e);
3918 return track.
vals().size();
3930 writeErrMsg(
"GetShowers", e);
3933 return shower.
vals().size();
3948 for (
size_t i = 0; i < vcol->size(); ++i) {
3955 writeErrMsg(
"GetVertices", e);
3958 return vertex.
size();
3973 for (
size_t i = 0; i < ecol->size(); ++i) {
3980 writeErrMsg(
"GetEvents", e);
3983 return event.size();
3989 unsigned int cryostat,
3993 std::vector<const recob::Hit*> temp;
3994 int NumberOfHitsBeforeThisPlane = 0;
3998 for (
size_t t = 0; t < temp.size(); ++t) {
3999 if (temp[t]->
WireID().Cryostat == cryostat && temp[t]->WireID().TPC == tpc &&
4000 temp[t]->WireID().Plane == plane)
4002 NumberOfHitsBeforeThisPlane++;
4004 return NumberOfHitsBeforeThisPlane;
4015 auto const& wireReadoutGeom = getWireReadoutGeom();
4017 float minSig(std::numeric_limits<float>::max());
4018 float maxSig(std::numeric_limits<float>::lowest());
4019 bool setLimits(
false);
4024 for (
size_t imod = 0; imod < recoOpt->
fWireLabels.size(); ++imod) {
4030 for (
size_t i = 0; i < wires.
size(); ++i) {
4032 std::vector<geo::WireID> wireids = wireReadoutGeom.ChannelToWire(wires[i]->Channel());
4034 bool goodWID =
false;
4035 for (
auto const& wid : wireids) {
4037 if (wid.Plane == plane && wid.Wire == wire && wid.TPC == rawOpt->
fTPC &&
4041 if (!goodWID)
continue;
4043 std::vector<float> wirSig = wires[i]->Signal();
4044 for (
unsigned int ii = 0; ii < wirSig.size(); ++ii) {
4045 minSig = std::min(minSig, wirSig[ii]);
4046 maxSig = std::max(maxSig, wirSig[ii]);
4054 histo->SetMaximum(1.2 * maxSig);
4055 histo->SetMinimum(1.2 * minSig);
4066 auto const& wireReadoutGeom = getWireReadoutGeom();
4071 for (
size_t imod = 0; imod < recoOpt->
fWireLabels.size(); ++imod) {
4077 for (
unsigned int i = 0; i < wires.
size(); ++i) {
4079 std::vector<geo::WireID> wireids = wireReadoutGeom.ChannelToWire(wires[i]->Channel());
4081 bool goodWID =
false;
4082 for (
auto const& wid : wireids) {
4084 if (wid.Plane == plane && wid.TPC == rawOpt->
fTPC && wid.Cryostat == rawOpt->
fCryostat)
4087 if (!goodWID)
continue;
4088 std::vector<float> wirSig = wires[i]->Signal();
4089 for (
unsigned int ii = 0; ii < wirSig.size(); ++ii)
4090 histo->Fill(wirSig[ii]);
4103 std::vector<double>& htau1,
4104 std::vector<double>& htau2,
4105 std::vector<double>& hitamplitudes,
4106 std::vector<double>& hpeaktimes,
4107 std::vector<int>& hstartT,
4108 std::vector<int>& hendT,
4109 std::vector<int>& hNMultiHit,
4110 std::vector<int>& hLocalHitIndex)
4114 auto const& wireReadoutGeom = getWireReadoutGeom();
4119 for (
size_t imod = 0; imod < recoOpt->
fWireLabels.size(); ++imod) {
4125 for (
size_t i = 0; i < wires.
size(); ++i) {
4127 std::vector<geo::WireID> wireids = wireReadoutGeom.ChannelToWire(wires[i]->Channel());
4129 bool goodWID =
false;
4130 for (
auto const& wid : wireids) {
4131 if (wid.Plane == plane && wid.Wire == wire && wid.TPC == rawOpt->
fTPC &&
4136 if (!goodWID)
continue;
4138 std::vector<float> wirSig = wires[i]->Signal();
4139 for (
unsigned int ii = 0; ii < wirSig.size(); ++ii)
4140 histo->Fill(1. * ii, wirSig[ii]);
4145 for (
size_t imod = 0; imod < recoOpt->
fHitLabels.size(); ++imod) {
4148 std::vector<const recob::Hit*>
hits;
4149 GetHits(evt, which, hits, plane);
4152 const auto& fitParams = hitResults->vectors();
4156 for (
size_t i = 0; i < hits.size(); ++i) {
4158 if (hits[i]->
WireID().Wire != wire)
continue;
4160 hpeaktimes.push_back(fitParams[FitParamsOffset + i][0]);
4161 htau1.push_back(fitParams[FitParamsOffset + i][1]);
4162 htau2.push_back(fitParams[FitParamsOffset + i][2]);
4163 hitamplitudes.push_back(fitParams[FitParamsOffset + i][3]);
4164 hstartT.push_back(hits[i]->StartTick());
4165 hendT.push_back(hits[i]->EndTick());
4166 hNMultiHit.push_back(hits[i]->Multiplicity());
4167 hLocalHitIndex.push_back(hits[i]->LocalIndex());
ISpacePointDrawerPtr fSpacePointDrawer
int fDraw2DSlopeEndPoints
void SpacePointOrtho(const art::Event &evt, evd::OrthoProj_t proj, double msize, evdb::View2D *view)
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
const art::Event * GetEvent() const
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)
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.
Float_t y1[n_points_granero]
Offers proxy::Tracks and proxy::Track class for recob::Track access.
bool has_length() const
Returns whether the shower has a valid length.
TPolyLine & AddPolyLine(int n, int c, int w, int s)
WireID suggestedWireID() const
Returns a better wire ID.
void Prong3D(const art::Event &evt, evdb::View3D *view)
float SpacePointChiSq(const std::vector< art::Ptr< recob::Hit >> &) const
std::vector< art::InputTag > fTrackLabels
module labels that produced tracks
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
Float_t x1[n_points_granero]
void SeedOrtho(const art::Event &evt, evd::OrthoProj_t proj, evdb::View2D *view)
TLine & AddLine(double x1, double y1, double x2, double y2)
Declaration of signal hit object.
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
Access to track position at different points.
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
Various functions related to the presence and the number of (valid) points.
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.
constexpr auto abs(T v)
Returns the absolute value of the argument.
Vector_t VertexDirection() const
Access to track direction at different points.
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.
cout<< "Opened file "<< fin<< " ixs= "<< ixs<< endl;if(ixs==0) hhh=(TH1F *) fff-> Get("h1")
void DrawShower3D(const recob::Shower &shower, int color, evdb::View3D *view)
A collection of drawable 2-D objects.
WireID_t Wire
Index of the wire within its plane.
int GetColor(double x) const
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)
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)
Singleton to hold the current art::Event for the event display.
std::vector< art::InputTag > fExtremePointLabels
module labels that produced Extreme Points
std::vector< art::InputTag > fCosmicTagLabels
module labels that produced cosmic tags
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.
Float_t y2[n_points_geant4]
double fFlashTMax
Maximum time for a flash to be displayed.
double Length() const
Length is associated with z coordinate [cm].
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)
bool isValid() const noexcept
The color scales used by the event display.
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
unsigned int CountValidPoints() const
Various functions related to the presence and the number of (valid) points.
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
TPolyLine3D & AddPolyLine3D(int n, int c, int w, int s)
TBox & AddBox(double x1, double y1, double x2, double y2)
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)
Point_t GetCenter() const
Returns the center of the TPC volume in world coordinates [cm].
Collection of exceptions for Geometry system.
std::vector< art::InputTag > fWireLabels
module labels that produced wires
TPCID FindTPCAtPosition(Point_t const &point) const
Returns the ID of the TPC at specified location.
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)
decltype(auto) constexpr to_string(T &&obj)
ADL-aware version of std::to_string.
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)
unsigned int fCryostat
Cryostat number to draw, typically set by TWQProjectionView.
enum geo::_plane_sigtype SigType_t
Enumerate the possible plane projections.
Provenance const * provenance() const
static EventHolder * Instance()
void PFParticle3D(const art::Event &evt, evdb::View3D *view)
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)
TPolyMarker & AddPolyMarker(int n, int c, int st, double sz)
Geometry information for a single wire plane.The plane is represented in the geometry by a solid whic...
Point_t const & Vertex() const
Access to track position at different points.
const evdb::ColorScale & CalQ(geo::SigType_t st) const
std::vector< art::InputTag > fEdgeLabels
module labels that produced Edge objects
TText & AddText(double x, double y, const char *text)
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)
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)
Point_t toPoint(Point const &p)
Convert the specified point into a geo::Point_t.
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.
const Double32_t * XYZ() const
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)
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
The data type to uniquely identify a TPC.
std::vector< art::InputTag > fSeedLabels
module labels that produced events
Declaration of cluster object.
Class to aid in the rendering of RecoBase objects.
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
std::vector< art::InputTag > fSpacePointLabels
module labels that produced space points
std::size_t getView(std::string const &moduleLabel, std::string const &productInstanceName, std::string const &processName, std::vector< ELEMENT const * > &result) const
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
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
Place to keep constants for event display.
int fDrawTrackSpacePoints
int fTicksPerPoint
number of ticks to include in one point
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
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.
Provides recob::Track data product.
#define MF_LOG_VERBATIM(category)
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.
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)
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
void Wire2D(const art::Event &evt, evdb::View2D *view, unsigned int plane)
int fAxisOrientation
0 = TDC values on y-axis, wire number on x-axis, 1 = swapped
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.
Point_t const & End() const
Access to track position at different points.
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
Access to track direction at different points.
void Event2D(const art::Event &evt, evdb::View2D *view, unsigned int plane)
void GetClusterOutlines(std::vector< const recob::Hit * > &hits, std::vector< double > &tpts, std::vector< double > &wpts, unsigned int plane)
A collection of 3D drawable objects.
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)
TPCGeo const & TPC(TPCID const &tpcid=details::tpc_zero) const
Returns the specified TPC.
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)
Float_t x2[n_points_geant4]
static const int kColor2[kNCOLS]
double sampling_rate(DetectorClocksData const &data)
Returns the period of the TPC readout electronics clock.
recob::tracking::Plane Plane
TMarker & AddMarker(double x, double y, int c, int st, double sz)
Point3DBase_t< PlaneGeoCoordinatesTag > LocalPoint_t
Type of points in the local GDML wire plane frame.
std::vector< int > fTimeMax
highest time in interesting region for each plane
std::vector< art::InputTag > fClusterLabels
module labels that produced clusters
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)
art framework interface to geometry description
double HalfWidth() const
Width is associated with x coordinate [cm].
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)
Event finding and building.
TPolyMarker3D & AddPolyMarker3D(int n, int c, int st, double sz)
Encapsulate the construction of a single detector plane .
The data type to uniquely identify a cryostat.
std::vector< Handle< PROD > > getMany(SelectorBase const &selector=MatchAllSelector{}) const
std::vector< int > fTimeMin
lowest time in interesting region for each plane