LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
evd::Ortho3DPad Class Reference

A drawing pad showing an orthographic rendering of 3D objects. More...

#include "Ortho3DPad.h"

Inheritance diagram for evd::Ortho3DPad:
evd::DrawingPad

Public Member Functions

 Ortho3DPad (const char *nm, const char *ti, evd::OrthoProj_t proj, double x1, double y1, double x2, double y2)
 
 ~Ortho3DPad ()
 
double GetMarkerSize () const
 
void Draw (const char *opt=0)
 
void SetZoom (double xlo, double ylo, double xhi, double yhi, bool update)
 
void UnZoom (bool update)
 
void SetMarkerSize (double size, bool update)
 
void SetMSizeEntry (TGNumberEntry *p)
 
void SetMSize ()
 
void MouseEvent ()
 
TPad * Pad ()
 
HeaderDrawerHeaderDraw ()
 
evd_tool::IExperimentDrawerGeometryDraw ()
 
SimulationDrawerSimulationDraw ()
 
RawDataDrawerRawDataDraw ()
 
RecoBaseDrawerRecoBaseDraw ()
 
AnalysisBaseDrawerAnalysisBaseDraw ()
 
HitSelectorHitSelectorGet ()
 

Static Public Member Functions

static void MouseEvent (evd::Ortho3DPad *p)
 

Protected Types

using IExperimentDrawerPtr = std::unique_ptr< evd_tool::IExperimentDrawer >
 

Protected Attributes

TPad * fPad
 The ROOT graphics pad. More...
 
HeaderDrawerfHeaderDraw
 Drawer for event header info. More...
 
IExperimentDrawerPtr fGeometryDraw
 Drawer for detector geometry. More...
 
SimulationDrawerfSimulationDraw
 Drawer for simulation objects. More...
 
RawDataDrawerfRawDataDraw
 Drawer for raw data. More...
 
RecoBaseDrawerfRecoBaseDraw
 Drawer for recobase objects. More...
 
AnalysisBaseDrawerfAnalysisBaseDraw
 Drawer for analysisbase objects. More...
 

Private Attributes

TH1F * fHisto
 Enclosing histogram. More...
 
evd::OrthoProj_t fProj
 Projection. More...
 
double fXLo
 Low x value. More...
 
double fXHi
 High x value. More...
 
double fYLo
 Low y value. More...
 
double fYHi
 High y value. More...
 
double fMSize
 Marker size. More...
 
std::vector< TBox > TPCBox
 TPC box. More...
 
evdb::View2DfView
 Collection of graphics objects to render. More...
 
TGNumberEntry * fMSizeEntry
 For changing marker size. More...
 
bool fPress
 Is button 1 pressed? More...
 
bool fBoxDrawn
 Is selection box drawn? More...
 
int fPressPx
 Pixel location where button 1 was pressed. More...
 
int fPressPy
 Poxel location where button 1 was pressed. More...
 
int fCurrentPx
 Current pixel location of mouse. More...
 
int fCurrentPy
 Current pixel location of mouse. More...
 
double fPressX
 User location where button 1 was pressed. More...
 
double fPressY
 User location where button 1 was pressed. More...
 
double fReleaseX
 User location where button 1 was released. More...
 
double fReleaseY
 User location where button 1 was released. More...
 

Static Private Attributes

static Ortho3DPadfMousePad = 0
 Selected pad for mouse action. More...
 

Detailed Description

A drawing pad showing an orthographic rendering of 3D objects.

Definition at line 28 of file Ortho3DPad.h.

Member Typedef Documentation

using evd::DrawingPad::IExperimentDrawerPtr = std::unique_ptr<evd_tool::IExperimentDrawer>
protectedinherited

Definition at line 43 of file DrawingPad.h.

Constructor & Destructor Documentation

evd::Ortho3DPad::Ortho3DPad ( const char *  name,
const char *  title,
evd::OrthoProj_t  proj,
double  x1,
double  y1,
double  x2,
double  y2 
)

Create a pad to show an orthographic rendering of 3D objcts.

Parameters
name: Name of the pad
title: Title of the pad
proj: Choose orthographic projection
x1: Location of left edge of pad (0-1)
x2: Location of right edge of pad (0-1)
y1: Location of bottom edge of pad (0-1)
y2: Location of top edge of pad (0-1)

Definition at line 44 of file Ortho3DPad.cxx.

References fHisto, evd::DrawingPad::fPad, fView, fXHi, fXLo, fYHi, fYLo, geo::GeometryCore::Iterate(), evd::kXY, evd::kXZ, evd::kYZ, evd::DrawingPad::Pad(), and TPCBox.

