12 #include "TGNumberEntry.h" 13 #include "TGTextView.h" 16 #include "TRootEmbeddedCanvas.h" 18 #include "TVirtualX.h" 64 , fTotalTPCLabel(nullptr)
66 , 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,
137 fPlaneEntry->Connect(
"ValueSet(Long_t)",
"evd::TWQProjectionView",
this,
"SetPlane()");
139 "ReturnPressed()",
"evd::TWQProjectionView",
this,
"SetPlane()");
144 unsigned int maxwire = 0;
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 = geo->
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";
276 Form(
"evd::TWQProjectionView::MouseDispatch(%d, (void*)%lu)", i, (
unsigned long)
this));
278 padname =
"fQPadPlane";
285 fPlaneQ.push_back(
new TQPad(padname, padtitle, twx2, twy1, twx3, twy2,
"Q", i, 0));
326 for (
unsigned int i = 0; i <
fPlanes.size(); ++i) {
346 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);
378 mf::LogDebug(
"TWQProjectionView") <<
"Starting to draw";
399 curr_zooming_plane = -1;
401 unsigned int const nPlanes =
fPlanes.size();
402 MF_LOG_DEBUG(
"TWQProjectionView") <<
"Start drawing " << nPlanes <<
" planes";
404 for (
unsigned int i = 0; i < nPlanes; ++i) {
407 planePad->
Pad()->Update();
408 planePad->
Pad()->GetFrame()->SetBit(TPad::kCannotMove,
true);
422 mf::LogDebug(
"TWQProjectionView") <<
"Done drawing " << nPlanes <<
" planes";
510 for (
size_t iplane = 0; iplane <
fPlanes.size(); ++iplane) {
514 double ch = 0, convch = 0;
516 fPlanes[iplane]->RawDataDraw()->GetChargeSum(iplane, ch, convch);
517 mf::LogVerbatim(
"TWQProjectionView") <<
"Warning! Calculating for RawData! ";
520 fPlanes[iplane]->RecoBaseDraw()->GetChargeSum(iplane, ch, convch);
524 <<
"\ncharge collected at collection plane: " << iplane <<
" " << ch <<
" " << convch;
533 int event = gPad->GetEvent();
547 if (shift_lock == 1)
break;
549 case kButton1Down: shift_lock = 0;
564 int event = gPad->GetEvent();
565 int px = gPad->GetEventX();
566 if (
event != 11)
return;
567 TObject* select = gPad->GetSelected();
569 if (!select->InheritsFrom(
"TBox"))
return;
572 float xx = gPad->AbsPixeltoX(px);
573 float x = gPad->PadtoX(xx);
576 kWire = (
unsigned int)TMath::Nint(x);
587 int event = gPad->GetEvent();
589 if (
event != 7)
return;
594 int px = gPad->GetEventX();
595 double w0 = gPad->AbsPixeltoX(px);
596 double x = gPad->PadtoX(w0);
598 int py = gPad->GetEventY();
599 double t0 = gPad->AbsPixeltoY(py);
600 double y = gPad->PadtoY(t0);
603 curr_zooming_plane = -1;
606 int repeat_plane = -1;
607 for (
size_t ii = 0; ii < this->
ppoints.size(); ++ii)
608 if (ppx.
plane == this->ppoints[ii].plane) {
613 this->
fPlanes[this->
ppoints[ii].plane]->View()->AddMarker(ppx.
w, ppx.
t, kRed, 29, 2.0);
615 this->
fPlanes[plane]->View()->AddMarker(0.0, 0.0, 2, 1, 0.1);
617 repeat_plane = this->
ppoints[ii].plane;
623 if (repeat_plane == -1) {
624 if (this->
ppoints.size() >= 2) {
631 this->
fPlanes[plane]->Pad()->cd();
632 this->
fPlanes[plane]->View()->Clear();
634 this->
fPlanes[plane]->View()->AddMarker(ppx.
w, ppx.
t, kRed, 29, 2.0);
636 this->
fPlanes[plane]->View()->AddMarker(0.0, 0.0, 2, 1, 0.1);
637 this->
fPlanes[plane]->View()->Draw();
649 fPlanes[
x]->View()->AddMarker(0.0, 0.0, 2, 1, 0.1);
665 if (
pline.size() >= 2) {
667 double xyz_vertex_fit[3];
669 double xx0 = 0., yy0 = 0., zz0 = 0.;
670 double xx1 = 0., yy1 = 0., zz1 = 0.;
684 bool wires_cross =
false;
685 bool time_good =
false;
695 TGText*
tt =
new TGText(
"too big");
696 tt->InsLine(1,
"time distance");
703 TGText*
tt =
new TGText(
"wires cross");
706 xyz_vertex_fit[1] =
y;
707 xyz_vertex_fit[2] =
z;
709 xyz_vertex_fit[0] = (
pline[0].t0 -
trigger_offset(clockData)) * larv * ftimetick + pos.X();
713 xx0 = (xyz_vertex_fit[0] + second_time) / 2;
721 TGText*
tt =
new TGText(
"cross");
722 tt->InsLine(1,
"wires do not");
742 TGText*
tt =
new TGText(
"too big");
743 tt->InsLine(1,
"time distance");
750 TGText*
tt =
new TGText(
"wires do cross");
753 xyz_vertex_fit[1] =
y;
754 xyz_vertex_fit[2] =
z;
756 xyz_vertex_fit[0] = (
pline[0].t1 -
trigger_offset(clockData)) * larv * ftimetick + pos.X();
760 xx1 = (xyz_vertex_fit[0] + second_time) / 2;
766 TGText*
tt =
new TGText(
"cross");
767 tt->InsLine(1,
"wires do not");
778 length = pow(xx0 - xx1, 2) + pow(yy0 - yy1, 2) + pow(zz0 - zz1, 2);
779 length = pow(length, 0.5);
784 TGText*
tt =
new TGText(
"selected points");
785 tt->InsLine(1,
"not enough");
798 std::cerr <<
"No event available\n";
808 double xyz_vertex_fit[3] = {0.};
809 double second_time = 0.;
821 bool wires_cross =
false;
822 bool time_good =
false;
833 TGText*
tt =
new TGText(
"too big");
834 tt->InsLine(1,
"time distance");
840 xyz_vertex_fit[1] =
y;
841 xyz_vertex_fit[2] =
z;
848 TGText*
tt =
new TGText(Form(
"z:%4.1f", z));
849 tt->InsLine(1, Form(
"x:%4.1f,", (xyz_vertex_fit[0] + second_time) / 2));
850 tt->InsLine(1, Form(
"y:%4.1f,", y));
857 TGText*
tt =
new TGText(
"cross");
858 tt->InsLine(1,
"wires do not");
867 unsigned int wplane = 0;
868 unsigned int wirevertex = 0;
873 for (
int yy = 0; yy < 2; ++yy)
884 pos.SetY(xyz_vertex_fit[1]);
885 pos.SetZ(xyz_vertex_fit[2]);
889 double timestart = detProp.ConvertXToTicks(xyz_vertex_fit[0], planeID);
892 fPlanes[wplane]->View()->Clear();
894 fPlanes[wplane]->View()->AddMarker(wirevertex, timestart, kMagenta, 29, 2.0);
896 fPlanes[wplane]->View()->AddMarker(0.0, 0.0, 2, 1, 0.1);
897 fPlanes[wplane]->Pad()->Update();
898 fPlanes[wplane]->View()->Draw();
906 TGText*
tt =
new TGText(
"selected points");
907 tt->InsLine(1,
"not enough");
919 std::cerr <<
"No event available\n";
936 if (
pline.size() < 2) {
937 TGText*
tt =
new TGText(
"not enough lines selected");
944 for (ii = 0; ii <
pline.size(); ++ii) {
947 omx[ii] = gser.Get2Dangle(deltawire, deltatime);
950 for (
size_t ii = 0; ii <
pline.size(); ++ii) {
959 int error1 = gser.GetProjectedPoint(&p00, &p01, p0N);
964 int error2 = gser.GetProjectedPoint(&p10, &p11, p1N);
965 if (error1 != -1 && error2 != -1)
966 fPlanes[p0N.
plane]->SaveHitList(p0N.
w, p0N.
t, p1N.
w, p1N.
t, kDistance, zoom_opt,
false);
969 for (
size_t jj = 0; jj <
fPlanes.size(); ++jj) {
973 gser.Get3DaxisN(
pline[0].plane,
pline[1].plane, omx[0], omx[1], xphi, xtheta);
976 TGText*
tt =
new TGText(Form(
"Length:%4.1f", length));
977 tt->InsLine(1, Form(
"Omega P%d:%4.1f,",
pline[0].plane, omx[0]));
978 tt->InsLine(2, Form(
"Omega P%d:%4.1f,",
pline[1].plane, omx[1]));
979 tt->InsLine(3, Form(
"Phi: %4.1f,", xphi));
981 tt->InsLine(4, Form(
"Theta: %4.1f", xtheta));
995 if (this->
pline.size() == 0)
return;
996 for (
size_t i = 0; i <
fPlanes.size(); ++i) {
1010 TObject* select = gPad->GetSelected();
1011 if (!select)
return;
1012 if (!select->InheritsFrom(
"TBox"))
return;
1014 static Float_t w0 = -1,
t0 = -1, w1 = -1,
t1 = -1;
1016 static Int_t pxold, pyold;
1017 static Int_t pw0, pt0;
1018 static Int_t linedrawn;
1020 static int wstart, wend;
1021 static float tstart, tend;
1023 int event = gPad->GetEvent();
1024 int px = gPad->GetEventX();
1025 int py = gPad->GetEventY();
1029 case kButton1Down: {
1030 gVirtualX->SetLineColor(-1);
1031 w0 = gPad->AbsPixeltoX(px);
1032 t0 = gPad->AbsPixeltoY(py);
1038 float x = gPad->PadtoX(w0);
1039 tstart = gPad->PadtoY(
t0);
1041 wstart = (
unsigned int)TMath::Nint(x);
1042 curr_zooming_plane = plane;
1045 case kButton1Motion: {
1065 if (linedrawn) gVirtualX->DrawBox(lx, ly, hx, hy, TVirtualX::kHollow);
1088 gVirtualX->DrawBox(lx, ly, hx, hy, TVirtualX::kHollow);
1092 if (px == pw0 && py == pt0)
break;
1093 w1 = gPad->AbsPixeltoX(px);
1094 t1 = gPad->AbsPixeltoY(py);
1095 gPad->Modified(kTRUE);
1097 float x = gPad->PadtoX(w1);
1098 tend = gPad->PadtoY(
t1);
1099 wend = (
unsigned int)TMath::Nint(x);
1101 gROOT->SetEditorMode();
1104 double xx1, yy1, xx2, yy2;
1106 gPad->GetRangeAxis(xx1, yy1, xx2, yy2);
1108 if (wstart != 0 && tstart != 0 && (
std::abs(wend - wstart) > 0.01 * (xx2 - xx1)) &&
1109 (
std::abs(tend - tstart) > 0.01 * (yy2 - yy1) && curr_zooming_plane == plane)) {
1112 this->
SetZoom(plane, wstart, wend, tstart, tend);
1124 static Float_t w0 = -1,
t0 = -1, w1 = -1,
t1 = -1;
1126 static Int_t pxold, pyold;
1127 static Int_t pw0, pt0;
1129 static Int_t linedrawn;
1131 int event = gPad->GetEvent();
1132 int px = gPad->GetEventX();
1133 int py = gPad->GetEventY();
1135 int linefinished = 0;
1139 case kButton1Down: {
1141 w0 = gPad->AbsPixeltoX(px);
1142 t0 = gPad->AbsPixeltoY(py);
1148 curr_zooming_plane = plane;
1152 case kButton1Motion: {
1165 if (linedrawn) gVirtualX->DrawLine(lx, ly, hx, hy);
1177 if (linedrawn) gVirtualX->DrawLine(lx, ly, hx, hy);
1182 if (px == pw0 && py == pt0)
break;
1183 w1 = gPad->AbsPixeltoX(px);
1184 t1 = gPad->AbsPixeltoY(py);
1186 gPad->Modified(kTRUE);
1193 return linefinished;
1200 TObject* select = gPad->GetSelected();
1201 if (!select)
return;
1202 if (!select->InheritsFrom(
"TBox"))
return;
1208 curr_zooming_plane = -1;
1209 gROOT->SetEditorMode();
1212 int repeat_plane = -1;
1214 for (
size_t ii = 0; ii < this->
pline.size(); ++ii) {
1215 if (ppx.
plane == this->pline[ii].plane) {
1216 this->
pline[ii] = ppx;
1219 this->
fPlanes[plane]->Pad()->cd();
1222 TLine& l = this->
fPlanes[this->
pline[ii].plane]->View()->AddLine(
1226 repeat_plane = this->
pline[ii].plane;
1232 if (repeat_plane == -1) {
1233 if (this->
pline.size() >= 2) {
1240 this->
fPlanes[this->
pline[0].plane]->Pad()->Modified();
1242 this->
fPlanes[this->
pline[0].plane]->Pad()->GetFrame()->SetBit(TPad::kCannotMove,
true);
1243 this->
fPlanes[this->
pline[0].plane]->Pad()->SetBit(TPad::kCannotMove,
true);
1244 this->
pline.pop_front();
1247 this->
pline.push_back(ppx);
1248 this->
fPlanes[plane]->Pad()->cd();
1249 this->
fPlanes[plane]->View()->Clear();
1250 this->
fPlanes[plane]->View()->Draw();
1267 int event = gPad->GetEvent();
1270 if (
event != 7)
return;
1275 int px = gPad->GetEventX();
1276 double w0 = gPad->AbsPixeltoX(px);
1277 double x = gPad->PadtoX(w0);
1279 int py = gPad->GetEventY();
1280 double t0 = gPad->AbsPixeltoY(py);
1281 double y = gPad->PadtoY(t0);
1283 fPlanes[plane]->SelectOneHit(x, y, zoom_opt);
1305 for (
size_t iplane = 0; iplane <
fPlanes.size(); ++iplane) {
1306 int minw, maxw, mint, maxt;
1311 fPlanes[iplane]->RawDataDraw()->GetRegionOfInterest(iplane, minw, maxw, mint, maxt);
1313 fPlanes[iplane]->RecoBaseDraw()->GetRegionOfInterest(iplane, minw, maxw, mint, maxt);
1315 if (test != 0)
continue;
1319 minw = -0.005 * (num_wires - 1);
1320 maxw = 1.005 * (num_wires - 1);
1321 mint = -0.005 *
fPlanes[iplane]->RawDataDraw()->TotalClockTicks();
1322 maxt = 1.01 *
fPlanes[iplane]->RawDataDraw()->TotalClockTicks();
1325 SetZoom(iplane, minw, maxw, mint, maxt,
false);
1326 zo.
wmin[iplane] = minw;
1327 zo.
tmin[iplane] = mint;
1328 zo.
wmax[iplane] = maxw;
1329 zo.
tmax[iplane] = maxt;
1357 pPlane->SetZoomFromView();
1377 MF_LOG_DEBUG(
"TWQProjectionView") <<
"Explicit request for redrawing";
1392 fZoomInterest->Connect(
"Clicked()",
"evd::TWQProjectionView",
this,
"ZoomInterest()");
1395 fUnZoomInterest->Connect(
"Clicked()",
"evd::TWQProjectionView",
this,
"ZoomInterest(=false)");
1398 fZoomBack->Connect(
"Clicked()",
"evd::TWQProjectionView",
this,
"ZoomBack()");
1401 fToggleAutoZoom->Connect(
"Clicked()",
"evd::TWQProjectionView",
this,
"SetZoomInterest()");
1407 fVFrame->AddFrame(
fZoomBack,
new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 5, 1));
1422 fToggleZoom->Connect(
"Clicked()",
"evd::TWQProjectionView",
this,
"RadioButtonsDispatch(=0)");
1424 "Clicked()",
"evd::TWQProjectionView",
this,
"RadioButtonsDispatch(=1)");
1427 fCalcAngle->Connect(
"Clicked()",
"evd::TWQProjectionView",
this,
"SaveSelection()");
1430 fClear->Connect(
"Clicked()",
"evd::TWQProjectionView",
this,
"ClearSelection()");
1438 fVFrame, 115, 75, 999, TGView::kNoHSB | TGView::kNoVSB);
1440 TGText*
tt =
new TGText(
"...");
1447 TGNumberFormat::kNESReal,
1448 TGNumberFormat::kNEAPositive,
1449 TGNumberFormat::kNELLimitMinMax,
1458 fDistance->Connect(
"ValueSet(Long_t)",
"evd::TWQProjectionView",
this,
"SetDistance()");
1460 "ReturnPressed()",
"evd::TWQProjectionView",
this,
"SetDistance()");
1465 fVFrame->AddFrame(
fToggleZoom,
new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 5, 1));
1468 fVFrame->AddFrame(
fCalcAngle,
new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 5, 1));
1469 fVFrame->AddFrame(
fClear,
new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 5, 1));
1471 fVFrame->AddFrame(
fDistance,
new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 5, 1));
1474 fVFrame->AddFrame(
fAngleInfo,
new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 5, 1));
1476 fVFrame->AddFrame(
fDistance,
new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 5, 1));
1483 fRedraw->Connect(
"Clicked()",
"evd::TWQProjectionView",
this,
"ForceRedraw()");
1485 fVFrame->AddFrame(
fRedraw,
new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 5, 1));
1499 TGHorizontalFrame* pRow =
nullptr;
1504 pRow =
new TGHorizontalFrame(
fVFrame, 216, 32, kHorizontalFrame);
1507 unsigned int const NCryo = geom.
Ncryostats();
1509 unsigned int const NCryoDigits =
1515 TGLabel* pLabel =
new TGLabel(pRow,
"Cryo #");
1516 pLabel->SetTextJustify(kTextRight | kTextCenterY);
1520 new TGNumberEntry(pRow,
1521 (Double_t)CurrentCryo,
1524 TGNumberFormat::kNESInteger,
1525 TGNumberFormat::kNEAAnyNumber,
1526 TGNumberFormat::kNELLimitMinMax,
1532 pTotalCryoLabel->SetTextJustify(kTextLeft | kTextCenterY);
1534 pRow->AddFrame(pLabel,
new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 5, 5));
1535 pRow->AddFrame(
fCryoInput,
new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 2, 2));
1536 pRow->AddFrame(pTotalCryoLabel,
new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 5, 5));
1538 fCryoInput->Connect(
"ValueSet(Long_t)",
"evd::TWQProjectionView",
this,
"SelectTPC()");
1541 TGLabel* pLabel =
new TGLabel(pRow,
"Cryo #0 (1 total)");
1543 pRow->AddFrame(pLabel,
new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 5, 5));
1546 fVFrame->AddFrame(pRow,
new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 2, 2));
1552 pRow =
new TGHorizontalFrame(
fVFrame, 216, 32, kHorizontalFrame);
1554 unsigned int MaxTPC = geom.
MaxTPCs();
1556 unsigned int const NTPCDigits =
1563 TGLabel* pLabel =
new TGLabel(pRow,
"TPC #");
1564 pLabel->SetTextJustify(kTextRight | kTextCenterY);
1568 new TGNumberEntry(pRow,
1569 (Double_t)CurrentTPC,
1572 TGNumberFormat::kNESInteger,
1573 TGNumberFormat::kNEAAnyNumber,
1574 TGNumberFormat::kNELLimitMinMax,
1582 pRow->AddFrame(pLabel,
new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 5, 5));
1583 pRow->AddFrame(
fTPCInput,
new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 2, 2));
1584 pRow->AddFrame(
fTotalTPCLabel,
new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 5, 5));
1586 fTPCInput->Connect(
"ValueSet(Long_t)",
"evd::TWQProjectionView",
this,
"SelectTPC()");
1589 TGLabel* pLabel =
new TGLabel(pRow,
"TPC #0 (1 total)");
1591 pRow->AddFrame(pLabel,
new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 5, 5));
1594 fVFrame->AddFrame(pRow,
new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 2, 2));
1635 if (NewTPC.Cryostat-- == 0)
1639 else if (!geom.
HasTPC(NewTPC)) {
1641 unsigned int const NCryos = geom.
Ncryostats();
1643 if (NewTPC.Cryostat >= NCryos) {
1652 MF_LOG_DEBUG(
"TWQProjectionView") << __func__ <<
": invalid TPC " << RequestedTPC
1653 <<
", corrected as " << NewTPC <<
" instead";
1656 if (!geom.
HasTPC(NewTPC)) {
1657 MF_LOG_ERROR(
"TWQProjectionView") << __func__ <<
": internal error: " << RequestedTPC
1658 <<
" turned into an invalid TPC " << NewTPC;
1660 else if (NewTPC != CurrentTPC) {
1662 << __func__ <<
": switching from " << CurrentTPC <<
" to " << NewTPC;
1665 if (rawOpt.
fCryostat != NewTPC.Cryostat) {
1666 unsigned int const NTPCs = geom.
NTPC(NewTPC);
1673 rawOpt.
fTPC = NewTPC.TPC;
1684 if (NewTPC != RequestedTPC) {
1695 if (parameter == 0) {
1699 else if (parameter == 1) {
1715 fFindEndpoint->Connect(
"Clicked()",
"evd::TWQProjectionView",
this,
"FindEndPoint()");
1718 fVFrame, 100, 55, 999, TGView::kNoHSB | TGView::kNoVSB);
1720 TGText*
tt =
new TGText(
"x,y,z");
1724 fClearPPoints->Connect(
"Clicked()",
"evd::TWQProjectionView",
this,
"ClearEndPoints()");
1727 new TGCheckButton(
fVFrame,
"ShowMarkers", 0);
1729 "Clicked()",
"evd::TWQProjectionView",
this,
"ToggleEndPointMarkers()");
1748 ThePrevZoomOpt.
wmin[plane],
1749 ThePrevZoomOpt.
wmax[plane],
1750 ThePrevZoomOpt.
tmin[plane],
1751 ThePrevZoomOpt.
tmax[plane],
1755 for (
size_t iplane = 0; iplane !=
fPlanes.size(); ++iplane) {
1757 ThePrevZoomOpt.
wmin[iplane],
1758 ThePrevZoomOpt.
wmax[iplane],
1759 ThePrevZoomOpt.
tmin[iplane],
1760 ThePrevZoomOpt.
tmax[iplane],
1769 <<
"unable to unzoom further - no zoom settings left on stack" << std::endl;
1791 TVirtualPad* ori = gPad;
1795 if (wirehi < wirelow) {
1801 if (timehi < timelow) {
1808 curr_zooming_plane = -1;
1810 fPlanes[plane]->SetZoomRange(wirelow, wirehi, timelow, timehi);
1826 TVirtualPad* ori = gPad;
1834 fWireQ->
Pad()->SetBit(TPad::kCannotMove,
true);
1835 fWireQ->
Pad()->GetFrame()->SetBit(TPad::kCannotMove,
true);
1850 kPlane = (
unsigned int)
fPlaneEntry->GetNumberEntry()->GetNumber();
1860 kWire = (num_wires - 1 > (
unsigned int)
fWireEntry->GetNumberEntry()->GetNumber()) ?
1861 (
unsigned int)
fWireEntry->GetNumberEntry()->GetNumber() :
1870 kDistance = (double)
fDistance->GetNumberEntry()->GetNumber();
1876 double threshold =
fThresEntry->GetNumberEntry()->GetNumber();
1882 TVirtualPad* ori = gPad;
1901 TGButton* b = (TGButton*)gTQSender;
1902 if (b->GetState() == kButtonDown) { cst->
fColorOrGray = 1; }
1907 TVirtualPad* ori = gPad;
1923 TGButton* b = (TGButton*)gTQSender;
1924 int id = b->WidgetId();
1946 TVirtualPad* ori = gPad;
1968 TGButton* b = (TGButton*)gTQSender;
1969 if (b->GetState() == kButtonDown) {
1978 TVirtualPad* ori = gPad;
2002 {*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.
details::range_type< T > Iterate() const
Initializes the specified ID with the ID of the first cryostat.
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...
unsigned int NTPC(CryostatID const &cryoid=cryostat_zero) const
Returns the total number of TPCs in the specified cryostat.
const art::Event * GetEvent() const
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.
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.
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 WireIDsIntersect(WireID const &wid1, WireID const &wid2, Point_t &intersection) const
Computes the intersection between two wires.
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.
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 detector geometry.
PlaneGeo const & Plane(PlaneID const &planeid) const
Returns the specified wire.
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.
Point_t GetBoxCenter() const
Returns the centre of the box representing the plane.
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
geo::Point_t toWorldCoords(LocalPoint_t const &local) const
Transform point from local plane frame to world frame.
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 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.
SigType_t SignalType(PlaneID const &pid) const
Returns the type of signal on the channels of specified TPC plane.
WireID NearestWireID(Point_t const &point, PlaneID const &planeid) const
Returns the ID of wire closest to position in the specified TPC.
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.
void clear()
Set a new event and data product label as current.
int fColorOrGray
0 = color, 1 = gray
unsigned int Nwires(PlaneID const &planeid) const
Returns the total number of wires in the specified plane.
static void MouseDispatch(int plane, void *wqpv)
TGCheckButton * fMCOn
Display MC truth information.
int trigger_offset(DetectorClocksData const &data)
static const char * zoom_opt
unsigned int Nplanes(TPCID const &tpcid=tpc_zero) const
Returns the total number of planes in the specified TPC.
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.
Namespace collecting geometry-related classes utilities.
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
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
geo::Point3DBase_t< PlaneGeoCoordinatesTag > LocalPoint_t
Type of points in the local GDML wire plane frame.
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)