LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
Display3DPad.cxx
Go to the documentation of this file.
1 #include "TPad.h"
7 #include "TView3D.h"
8 
19 
23 
24 namespace evd {
25 
37  const char* ti,
38  double x1,
39  double y1,
40  double x2,
41  double y2,
42  const char* /*opt*/)
43  : DrawingPad(nm, ti, x1, y1, x2, y2)
44  {
45  this->Pad()->SetFillColor(kBlack);
46  this->Pad()->Draw();
47  this->Pad()->cd();
48  fView = new evdb::View3D();
49 
50  // Set up the 3D drawing tools for the simulation
52 
53  // Implement the tools for handling the 3D simulation drawing tools
54  const fhicl::ParameterSet& drawSim3DTools = simDrawOpt->f3DDrawerParams;
55 
56  for (const std::string& draw3DTool : drawSim3DTools.get_pset_names()) {
57  const fhicl::ParameterSet& draw3DToolParamSet =
58  drawSim3DTools.get<fhicl::ParameterSet>(draw3DTool);
59 
60  fSim3DDrawerVec.push_back(art::make_tool<evdb_tool::ISim3DDrawer>(draw3DToolParamSet));
61  }
62 
63  // Set up the 3D drawing tools for the reconstruction
65 
66  // Implement the tools for handling the 3D reco drawing tools
67  const fhicl::ParameterSet& drawReco3DTools = recoDrawOpt->f3DDrawerParams;
68 
69  for (const std::string& draw3DTool : drawReco3DTools.get_pset_names()) {
70  const fhicl::ParameterSet& draw3DToolParamSet =
71  drawReco3DTools.get<fhicl::ParameterSet>(draw3DTool);
72 
73  fReco3DDrawerVec.push_back(art::make_tool<evdb_tool::I3DDrawer>(draw3DToolParamSet));
74  }
75 
76  return;
77  }
78 
79  //......................................................................
80 
82  {
83  if (fView) {
84  delete fView;
85  fView = 0;
86  }
87  }
88 
89  //......................................................................
90 
92  {
93  fView->Clear();
94 
96 
97  // grab the event from the singleton
99 
100  if (evt) {
101  this->GeometryDraw()->DetOutline3D(fView);
102  // this->SimulationDraw()->MCTruth3D (*evt, fView);
103  this->RecoBaseDraw()->PFParticle3D(*evt, fView);
104  this->RecoBaseDraw()->Edge3D(*evt, fView);
105  this->RecoBaseDraw()->SpacePoint3D(*evt, fView);
106  this->RecoBaseDraw()->Prong3D(*evt, fView);
107  this->RecoBaseDraw()->Seed3D(*evt, fView);
108  this->RecoBaseDraw()->Vertex3D(*evt, fView);
109  this->RecoBaseDraw()->Event3D(*evt, fView);
110  this->RecoBaseDraw()->Slice3D(*evt, fView);
111 
112  // Call the 3D simulation drawing tools
113  for (auto& draw3D : fSim3DDrawerVec)
114  draw3D->Draw(*evt, fView);
115 
116  // Call the 3D reco drawing tools
117  for (auto& draw3D : fReco3DDrawerVec)
118  draw3D->Draw(*evt, fView);
119  }
120 
121  this->Pad()->Clear();
122  this->Pad()->cd();
123  if (fPad->GetView() == 0) {
124  int irep;
125  double rmin[] = {
126  -2.1 * geo->DetHalfWidth(), -2.1 * geo->DetHalfHeight(), -0.5 * geo->DetLength()};
127  double rmax[] = {
128  2.1 * geo->DetHalfWidth(), 2.1 * geo->DetHalfHeight(), 0.5 * geo->DetLength()};
129  TView3D* v = new TView3D(1, rmin, rmax);
130  v->SetPerspective();
131  v->SetView(0.0, 260.0, 270.0, irep);
132  fPad->SetView(v); // ROOT takes ownership of object *v
133  }
134  fView->Draw();
135  fPad->Update();
136  }
137 
138 } //namespace
void SpacePoint3D(const art::Event &evt, evdb::View3D *view)
const art::Event * GetEvent() const
Definition: EventHolder.cxx:45
std::vector< std::unique_ptr< evdb_tool::I3DDrawer > > fReco3DDrawerVec
Definition: Display3DPad.h:45
Float_t y1[n_points_granero]
Definition: compare.C:5
void Prong3D(const art::Event &evt, evdb::View3D *view)
Float_t x1[n_points_granero]
Definition: compare.C:5
Length_t DetHalfWidth(TPCID const &tpcid=tpc_zero) const
Returns the half width of the active volume of the specified TPC.
void Vertex3D(const art::Event &evt, evdb::View3D *view)
void Event3D(const art::Event &evt, evdb::View3D *view)
void Edge3D(const art::Event &evt, evdb::View3D *view)
Singleton to hold the current art::Event for the event display.
Length_t DetLength(TPCID const &tpcid=tpc_zero) const
Returns the length of the active volume of the specified TPC.
Drawing pad showing a 3D rendering of the detector.
fhicl::ParameterSet f3DDrawerParams
FHICL paramegers for the 3D drawers.
Float_t y2[n_points_geant4]
Definition: compare.C:26
Display3DPad(const char *nm, const char *ti, double x1, double y1, double x2, double y2, const char *opt)
void Seed3D(const art::Event &evt, evdb::View3D *view)
std::vector< std::string > get_pset_names() const
evd_tool::IExperimentDrawer * GeometryDraw()
Definition: DrawingPad.cxx:97
LArSoft includes.
static EventHolder * Instance()
Definition: EventHolder.cxx:15
void PFParticle3D(const art::Event &evt, evdb::View3D *view)
T get(std::string const &key) const
Definition: ParameterSet.h:314
Base class for event display drawing pads.
Definition: DrawingPad.h:27
RecoBaseDrawer * RecoBaseDraw()
Definition: DrawingPad.cxx:132
void Slice3D(const art::Event &evt, evdb::View3D *view)
TPad * Pad()
Definition: DrawingPad.h:31
fhicl::ParameterSet f3DDrawerParams
FHICL paramegers for the 3D drawers.
std::vector< std::unique_ptr< evdb_tool::ISim3DDrawer > > fSim3DDrawerVec
Definition: Display3DPad.h:44
Class to aid in the rendering of RecoBase objects.
void Draw()
Definition: View3D.cxx:30
void Clear()
Definition: View3D.cxx:40
Length_t DetHalfHeight(TPCID const &tpcid=tpc_zero) const
Returns the half height of the active volume of the specified TPC.
A collection of 3D drawable objects.
TPad * fPad
The ROOT graphics pad.
Definition: DrawingPad.h:45
TCEvent evt
Definition: DataStructs.cxx:8
Float_t x2[n_points_geant4]
Definition: compare.C:26
evdb::View3D * fView
Collection of graphics objects to render.
Definition: Display3DPad.h:42
This is the interface class for drawing 3D detector geometries.
Namespace collecting geometry-related classes utilities.
art framework interface to geometry description
virtual void DetOutline3D(evdb::View3D *view)=0