51  : DrawingPad(name, title, x1, y1, x2, y2)
52  , fHisto(0)
53  , fProj(proj)
54  , fXLo(0.)
55  , fXHi(0.)
56  , fYLo(0.)
57  , fYHi(0.)
58  , fMSize(0.25)
59  , fMSizeEntry(0)
60  , fPress(false)
61  , fBoxDrawn(false)
62  , fPressPx(0)
63  , fPressPy(0)
64  , fCurrentPx(0)
65  , fCurrentPy(0)
66  , fPressX(0.)
67  , fPressY(0.)
68  , fReleaseX(0.)
69  , fReleaseY(0.)
70 {
71  // Get services.
72 
74 
75  // Set up pad.
76 
77  // Pad()->SetBit(kCannotPick); // workaround for issue #16169
78  Pad()->SetBit(TPad::kCannotMove);
79  Pad()->Draw();
80  Pad()->cd();
81  Pad()->SetLeftMargin(0.080);
82  Pad()->SetRightMargin(0.010);
83  Pad()->SetTopMargin(0.010);
84  Pad()->SetBottomMargin(0.10);
85 
86  // Define histogram boundaries (cm).
87  // For now only draw cryostat=0.
88  double minx = 1e9;
89  double maxx = -1e9;
90  double miny = 1e9;
91  double maxy = -1e9;
92  double minz = 1e9;
93  double maxz = -1e9;
94  for (auto const& tpc : geo->Iterate<geo::TPCGeo>(geo::CryostatID{0})) {
95  auto const world = tpc.GetCenter();
96  if (minx > world.X() - tpc.HalfWidth()) minx = world.X() - tpc.HalfWidth();
97  if (maxx < world.X() + tpc.HalfWidth()) maxx = world.X() + tpc.HalfWidth();
98  if (miny > world.Y() - tpc.HalfHeight()) miny = world.Y() - tpc.HalfHeight();
99  if (maxy < world.Y() + tpc.HalfHeight()) maxy = world.Y() + tpc.HalfHeight();
100  if (minz > world.Z() - tpc.Length() / 2.) minz = world.Z() - tpc.Length() / 2.;
101  if (maxz < world.Z() + tpc.Length() / 2.) maxz = world.Z() + tpc.Length() / 2.;
102 
103  switch (proj) {
104  case evd::kXY:
105  TPCBox.push_back(TBox(world.X() - tpc.HalfWidth(),
106  world.Y() - tpc.HalfHeight(),
107  world.X() + tpc.HalfWidth(),
108  world.Y() + tpc.HalfHeight()));
109  break;
110  case evd::kXZ:
111  TPCBox.push_back(TBox(world.Z() - tpc.Length() / 2.,
112  world.X() - tpc.HalfWidth(),
113  world.Z() + tpc.Length() / 2.,
114  world.X() + tpc.HalfWidth()));
115  break;
116  case evd::kYZ:
117  TPCBox.push_back(TBox(world.Z() - tpc.Length() / 2.,
118  world.Y() - tpc.HalfHeight(),
119  world.Z() + tpc.Length() / 2.,
120  world.Y() + tpc.HalfHeight()));
121  break;
122  default:
123  throw cet::exception("Ortho3DPad")
124  << __func__ << ": unwknow projection " << ((int)proj) << "\n";
125  } // switch
126  TPCBox.back().SetFillStyle(0);
127  TPCBox.back().SetLineStyle(2);
128  TPCBox.back().SetLineWidth(2);
129  TPCBox.back().SetLineColor(16);
130  }
131 
132  switch (proj) {
133  case evd::kXY:
134  fXLo = minx;
135  fXHi = maxx;
136  fYLo = miny;
137  fYHi = maxy;
138  break;
139  case evd::kXZ:
140  fXLo = minz;
141  fXHi = maxz;
142  fYLo = minx;
143  fYHi = maxx;
144  break;
145  case evd::kYZ:
146  fXLo = minz;
147  fXHi = maxz;
148  fYLo = miny;
149  fYHi = maxy;
150  break;
151  default:
152  throw cet::exception("Ortho3DPad")
153  << __func__ << ": unwknow projection " << ((int)proj) << "\n";
154  } // switch
155 
156  // Make enclosing histogram.
157 
158  fHisto = new TH1F(*(Pad()->DrawFrame(fXLo, fYLo, fXHi, fYHi)));
159  fHisto->SetBit(kCannotPick);
160  fHisto->SetBit(TPad::kCannotMove);
161  fHisto->SetTitleOffset(1., "Y");
162  fHisto->SetTitleOffset(1., "X");
163  fHisto->GetXaxis()->SetLabelSize(0.04);
164  fHisto->GetXaxis()->SetTitleSize(0.04);
165  switch (proj) {
166  case evd::kXY:
167  fHisto->GetXaxis()->SetTitle("x (cm)");
168  fHisto->GetYaxis()->SetTitle("y (cm)");
169  break;
170  case evd::kXZ:
171  fHisto->GetXaxis()->SetTitle("z (cm)");
172  fHisto->GetYaxis()->SetTitle("x (cm)");
173  break;
174  case evd::kYZ:
175  fHisto->GetXaxis()->SetTitle("z (cm)");
176  fHisto->GetYaxis()->SetTitle("y (cm)");
177  break;
178  default:
179  throw cet::exception("Ortho3DPad")
180  << __func__ << ": unexpected flow (projection: " << ((int)proj) << ")\n";
181  } // switch
182 
183  fHisto->GetXaxis()->CenterTitle();
184  fHisto->GetYaxis()->SetLabelSize(0.04);
185  fHisto->GetYaxis()->SetTitleSize(0.04);
186  fHisto->GetYaxis()->CenterTitle();
187  fHisto->SetFillColor(18);
188  fHisto->Draw("AB");
189 
190  fView = new evdb::View2D();
191 
192  // Set pad fill color
193  Pad()->SetFillColor(18);
194  Pad()->SetFrameFillColor(18);
195  Pad()->GetPainter()->SetFillColor(18);
196  Pad()->Modified();
197  Pad()->Update();
198 
199  // Install mouse event handler.
200 
201  std::ostringstream ostr;
202  ostr << "evd::Ortho3DPad::MouseEvent((evd::Ortho3DPad*)" << this << ")";
203  fPad->AddExec("getmousezoom", ostr.str().c_str());
204 }
details::range_type< T > Iterate() const
Initializes the specified ID with the ID of the first cryostat.
Definition: GeometryCore.h:541
double fXHi
High x value.
Definition: Ortho3DPad.h:77
int fPressPy
Poxel location where button 1 was pressed.
Definition: Ortho3DPad.h:93
Float_t y1[n_points_granero]
Definition: compare.C:5
double fReleaseX
User location where button 1 was released.
Definition: Ortho3DPad.h:98
Float_t x1[n_points_granero]
Definition: compare.C:5
double fYHi
High y value.
Definition: Ortho3DPad.h:79
Geometry information for a single TPC.
Definition: TPCGeo.h:36
int fCurrentPy
Current pixel location of mouse.
Definition: Ortho3DPad.h:95
int fPressPx
Pixel location where button 1 was pressed.
Definition: Ortho3DPad.h:92
double fXLo
Low x value.
Definition: Ortho3DPad.h:76
Float_t y2[n_points_geant4]
Definition: compare.C:26
double fReleaseY
User location where button 1 was released.
Definition: Ortho3DPad.h:99
evd::OrthoProj_t fProj
Projection.
Definition: Ortho3DPad.h:75
bool fBoxDrawn
Is selection box drawn?
Definition: Ortho3DPad.h:91
double fYLo
Low y value.
Definition: Ortho3DPad.h:78
TPad * Pad()
Definition: DrawingPad.h:31
double fPressX
User location where button 1 was pressed.
Definition: Ortho3DPad.h:96
double fPressY
User location where button 1 was pressed.
Definition: Ortho3DPad.h:97
int fCurrentPx
Current pixel location of mouse.
Definition: Ortho3DPad.h:94
std::vector< TBox > TPCBox
TPC box.
Definition: Ortho3DPad.h:81
Float_t proj
Definition: plot.C:35
TH1F * fHisto
Enclosing histogram.
Definition: Ortho3DPad.h:74
TPad * fPad
The ROOT graphics pad.
Definition: DrawingPad.h:45
bool fPress
Is button 1 pressed?
Definition: Ortho3DPad.h:90
Float_t x2[n_points_geant4]
Definition: compare.C:26
Namespace collecting geometry-related classes utilities.
TGNumberEntry * fMSizeEntry
For changing marker size.
Definition: Ortho3DPad.h:86
DrawingPad(const char *nm, const char *ti, double x1, double y1, double y2, double x2)
Definition: DrawingPad.cxx:36
evdb::View2D * fView
Collection of graphics objects to render.
Definition: Ortho3DPad.h:82
double fMSize
Marker size.
Definition: Ortho3DPad.h:80
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
The data type to uniquely identify a cryostat.
Definition: geo_types.h:192
evd::Ortho3DPad::~Ortho3DPad ( )

