12 #include "TGNumberEntry.h" 13 #include "TGTextView.h" 16 #include "TRootEmbeddedCanvas.h" 18 #include "TVirtualX.h" 65 , fTotalTPCLabel(nullptr)
67 , fLastEvent(new
util::DataProductChangeTracker_t)
84 fMC =
new MCBriefPad(
"fMCPad",
"MC Info.", 0.15, 0.13, 1.0, 0.17,
"");
89 fWireQ =
new TQPad(
"fWireQPad",
"ADCvsTime", 0.15, 0.0, 1.0, 0.14,
"TQ", 0, 0);
90 fWireQ->
Pad()->SetBit(TPad::kCannotMove,
true);
94 fMetaFrame =
new TGCompositeFrame(mf, 60, 60, kHorizontalFrame);
101 new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 5, 5, 5, 5);
108 fMetaFrame->AddFrame(
fVFrame,
new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandY));
119 TGNumberFormat::kNESInteger,
120 TGNumberFormat::kNEAAnyNumber,
121 TGNumberFormat::kNELLimitMinMax,
123 wireReadoutGeom.Nplanes() - 1);
127 kWire = TMath::Nint(0.5 * wireReadoutGeom.Nwires(
geo::PlaneID{tpcid, 0}));
137 fPlaneEntry->Connect(
"ValueSet(Long_t)",
"evd::TWQProjectionView",
this,
"SetPlane()");
139 "ReturnPressed()",
"evd::TWQProjectionView",
this,
"SetPlane()");
144 unsigned int maxwire = 0;
145 for (
auto const& plane : wireReadoutGeom.Iterate<
geo::PlaneGeo>(tpcid)) {
146 maxwire = (plane.Nwires() - 1 > maxwire) ? plane.Nwires() - 1 : maxwire;
153 TGNumberFormat::kNESInteger,
154 TGNumberFormat::kNEAAnyNumber,
155 TGNumberFormat::kNELLimitMinMax,
164 fWireEntry->Connect(
"ValueSet(Long_t)",
"evd::TWQProjectionView",
this,
"SetWire()");
166 "ReturnPressed()",
"evd::TWQProjectionView",
this,
"SetWire()");
176 TGNumberFormat::kNESInteger,
177 TGNumberFormat::kNEAAnyNumber,
178 TGNumberFormat::kNELLimitMinMax,
192 fThresEntry->Connect(
"ValueSet(Long_t)",
"evd::TWQProjectionView",
this,
"SetThreshold()");
194 "ReturnPressed()",
"evd::TWQProjectionView",
this,
"SetThreshold()");
201 fGreyScale->Connect(
"Clicked()",
"evd::TWQProjectionView",
this,
"SetGreyscale()");
202 if (cst->fColorOrGray == 1)
fGreyScale->SetState(kButtonDown);
207 fMCOn->Connect(
"Clicked()",
"evd::TWQProjectionView",
this,
"SetMCInfo()");
215 fRawDraw->Connect(
"Clicked()",
"evd::TWQProjectionView",
this,
"SetRawCalib()");
216 fCalibDraw->Connect(
"Clicked()",
"evd::TWQProjectionView",
this,
"SetRawCalib()");
217 fRawCalibDraw->Connect(
"Clicked()",
"evd::TWQProjectionView",
this,
"SetRawCalib()");
229 fFrame->AddFrame(
fMCOn,
new TGLayoutHints(kLHintsBottom | kLHintsRight, 0, 0, 5, 1));
231 fFrame->AddFrame(
fGreyScale,
new TGLayoutHints(kLHintsBottom | kLHintsRight, 0, 0, 5, 1));
232 fFrame->AddFrame(
fRawCalibDraw,
new TGLayoutHints(kLHintsBottom | kLHintsRight, 0, 0, 5, 1));
233 fFrame->AddFrame(
fCalibDraw,
new TGLayoutHints(kLHintsBottom | kLHintsRight, 0, 0, 5, 1));
234 fFrame->AddFrame(
fRawDraw,
new TGLayoutHints(kLHintsBottom | kLHintsRight, 0, 0, 5, 1));
235 fFrame->AddFrame(
fPlaneEntry,
new TGLayoutHints(kLHintsBottom | kLHintsRight, 0, 0, 2, 1));
236 fFrame->AddFrame(
fPlaneLabel,
new TGLayoutHints(kLHintsBottom | kLHintsRight, 0, 0, 5, 1));
237 fFrame->AddFrame(
fWireEntry,
new TGLayoutHints(kLHintsBottom | kLHintsRight, 0, 0, 2, 1));
238 fFrame->AddFrame(
fWireLabel,
new TGLayoutHints(kLHintsBottom | kLHintsRight, 0, 0, 5, 1));
239 fFrame->AddFrame(
fThresEntry,
new TGLayoutHints(kLHintsBottom | kLHintsRight, 0, 0, 2, 1));
240 fFrame->AddFrame(
fThresLabel,
new TGLayoutHints(kLHintsBottom | kLHintsRight, 0, 0, 5, 1));
243 unsigned int nplanes = wireReadoutGeom.Nplanes();
257 for (
unsigned int i = 0; i < nplanes; ++i) {
261 double twy1 = 0.17 + (i) * (1.0 - 0.171) / (1. * nplanes);
262 double twy2 = 0.17 + (i + 1) * (1.0 - 0.171) / (1. * nplanes);
264 TString padname =
"fWireProjP";
267 TString padtitle =
"Plane";
275 Form(
"evd::TWQProjectionView::MouseDispatch(%d, (void*)%lu)", i, (
unsigned long)
this));
277 padname =
"fQPadPlane";
284 fPlaneQ.push_back(
new TQPad(padname, padtitle, twx2, twy1, twx3, twy2,
"Q", i, 0));
325 for (
unsigned int i = 0; i <
fPlanes.size(); ++i) {
345 planePad->RawDataDraw()->ResetRegionOfInterest();
354 for (
unsigned int i = 0; i <
fPlanes.size(); ++i) {
357 fPlanes[i]->Pad()->GetFrame()->SetBit(TPad::kCannotMove,
true);
359 for (
unsigned int j = 0; j <
fPlaneQ.size(); ++j) {
362 fPlaneQ[j]->Pad()->GetFrame()->SetBit(TPad::kCannotMove,
true);
377 mf::LogDebug(
"TWQProjectionView") <<
"Starting to draw";
396 curr_zooming_plane = -1;
398 unsigned int const nPlanes =
fPlanes.size();
399 MF_LOG_DEBUG(
"TWQProjectionView") <<
"Start drawing " << nPlanes <<
" planes";
401 for (
unsigned int i = 0; i < nPlanes; ++i) {
404 planePad->
Pad()->Update();
405 planePad->
Pad()->GetFrame()->SetBit(TPad::kCannotMove,
true);
413 mf::LogDebug(
"TWQProjectionView") <<
"Done drawing " << nPlanes <<
" planes";
438 for (
size_t iplane = 0; iplane <
fPlanes.size(); ++iplane) {
442 double ch = 0, convch = 0;
444 fPlanes[iplane]->RawDataDraw()->GetChargeSum(iplane, ch, convch);
445 mf::LogVerbatim(
"TWQProjectionView") <<
"Warning! Calculating for RawData! ";
448 fPlanes[iplane]->RecoBaseDraw()->GetChargeSum(iplane, ch, convch);
452 <<
"\ncharge collected at collection plane: " << iplane <<
" " << ch <<
" " << convch;
461 int event = gPad->GetEvent();
475 if (shift_lock == 1)
break;
477 case kButton1Down: shift_lock = 0;
492 int event = gPad->GetEvent();
493 int px = gPad->GetEventX();
494 if (
event != 11)
return;
495 TObject* select = gPad->GetSelected();
497 if (!select->InheritsFrom(
"TBox"))
return;
500 float xx = gPad->AbsPixeltoX(px);
501 float x = gPad->PadtoX(xx);
504 kWire = (
unsigned int)TMath::Nint(x);
515 int event = gPad->GetEvent();
517 if (
event != 7)
return;
522 int px = gPad->GetEventX();
523 double w0 = gPad->AbsPixeltoX(px);
524 double x = gPad->PadtoX(w0);
526 int py = gPad->GetEventY();
527 double t0 = gPad->AbsPixeltoY(py);
528 double y = gPad->PadtoY(t0);
531 curr_zooming_plane = -1;
534 int repeat_plane = -1;
535 for (
size_t ii = 0; ii < this->
ppoints.size(); ++ii)
536 if (ppx.
plane == this->ppoints[ii].plane) {
541 this->
fPlanes[this->
ppoints[ii].plane]->View()->AddMarker(ppx.
w, ppx.
t, kRed, 29, 2.0);
543 this->
fPlanes[plane]->View()->AddMarker(0.0, 0.0, 2, 1, 0.1);
545 repeat_plane = this->
ppoints[ii].plane;
551 if (repeat_plane == -1) {
552 if (this->
ppoints.size() >= 2) {
559 this->
fPlanes[plane]->Pad()->cd();
560 this->
fPlanes[plane]->View()->Clear();
562 this->
fPlanes[plane]->View()->AddMarker(ppx.
w, ppx.
t, kRed, 29, 2.0);
564 this->
fPlanes[plane]->View()->AddMarker(0.0, 0.0, 2, 1, 0.1);
565 this->
fPlanes[plane]->View()->Draw();
577 fPlanes[
x]->View()->AddMarker(0.0, 0.0, 2, 1, 0.1);
593 if (
pline.size() >= 2) {
595 double xyz_vertex_fit[3];
597 double xx0 = 0., yy0 = 0., zz0 = 0.;
598 double xx1 = 0., yy1 = 0., zz1 = 0.;
611 std::optional<geo::WireIDIntersection> wires_cross{};
612 bool time_good =
false;
615 wires_cross = wireReadoutGeom.WireIDsIntersect(wire1, wire2);
619 TGText*
tt =
new TGText(
"too big");
620 tt->InsLine(1,
"time distance");
627 TGText*
tt =
new TGText(
"wires cross");
630 xyz_vertex_fit[1] = wires_cross->y;
631 xyz_vertex_fit[2] = wires_cross->z;
632 auto pos = wireReadoutGeom.Plane(
geo::PlaneID(tpcid,
pline[0].plane)).GetBoxCenter();
633 xyz_vertex_fit[0] = (
pline[0].t0 -
trigger_offset(clockData)) * larv * ftimetick + pos.X();
637 xx0 = (xyz_vertex_fit[0] + second_time) / 2;
638 yy0 = wires_cross->y;
639 zz0 = wires_cross->z;
645 TGText*
tt =
new TGText(
"cross");
646 tt->InsLine(1,
"wires do not");
655 wires_cross = std::nullopt;
659 wires_cross = wireReadoutGeom.WireIDsIntersect(wire1, wire2);
663 TGText*
tt =
new TGText(
"too big");
664 tt->InsLine(1,
"time distance");
671 TGText*
tt =
new TGText(
"wires do cross");
674 xyz_vertex_fit[1] = wires_cross->y;
675 xyz_vertex_fit[2] = wires_cross->z;
676 auto pos = wireReadoutGeom.Plane(
geo::PlaneID(tpcid,
pline[0].plane)).GetBoxCenter();
677 xyz_vertex_fit[0] = (
pline[0].t1 -
trigger_offset(clockData)) * larv * ftimetick + pos.X();
681 xx1 = (xyz_vertex_fit[0] + second_time) / 2;
682 yy1 = wires_cross->y;
683 zz1 = wires_cross->z;
687 TGText*
tt =
new TGText(
"cross");
688 tt->InsLine(1,
"wires do not");
699 length = pow(xx0 - xx1, 2) + pow(yy0 - yy1, 2) + pow(zz0 - zz1, 2);
700 length = pow(length, 0.5);
705 TGText*
tt =
new TGText(
"selected points");
706 tt->InsLine(1,
"not enough");
719 std::cerr <<
"No event available\n";
729 double xyz_vertex_fit[3] = {0.};
730 double second_time = 0.;
740 std::optional<geo::WireIDIntersection> wires_cross{};
741 bool time_good =
false;
744 wires_cross = wireReadoutGeom.WireIDsIntersect(wire1, wire2);
748 TGText*
tt =
new TGText(
"too big");
749 tt->InsLine(1,
"time distance");
755 xyz_vertex_fit[1] = wires_cross->y;
756 xyz_vertex_fit[2] = wires_cross->z;
763 TGText*
tt =
new TGText(Form(
"z:%4.1f", wires_cross->z));
764 tt->InsLine(1, Form(
"x:%4.1f,", (xyz_vertex_fit[0] + second_time) / 2));
765 tt->InsLine(1, Form(
"y:%4.1f,", wires_cross->y));
772 TGText*
tt =
new TGText(
"cross");
773 tt->InsLine(1,
"wires do not");
782 unsigned int wplane = 0;
783 unsigned int wirevertex = 0;
788 for (
int yy = 0; yy < 2; ++yy)
798 auto const& planeg = wireReadoutGeom.Plane(planeID);
799 auto pos = planeg.toWorldCoords(
origin);
800 pos.SetY(xyz_vertex_fit[1]);
801 pos.SetZ(xyz_vertex_fit[2]);
803 wirevertex = planeg.NearestWireID(pos).Wire;
805 double timestart = detProp.ConvertXToTicks(xyz_vertex_fit[0], planeID);
808 fPlanes[wplane]->View()->Clear();
810 fPlanes[wplane]->View()->AddMarker(wirevertex, timestart, kMagenta, 29, 2.0);
812 fPlanes[wplane]->View()->AddMarker(0.0, 0.0, 2, 1, 0.1);
813 fPlanes[wplane]->Pad()->Update();
814 fPlanes[wplane]->View()->Draw();
822 TGText*
tt =
new TGText(
"selected points");
823 tt->InsLine(1,
"not enough");
835 std::cerr <<
"No event available\n";
853 if (
pline.size() < 2) {
854 TGText*
tt =
new TGText(
"not enough lines selected");
861 for (ii = 0; ii <
pline.size(); ++ii) {
864 omx[ii] = gser.Get2Dangle(deltawire, deltatime);
867 for (
size_t ii = 0; ii <
pline.size(); ++ii) {
876 int error1 = gser.GetProjectedPoint(&p00, &p01, p0N);
881 int error2 = gser.GetProjectedPoint(&p10, &p11, p1N);
882 if (error1 != -1 && error2 != -1)
883 fPlanes[p0N.
plane]->SaveHitList(p0N.
w, p0N.
t, p1N.
w, p1N.
t, kDistance, zoom_opt,
false);
886 for (
size_t jj = 0; jj <
fPlanes.size(); ++jj) {
890 gser.Get3DaxisN(
pline[0].plane,
pline[1].plane, omx[0], omx[1], xphi, xtheta);
893 TGText*
tt =
new TGText(Form(
"Length:%4.1f", length));
894 tt->InsLine(1, Form(
"Omega P%d:%4.1f,",
pline[0].plane, omx[0]));
895 tt->InsLine(2, Form(
"Omega P%d:%4.1f,",
pline[1].plane, omx[1]));
896 tt->InsLine(3, Form(
"Phi: %4.1f,", xphi));
898 tt->InsLine(4, Form(
"Theta: %4.1f", xtheta));
912 if (this->
pline.size() == 0)
return;
913 for (
size_t i = 0; i <
fPlanes.size(); ++i) {
927 TObject* select = gPad->GetSelected();
929 if (!select->InheritsFrom(
"TBox"))
return;
931 static Float_t w0 = -1,
t0 = -1, w1 = -1,
t1 = -1;
933 static Int_t pxold, pyold;
934 static Int_t pw0, pt0;
935 static Int_t linedrawn;
937 static int wstart, wend;
938 static float tstart, tend;
940 int event = gPad->GetEvent();
941 int px = gPad->GetEventX();
942 int py = gPad->GetEventY();
947 gVirtualX->SetLineColor(-1);
948 w0 = gPad->AbsPixeltoX(px);
949 t0 = gPad->AbsPixeltoY(py);
955 float x = gPad->PadtoX(w0);
956 tstart = gPad->PadtoY(
t0);
958 wstart = (
unsigned int)TMath::Nint(x);
959 curr_zooming_plane = plane;
962 case kButton1Motion: {
982 if (linedrawn) gVirtualX->DrawBox(lx, ly, hx, hy, TVirtualX::kHollow);
1005 gVirtualX->DrawBox(lx, ly, hx, hy, TVirtualX::kHollow);
1009 if (px == pw0 && py == pt0)
break;
1010 w1 = gPad->AbsPixeltoX(px);
1011 t1 = gPad->AbsPixeltoY(py);
1012 gPad->Modified(kTRUE);
1014 float x = gPad->PadtoX(w1);
1015 tend = gPad->PadtoY(
t1);
1016 wend = (
unsigned int)TMath::Nint(x);
1018 gROOT->SetEditorMode();
1021 double xx1, yy1, xx2, yy2;
1023 gPad->GetRangeAxis(xx1, yy1, xx2, yy2);
1025 if (wstart != 0 && tstart != 0 && (
std::abs(wend - wstart) > 0.01 * (xx2 - xx1)) &&
1026 (
std::abs(tend - tstart) > 0.01 * (yy2 - yy1) && curr_zooming_plane == plane)) {
1029 this->
SetZoom(plane, wstart, wend, tstart, tend);
1041 static Float_t w0 = -1,
t0 = -1, w1 = -1,
t1 = -1;
1043 static Int_t pxold, pyold;
1044 static Int_t pw0, pt0;
1046 static Int_t linedrawn;
1048 int event = gPad->GetEvent();
1049 int px = gPad->GetEventX();
1050 int py = gPad->GetEventY();
1052 int linefinished = 0;
1056 case kButton1Down: {
1058 w0 = gPad->AbsPixeltoX(px);
1059 t0 = gPad->AbsPixeltoY(py);
1065 curr_zooming_plane = plane;
1069 case kButton1Motion: {
1082 if (linedrawn) gVirtualX->DrawLine(lx, ly, hx, hy);
1094 if (linedrawn) gVirtualX->DrawLine(lx, ly, hx, hy);
1099 if (px == pw0 && py == pt0)
break;
1100 w1 = gPad->AbsPixeltoX(px);
1101 t1 = gPad->AbsPixeltoY(py);
1103 gPad->Modified(kTRUE);
1110 return linefinished;
1117 TObject* select = gPad->GetSelected();
1118 if (!select)
return;
1119 if (!select->InheritsFrom(
"TBox"))
return;
1125 curr_zooming_plane = -1;
1126 gROOT->SetEditorMode();
1129 int repeat_plane = -1;
1131 for (
size_t ii = 0; ii < this->
pline.size(); ++ii) {
1132 if (ppx.
plane == this->pline[ii].plane) {
1133 this->
pline[ii] = ppx;
1136 this->
fPlanes[plane]->Pad()->cd();
1139 TLine& l = this->
fPlanes[this->
pline[ii].plane]->View()->AddLine(
1143 repeat_plane = this->
pline[ii].plane;
1149 if (repeat_plane == -1) {
1150 if (this->
pline.size() >= 2) {
1157 this->
fPlanes[this->
pline[0].plane]->Pad()->Modified();
1159 this->
fPlanes[this->
pline[0].plane]->Pad()->GetFrame()->SetBit(TPad::kCannotMove,
true);
1160 this->
fPlanes[this->
pline[0].plane]->Pad()->SetBit(TPad::kCannotMove,
true);
1161 this->
pline.pop_front();
1164 this->
pline.push_back(ppx);
1165 this->
fPlanes[plane]->Pad()->cd();
1166 this->
fPlanes[plane]->View()->Clear();
1167 this->
fPlanes[plane]->View()->Draw();
1184 int event = gPad->GetEvent();
1187 if (
event != 7)
return;
1192 int px = gPad->GetEventX();
1193 double w0 = gPad->AbsPixeltoX(px);
1194 double x = gPad->PadtoX(w0);
1196 int py = gPad->GetEventY();
1197 double t0 = gPad->AbsPixeltoY(py);
1198 double y = gPad->PadtoY(t0);
1200 fPlanes[plane]->SelectOneHit(x, y, zoom_opt);
1222 for (
size_t iplane = 0; iplane <
fPlanes.size(); ++iplane) {
1223 int minw, maxw, mint, maxt;
1228 fPlanes[iplane]->RawDataDraw()->GetRegionOfInterest(iplane, minw, maxw, mint, maxt);
1230 fPlanes[iplane]->RecoBaseDraw()->GetRegionOfInterest(iplane, minw, maxw, mint, maxt);
1232 if (test != 0)
continue;
1235 auto const num_wires = wireReadoutGeom.Nwires(
geo::PlaneID(0, 0, iplane));
1236 minw = -0.005 * (num_wires - 1);
1237 maxw = 1.005 * (num_wires - 1);
1238 mint = -0.005 *
fPlanes[iplane]->RawDataDraw()->TotalClockTicks();
1239 maxt = 1.01 *
fPlanes[iplane]->RawDataDraw()->TotalClockTicks();
1242 SetZoom(iplane, minw, maxw, mint, maxt,
false);
1243 zo.
wmin[iplane] = minw;
1244 zo.
tmin[iplane] = mint;
1245 zo.
wmax[iplane] = maxw;
1246 zo.
tmax[iplane] = maxt;
1274 pPlane->SetZoomFromView();
1294 MF_LOG_DEBUG(
"TWQProjectionView") <<
"Explicit request for redrawing";
1309 fZoomInterest->Connect(
"Clicked()",
"evd::TWQProjectionView",
this,
"ZoomInterest()");
1312 fUnZoomInterest->Connect(
"Clicked()",
"evd::TWQProjectionView",
this,
"ZoomInterest(=false)");
1315 fZoomBack->Connect(
"Clicked()",
"evd::TWQProjectionView",
this,
"ZoomBack()");
1318 fToggleAutoZoom->Connect(
"Clicked()",
"evd::TWQProjectionView",
this,
"SetZoomInterest()");
1324 fVFrame->AddFrame(
fZoomBack,
new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 5, 1));
1339 fToggleZoom->Connect(
"Clicked()",
"evd::TWQProjectionView",
this,
"RadioButtonsDispatch(=0)");
1341 "Clicked()",
"evd::TWQProjectionView",
this,
"RadioButtonsDispatch(=1)");
1344 fCalcAngle->Connect(
"Clicked()",
"evd::TWQProjectionView",
this,
"SaveSelection()");
1347 fClear->Connect(
"Clicked()",
"evd::TWQProjectionView",
this,
"ClearSelection()");
1355 fVFrame, 115, 75, 999, TGView::kNoHSB | TGView::kNoVSB);
1357 TGText*
tt =
new TGText(
"...");
1364 TGNumberFormat::kNESReal,
1365 TGNumberFormat::kNEAPositive,
1366 TGNumberFormat::kNELLimitMinMax,
1375 fDistance->Connect(
"ValueSet(Long_t)",
"evd::TWQProjectionView",
this,
"SetDistance()");
1377 "ReturnPressed()",
"evd::TWQProjectionView",
this,
"SetDistance()");
1382 fVFrame->AddFrame(
fToggleZoom,
new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 5, 1));
1385 fVFrame->AddFrame(
fCalcAngle,
new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 5, 1));
1386 fVFrame->AddFrame(
fClear,
new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 5, 1));
1388 fVFrame->AddFrame(
fDistance,
new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 5, 1));
1391 fVFrame->AddFrame(
fAngleInfo,
new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 5, 1));
1393 fVFrame->AddFrame(
fDistance,
new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 5, 1));
1400 fRedraw->Connect(
"Clicked()",
"evd::TWQProjectionView",
this,
"ForceRedraw()");
1402 fVFrame->AddFrame(
fRedraw,
new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 5, 1));
1416 TGHorizontalFrame* pRow =
nullptr;
1421 pRow =
new TGHorizontalFrame(
fVFrame, 216, 32, kHorizontalFrame);
1424 unsigned int const NCryo = geom.
Ncryostats();
1426 unsigned int const NCryoDigits =
1432 TGLabel* pLabel =
new TGLabel(pRow,
"Cryo #");
1433 pLabel->SetTextJustify(kTextRight | kTextCenterY);
1437 new TGNumberEntry(pRow,
1438 (Double_t)CurrentCryo,
1441 TGNumberFormat::kNESInteger,
1442 TGNumberFormat::kNEAAnyNumber,
1443 TGNumberFormat::kNELLimitMinMax,
1449 pTotalCryoLabel->SetTextJustify(kTextLeft | kTextCenterY);
1451 pRow->AddFrame(pLabel,
new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 5, 5));
1452 pRow->AddFrame(
fCryoInput,
new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 2, 2));
1453 pRow->AddFrame(pTotalCryoLabel,
new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 5, 5));
1455 fCryoInput->Connect(
"ValueSet(Long_t)",
"evd::TWQProjectionView",
this,
"SelectTPC()");
1458 TGLabel* pLabel =
new TGLabel(pRow,
"Cryo #0 (1 total)");
1460 pRow->AddFrame(pLabel,
new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 5, 5));
1463 fVFrame->AddFrame(pRow,
new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 2, 2));
1469 pRow =
new TGHorizontalFrame(
fVFrame, 216, 32, kHorizontalFrame);
1471 unsigned int MaxTPC = geom.
MaxTPCs();
1473 unsigned int const NTPCDigits =
1480 TGLabel* pLabel =
new TGLabel(pRow,
"TPC #");
1481 pLabel->SetTextJustify(kTextRight | kTextCenterY);
1485 new TGNumberEntry(pRow,
1486 (Double_t)CurrentTPC,
1489 TGNumberFormat::kNESInteger,
1490 TGNumberFormat::kNEAAnyNumber,
1491 TGNumberFormat::kNELLimitMinMax,
1499 pRow->AddFrame(pLabel,
new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 5, 5));
1500 pRow->AddFrame(
fTPCInput,
new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 2, 2));
1501 pRow->AddFrame(
fTotalTPCLabel,
new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 5, 5));
1503 fTPCInput->Connect(
"ValueSet(Long_t)",
"evd::TWQProjectionView",
this,
"SelectTPC()");
1506 TGLabel* pLabel =
new TGLabel(pRow,
"TPC #0 (1 total)");
1508 pRow->AddFrame(pLabel,
new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 5, 5));
1511 fVFrame->AddFrame(pRow,
new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 2, 2));
1552 if (NewTPC.Cryostat-- == 0)
1556 else if (!geom.
HasTPC(NewTPC)) {
1558 unsigned int const NCryos = geom.
Ncryostats();
1560 if (NewTPC.Cryostat >= NCryos) {
1569 MF_LOG_DEBUG(
"TWQProjectionView") << __func__ <<
": invalid TPC " << RequestedTPC
1570 <<
", corrected as " << NewTPC <<
" instead";
1573 if (!geom.
HasTPC(NewTPC)) {
1574 MF_LOG_ERROR(
"TWQProjectionView") << __func__ <<
": internal error: " << RequestedTPC
1575 <<
" turned into an invalid TPC " << NewTPC;
1577 else if (NewTPC != CurrentTPC) {
1579 << __func__ <<
": switching from " << CurrentTPC <<
" to " << NewTPC;
1582 if (rawOpt.
fCryostat != NewTPC.Cryostat) {
1583 unsigned int const NTPCs = geom.
NTPC(NewTPC);
1590 rawOpt.
fTPC = NewTPC.TPC;
1601 if (NewTPC != RequestedTPC) {
1612 if (parameter == 0) {
1616 else if (parameter == 1) {
1632 fFindEndpoint->Connect(
"Clicked()",
"evd::TWQProjectionView",
this,
"FindEndPoint()");
1635 fVFrame, 100, 55, 999, TGView::kNoHSB | TGView::kNoVSB);
1637 TGText*
tt =
new TGText(
"x,y,z");
1641 fClearPPoints->Connect(
"Clicked()",
"evd::TWQProjectionView",
this,
"ClearEndPoints()");
1644 new TGCheckButton(
fVFrame,
"ShowMarkers", 0);
1646 "Clicked()",
"evd::TWQProjectionView",
this,
"ToggleEndPointMarkers()");
1665 ThePrevZoomOpt.
wmin[plane],
1666 ThePrevZoomOpt.
wmax[plane],
1667 ThePrevZoomOpt.
tmin[plane],
1668 ThePrevZoomOpt.
tmax[plane],
1672 for (
size_t iplane = 0; iplane !=
fPlanes.size(); ++iplane) {
1674 ThePrevZoomOpt.
wmin[iplane],
1675 ThePrevZoomOpt.
wmax[iplane],
1676 ThePrevZoomOpt.
tmin[iplane],
1677 ThePrevZoomOpt.
tmax[iplane],
1686 <<
"unable to unzoom further - no zoom settings left on stack" << std::endl;
1708 TVirtualPad* ori = gPad;
1712 if (wirehi < wirelow) {
1718 if (timehi < timelow) {
1725 curr_zooming_plane = -1;
1727 fPlanes[plane]->SetZoomRange(wirelow, wirehi, timelow, timehi);
1743 TVirtualPad* ori = gPad;
1751 fWireQ->
Pad()->SetBit(TPad::kCannotMove,
true);
1752 fWireQ->
Pad()->GetFrame()->SetBit(TPad::kCannotMove,
true);
1767 kPlane = (
unsigned int)
fPlaneEntry->GetNumberEntry()->GetNumber();
1776 auto const num_wires = wireReadoutGeom.Nwires(
geo::PlaneID(0, 0, kPlane));
1777 kWire = (num_wires - 1 > (
unsigned int)
fWireEntry->GetNumberEntry()->GetNumber()) ?
1778 (
unsigned int)
fWireEntry->GetNumberEntry()->GetNumber() :
1787 kDistance = (double)
fDistance->GetNumberEntry()->GetNumber();
1793 double threshold =
fThresEntry->GetNumberEntry()->GetNumber();
1799 TVirtualPad* ori = gPad;
1818 TGButton* b = (TGButton*)gTQSender;
1819 if (b->GetState() == kButtonDown) { cst->
fColorOrGray = 1; }
1824 TVirtualPad* ori = gPad;
1840 TGButton* b = (TGButton*)gTQSender;
1841 int id = b->WidgetId();
1863 TVirtualPad* ori = gPad;
1885 TGButton* b = (TGButton*)gTQSender;
1886 if (b->GetState() == kButtonDown) {
1895 TVirtualPad* ori = gPad;
1919 {*pEvent, art::ServiceHandle<evd::RawDrawingOptions const>()->fRawDataLabels[0]}))
void SetTestFlag(int value)
std::vector< ZoomOptions > fPrevZoomOpt
TGNumberEntry * fCryoInput
current cryostat
code to link reconstructed objects back to the MC truth information
TGRadioButton * fToggleClusters
Use make cluster setting.
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
HeaderPad * fHeaderPad
Show header information.
std::deque< util::PxLine > pline
list of lines in each WireProjPad used for calculating 2d and 3d angles, also making seeds (eventuall...
const art::Event * GetEvent() const
Namespace for general, non-LArSoft-specific utilities.
int fEnableMCTruthCheckBox
1 to have the check box appear, 0 otherwise
unsigned int fTPC
TPC number to draw, typically set by TWQProjectionView.
void SetMouseZoomRegion(int plane)
static unsigned int kWire
int DrawLine(int plane, util::PxLine &pline)
void SetTestFlag(int number=1)
Drawing pad for short summary of an MC event.
TGTextButton * fCalcAngle
Calculate the 2D & 3D angles between lines.
Drawing pad showing a single X-Z or Y-Z projection of an event.
Display parameters for the raw data.
TGTextButton * fZoomBack
Unzoom on iteresting region.
int fDrawRawDataOrCalibWires
0 for raw
TGCompositeFrame * fFrame
Graphics frame.
unsigned int NTPC(CryostatID const &cryoid=details::cryostat_zero) const
Returns the total number of TPCs in the specified cryostat.
double fLastThreshold
Kludge to prevent double drawing when changing threshold.
TGTextButton * fZoomInterest
Zoom on iteresting region.
The data type to uniquely identify a Plane.
void Draw(const char *opt=0)
Drawing pad for time or charge histograms.
bool isZoomAutomatic
true if user did not ask for custom zoom
double Temperature() const
In kelvin.
void ForceRedraw()
Forces a redraw of the window.
TGNumberEntry * fTPCInput
current TPC
constexpr auto abs(T v)
Returns the absolute value of the argument.
TGCheckButton * fToggleShowMarkers
Toggle the ShowEndPointMarkersSetting.
Classes detecting configuration changes.
#define MF_LOG_ERROR(category)
TQPad * fWireQ
Histogram of charge vs time on selected wire.
TGTextView * fXYZPosition
Display the xyz position.
cout<< "Opened file "<< fin<< " ixs= "<< ixs<< endl;if(ixs==0) hhh=(TH1F *) fff-> Get("h1")
static unsigned int kPlane
TCanvas * fCanvas
The ROOT drawing canvas.
A collection of drawable 2-D objects.
WireID_t Wire
Index of the wire within its plane.
static void FromPDG(TLine &line, int pdgcode)
int fMakeClusters
Draw two lines to make clusters if clicked.
TGLayoutHints * fLayout
Layout hints for frame.
unsigned int Ncryostats() const
Returns the number of cryostats in the detector.
TGNumberEntry * fDistance
Distance from line to find hits in cluster.
Manage all things related to colors for the event display.
std::deque< util::PxPoint > ppoints
list of points in each WireProjPad used for x,y,z finding
TGTextButton * fFindEndpoint
Calculate XYZ position of two points in wire planes.
unsigned short fShowMCTruthVectors
Singleton to hold the current art::Event for the event display.
TGRadioButton * fRawCalibDraw
Draw raw and calibrated information.
std::vector< TQPad * > fPlaneQ
charge on each plane
void SetAutomaticZoomMode(bool bSet=true)
Records whether we are automatically zooming to the region of interest.
double Efield(unsigned int planegap=0) const
kV/cm
std::map< int, double > wmin
int fShowEndPointSection
Show section corresponding to EndPoint finding.
std::vector< double > const & GetCurrentZoom() const
The color scales used by the event display.
TWQProjectionView(TGMainFrame *mf)
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
int fShowClusterSection
Show section to make clusters.
Access the description of the physical detector geometry.
TGCheckButton * fToggleAutoZoom
Toggle the autozoom setting.
TGCompositeFrame * fMetaFrame
needed for the side frame
TGTextButton * fClear
Clears the selected points in an event.
TGTextButton * fClearPPoints
Clear current list of End Points.
int fShowSideBar
1 to show, 0 don't show
TGRadioButton * fToggleZoom
Use zoom setting.
unsigned short fXsize
Size of the canvas;.
A drawing pad for time vs wire.
void ResetRegionsOfInterest()
Clear all the regions of interest.
int fAutoZoomInterest
Set the automatic zoom to the interest region.
decltype(auto) constexpr to_string(T &&obj)
ADL-aware version of std::to_string.
TGLabel * fTotalTPCLabel
total TPCs in the current cryostat
unsigned int fCryostat
Cryostat number to draw, typically set by TWQProjectionView.
static EventHolder * Instance()
void SetUpDrawingButtons()
static int curr_zooming_plane
Geometry information for a single wire plane.The plane is represented in the geometry by a solid whic...
int fShowEndPointMarkers
Draw EndPoint Markers if clicked.
double fMinSignal
minimum ADC count to display a time bin
void ChangeWire(int plane)
TGTextButton * fRedraw
Button to force redraw.
geo::TPCID CurrentTPC() const
Returns the current TPC as a TPCID.
TGCompositeFrame * fVFrame
needed for the side frame
void SelectHit(int plane)
void Draw(const char *opt="")
TGNumberEntry * fThresEntry
ADC threshold to display.
double FindLineLength(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp)
double DriftVelocity(double efield=0., double temperature=0.) const
cm/us
void SelectTPC()
select TPC from GUI
The data type to uniquely identify a TPC.
Description of the physical geometry of one entire detector.
bool OnNewEvent()
Returns if a new event is detected; if so, it also resets accordingly.
Class to aid in the rendering of RecoBase objects.
void DrawPads(const char *opt="")
TGRadioButton * fCalibDraw
Draw calibrated information only.
std::map< int, double > wmax
Class to aid in the rendering of RawData objects.
void ZoomInterest(bool flag=true)
void SetUpClusterButtons()
unsigned short fYsize
Size of the canvas;.
void SetClusterInterest()
TGRadioButton * fRawDraw
Draw Raw information only.
TGTextButton * fUnZoomInterest
Unzoom on iteresting region.
void RadioButtonsDispatch(int parameter)
TGNumberEntry * fPlaneEntry
Plane number displayed.
unsigned int CryostatID_t
Type for the ID number.
unsigned int TPCID_t
Type for the ID number.
Encapsulate the construction of a single detector plane .
int fChangeWire
1 to click mouse and change wire, 0 don't
Contains all timing reference information for the detector.
void ToggleEndPointMarkers()
MaybeLogger_< ELseverityLevel::ELsev_success, false > LogDebug
static std::string TotalElementsString(unsigned int NElements)
Returns a string visualizing the total number of elements.
void clear()
Set a new event and data product label as current.
int fColorOrGray
0 = color, 1 = gray
static void MouseDispatch(int plane, void *wqpv)
TGCheckButton * fMCOn
Display MC truth information.
int trigger_offset(DetectorClocksData const &data)
static const char * zoom_opt
int fPrintTotalCharge
Print out the total charge in an event.
void SetClusters(int plane)
void SetZoom(int plane, int wirelow, int wirehi, int timelo, int timehi, bool StoreZoom=true)
MCBriefPad * fMC
Short summary of MC event.
A view showing the time vs wire, charge and charge vs time information for an event.
std::vector< TWireProjPad * > fPlanes
time vs wire projection for each plane
double sampling_rate(DetectorClocksData const &data)
Returns the period of the TPC readout electronics clock.
bool update(DataProductChangeTracker_t const &new_prod)
Update to a new data product, return true if it has changed.
void SelectPoint(int plane)
TGCheckButton * fGreyScale
Display gray or color scale.
std::map< int, double > tmin
Point3DBase_t< PlaneGeoCoordinatesTag > LocalPoint_t
Type of points in the local GDML wire plane frame.
util::DataProductChangeTracker_t * fLastEvent
keeps track of latest event
TRootEmbeddedCanvas * fEmbCanvas
Embedded canvas.
unsigned int MaxTPCs() const
Returns the largest number of TPCs a cryostat in the detector has.
bool HasTPC(TPCID const &tpcid) const
Returns whether we have the specified TPC.
TGNumberEntry * fWireEntry
Wire number displayed.
bool isValid() const
Returns whether there is a current event and data product.
art framework interface to geometry description
constexpr Point origin()
Returns a origin position with a point of the specified type.
Event finding and building.
The data type to uniquely identify a cryostat.
Signal from collection planes.
std::map< int, double > tmax
void SetPlaneWire(unsigned int plane=0, unsigned int wire=0)