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.5 2011/04/12 22:07:16 bckhouse Exp $
6 ///
7 #include <iostream>
8 #include "TPad.h"
9 #include "TView3D.h"
10 #include "TGLViewer.h"
11 #include "TPolyLine3D.h"
12 
14 #include "nuevdb/EventDisplayBase/View3D.h"
15 #include "nuevdb/EventDisplayBase/EventHolder.h"
16 #include "Geometry/GeometryGAr.h"
24 
25 namespace gar {
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  ///
39  const char* ti,
40  double x1,
41  double y1,
42  double x2,
43  double y2,
44  const char* /*opt*/)
45  : DrawingPad(nm, ti, x1, y1, x2, y2)
46  {
47  this->Pad()->SetFillColor(kBlack);
48  this->Pad()->Draw();
49  this->Pad()->cd();
50  fView = new evdb::View3D();
51  }
52 
53  //......................................................................
54 
56  {
57  if (fView) { delete fView; fView = 0; }
58  }
59 
60  //......................................................................
61 
63  {
64  fView->Clear();
65 
67 
68  // grab the event from the singleton
69  const art::Event *evt = evdb::EventHolder::Instance()->GetEvent();
70 
71  if(evt){
72  this->HeaderDraw() ->Header (fView);
73  this->GeometryDraw() ->DetOutline3D (fView);
74  this->SimulationDraw()->MCTruth3D (*evt, fView);
75  this->RecoBaseDraw() ->Track3D (*evt, fView);
76  this->RecoBaseDraw() ->Hit3D (*evt, fView);
77  this->RecoBaseDraw() ->TPCCluster3D (*evt, fView);
78  this->RecoBaseDraw() ->CaloCluster3D(*evt, fView);
79  this->RecoBaseDraw() ->CaloHit3D (*evt, fView);
80  this->RecoBaseDraw() ->Vertex3D (*evt, fView);
81  this->RecoBaseDraw() ->VecHit3D (*evt, fView);
82  this->RawDataDraw() ->RawDigit3D (*evt, fView);
83  }
84 
85  this->Pad()->Clear();
86  this->Pad()->cd();
87  if (fPad->GetView()==0) {
88  //int irep=0;
89  // nb. coordinates are so Y is up, but ROOT thinks Z is up, so report (z,x,y)
90  double rmin[]={geo->TPCZCent() - 0.7*geo->TPCLength(), geo->TPCXCent() - 0.7*geo->TPCRadius(), geo->TPCYCent() - 0.7*geo->TPCRadius()};
91  double rmax[]={geo->TPCZCent() + 0.7*geo->TPCLength(), geo->TPCXCent() + 0.7*geo->TPCRadius(), geo->TPCYCent() + 0.7*geo->TPCRadius()};
92  TView3D* v = new TView3D(1,rmin,rmax);
93  v->SetPerspective();
94  //v->SetView(-90.0,75.0,0,irep);
95  //v->ZoomView(0, 3);
96  v->ResizePad();
97  //v->ToggleZoom(0);
98  //v->SetView(geo->TPCXCent(),geo->TPCYCent(),geo->TPCZCent(),irep);
99  fPad->SetView(v); // ROOT takes ownership of object *v
100  }
101  fView->Draw();
102  fPad->Update();
103  }
104 
105 
106  ////////////////////////////////////////////////////////////////////////
107 }
108 }//namespace
HeaderDrawer * HeaderDraw()
Definition: DrawingPad.cxx:76
SimulationDrawer * SimulationDraw()
Definition: DrawingPad.cxx:94
void MCTruth3D(const art::Event &evt, evdb::View3D *view)
void RawDigit3D(art::Event const &evt, evdb::View3D *view)
Draws raw digit content in 2D wire plane representation.
TPad * fPad
The ROOT graphics pad.
Definition: DrawingPad.h:42
void TPCCluster3D(art::Event const &evt, evdb::View3D *view)
GeometryDrawer * GeometryDraw()
Definition: DrawingPad.cxx:85
void VecHit3D(art::Event const &evt, evdb::View3D *view)
void CaloCluster3D(art::Event const &evt, evdb::View3D *view)
void Track3D(art::Event const &evt, evdb::View3D *view)
RawDataDrawer * RawDataDraw()
Definition: DrawingPad.cxx:104
void CaloHit3D(art::Event const &evt, evdb::View3D *view)
LArSoft includes.
Definition: InfoTransfer.h:33
void DetOutline3D(evdb::View3D *view)
Class to aid in the rendering of Geometry objects.
void Vertex3D(art::Event const &evt, evdb::View3D *view)
Base class for event display drawing pads.
Definition: DrawingPad.h:23
General GArSoft Utilities.
RecoBaseDrawer * RecoBaseDraw()
Definition: DrawingPad.cxx:115
void Header(evdb::View2D *view)
Display3DPad(const char *nm, const char *ti, double x1, double y1, double x2, double y2, const char *opt)
evdb::View3D * fView
Collection of graphics objects to render.
Definition: Display3DPad.h:54
TCEvent evt
Definition: DataStructs.cxx:7
LArSoft geometry interface.
Definition: ChannelGeo.h:16
art framework interface to geometry description
void Hit3D(art::Event const &evt, evdb::View3D *view)