Definition at line 209 of file Ortho3DPad.cxx.

References fHisto, and fView.

210 {
211  if (fHisto) {
212  delete fHisto;
213  fHisto = nullptr;
214  }
215  if (fView) {
216  delete fView;
217  fView = nullptr;
218  }
219 }
TH1F * fHisto
Enclosing histogram.
Definition: Ortho3DPad.h:74
evdb::View2D * fView
Collection of graphics objects to render.
Definition: Ortho3DPad.h:82

Member Function Documentation

AnalysisBaseDrawer * evd::DrawingPad::AnalysisBaseDraw ( )
inherited

Provide access to the drawer for AnalysisBase classes

Definition at line 143 of file DrawingPad.cxx.

References evd::DrawingPad::fAnalysisBaseDraw.

Referenced by evd::CalorPad::Draw().

144  {
145  if (fAnalysisBaseDraw == 0) fAnalysisBaseDraw = new AnalysisBaseDrawer();
146  return fAnalysisBaseDraw;
147  }
AnalysisBaseDrawer * fAnalysisBaseDraw
Drawer for analysisbase objects.
Definition: DrawingPad.h:51
void evd::Ortho3DPad::Draw ( const char *  opt = 0)

Definition at line 224 of file Ortho3DPad.cxx.

References util::abs(), evdb::View2D::Clear(), evdb::View2D::Draw(), e, tca::evt, fBoxDrawn, fHisto, fMSize, evd::DrawingPad::fPad, fProj, fView, fXHi, fXLo, fYHi, fYLo, evdb::EventHolder::Instance(), evd::SimulationDrawer::MCTruthOrtho(), evd::RecoBaseDrawer::OpFlashOrtho(), evd::RecoBaseDrawer::PFParticleOrtho(), evd::RecoBaseDrawer::ProngOrtho(), evd::DrawingPad::RecoBaseDraw(), evd::RecoBaseDrawer::SeedOrtho(), evd::DrawingPad::SimulationDraw(), evd::RecoBaseDrawer::SpacePointOrtho(), TPCBox, UnZoom(), evd::RecoBaseDrawer::VertexOrtho(), x1, and y1.

Referenced by evd::Ortho3DView::Draw().

