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 ///
6 #include "TPad.h"
7 #include "TView3D.h"
8 
10 #include "nuevdb/EventDisplayBase/View3D.h"
11 #include "nuevdb/EventDisplayBase/EventHolder.h"
19 
23 
24 namespace evd{
25 
26 ///
27 /// Create a pad to show a 3D rendering of the detector and events
28 /// @param nm : Name of the pad
29 /// @param ti : Title of the pad
30 /// @param x1 : Location of left edge of pad (0-1)
31 /// @param x2 : Location of right edge of pad (0-1)
32 /// @param y1 : Location of bottom edge of pad (0-1)
33 /// @param y2 : Location of top edge of pad (0-1)
34 /// @param opt: Options. Currently just a place holder
35 ///
36 Display3DPad::Display3DPad(const char* nm, const char* ti,
37  double x1, double y1,
38  double x2, double y2,
39  const char* /*opt*/) :
40  DrawingPad(nm, ti, x1, y1, x2, y2)
41 {
42  this->Pad()->SetFillColor(kBlack);
43  this->Pad()->Draw();
44  this->Pad()->cd();
45  fView = new evdb::View3D();
46 
47  // Set up the 3D drawing tools for the simulation
49 
50  // Implement the tools for handling the 3D simulation drawing tools
51  const fhicl::ParameterSet& drawSim3DTools = simDrawOpt->f3DDrawerParams;
52 
53  for(const std::string& draw3DTool : drawSim3DTools.get_pset_names())
54  {
55  const fhicl::ParameterSet& draw3DToolParamSet = drawSim3DTools.get<fhicl::ParameterSet>(draw3DTool);
56 
57  fSim3DDrawerVec.push_back(art::make_tool<evdb_tool::ISim3DDrawer>(draw3DToolParamSet));
58  }
59 
60  // Set up the 3D drawing tools for the reconstruction
62 
63  // Implement the tools for handling the 3D reco drawing tools
64  const fhicl::ParameterSet& drawReco3DTools = recoDrawOpt->f3DDrawerParams;
65 
66  for(const std::string& draw3DTool : drawReco3DTools.get_pset_names())
67  {
68  const fhicl::ParameterSet& draw3DToolParamSet = drawReco3DTools.get<fhicl::ParameterSet>(draw3DTool);
69 
70  fReco3DDrawerVec.push_back(art::make_tool<evdb_tool::I3DDrawer>(draw3DToolParamSet));
71  }
72 
73  return;
74 }
75 
76 //......................................................................
77 
79 {
80  if (fView) { delete fView; fView = 0; }
81 }
82 
83 //......................................................................
84 
86 {
87  fView->Clear();
88 
90 
91  // grab the event from the singleton
92  const art::Event *evt = evdb::EventHolder::Instance()->GetEvent();
93 
94  if(evt){
96 // this->SimulationDraw()->MCTruth3D (*evt, fView);
97  this->RecoBaseDraw()-> PFParticle3D (*evt, fView);
98  this->RecoBaseDraw()-> Edge3D (*evt, fView);
99  this->RecoBaseDraw()-> SpacePoint3D (*evt, fView);
100  this->RecoBaseDraw()-> Prong3D (*evt, fView);
101  this->RecoBaseDraw()-> Seed3D (*evt, fView);
102  this->RecoBaseDraw()-> Vertex3D (*evt, fView);
103  this->RecoBaseDraw()-> Event3D (*evt, fView);
104  this->RecoBaseDraw()-> Slice3D (*evt, fView);
105 
106  // Call the 3D simulation drawing tools
107  for(auto& draw3D : fSim3DDrawerVec) draw3D->Draw(*evt, fView);
108 
109  // Call the 3D reco drawing tools
110  for(auto& draw3D : fReco3DDrawerVec) draw3D->Draw(*evt, fView);
111 
112  }
113 
114  this->Pad()->Clear();
115  this->Pad()->cd();
116  if (fPad->GetView()==0) {
117  int irep;
118  double rmin[]={-2.1*geo->DetHalfWidth(),-2.1*geo->DetHalfHeight(),-0.5*geo->DetLength()};
119  double rmax[]={ 2.1*geo->DetHalfWidth(), 2.1*geo->DetHalfHeight(), 0.5*geo->DetLength()};
120  TView3D* v = new TView3D(1,rmin,rmax);
121  v->SetPerspective();
122  v->SetView(0.0,260.0,270.0,irep);
123  fPad->SetView(v); // ROOT takes ownership of object *v
124  }
125  fView->Draw();
126  fPad->Update();
127 }
128 
129 
130 }//namespace
std::vector< std::unique_ptr< evdb_tool::I3DDrawer > > fReco3DDrawerVec
Definition: Display3DPad.h:39
geo::Length_t DetHalfWidth(geo::TPCID const &tpcid) const
Returns the half width of the active volume of the specified TPC.
std::string string
Definition: nybbler.cc:12
art framework interface to geometry description
fhicl::ParameterSet f3DDrawerParams
FHICL paramegers for the 3D drawers.
Display3DPad(const char *nm, const char *ti, double x1, double y1, double x2, double y2, const char *opt)
std::vector< std::string > get_pset_names() const
evd_tool::IExperimentDrawer * GeometryDraw()
Definition: DrawingPad.cxx:81
geo::Length_t DetHalfHeight(geo::TPCID const &tpcid) const
Returns the half height of the active volume of the specified TPC.
LArSoft includes.
Definition: InfoTransfer.h:33
T get(std::string const &key) const
Definition: ParameterSet.h:271
Base class for event display drawing pads.
Definition: DrawingPad.h:29
RecoBaseDrawer * RecoBaseDraw()
Definition: DrawingPad.cxx:117
geo::Length_t DetLength(geo::TPCID const &tpcid) const
Returns the length of the active volume of the specified TPC.
TPad * Pad()
Definition: DrawingPad.h:37
fhicl::ParameterSet f3DDrawerParams
FHICL paramegers for the 3D drawers.
std::vector< std::unique_ptr< evdb_tool::ISim3DDrawer > > fSim3DDrawerVec
Definition: Display3DPad.h:38
TPad * fPad
The ROOT graphics pad.
Definition: DrawingPad.h:52
TCEvent evt
Definition: DataStructs.cxx:7
evdb::View3D * fView
Collection of graphics objects to render.
Definition: Display3DPad.h:36
This is the interface class for drawing 3D detector geometries.
LArSoft geometry interface.
Definition: ChannelGeo.h:16
virtual void DetOutline3D(evdb::View3D *view)=0