9 #include "TGNumberEntry.h" 13 #include "TPolyMarker.h" 14 #include "TVirtualX.h" 15 #include "TVirtualPadPainter.h" 18 #include "cetlib_except/exception.h" 27 #include "nuevdb/EventDisplayBase/EventHolder.h" 28 #include "nuevdb/EventDisplayBase/View2D.h" 78 Pad()->SetBit(TPad::kCannotMove);
81 Pad()->SetLeftMargin(0.080);
82 Pad()->SetRightMargin(0.010);
83 Pad()->SetTopMargin(0.010);
84 Pad()->SetBottomMargin(0.10);
94 for (
size_t i = 0; i < geo->
NTPC(); ++i) {
95 double local[3] = {0., 0., 0.};
96 double world[3] = {0., 0., 0.};
103 if (minz > world[2] - geo->
DetLength(i) / 2.) minz = world[2] - geo->
DetLength(i) / 2.;
104 if (maxz < world[2] + geo->
DetLength(i) / 2.) maxz = world[2] + geo->
DetLength(i) / 2.;
127 << __func__ <<
": unwknow projection " << ((
int)proj) <<
"\n";
129 TPCBox.back().SetFillStyle(0);
130 TPCBox.back().SetLineStyle(2);
131 TPCBox.back().SetLineWidth(2);
132 TPCBox.back().SetLineColor(16);
156 << __func__ <<
": unwknow projection " << ((
int)proj) <<
"\n";
162 fHisto->SetBit(kCannotPick);
163 fHisto->SetBit(TPad::kCannotMove);
164 fHisto->SetTitleOffset(1.,
"Y");
165 fHisto->SetTitleOffset(1.,
"X");
166 fHisto->GetXaxis()->SetLabelSize(0.04);
167 fHisto->GetXaxis()->SetTitleSize(0.04);
170 fHisto->GetXaxis()->SetTitle(
"x (cm)");
171 fHisto->GetYaxis()->SetTitle(
"y (cm)");
174 fHisto->GetXaxis()->SetTitle(
"z (cm)");
175 fHisto->GetYaxis()->SetTitle(
"x (cm)");
178 fHisto->GetXaxis()->SetTitle(
"z (cm)");
179 fHisto->GetYaxis()->SetTitle(
"y (cm)");
183 << __func__ <<
": unexpected flow (projection: " << ((
int)proj) <<
")\n";
186 fHisto->GetXaxis()->CenterTitle();
187 fHisto->GetYaxis()->SetLabelSize(0.04);
188 fHisto->GetYaxis()->SetTitleSize(0.04);
189 fHisto->GetYaxis()->CenterTitle();
193 fView =
new evdb::View2D();
196 Pad()->SetFillColor(18);
197 Pad()->SetFrameFillColor(18);
198 Pad()->GetPainter()->SetFillColor(18);
204 std::ostringstream ostr;
205 ostr <<
"evd::Ortho3DPad::MouseEvent((evd::Ortho3DPad*)" <<
this <<
")";
206 fPad->AddExec(
"getmousezoom", ostr.str().c_str());
241 if (
art::Event const* evtPtr = evdb::EventHolder::Instance()->GetEvent()) {
242 auto const&
evt = *evtPtr;
258 fPad->GetPainter()->SetFillColor(18);
262 latex.SetTextColor(16);
263 latex.SetTextSize(0.05);
264 for (
size_t i = 0; i <
TPCBox.size(); ++i) {
268 for (
size_t j = 0; j < i; ++j) {
274 latex.DrawLatex(x1, y1, Form(
"%lu", i));
287 fHisto->GetXaxis()->SetRangeUser(xlo, xhi);
288 fHisto->GetYaxis()->SetRangeUser(ylo, yhi);
324 if (
fMSize != size / 4.) {
337 TIter next(
fPad->GetListOfPrimitives());
338 while (TObject* obj = next()) {
339 if (obj->InheritsFrom(TPolyMarker::Class())) {
340 TPolyMarker*
pm = (TPolyMarker*)obj;
341 pm->SetMarkerSize(
fMSize);
392 TObject*
select = gPad->GetSelected();
394 if (!select->InheritsFrom(
"TBox"))
return;
395 ((TBox*)select)->SetBit(TBox::kCannotMove);
413 int event = gPad->GetEvent();
414 int px = gPad->GetEventX();
415 int py = gPad->GetEventY();
416 double x = gPad->AbsPixeltoX(px);
417 double y = gPad->AbsPixeltoY(py);
426 gPad->SetCursor(kCross);
436 gPad->SetCursor(kCross);
483 gPad->SetCursor(kCross);
494 gVirtualX->DrawBox(pxlo, pylo, pxhi, pyhi, TVirtualX::kHollow);
500 gVirtualX->SetLineColor(-1);
501 gVirtualX->SetLineStyle(0);
502 gVirtualX->SetLineWidth(1);
507 gPad->SetCursor(kCross);
524 gPad->SetCursor(kCross);
535 SetZoom(xlo, ylo, xhi, yhi,
true);
void SpacePointOrtho(const art::Event &evt, evd::OrthoProj_t proj, double msize, evdb::View2D *view)
void SetZoom(double xlo, double ylo, double xhi, double yhi, bool update)
void PFParticleOrtho(const art::Event &evt, evd::OrthoProj_t proj, double msize, evdb::View2D *view)
int fPressPy
Poxel location where button 1 was pressed.
geo::Length_t DetHalfWidth(geo::TPCID const &tpcid) const
Returns the half width of the active volume of the specified TPC.
double fReleaseX
User location where button 1 was released.
void SetMarkerSize(double size, bool update)
void SetMSizeEntry(TGNumberEntry *p)
void SeedOrtho(const art::Event &evt, evd::OrthoProj_t proj, evdb::View2D *view)
Geometry information for a single TPC.
void ProngOrtho(const art::Event &evt, evd::OrthoProj_t proj, double msize, evdb::View2D *view)
A drawing pad showing an orthographic rendering of 3D objects.
int fCurrentPy
Current pixel location of mouse.
int fPressPx
Pixel location where button 1 was pressed.
art framework interface to geometry description
TH1F * DrawFrame(TGraph *gr0, TGraph *gr1, TPad *p, const char *xt, const char *yt, double yminsc, double ymaxsc)
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
geo::Length_t DetHalfHeight(geo::TPCID const &tpcid) const
Returns the half height of the active volume of the specified TPC.
double fReleaseY
User location where button 1 was released.
evd::OrthoProj_t fProj
Projection.
bool fBoxDrawn
Is selection box drawn?
Base class for event display drawing pads.
RecoBaseDrawer * RecoBaseDraw()
geo::Length_t DetLength(geo::TPCID const &tpcid) const
Returns the length of the active volume of the specified TPC.
static int max(int a, int b)
SimulationDrawer * SimulationDraw()
Drawing pad showing an orthographic projection of 3D objects in the detector.
Ortho3DPad(const char *nm, const char *ti, evd::OrthoProj_t proj, double x1, double y1, double x2, double y2)
double fPressX
User location where button 1 was pressed.
auto select(T const &...t)
double fPressY
User location where button 1 was pressed.
int fCurrentPx
Current pixel location of mouse.
unsigned int NTPC(unsigned int cstat=0) const
Returns the total number of TPCs in the specified cryostat.
std::vector< TBox > TPCBox
TPC box.
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
void MCTruthOrtho(const art::Event &evt, evd::OrthoProj_t proj, double msize, evdb::View2D *view)
TH1F * fHisto
Enclosing histogram.
TPCGeo const & TPC(unsigned int const tpc=0, unsigned int const cstat=0) const
Returns the specified TPC.
TPad * fPad
The ROOT graphics pad.
void OpFlashOrtho(const art::Event &evt, detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, evd::OrthoProj_t proj, evdb::View2D *view)
bool fPress
Is button 1 pressed?
static void MouseEvent(evd::Ortho3DPad *p)
LArSoft geometry interface.
static Ortho3DPad * fMousePad
Selected pad for mouse action.
TGNumberEntry * fMSizeEntry
For changing marker size.
void LocalToWorld(const double *tpc, double *world) const
Transform point from local TPC frame to world frame.
evdb::View2D * fView
Collection of graphics objects to render.
void Draw(const char *opt=0)
void VertexOrtho(const art::PtrVector< recob::Vertex > &vertex, evd::OrthoProj_t proj, evdb::View2D *view, int marker)
double fMSize
Marker size.
cet::coded_exception< error, detail::translate > exception
Event finding and building.
Encapsulate the construction of a single detector plane.