225 {
226  fPad->Clear();
227  fView->Clear();
228 
229  // Remove zoom.
230 
231  UnZoom(false);
232 
233  // grab the event from the singleton
234 
235  // Insert graphic objects into fView collection.
236 
237  if (art::Event const* evtPtr = evdb::EventHolder::Instance()->GetEvent()) {
238  auto const& evt = *evtPtr;
239  auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(evt);
240  auto const detProp =
242 
248  RecoBaseDraw()->OpFlashOrtho(evt, clockData, detProp, fProj, fView);
250  }
251  // Draw objects on pad.
252 
253  fPad->cd();
254  fPad->GetPainter()->SetFillColor(18);
255  fHisto->Draw("X-");
256  fView->Draw();
257  TLatex latex;
258  latex.SetTextColor(16);
259  latex.SetTextSize(0.05);
260  for (size_t i = 0; i < TPCBox.size(); ++i) {
261  TPCBox[i].Draw();
262  double x1 = TPCBox[i].GetX2() - 0.02 * (fXHi - fXLo);
263  double y1 = TPCBox[i].GetY2() - 0.05 * (fYHi - fYLo);
264  for (size_t j = 0; j < i; ++j) {
265  if (std::abs(x1 - (TPCBox[j].GetX2() - 0.02 * (fXHi - fXLo))) < 1e-6 &&
266  std::abs(y1 - (TPCBox[j].GetY2() - 0.05 * (fYHi - fYLo))) < 1e-6) {
267  y1 -= 0.05 * (fYHi - fYLo);
268  }
269  }
270  latex.DrawLatex(x1, y1, Form("%lu", i));
271  }
272  fPad->Modified();
273  fPad->Update();
274  fBoxDrawn = false;
275 }
void SpacePointOrtho(const art::Event &evt, evd::OrthoProj_t proj, double msize, evdb::View2D *view)
double fXHi
High x value.
Definition: Ortho3DPad.h:77
void PFParticleOrtho(const art::Event &evt, evd::OrthoProj_t proj, double msize, evdb::View2D *view)
void UnZoom(bool update)
Definition: Ortho3DPad.cxx:294
Float_t y1[n_points_granero]
Definition: compare.C:5
Float_t x1[n_points_granero]
Definition: compare.C:5
void SeedOrtho(const art::Event &evt, evd::OrthoProj_t proj, evdb::View2D *view)
double fYHi
High y value.
Definition: Ortho3DPad.h:79
constexpr auto abs(T v)
Returns the absolute value of the argument.
void ProngOrtho(const art::Event &evt, evd::OrthoProj_t proj, double msize, evdb::View2D *view)
double fXLo
Low x value.
Definition: Ortho3DPad.h:76
void Clear()
Definition: View2D.cxx:109
void Draw()
Definition: View2D.cxx:89
evd::OrthoProj_t fProj
Projection.
Definition: Ortho3DPad.h:75
static EventHolder * Instance()
Definition: EventHolder.cxx:15
bool fBoxDrawn
Is selection box drawn?
Definition: Ortho3DPad.h:91
double fYLo
Low y value.
Definition: Ortho3DPad.h:78
RecoBaseDrawer * RecoBaseDraw()
Definition: DrawingPad.cxx:132
SimulationDrawer * SimulationDraw()
Definition: DrawingPad.cxx:112
std::vector< TBox > TPCBox
TPC box.
Definition: Ortho3DPad.h:81
void MCTruthOrtho(const art::Event &evt, evd::OrthoProj_t proj, double msize, evdb::View2D *view)
TH1F * fHisto
Enclosing histogram.
Definition: Ortho3DPad.h:74
TPad * fPad
The ROOT graphics pad.
Definition: DrawingPad.h:45
void OpFlashOrtho(const art::Event &evt, detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, evd::OrthoProj_t proj, evdb::View2D *view)
TCEvent evt
Definition: DataStructs.cxx:8
Float_t e
Definition: plot.C:35
evdb::View2D * fView
Collection of graphics objects to render.
Definition: Ortho3DPad.h:82
void VertexOrtho(const art::PtrVector< recob::Vertex > &vertex, evd::OrthoProj_t proj, evdb::View2D *view, int marker)
double fMSize
Marker size.
Definition: Ortho3DPad.h:80
evd_tool::IExperimentDrawer * evd::DrawingPad::GeometryDraw ( )
inherited

Provide access to the drawer for the detector geometry

Definition at line 97 of file DrawingPad.cxx.

References evd::DrawingPad::fGeometryDraw, evd::EvdLayoutOptions::fParameterSet, and fhicl::ParameterSet::get().

Referenced by evd::Display3DPad::Draw().

98  {
99  if (fGeometryDraw == 0) {
101  const fhicl::ParameterSet& pset = layoutOptions->fParameterSet;
102 
103  fGeometryDraw = art::make_tool<evd_tool::IExperimentDrawer>(
104  pset.get<fhicl::ParameterSet>("Experiment3DDrawer"));
105  }
106  return fGeometryDraw.get();
107  }
IExperimentDrawerPtr fGeometryDraw
Drawer for detector geometry.
Definition: DrawingPad.h:47
T get(std::string const &key) const
Definition: ParameterSet.h:314
fhicl::ParameterSet const & fParameterSet
double evd::Ortho3DPad::GetMarkerSize ( ) const
inline

