12 #include "TGNumberEntry.h" 13 #include "TGTextView.h" 16 #include "TRootEmbeddedCanvas.h" 18 #include "TVirtualX.h" 41 #include "nuevdb/EventDisplayBase/EventHolder.h" 42 #include "nuevdb/EventDisplayBase/View2D.h" 64 , fTotalTPCLabel(nullptr)
66 , fLastEvent(new
util::DataProductChangeTracker_t)
79 evdb::Canvas::fCanvas->cd();
83 evdb::Canvas::fCanvas->cd();
84 fMC =
new MCBriefPad(
"fMCPad",
"MC Info.", 0.15, 0.13, 1.0, 0.17,
"");
87 evdb::Canvas::fCanvas->cd();
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);
103 mf->RemoveFrame((TGFrame*)fEmbCanvas);
104 mf->RemoveFrame(fFrame);
106 fEmbCanvas->ReparentWindow(
fMetaFrame, fXsize, fYsize);
108 fMetaFrame->AddFrame(
fVFrame,
new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandY));
112 mf->AddFrame(fFrame);
119 TGNumberFormat::kNESInteger,
120 TGNumberFormat::kNEAAnyNumber,
121 TGNumberFormat::kNELLimitMinMax,
126 kWire = TMath::Nint(0.5 * geo->
Nwires(0));
136 fPlaneEntry->Connect(
"ValueSet(Long_t)",
"evd::TWQProjectionView",
this,
"SetPlane()");
138 "ReturnPressed()",
"evd::TWQProjectionView",
this,
"SetPlane()");
143 unsigned int maxwire = 0;
144 for (
unsigned int ip = 0; ip < geo->
Nplanes(); ip++)
145 maxwire = (geo->
Nwires(ip) - 1 > maxwire) ? geo->
Nwires(ip) - 1 : maxwire;
151 TGNumberFormat::kNESInteger,
152 TGNumberFormat::kNEAAnyNumber,
153 TGNumberFormat::kNELLimitMinMax,
162 fWireEntry->Connect(
"ValueSet(Long_t)",
"evd::TWQProjectionView",
this,
"SetWire()");
164 "ReturnPressed()",
"evd::TWQProjectionView",
this,
"SetWire()");
174 TGNumberFormat::kNESInteger,
175 TGNumberFormat::kNEAAnyNumber,
176 TGNumberFormat::kNELLimitMinMax,
190 fThresEntry->Connect(
"ValueSet(Long_t)",
"evd::TWQProjectionView",
this,
"SetThreshold()");
192 "ReturnPressed()",
"evd::TWQProjectionView",
this,
"SetThreshold()");
195 fThresLabel =
new TGLabel(fFrame,
"ADC Threshold");
198 fGreyScale =
new TGCheckButton(fFrame,
"Grayscale", 1);
199 fGreyScale->Connect(
"Clicked()",
"evd::TWQProjectionView",
this,
"SetGreyscale()");
200 if (cst->fColorOrGray == 1)
fGreyScale->SetState(kButtonDown);
204 fMCOn =
new TGCheckButton(fFrame,
"MC Truth", 5);
205 fMCOn->Connect(
"Clicked()",
"evd::TWQProjectionView",
this,
"SetMCInfo()");
211 fCalibDraw =
new TGRadioButton(fFrame,
"Reconstructed", 3);
212 fRawDraw =
new TGRadioButton(fFrame,
"Raw", 4);
213 fRawDraw->Connect(
"Clicked()",
"evd::TWQProjectionView",
this,
"SetRawCalib()");
214 fCalibDraw->Connect(
"Clicked()",
"evd::TWQProjectionView",
this,
"SetRawCalib()");
215 fRawCalibDraw->Connect(
"Clicked()",
"evd::TWQProjectionView",
this,
"SetRawCalib()");
227 fFrame->AddFrame(
fMCOn,
new TGLayoutHints(kLHintsBottom | kLHintsRight, 0, 0, 5, 1));
229 fFrame->AddFrame(
fGreyScale,
new TGLayoutHints(kLHintsBottom | kLHintsRight, 0, 0, 5, 1));
230 fFrame->AddFrame(
fRawCalibDraw,
new TGLayoutHints(kLHintsBottom | kLHintsRight, 0, 0, 5, 1));
231 fFrame->AddFrame(
fCalibDraw,
new TGLayoutHints(kLHintsBottom | kLHintsRight, 0, 0, 5, 1));
232 fFrame->AddFrame(
fRawDraw,
new TGLayoutHints(kLHintsBottom | kLHintsRight, 0, 0, 5, 1));
233 fFrame->AddFrame(
fPlaneEntry,
new TGLayoutHints(kLHintsBottom | kLHintsRight, 0, 0, 2, 1));
234 fFrame->AddFrame(
fPlaneLabel,
new TGLayoutHints(kLHintsBottom | kLHintsRight, 0, 0, 5, 1));
235 fFrame->AddFrame(
fWireEntry,
new TGLayoutHints(kLHintsBottom | kLHintsRight, 0, 0, 2, 1));
236 fFrame->AddFrame(
fWireLabel,
new TGLayoutHints(kLHintsBottom | kLHintsRight, 0, 0, 5, 1));
237 fFrame->AddFrame(
fThresEntry,
new TGLayoutHints(kLHintsBottom | kLHintsRight, 0, 0, 2, 1));
238 fFrame->AddFrame(
fThresLabel,
new TGLayoutHints(kLHintsBottom | kLHintsRight, 0, 0, 5, 1));
241 unsigned int nplanes = geo->
Nplanes();
255 for (
unsigned int i = 0; i < nplanes; ++i) {
259 double twy1 = 0.17 + (i) * (1.0 - 0.171) / (1. * nplanes);
260 double twy2 = 0.17 + (i + 1) * (1.0 - 0.171) / (1. * nplanes);
262 TString padname =
"fWireProjP";
265 TString padtitle =
"Plane";
268 evdb::Canvas::fCanvas->cd();
274 Form(
"evd::TWQProjectionView::MouseDispatch(%d, (void*)%lu)", i, (
unsigned long)
this));
276 padname =
"fQPadPlane";
282 evdb::Canvas::fCanvas->cd();
283 fPlaneQ.push_back(
new TQPad(padname, padtitle, twx2, twy1, twx3, twy2,
"Q", i, 0));
290 evdb::Canvas::fCanvas->Update();
324 for (
unsigned int i = 0; i <
fPlanes.size(); ++i) {
345 planePad->RawDataDraw()->ResetRegionOfInterest();
355 for (
unsigned int i = 0; i <
fPlanes.size(); ++i) {
358 fPlanes[i]->Pad()->GetFrame()->SetBit(TPad::kCannotMove,
true);
360 for (
unsigned int j = 0; j <
fPlaneQ.size(); ++j) {
363 fPlaneQ[j]->Pad()->GetFrame()->SetBit(TPad::kCannotMove,
true);
380 mf::LogDebug(
"TWQProjectionView") <<
"Starting to draw";
388 evdb::Canvas::fCanvas->cd();
401 curr_zooming_plane = -1;
403 unsigned int const nPlanes =
fPlanes.size();
404 MF_LOG_DEBUG(
"TWQProjectionView") <<
"Start drawing " << nPlanes <<
" planes";
406 for (
unsigned int i = 0; i < nPlanes; ++i) {
409 planePad->
Pad()->Update();
410 planePad->
Pad()->GetFrame()->SetBit(TPad::kCannotMove,
true);
424 mf::LogDebug(
"TWQProjectionView") <<
"Done drawing " << nPlanes <<
" planes";
450 evdb::Canvas::fCanvas->Update();
514 for (
size_t iplane = 0; iplane <
fPlanes.size(); ++iplane) {
518 double ch = 0, convch = 0;
520 fPlanes[iplane]->RawDataDraw()->GetChargeSum(iplane, ch, convch);
521 mf::LogVerbatim(
"TWQProjectionView") <<
"Warning! Calculating for RawData! ";
524 fPlanes[iplane]->RecoBaseDraw()->GetChargeSum(iplane, ch, convch);
528 <<
"\ncharge collected at collection plane: " << iplane <<
" " << ch <<
" " << convch;
538 int event = gPad->GetEvent();
552 if (shift_lock == 1)
break;
554 case kButton1Down: shift_lock = 0;
570 int event = gPad->GetEvent();
571 int px = gPad->GetEventX();
572 if (
event != 11)
return;
573 TObject*
select = gPad->GetSelected();
575 if (!select->InheritsFrom(
"TBox"))
return;
578 float xx = gPad->AbsPixeltoX(px);
579 float x = gPad->PadtoX(xx);
582 kWire = (
unsigned int)TMath::Nint(x);
594 int event = gPad->GetEvent();
596 if (
event != 7)
return;
601 int px = gPad->GetEventX();
602 double w0 = gPad->AbsPixeltoX(px);
603 double x = gPad->PadtoX(w0);
605 int py = gPad->GetEventY();
606 double t0 = gPad->AbsPixeltoY(py);
607 double y = gPad->PadtoY(t0);
610 curr_zooming_plane = -1;
613 int repeat_plane = -1;
614 for (
size_t ii = 0; ii < this->
ppoints.size(); ++ii)
615 if (ppx.
plane == this->ppoints[ii].plane) {
620 this->
fPlanes[this->
ppoints[ii].plane]->View()->AddMarker(ppx.
w, ppx.
t, kRed, 29, 2.0);
622 this->
fPlanes[plane]->View()->AddMarker(0.0, 0.0, 2, 1, 0.1);
624 repeat_plane = this->
ppoints[ii].plane;
630 if (repeat_plane == -1) {
631 if (this->
ppoints.size() >= 2) {
638 this->
fPlanes[plane]->Pad()->cd();
639 this->
fPlanes[plane]->View()->Clear();
641 this->
fPlanes[plane]->View()->AddMarker(ppx.
w, ppx.
t, kRed, 29, 2.0);
643 this->
fPlanes[plane]->View()->AddMarker(0.0, 0.0, 2, 1, 0.1);
644 this->
fPlanes[plane]->View()->Draw();
657 fPlanes[
x]->View()->AddMarker(0.0, 0.0, 2, 1, 0.1);
674 if (
pline.size() >= 2) {
676 double xyz_vertex_fit[3];
679 const double origin[3] = {0., 0., 0.};
680 double xx0 = 0., yy0 = 0., zz0 = 0.;
681 double xx1 = 0., yy1 = 0., zz1 = 0.;
695 bool wires_cross =
false;
696 bool time_good =
false;
706 TGText*
tt =
new TGText(
"too big");
707 tt->InsLine(1,
"time distance");
713 TGText*
tt =
new TGText(
"wires cross");
716 xyz_vertex_fit[1] =
y;
717 xyz_vertex_fit[2] =
z;
723 xx0 = (xyz_vertex_fit[0] + second_time) / 2;
731 TGText*
tt =
new TGText(
"cross");
732 tt->InsLine(1,
"wires do not");
752 TGText*
tt =
new TGText(
"too big");
753 tt->InsLine(1,
"time distance");
760 TGText*
tt =
new TGText(
"wires do cross");
763 xyz_vertex_fit[1] =
y;
764 xyz_vertex_fit[2] =
z;
770 xx1 = (xyz_vertex_fit[0] + second_time) / 2;
776 TGText*
tt =
new TGText(
"cross");
777 tt->InsLine(1,
"wires do not");
788 length =
pow(xx0 - xx1, 2) +
pow(yy0 - yy1, 2) +
pow(zz0 - zz1, 2);
789 length =
pow(length, 0.5);
794 TGText*
tt =
new TGText(
"selected points");
795 tt->InsLine(1,
"not enough");
807 art::Event const* pEvent = evdb::EventHolder::Instance()->GetEvent();
809 std::cerr <<
"No event available\n";
819 double xyz_vertex_fit[3] = {0.};
820 double second_time = 0.;
821 double pos[3] = {0.};
822 const double origin[3] = {0., 0., 0.};
833 bool wires_cross =
false;
834 bool time_good =
false;
845 TGText*
tt =
new TGText(
"too big");
846 tt->InsLine(1,
"time distance");
852 xyz_vertex_fit[1] =
y;
853 xyz_vertex_fit[2] =
z;
860 TGText*
tt =
new TGText(Form(
"z:%4.1f", z));
861 tt->InsLine(1, Form(
"x:%4.1f,", (xyz_vertex_fit[0] + second_time) / 2));
862 tt->InsLine(1, Form(
"y:%4.1f,", y));
869 TGText*
tt =
new TGText(
"cross");
870 tt->InsLine(1,
"wires do not");
879 unsigned int wplane = 0;
880 unsigned int wirevertex = 0;
883 for (
size_t xx = 0; xx <
fPlanes.size(); ++xx) {
885 for (
int yy = 0; yy < 2; ++yy)
886 if (
ppoints[yy].plane == xx) ++wplane;
895 pos[1] = xyz_vertex_fit[1];
896 pos[2] = xyz_vertex_fit[2];
901 detProp.ConvertXToTicks(xyz_vertex_fit[0], wplane, rawOpt->
fTPC, rawOpt->
fCryostat);
904 fPlanes[wplane]->View()->Clear();
906 fPlanes[wplane]->View()->AddMarker(wirevertex, timestart, kMagenta, 29, 2.0);
908 fPlanes[wplane]->View()->AddMarker(0.0, 0.0, 2, 1, 0.1);
909 fPlanes[wplane]->Pad()->Update();
910 fPlanes[wplane]->View()->Draw();
918 TGText*
tt =
new TGText(
"selected points");
919 tt->InsLine(1,
"not enough");
930 art::Event const* pEvent = evdb::EventHolder::Instance()->GetEvent();
932 std::cerr <<
"No event available\n";
948 if (
pline.size() < 2) {
949 TGText*
tt =
new TGText(
"not enough lines selected");
956 for (ii = 0; ii <
pline.size(); ++ii) {
959 omx[ii] = gser.Get2Dangle(deltawire, deltatime);
962 for (
size_t ii = 0; ii <
pline.size(); ++ii) {
971 int error1 = gser.GetProjectedPoint(&p00, &p01, p0N);
976 int error2 = gser.GetProjectedPoint(&p10, &p11, p1N);
977 if (error1 != -1 && error2 != -1)
978 fPlanes[p0N.
plane]->SaveHitList(p0N.
w, p0N.
t, p1N.
w, p1N.
t, kDistance, zoom_opt,
false);
981 for (
size_t jj = 0; jj <
fPlanes.size(); ++jj) {
985 gser.Get3DaxisN(
pline[0].plane,
pline[1].plane, omx[0], omx[1], xphi, xtheta);
988 TGText*
tt =
new TGText(Form(
"Length:%4.1f", length));
989 tt->InsLine(1, Form(
"Omega P%d:%4.1f,",
pline[0].plane, omx[0]));
990 tt->InsLine(2, Form(
"Omega P%d:%4.1f,",
pline[1].plane, omx[1]));
991 tt->InsLine(3, Form(
"Phi: %4.1f,", xphi));
993 tt->InsLine(4, Form(
"Theta: %4.1f", xtheta));
1008 if (this->
pline.size() == 0)
return;
1009 for (
size_t i = 0; i <
fPlanes.size(); ++i) {
1024 TObject*
select = gPad->GetSelected();
1025 if (!select)
return;
1026 if (!select->InheritsFrom(
"TBox"))
return;
1028 static Float_t w0 = -1,
t0 = -1, w1 = -1,
t1 = -1;
1030 static Int_t pxold, pyold;
1031 static Int_t pw0, pt0;
1032 static Int_t linedrawn;
1034 static int wstart, wend;
1035 static float tstart, tend;
1037 int event = gPad->GetEvent();
1038 int px = gPad->GetEventX();
1039 int py = gPad->GetEventY();
1043 case kButton1Down: {
1044 gVirtualX->SetLineColor(-1);
1045 w0 = gPad->AbsPixeltoX(px);
1046 t0 = gPad->AbsPixeltoY(py);
1052 float x = gPad->PadtoX(w0);
1053 tstart = gPad->PadtoY(
t0);
1055 wstart = (
unsigned int)TMath::Nint(x);
1056 curr_zooming_plane = plane;
1059 case kButton1Motion: {
1079 if (linedrawn) gVirtualX->DrawBox(lx, ly, hx, hy, TVirtualX::kHollow);
1102 gVirtualX->DrawBox(lx, ly, hx, hy, TVirtualX::kHollow);
1106 if (px == pw0 && py == pt0)
break;
1107 w1 = gPad->AbsPixeltoX(px);
1108 t1 = gPad->AbsPixeltoY(py);
1109 gPad->Modified(kTRUE);
1111 float x = gPad->PadtoX(w1);
1112 tend = gPad->PadtoY(
t1);
1113 wend = (
unsigned int)TMath::Nint(x);
1115 gROOT->SetEditorMode();
1118 double xx1, yy1, xx2, yy2;
1120 gPad->GetRangeAxis(xx1, yy1, xx2, yy2);
1122 if (wstart != 0 && tstart != 0 && (
std::abs(wend - wstart) > 0.01 * (xx2 - xx1)) &&
1123 (
std::abs(tend - tstart) > 0.01 * (yy2 - yy1) && curr_zooming_plane == plane)) {
1126 this->
SetZoom(plane, wstart, wend, tstart, tend);
1139 static Float_t w0 = -1,
t0 = -1, w1 = -1,
t1 = -1;
1141 static Int_t pxold, pyold;
1142 static Int_t pw0, pt0;
1144 static Int_t linedrawn;
1146 int event = gPad->GetEvent();
1147 int px = gPad->GetEventX();
1148 int py = gPad->GetEventY();
1150 int linefinished = 0;
1154 case kButton1Down: {
1156 w0 = gPad->AbsPixeltoX(px);
1157 t0 = gPad->AbsPixeltoY(py);
1163 curr_zooming_plane = plane;
1167 case kButton1Motion: {
1180 if (linedrawn) gVirtualX->DrawLine(lx, ly, hx, hy);
1192 if (linedrawn) gVirtualX->DrawLine(lx, ly, hx, hy);
1197 if (px == pw0 && py == pt0)
break;
1198 w1 = gPad->AbsPixeltoX(px);
1199 t1 = gPad->AbsPixeltoY(py);
1201 gPad->Modified(kTRUE);
1208 return linefinished;
1216 TObject*
select = gPad->GetSelected();
1217 if (!select)
return;
1218 if (!select->InheritsFrom(
"TBox"))
return;
1224 curr_zooming_plane = -1;
1225 gROOT->SetEditorMode();
1228 int repeat_plane = -1;
1230 for (
size_t ii = 0; ii < this->
pline.size(); ++ii) {
1231 if (ppx.
plane == this->pline[ii].plane) {
1232 this->
pline[ii] = ppx;
1235 this->
fPlanes[plane]->Pad()->cd();
1238 TLine&
l = this->
fPlanes[this->
pline[ii].plane]->View()->AddLine(
1242 repeat_plane = this->
pline[ii].plane;
1248 if (repeat_plane == -1) {
1249 if (this->
pline.size() >= 2) {
1256 this->
fPlanes[this->
pline[0].plane]->Pad()->Modified();
1258 this->
fPlanes[this->
pline[0].plane]->Pad()->GetFrame()->SetBit(TPad::kCannotMove,
true);
1259 this->
fPlanes[this->
pline[0].plane]->Pad()->SetBit(TPad::kCannotMove,
true);
1260 this->
pline.pop_front();
1263 this->
pline.push_back(ppx);
1264 this->
fPlanes[plane]->Pad()->cd();
1265 this->
fPlanes[plane]->View()->Clear();
1266 this->
fPlanes[plane]->View()->Draw();
1284 int event = gPad->GetEvent();
1287 if (
event != 7)
return;
1292 int px = gPad->GetEventX();
1293 double w0 = gPad->AbsPixeltoX(px);
1294 double x = gPad->PadtoX(w0);
1296 int py = gPad->GetEventY();
1297 double t0 = gPad->AbsPixeltoY(py);
1298 double y = gPad->PadtoY(t0);
1300 fPlanes[plane]->SelectOneHit(x, y, zoom_opt);
1323 for (
size_t iplane = 0; iplane <
fPlanes.size(); ++iplane) {
1324 int minw, maxw, mint, maxt;
1329 fPlanes[iplane]->RawDataDraw()->GetRegionOfInterest(iplane, minw, maxw, mint, maxt);
1331 fPlanes[iplane]->RecoBaseDraw()->GetRegionOfInterest(iplane, minw, maxw, mint, maxt);
1333 if (test != 0)
continue;
1336 minw = -0.005 * (geo->
Nwires(iplane) - 1);
1337 maxw = 1.005 * (geo->
Nwires(iplane) - 1);
1338 mint = -0.005 *
fPlanes[iplane]->RawDataDraw()->TotalClockTicks();
1339 maxt = 1.01 *
fPlanes[iplane]->RawDataDraw()->TotalClockTicks();
1342 SetZoom(iplane, minw, maxw, mint, maxt,
false);
1343 zo.
wmin[iplane] = minw;
1344 zo.
tmin[iplane] = mint;
1345 zo.
wmax[iplane] = maxw;
1346 zo.
tmax[iplane] = maxt;
1377 pPlane->SetZoomFromView();
1400 MF_LOG_DEBUG(
"TWQProjectionView") <<
"Explicit request for redrawing";
1416 fZoomInterest->Connect(
"Clicked()",
"evd::TWQProjectionView",
this,
"ZoomInterest()");
1419 fUnZoomInterest->Connect(
"Clicked()",
"evd::TWQProjectionView",
this,
"ZoomInterest(=false)");
1422 fZoomBack->Connect(
"Clicked()",
"evd::TWQProjectionView",
this,
"ZoomBack()");
1425 fToggleAutoZoom->Connect(
"Clicked()",
"evd::TWQProjectionView",
this,
"SetZoomInterest()");
1431 fVFrame->AddFrame(
fZoomBack,
new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 5, 1));
1447 fToggleZoom->Connect(
"Clicked()",
"evd::TWQProjectionView",
this,
"RadioButtonsDispatch(=0)");
1449 "Clicked()",
"evd::TWQProjectionView",
this,
"RadioButtonsDispatch(=1)");
1452 fCalcAngle->Connect(
"Clicked()",
"evd::TWQProjectionView",
this,
"SaveSelection()");
1455 fClear->Connect(
"Clicked()",
"evd::TWQProjectionView",
this,
"ClearSelection()");
1463 fVFrame, 115, 75, 999, TGView::kNoHSB | TGView::kNoVSB);
1465 TGText*
tt =
new TGText(
"...");
1472 TGNumberFormat::kNESReal,
1473 TGNumberFormat::kNEAPositive,
1474 TGNumberFormat::kNELLimitMinMax,
1483 fDistance->Connect(
"ValueSet(Long_t)",
"evd::TWQProjectionView",
this,
"SetDistance()");
1485 "ReturnPressed()",
"evd::TWQProjectionView",
this,
"SetDistance()");
1490 fVFrame->AddFrame(
fToggleZoom,
new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 5, 1));
1493 fVFrame->AddFrame(
fCalcAngle,
new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 5, 1));
1494 fVFrame->AddFrame(
fClear,
new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 5, 1));
1496 fVFrame->AddFrame(
fDistance,
new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 5, 1));
1499 fVFrame->AddFrame(
fAngleInfo,
new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 5, 1));
1501 fVFrame->AddFrame(
fDistance,
new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 5, 1));
1509 fRedraw->Connect(
"Clicked()",
"evd::TWQProjectionView",
this,
"ForceRedraw()");
1511 fVFrame->AddFrame(
fRedraw,
new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 5, 1));
1527 TGHorizontalFrame* pRow =
nullptr;
1532 pRow =
new TGHorizontalFrame(
fVFrame, 216, 32, kHorizontalFrame);
1535 unsigned int const NCryo = geom.
Ncryostats();
1537 unsigned int const NCryoDigits =
1543 TGLabel* pLabel =
new TGLabel(pRow,
"Cryo #");
1544 pLabel->SetTextJustify(kTextRight | kTextCenterY);
1548 new TGNumberEntry(pRow,
1549 (Double_t)CurrentCryo,
1552 TGNumberFormat::kNESInteger,
1553 TGNumberFormat::kNEAAnyNumber,
1554 TGNumberFormat::kNELLimitMinMax,
1560 pTotalCryoLabel->SetTextJustify(kTextLeft | kTextCenterY);
1562 pRow->AddFrame(pLabel,
new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 5, 5));
1563 pRow->AddFrame(
fCryoInput,
new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 2, 2));
1564 pRow->AddFrame(pTotalCryoLabel,
new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 5, 5));
1566 fCryoInput->Connect(
"ValueSet(Long_t)",
"evd::TWQProjectionView",
this,
"SelectTPC()");
1569 TGLabel* pLabel =
new TGLabel(pRow,
"Cryo #0 (1 total)");
1571 pRow->AddFrame(pLabel,
new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 5, 5));
1574 fVFrame->AddFrame(pRow,
new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 2, 2));
1580 pRow =
new TGHorizontalFrame(
fVFrame, 216, 32, kHorizontalFrame);
1582 unsigned int MaxTPC = geom.
MaxTPCs();
1584 unsigned int const NTPCDigits =
1591 TGLabel* pLabel =
new TGLabel(pRow,
"TPC #");
1592 pLabel->SetTextJustify(kTextRight | kTextCenterY);
1596 new TGNumberEntry(pRow,
1597 (Double_t)CurrentTPC,
1600 TGNumberFormat::kNESInteger,
1601 TGNumberFormat::kNEAAnyNumber,
1602 TGNumberFormat::kNELLimitMinMax,
1610 pRow->AddFrame(pLabel,
new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 5, 5));
1611 pRow->AddFrame(
fTPCInput,
new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 2, 2));
1612 pRow->AddFrame(
fTotalTPCLabel,
new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 5, 5));
1614 fTPCInput->Connect(
"ValueSet(Long_t)",
"evd::TWQProjectionView",
this,
"SelectTPC()");
1617 TGLabel* pLabel =
new TGLabel(pRow,
"TPC #0 (1 total)");
1619 pRow->AddFrame(pLabel,
new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 5, 5));
1622 fVFrame->AddFrame(pRow,
new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 2, 2));
1664 if (NewTPC.Cryostat-- == 0)
1668 else if (!geom.
HasTPC(NewTPC)) {
1670 unsigned int const NCryos = geom.
Ncryostats();
1672 if (NewTPC.Cryostat >= NCryos) {
1681 MF_LOG_DEBUG(
"TWQProjectionView") << __func__ <<
": invalid TPC " << RequestedTPC
1682 <<
", corrected as " << NewTPC <<
" instead";
1685 if (!geom.
HasTPC(NewTPC)) {
1686 MF_LOG_ERROR(
"TWQProjectionView") << __func__ <<
": internal error: " << RequestedTPC
1687 <<
" turned into an invalid TPC " << NewTPC;
1689 else if (NewTPC != CurrentTPC) {
1691 << __func__ <<
": switching from " << CurrentTPC <<
" to " << NewTPC;
1694 if (rawOpt.
fCryostat != NewTPC.Cryostat) {
1695 unsigned int const NTPCs = geom.
NTPC(NewTPC);
1702 rawOpt.
fTPC = NewTPC.TPC;
1713 if (NewTPC != RequestedTPC) {
1725 if (parameter == 0) {
1729 else if (parameter == 1) {
1746 fFindEndpoint->Connect(
"Clicked()",
"evd::TWQProjectionView",
this,
"FindEndPoint()");
1749 fVFrame, 100, 55, 999, TGView::kNoHSB | TGView::kNoVSB);
1751 TGText*
tt =
new TGText(
"x,y,z");
1755 fClearPPoints->Connect(
"Clicked()",
"evd::TWQProjectionView",
this,
"ClearEndPoints()");
1758 new TGCheckButton(
fVFrame,
"ShowMarkers", 0);
1760 "Clicked()",
"evd::TWQProjectionView",
this,
"ToggleEndPointMarkers()");
1780 ThePrevZoomOpt.
wmin[plane],
1781 ThePrevZoomOpt.
wmax[plane],
1782 ThePrevZoomOpt.
tmin[plane],
1783 ThePrevZoomOpt.
tmax[plane],
1787 for (
size_t iplane = 0; iplane !=
fPlanes.size(); ++iplane) {
1789 ThePrevZoomOpt.
wmin[iplane],
1790 ThePrevZoomOpt.
wmax[iplane],
1791 ThePrevZoomOpt.
tmin[iplane],
1792 ThePrevZoomOpt.
tmax[iplane],
1801 <<
"unable to unzoom further - no zoom settings left on stack" <<
std::endl;
1824 TVirtualPad* ori = gPad;
1828 if (wirehi < wirelow) {
1834 if (timehi < timelow) {
1841 curr_zooming_plane = -1;
1843 fPlanes[plane]->SetZoomRange(wirelow, wirehi, timelow, timehi);
1847 evdb::Canvas::fCanvas->cd();
1848 evdb::Canvas::fCanvas->Modified();
1849 evdb::Canvas::fCanvas->Update();
1860 TVirtualPad* ori = gPad;
1868 fWireQ->
Pad()->SetBit(TPad::kCannotMove,
true);
1869 fWireQ->
Pad()->GetFrame()->SetBit(TPad::kCannotMove,
true);
1874 evdb::Canvas::fCanvas->cd();
1875 evdb::Canvas::fCanvas->Modified();
1876 evdb::Canvas::fCanvas->Update();
1885 kPlane = (
unsigned int)
fPlaneEntry->GetNumberEntry()->GetNumber();
1895 kWire = (geo->
Nwires(kPlane) - 1 > (
unsigned int)
fWireEntry->GetNumberEntry()->GetNumber()) ?
1896 (
unsigned int)
fWireEntry->GetNumberEntry()->GetNumber() :
1906 kDistance = (double)
fDistance->GetNumberEntry()->GetNumber();
1913 double threshold =
fThresEntry->GetNumberEntry()->GetNumber();
1919 TVirtualPad* ori = gPad;
1921 evdb::Canvas::fCanvas->cd();
1922 evdb::Canvas::fCanvas->Modified();
1923 evdb::Canvas::fCanvas->Update();
1939 TGButton*
b = (TGButton*)gTQSender;
1940 if (b->GetState() == kButtonDown) { cst->
fColorOrGray = 1; }
1945 TVirtualPad* ori = gPad;
1947 evdb::Canvas::fCanvas->cd();
1948 evdb::Canvas::fCanvas->Modified();
1949 evdb::Canvas::fCanvas->Update();
1962 TGButton*
b = (TGButton*)gTQSender;
1963 int id = b->WidgetId();
1985 TVirtualPad* ori = gPad;
1993 evdb::Canvas::fCanvas->cd();
1994 evdb::Canvas::fCanvas->Modified();
1995 evdb::Canvas::fCanvas->Update();
2008 TGButton*
b = (TGButton*)gTQSender;
2009 if (b->GetState() == kButtonDown) {
2018 TVirtualPad* ori = gPad;
2021 evdb::Canvas::fCanvas->cd();
2022 evdb::Canvas::fCanvas->Modified();
2023 evdb::Canvas::fCanvas->Update();
2034 art::Event const* pEvent = evdb::EventHolder::Instance()->GetEvent();
2043 {*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...
double z
z position of intersection
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.
PlaneGeo const & Plane(unsigned int const p, unsigned int const tpc=0, unsigned int const cstat=0) const
Returns the specified wire.
void SetMouseZoomRegion(int plane)
static unsigned int kWire
int DrawLine(int plane, util::PxLine &pline)
void SetTestFlag(int number=1)
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
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
TGCheckButton * fToggleShowMarkers
Toggle the ShowEndPointMarkersSetting.
#define MF_LOG_ERROR(category)
TQPad * fWireQ
Histogram of charge vs time on selected wire.
TGTextView * fXYZPosition
Display the xyz position.
static unsigned int kPlane
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.
SigType_t SignalType(geo::PlaneID const &pid) const
Returns the type of signal on the channels of specified TPC plane.
unsigned int Ncryostats() const
Returns the number of cryostats in the detector.
TGNumberEntry * fDistance
Distance from line to find hits in cluster.
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
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.
unsigned int Nwires(unsigned int p, unsigned int tpc=0, unsigned int cstat=0) const
Returns the total number of wires in the specified plane.
static Argument * parameter
art framework interface to geometry description
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
TWQProjectionView(TGMainFrame *mf)
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
int fShowClusterSection
Show section to make clusters.
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.
unsigned int Nplanes(unsigned int tpc=0, unsigned int cstat=0) const
Returns the total number of wire planes in the specified TPC.
int fShowSideBar
1 to show, 0 don't show
TGRadioButton * fToggleZoom
Use zoom setting.
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.
TGLabel * fTotalTPCLabel
total TPCs in the current cryostat
unsigned int fCryostat
Cryostat number to draw, typically set by TWQProjectionView.
void SetUpDrawingButtons()
static int curr_zooming_plane
geo::WireID::WireID_t NearestWire(geo::Point_t const &point, geo::PlaneID const &planeid) const
Returns the index of wire closest to position in the specified TPC.
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 geometry of one entire detector.
bool OnNewEvent()
Returns if a new event is detected; if so, it also resets accordingly.
void DrawPads(const char *opt="")
auto select(T const &...t)
TGRadioButton * fCalibDraw
Draw calibrated information only.
std::map< int, double > wmax
void ZoomInterest(bool flag=true)
void SetUpClusterButtons()
unsigned int NTPC(unsigned int cstat=0) const
Returns the total number of TPCs in the specified cryostat.
void SetClusterInterest()
TGRadioButton * fRawDraw
Draw Raw information only.
TGTextButton * fUnZoomInterest
Unzoom on iteresting region.
bool WireIDsIntersect(WireID const &wid1, WireID const &wid2, geo::Point_t &intersection) const
Computes the intersection between two wires.
bool HasTPC(geo::TPCID const &tpcid) const
Returns whether we have the specified TPC.
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()
double y
y position of intersection
MaybeLogger_< ELseverityLevel::ELsev_success, false > LogDebug
static std::string TotalElementsString(unsigned int NElements)
Returns a string visualizing the total number of elements.
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
Access the description of detector geometry.
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.
LArSoft geometry interface.
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
util::DataProductChangeTracker_t * fLastEvent
keeps track of latest event
unsigned int MaxTPCs() const
Returns the largest number of TPCs a cryostat in the detector has.
std::string to_string(ModuleType const mt)
void LocalToWorld(const double *plane, double *world) const
Transform point from local plane frame to world frame.
TGNumberEntry * fWireEntry
Wire number displayed.
bool isValid() const
Returns whether there is a current event and data product.
constexpr Point origin()
Returns a origin position with a point of the specified type.
QTextStream & endl(QTextStream &s)
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)