Display3DPad.cxx
Go to the documentation of this file.
1 ///
2 /// \file Display3DPad.cxx
3 /// \brief Drawing pad showing a 3D rendering of the detector
4 /// \author messier@indiana.edu
5 /// \version $Id: Display3DPad.cxx,v 1.6 2011-10-21 20:37:50 gsdavies Exp $
6 ///
7 #include <iostream>
8 
9 #include "TPad.h"
10 #include "TView3D.h"
11 #include "TGLViewer.h"
12 
14 
24 #include "Geometry/Geometry.h"
25 
26 namespace evd
27 {
28  ///
29  /// Create a pad to show a 3D rendering of the detector and events
30  /// @param nm : Name of the pad
31  /// @param ti : Title of the pad
32  /// @param x1 : Location of left edge of pad (0-1)
33  /// @param x2 : Location of right edge of pad (0-1)
34  /// @param y1 : Location of bottom edge of pad (0-1)
35  /// @param y2 : Location of top edge of pad (0-1)
36  /// @param opt: Options. Currently just a place holder
37  ///
38  Display3DPad::Display3DPad(const char* nm, const char* ti,
39  double x1, double y1,
40  double x2, double y2,
41  const char* /*opt*/) :
42  DrawingPad(nm, ti, x1, y1, x2, y2)
43  {
44  // this->Pad()->Draw();
45  // this->Pad()->cd();
46  fView = new evdb::View3D();
47  }
48 
49  //......................................................................
51  {
52  if (fView) { delete fView; fView = 0; }
53  }
54 
55  //......................................................................
57  {
58  fView->Clear();
59 
60  // grab the event from the singleton
62  if (evt==0) return;
63 
65  this->HeaderDraw()-> Header (fView);
66  this->GeometryDraw()-> DetOutline3D (*evt, fView);
67  this->RawDataDraw()-> RawDigit3D (*evt, fView);
68  this->SimulationDraw()->MCTruthVertices3D (*evt, fView);
69  this->SimulationDraw()->MCTruthVectors3D (*evt, fView);
71  this->SimulationDraw()->FLSHit3D (*evt, fView);
72  this->RecoBaseDraw()-> CellHit3D (*evt, fView);
73  this->RecoBaseDraw()-> Cluster3D (*evt, fView);
74  this->RecoBaseDraw()-> Prong3D (*evt, fView);
75 
76  int irep;
77  this->Pad()->Clear();
78  this->Pad()->cd();
79  if (fPad->GetView()==0) {
80  double rmin[]={ -geo->DetHalfWidth(),
81  -geo->DetHalfHeight(),
82  (0.5-0.45)*geo->DetLength()
83  };
84  double rmax[]={ geo->DetHalfWidth(),
85  geo->DetHalfHeight(),
86  (0.5+0.25)*geo->DetLength()
87  };
88  TView3D* v = new TView3D(1,rmin,rmax);
89  v->SetPerspective();
90  v->SetView(-125.0,-115.0,135.0,irep);
91  fPad->SetView(v); // ROOT takes ownership of object *v
92  }
94  fPad->GetView()->SetView(opt->fTheta,opt->fPhi,opt->fPsi, irep);
95  fView->Draw();
96  fPad->Update();
97  }
98 
99 } // end namespace evd
100 ////////////////////////////////////////////////////////////////////////
const art::Event * GetEvent() const
Definition: EventHolder.cxx:45
Render the objects from the Simulation package.
HeaderDrawer * HeaderDraw()
Definition: DrawingPad.cxx:64
Float_t y1[n_points_granero]
Definition: compare.C:5
Float_t x1[n_points_granero]
Definition: compare.C:5
static constexpr Double_t nm
Definition: Munits.h:133
double fTheta
View angles for 3D.
double DetLength() const
GeometryDrawer * GeometryDraw()
Definition: DrawingPad.cxx:73
Singleton to hold the current art::Event for the event display.
Display3DPad(const char *nm, const char *ti, double x1, double y1, double x2, double y2, const char *opt)
std::string Header(std::string label)
nova event display
RawDataDrawer * RawDataDraw()
Definition: DrawingPad.cxx:91
static EventHolder * Instance()
Definition: EventHolder.cxx:15
int evt
Base class for event display drawing pads.
Definition: DrawingPad.h:20
RecoBaseDrawer * RecoBaseDraw()
Definition: DrawingPad.cxx:101
TPad * Pad()
Definition: DrawingPad.h:27
double DetHalfHeight() const
SimulationDrawer * SimulationDraw()
Definition: DrawingPad.cxx:82
Class to aid in the rendering of RecoBase objects.
void Draw()
Definition: View3D.cxx:30
Class to aid in the rendering of RawData objects.
void MCTruthTrajectories3D(const art::Event &evt, evdb::View3D *view)
Class to aid in the rendering of Geometry objects.
void Clear()
Definition: View3D.cxx:40
void MCTruthVectors3D(const art::Event &evt, evdb::View3D *view)
double DetHalfWidth() const
void MCTruthVertices3D(const art::Event &evt, evdb::View3D *view)
Render the objects from the Simulation package.
A collection of 3D drawable objects.
TPad * fPad
The ROOT graphics pad.
Definition: DrawingPad.h:37
evdb::View3D * fView
Collection of graphics objects to render.
Definition: Display3DPad.h:31
Helper for AttenCurve.
Definition: Path.h:10
void FLSHit3D(const art::Event &evt, evdb::View3D *xzview)
Encapsulate the geometry of one entire detector (near, far, ndos)
Global drawing options that apply to all displays.