Definition at line 48 of file Ortho3DPad.h.

References Draw(), SetMarkerSize(), and util::size().

Referenced by evd::Ortho3DView::Ortho3DView().

48 { return 4. * fMSize; } // Size in pixels.
double fMSize
Marker size.
Definition: Ortho3DPad.h:80
HeaderDrawer * evd::DrawingPad::HeaderDraw ( )
inherited

Provide access to the drawer for the detector geometry

Definition at line 88 of file DrawingPad.cxx.

References evd::DrawingPad::fHeaderDraw.

Referenced by evd::HeaderPad::Draw().

89  {
90  if (fHeaderDraw == 0) fHeaderDraw = new HeaderDrawer();
91  return fHeaderDraw;
92  }
HeaderDrawer * fHeaderDraw
Drawer for event header info.
Definition: DrawingPad.h:46
HitSelector * evd::DrawingPad::HitSelectorGet ( )
inherited

Provide access to the HitSelector

Definition at line 155 of file DrawingPad.cxx.

References evd::gTheHitSelector.

Referenced by evd::TWireProjPad::ClearHitList(), evd::TWireProjPad::Draw(), evd::TWireProjPad::SaveHitList(), evd::TWireProjPad::SaveSeedList(), and evd::TWireProjPad::SelectOneHit().

156  {
157  if (gTheHitSelector == 0) gTheHitSelector = new HitSelector();
158  return gTheHitSelector;
159  }
HitSelector * gTheHitSelector
Definition: DrawingPad.cxx:25
void evd::Ortho3DPad::MouseEvent ( evd::Ortho3DPad p)
static

Definition at line 380 of file Ortho3DPad.cxx.

References fMousePad, and MouseEvent().

Referenced by MouseEvent().

381 {
382  TObject* select = gPad->GetSelected();
383  if (!select) return;
384  if (!select->InheritsFrom("TBox")) return;
385  ((TBox*)select)->SetBit(TBox::kCannotMove);
386 
387  // This line is a workaround for a root bug that sends mouse events
388  // to the wrong pad.
389 
390  if (fMousePad != 0) p = fMousePad;
391 
392  p->MouseEvent();
393 }
static void MouseEvent(evd::Ortho3DPad *p)
Definition: Ortho3DPad.cxx:380
static Ortho3DPad * fMousePad
Selected pad for mouse action.
Definition: Ortho3DPad.h:70
void evd::Ortho3DPad::MouseEvent ( )

Definition at line 398 of file Ortho3DPad.cxx.

References fBoxDrawn, fCurrentPx, fCurrentPy, fMousePad, fPress, fPressPx, fPressPy, fPressX, fPressY, fReleaseX, fReleaseY, SetZoom(), x, and y.

