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"
44 #include "art/Framework/Principal/fwd.h"
45 #include "art/Framework/Services/Registry/ServiceHandle.h"
46 #include "messagefacility/MessageLogger/MessageLogger.h"
64 , fTotalTPCLabel(nullptr)
66 , fLastEvent(new util::DataProductChangeTracker_t)
69 art::ServiceHandle<geo::Geometry const> geo;
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,
180 art::ServiceHandle<evd::ColorDrawingOptions const> cst;
181 art::ServiceHandle<evd::SimulationDrawingOptions> sdo;
182 art::ServiceHandle<evd::RawDrawingOptions const> rawopt;
183 art::ServiceHandle<evd::EvdLayoutOptions> evdlayoutopt;
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);
203 if (evdlayoutopt->fEnableMCTruthCheckBox) {
204 fMCOn =
new TGCheckButton(fFrame,
"MC Truth", 5);
205 fMCOn->Connect(
"Clicked()",
"evd::TWQProjectionView",
this,
"SetMCInfo()");
206 if (sdo->fShowMCTruthText == 1)
fMCOn->SetState(kButtonDown);
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()");
216 if (rawopt->fDrawRawDataOrCalibWires == 0)
218 else if (rawopt->fDrawRawDataOrCalibWires == 1)
220 else if (rawopt->fDrawRawDataOrCalibWires == 2)
226 if (evdlayoutopt->fEnableMCTruthCheckBox) {
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();
243 if (evdlayoutopt->fShowSideBar)
246 evdlayoutopt->fShowEndPointSection =
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";
384 art::ServiceHandle<geo::Geometry const> geo;
388 evdb::Canvas::fCanvas->cd();
394 art::ServiceHandle<evd::EvdLayoutOptions const> evdlayoutopt;
395 if (evdlayoutopt->fPrintTotalCharge)
PrintCharge();
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();
451 mf::LogDebug(
"TWQProjectionView") <<
"Done drawing";
502 art::ServiceHandle<evd::InfoTransfer> infot;
503 infot->SetTestFlag(number);
511 art::ServiceHandle<geo::Geometry const> geo;
512 art::ServiceHandle<evd::RawDrawingOptions const> rawopt;
514 for (
size_t iplane = 0; iplane <
fPlanes.size(); ++iplane) {
518 double ch = 0, convch = 0;
519 if (rawopt->fDrawRawDataOrCalibWires == 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);
527 mf::LogVerbatim(
"TWQProjectionView")
528 <<
"\ncharge collected at collection plane: " << iplane <<
" " << ch <<
" " << convch;
538 int event = gPad->GetEvent();
540 art::ServiceHandle<evd::EvdLayoutOptions const> evdlayoutopt;
546 if (evdlayoutopt->fMakeClusters == 1) { wqpp->
SelectHit(plane); }
553 if (evdlayoutopt->fChangeWire == 1) wqpp->
ChangeWire(plane);
556 if (evdlayoutopt->fMakeClusters == 1) { wqpp->
SetClusters(plane); }
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;
598 art::ServiceHandle<evd::EvdLayoutOptions const> evdlayoutopt;
599 if (evdlayoutopt->fShowEndPointSection != 1)
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);
613 int repeat_plane = -1;
614 for (
size_t ii = 0; ii < this->
ppoints.size(); ++ii)
615 if (ppx.
plane ==
this->ppoints[ii].plane) {
619 if (evdlayoutopt->fShowEndPointMarkers)
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();
640 if (evdlayoutopt->fShowEndPointMarkers)
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.;
686 art::ServiceHandle<geo::Geometry const> geom;
687 art::ServiceHandle<evd::RawDrawingOptions const> rawOpt;
695 bool wires_cross =
false;
696 bool time_good =
false;
700 wires_cross = geom->WireIDsIntersect(wire1, wire2, widIntersect);
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;
718 geom->Plane(
pline[0].plane).LocalToWorld(origin, pos);
720 geom->Plane(
pline[1].plane).LocalToWorld(origin, pos);
723 xx0 = (xyz_vertex_fit[0] + second_time) / 2;
731 TGText* tt =
new TGText(
"cross");
732 tt->InsLine(1,
"wires do not");
746 wires_cross = geom->WireIDsIntersect(wire1, wire2, widIntersect);
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;
765 geom->Plane(
pline[0].plane).LocalToWorld(origin, pos);
767 geom->Plane(
pline[1].plane).LocalToWorld(origin, pos);
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();
813 auto const detProp = art::ServiceHandle<detinfo::DetectorPropertiesService>()->DataFor(*pEvent);
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.};
826 art::ServiceHandle<geo::Geometry const> geom;
827 art::ServiceHandle<evd::RawDrawingOptions const> rawOpt;
833 bool wires_cross =
false;
834 bool time_good =
false;
838 geom->WireIDsIntersect(wire1, wire2, widIntersect);
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;
881 art::ServiceHandle<evd::EvdLayoutOptions const> evdlayoutopt;
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;
894 geom->Plane(wplane).LocalToWorld(origin, pos);
895 pos[1] = xyz_vertex_fit[1];
896 pos[2] = xyz_vertex_fit[2];
898 wirevertex = geom->NearestWire(pos, wplane, rawOpt->fTPC, rawOpt->fCryostat);
901 detProp.ConvertXToTicks(xyz_vertex_fit[0], wplane, rawOpt->fTPC, rawOpt->fCryostat);
904 fPlanes[wplane]->View()->Clear();
905 if (wires_cross && evdlayoutopt->fShowEndPointMarkers)
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();
936 art::ServiceHandle<geo::Geometry const> geom;
937 auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService>()->DataFor(*pEvent);
938 auto const detProp = art::ServiceHandle<detinfo::DetectorPropertiesService>()->DataFor(*pEvent, clockData);
941 art::ServiceHandle<evd::EvdLayoutOptions const> evdlayoutoptions;
942 if (evdlayoutoptions->fMakeClusters) {
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)
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));
1003 art::ServiceHandle<evd::EvdLayoutOptions const> evdlayoutopt;
1005 if (!evdlayoutopt->fMakeClusters)
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);
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)) &&
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);
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;
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();
1280 art::ServiceHandle<evd::RecoDrawingOptions const> recoopt;
1281 if (!recoopt->fUseHitSelector)
return;
1284 int event = gPad->GetEvent();
1287 if (event != 7)
return;
1289 art::ServiceHandle<evd::EvdLayoutOptions const> evdlayoutopt;
1290 if (evdlayoutopt->fMakeClusters != 1)
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);
1310 mf::LogVerbatim(
"TWQProjectionView") <<
"ZoomInterest called";
1317 art::ServiceHandle<geo::Geometry const> geo;
1318 art::ServiceHandle<evd::RawDrawingOptions const> rawopt;
1323 for (
size_t iplane = 0; iplane <
fPlanes.size(); ++iplane) {
1324 int minw, maxw, mint, maxt;
1327 if (rawopt->fDrawRawDataOrCalibWires == 0)
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;
1367 art::ServiceHandle<evd::EvdLayoutOptions> evdlayoutopt;
1377 pPlane->SetZoomFromView();
1384 art::ServiceHandle<evd::EvdLayoutOptions> evdlayoutopt;
1392 art::ServiceHandle<evd::EvdLayoutOptions> evdlayoutopt;
1400 MF_LOG_DEBUG(
"TWQProjectionView") <<
"Explicit request for redrawing";
1413 art::ServiceHandle<evd::EvdLayoutOptions const> evdlayoutopt;
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()");
1426 if (evdlayoutopt->fAutoZoomInterest == 1)
fToggleAutoZoom->SetState(kButtonDown);
1431 fVFrame->AddFrame(
fZoomBack,
new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 5, 1));
1440 art::ServiceHandle<evd::EvdLayoutOptions const> evdlayoutopt;
1441 if (!evdlayoutopt->fShowClusterSection)
return;
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()");
1457 if (evdlayoutopt->fMakeClusters == 1)
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));
1525 art::ServiceHandle<evd::RawDrawingOptions const> rawOpt;
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) {
1690 MF_LOG_DEBUG(
"TWQProjectionView")
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) {
1724 art::ServiceHandle<evd::EvdLayoutOptions> evdlayoutopt;
1725 if (parameter == 0) {
1726 evdlayoutopt->fMakeClusters = 0;
1729 else if (parameter == 1) {
1730 evdlayoutopt->fMakeClusters = 1;
1740 art::ServiceHandle<evd::EvdLayoutOptions const> evdlayoutopt;
1741 if (!evdlayoutopt->fShowEndPointSection)
return;
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()");
1761 if (evdlayoutopt->fShowEndPointMarkers == 1)
fToggleShowMarkers->SetState(kButtonDown);
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],
1800 mf::LogVerbatim(
"TWQProjectionView")
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) {
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();
1894 art::ServiceHandle<geo::Geometry const> geo;
1896 (
unsigned int)
fWireEntry->GetNumberEntry()->GetNumber() :
1913 double threshold =
fThresEntry->GetNumberEntry()->GetNumber();
1916 art::ServiceHandle<evd::RawDrawingOptions> rawopt;
1917 rawopt->fMinSignal = threshold;
1919 TVirtualPad* ori = gPad;
1921 evdb::Canvas::fCanvas->cd();
1922 evdb::Canvas::fCanvas->Modified();
1923 evdb::Canvas::fCanvas->Update();
1937 art::ServiceHandle<evd::ColorDrawingOptions> cst;
1939 TGButton* b = (TGButton*)gTQSender;
1940 if (b->GetState() == kButtonDown) { cst->fColorOrGray = 1; }
1942 cst->fColorOrGray = 0;
1945 TVirtualPad* ori = gPad;
1947 evdb::Canvas::fCanvas->cd();
1948 evdb::Canvas::fCanvas->Modified();
1949 evdb::Canvas::fCanvas->Update();
1960 art::ServiceHandle<evd::RawDrawingOptions> rawopt;
1962 TGButton* b = (TGButton*)gTQSender;
1963 int id = b->WidgetId();
1967 rawopt->fDrawRawDataOrCalibWires = 0;
1973 rawopt->fDrawRawDataOrCalibWires = 1;
1979 rawopt->fDrawRawDataOrCalibWires = 2;
1985 TVirtualPad* ori = gPad;
1993 evdb::Canvas::fCanvas->cd();
1994 evdb::Canvas::fCanvas->Modified();
1995 evdb::Canvas::fCanvas->Update();
2006 art::ServiceHandle<evd::SimulationDrawingOptions> sdo;
2008 TGButton* b = (TGButton*)gTQSender;
2009 if (b->GetState() == kButtonDown) {
2010 sdo->fShowMCTruthText = 1;
2011 sdo->fShowMCTruthVectors = 1;
2014 sdo->fShowMCTruthText = 0;
2015 sdo->fShowMCTruthVectors = 0;
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]}))
2046 MF_LOG_DEBUG(
"TWQProjectionView") <<
"New event or product: " << *fLastEvent;
2048 art::ServiceHandle<evd::EvdLayoutOptions const> drawopt;
2049 SetAutomaticZoomMode(drawopt->fAutoZoomInterest == 1);
std::vector< ZoomOptions > fPrevZoomOpt
TGNumberEntry * fCryoInput
current cryostat
TGRadioButton * fToggleClusters
Use make cluster setting.
process_name opflash particleana ie ie ie z
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
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)
process_name opflash particleana ie x
BEGIN_PROLOG could also be cerr
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.
then echo unknown compiler flag
Display parameters for the raw data.
TGTextButton * fZoomBack
Unzoom on iteresting region.
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.
Classes detecting configuration changes.
TQPad * fWireQ
Histogram of charge vs time on selected wire.
std::size_t size(FixedBins< T, C > const &) noexcept
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)
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.
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
std::vector< double > const & GetCurrentZoom() const
The color scales used by the event display.
TWQProjectionView(TGMainFrame *mf)
Access the description of 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.
TGRadioButton * fToggleZoom
Use zoom setting.
process_name opflash particleana ie ie y
A drawing pad for time vs wire.
void ResetRegionsOfInterest()
Clear all the regions of interest.
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
void ChangeWire(int plane)
TGTextButton * fRedraw
Button to force redraw.
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 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 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.
process_name physics producers generator physics producers generator physics producers generator py
Contains all timing reference information for the detector.
void ToggleEndPointMarkers()
std::string to_string(WindowPattern const &pattern)
double y
y position of intersection
static std::string TotalElementsString(unsigned int NElements)
Returns a string visualizing the total number of elements.
static void MouseDispatch(int plane, void *wqpv)
TGCheckButton * fMCOn
Display MC truth information.
int trigger_offset(DetectorClocksData const &data)
static const char * zoom_opt
void SetClusters(int plane)
void SetZoom(int plane, int wirelow, int wirehi, int timelo, int timehi, bool StoreZoom=true)
BEGIN_PROLOG hitmakerfive clustermakerfour pfparticlemakerthree showermakertwo END_PROLOG hitmakerfive clustermakerfour pfparticlemakerthree sequence::inline_paths sequence::inline_paths sequence::inline_paths showermakers test
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
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.
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.
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)