399 {
400  // Get event type and location.
401 
402  int event = gPad->GetEvent();
403  int px = gPad->GetEventX(); // pixels.
404  int py = gPad->GetEventY(); // pixels.
405  double x = gPad->AbsPixeltoX(px); // User coordinates.
406  double y = gPad->AbsPixeltoY(py); // User coordinates.
407 
408  // Handle different events.
409 
410  switch (event) {
411  case kMouseEnter:
412 
413  // Main purpose of this case is to set the cursor shape.
414 
415  gPad->SetCursor(kCross);
416  fCurrentPx = px;
417  fCurrentPy = py;
418  fMousePad = this;
419  break;
420 
421  case kMouseMotion:
422 
423  // Not really needed...
424 
425  gPad->SetCursor(kCross);
426  fCurrentPx = px;
427  fCurrentPy = py;
428  break;
429 
430  case kMouseLeave:
431 
432  // Undraw box.
433 
434  //if(fBoxDrawn) {
435  // double pxlo = std::min(fPressPx, fCurrentPx);
436  // double pxhi = std::max(fPressPx, fCurrentPx);
437  // double pylo = std::min(fPressPy, fCurrentPy);
438  // double pyhi = std::max(fPressPy, fCurrentPy);
439  // gVirtualX->DrawBox(pxlo, pylo, pxhi, pyhi, TVirtualX::kHollow);
440  // fBoxDrawn = false;
441  //}
442 
443  // Set everything to default.
444 
445  fPress = false;
446  fPressPx = 0;
447  fPressPy = 0;
448  fCurrentPx = 0;
449  fCurrentPy = 0;
450  fPressX = 0.;
451  fPressY = 0.;
452  fReleaseX = 0.;
453  fReleaseY = 0.;
454  fMousePad = 0;
455  break;
456 
457  case kButton1Motion:
458 
459  // Undraw old selection box.
460 
461  //if(fBoxDrawn) {
462  // double pxlo = std::min(fPressPx, fCurrentPx);
463  // double pxhi = std::max(fPressPx, fCurrentPx);
464  // double pylo = std::min(fPressPy, fCurrentPy);
465  // double pyhi = std::max(fPressPy, fCurrentPy);
466  // gVirtualX->DrawBox(pxlo, pylo, pxhi, pyhi, TVirtualX::kHollow);
467  // fBoxDrawn = false;
468  //}
469 
470  // Update cursor location.
471 
472  gPad->SetCursor(kCross);
473  fCurrentPx = px;
474  fCurrentPy = py;
475 
476  // Draw new selection box.
477 
478  {
479  double pxlo = std::min(fPressPx, fCurrentPx);
480  double pxhi = std::max(fPressPx, fCurrentPx);
481  double pylo = std::min(fPressPy, fCurrentPy);
482  double pyhi = std::max(fPressPy, fCurrentPy);
483  gVirtualX->DrawBox(pxlo, pylo, pxhi, pyhi, TVirtualX::kHollow);
484  fBoxDrawn = true;
485  }
486  break;
487 
488  case kButton1Down:
489  gVirtualX->SetLineColor(-1);
490  gVirtualX->SetLineStyle(0);
491  gVirtualX->SetLineWidth(1);
492 
493  // Record the location of the button press event, which will be
494  // one corner of zoom region.
495 
496  gPad->SetCursor(kCross);
497  fPress = true;
498  fPressPx = px;
499  fPressPy = py;
500  fCurrentPx = px;
501  fCurrentPy = py;
502  fPressX = x;
503  fPressY = y;
504  fReleaseX = 0.;
505  fReleaseY = 0.;
506  fMousePad = this;
507  break;
508 
509  case kButton1Up:
510 
511  // Get the location of button release event, then zoom.
512 
513  gPad->SetCursor(kCross);
514  fPress = false;
515  fCurrentPx = px;
516  fCurrentPy = py;
517  fReleaseX = x;
518  fReleaseY = y;
519  {
520  double xlo = std::min(fPressX, fReleaseX);
521  double xhi = std::max(fPressX, fReleaseX);
522  double ylo = std::min(fPressY, fReleaseY);
523  double yhi = std::max(fPressY, fReleaseY);
524  SetZoom(xlo, ylo, xhi, yhi, true);
525  }
526  fMousePad = 0;
527  break;
528  }
529 }
Float_t x
Definition: compare.C:6
void SetZoom(double xlo, double ylo, double xhi, double yhi, bool update)
Definition: Ortho3DPad.cxx:280
int fPressPy
Poxel location where button 1 was pressed.
Definition: Ortho3DPad.h:93
double fReleaseX
User location where button 1 was released.
Definition: Ortho3DPad.h:98
Float_t y
Definition: compare.C:6
int fCurrentPy
Current pixel location of mouse.
Definition: Ortho3DPad.h:95
int fPressPx
Pixel location where button 1 was pressed.
Definition: Ortho3DPad.h:92
double fReleaseY
User location where button 1 was released.
Definition: Ortho3DPad.h:99
bool fBoxDrawn
Is selection box drawn?
Definition: Ortho3DPad.h:91
double fPressX
User location where button 1 was pressed.
Definition: Ortho3DPad.h:96
double fPressY
User location where button 1 was pressed.
Definition: Ortho3DPad.h:97
int fCurrentPx
Current pixel location of mouse.
Definition: Ortho3DPad.h:94
bool fPress
Is button 1 pressed?
Definition: Ortho3DPad.h:90
static Ortho3DPad * fMousePad
Selected pad for mouse action.
Definition: Ortho3DPad.h:70
Event finding and building.
RawDataDrawer * evd::DrawingPad::RawDataDraw ( )
inherited

Provide access to the drawer for the RawData classes

Definition at line 121 of file DrawingPad.cxx.

References evd::DrawingPad::fRawDataDraw.

Referenced by evd::TQPad::BookHistogram(), evd::TQPad::Draw(), evd::TWireProjPad::Draw(), evd::TWireProjPad::ShowFull(), and evd::TWireProjPad::TWireProjPad().

122  {
123  if (fRawDataDraw == 0) fRawDataDraw = new RawDataDrawer();
124  return fRawDataDraw;
125  }
RawDataDrawer * fRawDataDraw
Drawer for raw data.
Definition: DrawingPad.h:49
RecoBaseDrawer * evd::DrawingPad::RecoBaseDraw ( )
inherited

Provide access to the drawer for RecoBase classes

Definition at line 132 of file DrawingPad.cxx.

References evd::DrawingPad::fRecoBaseDraw.

Referenced by evd::Display3DPad::Draw(), evd::TWireProjPad::Draw(), Draw(), and evd::TWireProjPad::ShowFull().

133  {
134  if (fRecoBaseDraw == 0) fRecoBaseDraw = new RecoBaseDrawer();
135  return fRecoBaseDraw;
136  }
RecoBaseDrawer * fRecoBaseDraw
Drawer for recobase objects.
Definition: DrawingPad.h:50
void evd::Ortho3DPad::SetMarkerSize ( double  size,
bool  update 
)

Definition at line 313 of file Ortho3DPad.cxx.

References fBoxDrawn, fMSize, fMSizeEntry, and evd::DrawingPad::fPad.

Referenced by SetMSize(), and UnZoom().

314 {
315  // Update marker size.
316 
317  if (fMSize != size / 4.) {
318 
319  // Update marker size attribute.
320 
321  fMSize = size / 4.; // Scale to pixels.
322 
323  // Update widget.
324 
325  if (fMSizeEntry) fMSizeEntry->SetNumber(size);
326 
327  // Loop over graphic objects that are currently drawn on
328  // pad, and update any that are polymarkers.
329 
330  TIter next(fPad->GetListOfPrimitives());
331  while (TObject* obj = next()) {
332  if (obj->InheritsFrom(TPolyMarker::Class())) {
333  TPolyMarker* pm = (TPolyMarker*)obj;
334  pm->SetMarkerSize(fMSize);
335  }
336  }
337 
338  fPad->Modified();
339  if (update) {
340  fPad->Update();
341  fBoxDrawn = false;
342  }
343  }
344 }
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:101
bool fBoxDrawn
Is selection box drawn?
Definition: Ortho3DPad.h:91
TPad * fPad
The ROOT graphics pad.
Definition: DrawingPad.h:45
TGNumberEntry * fMSizeEntry
For changing marker size.
Definition: Ortho3DPad.h:86
double fMSize
Marker size.
Definition: Ortho3DPad.h:80
void evd::Ortho3DPad::SetMSize ( )

Definition at line 362 of file Ortho3DPad.cxx.

References fMSizeEntry, and SetMarkerSize().

363 {
364 
365  // Get marker size from number entry widget.
366 
367  if (!fMSizeEntry) throw cet::exception("Ortho3DPad") << __func__ << ": no MSize entry\n";
368  double val = fMSizeEntry->GetNumber();
369 
370  // Scale the marker size such that the displayed marker size
371  // is measured in pixels.
372 
373  SetMarkerSize(val, true);
374 }
void SetMarkerSize(double size, bool update)
Definition: Ortho3DPad.cxx:313
TGNumberEntry * fMSizeEntry
For changing marker size.
Definition: Ortho3DPad.h:86
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
void evd::Ortho3DPad::SetMSizeEntry ( TGNumberEntry *  p)

Definition at line 352 of file Ortho3DPad.cxx.

References fMSize, and fMSizeEntry.

Referenced by evd::Ortho3DView::Ortho3DView().

353 {
354  fMSizeEntry = p;
355  if (fMSizeEntry) fMSizeEntry->SetNumber(4. * fMSize);
356 }
TGNumberEntry * fMSizeEntry
For changing marker size.
Definition: Ortho3DPad.h:86
double fMSize
Marker size.
Definition: Ortho3DPad.h:80
void evd::Ortho3DPad::SetZoom ( double  xlo,
double  ylo,
double  xhi,
double  yhi,
bool  update 
)

Definition at line 280 of file Ortho3DPad.cxx.

References fBoxDrawn, fHisto, and evd::DrawingPad::fPad.

Referenced by MouseEvent().

281 {
282  fHisto->GetXaxis()->SetRangeUser(xlo, xhi);
283  fHisto->GetYaxis()->SetRangeUser(ylo, yhi);
284  fPad->Modified();
285  if (update) {
286  fPad->Update();
287  fBoxDrawn = false;
288  }
289 }
bool fBoxDrawn
Is selection box drawn?
Definition: Ortho3DPad.h:91
TH1F * fHisto
Enclosing histogram.
Definition: Ortho3DPad.h:74
TPad * fPad
The ROOT graphics pad.
Definition: DrawingPad.h:45
SimulationDrawer * evd::DrawingPad::SimulationDraw ( )
inherited

Provide access to the drawer for the Simulation classes

Definition at line 112 of file DrawingPad.cxx.

References evd::DrawingPad::fSimulationDraw.

Referenced by evd::MCBriefPad::Draw(), evd::TWireProjPad::Draw(), and Draw().

113  {
114  if (fSimulationDraw == 0) fSimulationDraw = new SimulationDrawer();
115  return fSimulationDraw;
116  }
SimulationDrawer * fSimulationDraw
Drawer for simulation objects.
Definition: DrawingPad.h:48
void evd::Ortho3DPad::UnZoom ( bool  update)

Definition at line 294 of file Ortho3DPad.cxx.

References fBoxDrawn, fHisto, evd::DrawingPad::fPad, fXHi, fXLo, fYHi, fYLo, and SetMarkerSize().

Referenced by Draw().

295 {
296  fHisto->GetXaxis()->SetRangeUser(fXLo, fXHi);
297  fHisto->GetYaxis()->SetRangeUser(fYLo, fYHi);
298  fPad->Modified();
299 
300  // Also set marker size to default one pixel.
301 
302  SetMarkerSize(1., false);
303 
304  if (update) {
305  fPad->Update();
306  fBoxDrawn = false;
307  }
308 }
double fXHi
High x value.
Definition: Ortho3DPad.h:77
void SetMarkerSize(double size, bool update)
Definition: Ortho3DPad.cxx:313
double fYHi
High y value.
Definition: Ortho3DPad.h:79
double fXLo
Low x value.
Definition: Ortho3DPad.h:76
bool fBoxDrawn
Is selection box drawn?
Definition: Ortho3DPad.h:91
double fYLo
Low y value.
Definition: Ortho3DPad.h:78
TH1F * fHisto
Enclosing histogram.
Definition: Ortho3DPad.h:74
TPad * fPad
The ROOT graphics pad.
Definition: DrawingPad.h:45

Member Data Documentation

AnalysisBaseDrawer* evd::DrawingPad::fAnalysisBaseDraw
protectedinherited

Drawer for analysisbase objects.

Definition at line 51 of file DrawingPad.h.

Referenced by evd::DrawingPad::AnalysisBaseDraw(), and evd::DrawingPad::~DrawingPad().

bool evd::Ortho3DPad::fBoxDrawn
private

Is selection box drawn?

Definition at line 91 of file Ortho3DPad.h.

Referenced by Draw(), MouseEvent(), SetMarkerSize(), SetZoom(), and UnZoom().

int evd::Ortho3DPad::fCurrentPx
private

Current pixel location of mouse.

Definition at line 94 of file Ortho3DPad.h.

Referenced by MouseEvent().

int evd::Ortho3DPad::fCurrentPy
private

Current pixel location of mouse.

Definition at line 95 of file Ortho3DPad.h.

Referenced by MouseEvent().

IExperimentDrawerPtr evd::DrawingPad::fGeometryDraw
protectedinherited

Drawer for detector geometry.

Definition at line 47 of file DrawingPad.h.

Referenced by evd::DrawingPad::GeometryDraw().

HeaderDrawer* evd::DrawingPad::fHeaderDraw
protectedinherited

Drawer for event header info.

Definition at line 46 of file DrawingPad.h.

Referenced by evd::DrawingPad::HeaderDraw(), and evd::DrawingPad::~DrawingPad().

TH1F* evd::Ortho3DPad::fHisto
private

Enclosing histogram.

Definition at line 74 of file Ortho3DPad.h.

Referenced by Draw(), Ortho3DPad(), SetZoom(), UnZoom(), and ~Ortho3DPad().

evd::Ortho3DPad * evd::Ortho3DPad::fMousePad = 0
staticprivate

Selected pad for mouse action.

Define static data members.

Definition at line 70 of file Ortho3DPad.h.

Referenced by MouseEvent().

double evd::Ortho3DPad::fMSize
private

Marker size.

Definition at line 80 of file Ortho3DPad.h.

Referenced by Draw(), SetMarkerSize(), and SetMSizeEntry().

TGNumberEntry* evd::Ortho3DPad::fMSizeEntry
private

For changing marker size.

Definition at line 86 of file Ortho3DPad.h.

Referenced by SetMarkerSize(), SetMSize(), and SetMSizeEntry().

bool evd::Ortho3DPad::fPress
private

Is button 1 pressed?

Definition at line 90 of file Ortho3DPad.h.

Referenced by MouseEvent().

int evd::Ortho3DPad::fPressPx
private

Pixel location where button 1 was pressed.

Definition at line 92 of file Ortho3DPad.h.

Referenced by MouseEvent().

int evd::Ortho3DPad::fPressPy
private

Poxel location where button 1 was pressed.

Definition at line 93 of file Ortho3DPad.h.

Referenced by MouseEvent().

double evd::Ortho3DPad::fPressX
private

User location where button 1 was pressed.

Definition at line 96 of file Ortho3DPad.h.

Referenced by MouseEvent().

double evd::Ortho3DPad::fPressY
private

User location where button 1 was pressed.

Definition at line 97 of file Ortho3DPad.h.

Referenced by MouseEvent().

evd::OrthoProj_t evd::Ortho3DPad::fProj
private

Projection.

Definition at line 75 of file Ortho3DPad.h.

Referenced by Draw().

RawDataDrawer* evd::DrawingPad::fRawDataDraw
protectedinherited

Drawer for raw data.

Definition at line 49 of file DrawingPad.h.

Referenced by evd::DrawingPad::RawDataDraw(), and evd::DrawingPad::~DrawingPad().

RecoBaseDrawer* evd::DrawingPad::fRecoBaseDraw
protectedinherited

Drawer for recobase objects.

Definition at line 50 of file DrawingPad.h.

Referenced by evd::DrawingPad::RecoBaseDraw(), and evd::DrawingPad::~DrawingPad().

double evd::Ortho3DPad::fReleaseX
private

User location where button 1 was released.

Definition at line 98 of file Ortho3DPad.h.

Referenced by MouseEvent().

double evd::Ortho3DPad::fReleaseY
private

User location where button 1 was released.

Definition at line 99 of file Ortho3DPad.h.

Referenced by MouseEvent().

SimulationDrawer* evd::DrawingPad::fSimulationDraw
protectedinherited

Drawer for simulation objects.

Definition at line 48 of file DrawingPad.h.

Referenced by evd::DrawingPad::SimulationDraw(), and evd::DrawingPad::~DrawingPad().

evdb::View2D* evd::Ortho3DPad::fView
private

Collection of graphics objects to render.

Definition at line 82 of file Ortho3DPad.h.

Referenced by Draw(), Ortho3DPad(), and ~Ortho3DPad().

double evd::Ortho3DPad::fXHi
private

High x value.

Definition at line 77 of file Ortho3DPad.h.

Referenced by Draw(), Ortho3DPad(), and UnZoom().

double evd::Ortho3DPad::fXLo
private

Low x value.

Definition at line 76 of file Ortho3DPad.h.

Referenced by Draw(), Ortho3DPad(), and UnZoom().

double evd::Ortho3DPad::fYHi
private

High y value.

Definition at line 79 of file Ortho3DPad.h.

Referenced by Draw(), Ortho3DPad(), and UnZoom().

double evd::Ortho3DPad::fYLo
private

Low y value.

Definition at line 78 of file Ortho3DPad.h.

Referenced by Draw(), Ortho3DPad(), and UnZoom().

std::vector<TBox> evd::Ortho3DPad::TPCBox
private

TPC box.

Definition at line 81 of file Ortho3DPad.h.

Referenced by Draw(), and Ortho3DPad().


The documentation for this class was generated from the following files: