Display3DView.cxx
Go to the documentation of this file.
1 ///
2 /// \file Display3DView.cxx
3 /// \brief The "main" event display view that most people will want to use
4 /// \author messier@indiana.edu
5 /// \version $Id: Display3DView.cxx,v 1.2 2011/01/19 16:40:59 p-novaart Exp $
6 ///
7 #include "TCanvas.h"
8 #include "TVirtualViewer3D.h"
9 
19 
21 
22 namespace gar {
23  namespace evd{
24 
25  //......................................................................
27  : evdb::Canvas(mf)
28  , fMCOn (nullptr)
29  , fRawDraw (nullptr)
30  , fRecoDraw (nullptr)
31  {
34 
35  fHeaderPad = new HeaderPad ("fHeaderPad", "Header", 0.00, 0.00, 0.15, 0.13, "");
36  evdb::Canvas::fCanvas->cd();
37 
38  fMC = new MCBriefPad("fMCPad", "MC Info.", 0.15, 0.13, 1.00, 0.17, "");
39 
40  evdb::Canvas::fCanvas->cd();
41  fHeaderPad->Draw();
42 
43  evdb::Canvas::fCanvas->cd();
44  fMC->Draw();
45 
46  if(evdlayoutopt->fEnableMCTruthCheckBox){
47  fMCOn = new TGCheckButton(fFrame,"MC Truth",5);
48  fMCOn->Connect("Clicked()", "gar::evd::Display3DView", this, "SetMCInfo()");
49  if(sdo->fShowMCTruthText == 1) fMCOn->SetState(kButtonDown);
50  }
51 
52  // radio buttons to toggle drawing raw vs calibrated information
53  fRecoDraw = new TGRadioButton(fFrame,"Reconstructed", 3);
54  fRawDraw = new TGRadioButton(fFrame,"Raw", 4);
55  fRawDraw ->Connect("Clicked()", "gar::evd::Display3DView", this, "SetRawReco()");
56  fRecoDraw ->Connect("Clicked()", "gar::evd::Display3DView", this, "SetRawReco()");
57 
58  if(evdlayoutopt->fEnableMCTruthCheckBox){
59  fFrame->AddFrame(fMCOn, new TGLayoutHints(kLHintsBottom | kLHintsRight, 0, 0, 5, 1 ) );
60  }
61  fFrame->AddFrame(fRecoDraw, new TGLayoutHints(kLHintsBottom | kLHintsRight, 0, 0, 5, 1 ) );
62  fFrame->AddFrame(fRawDraw, new TGLayoutHints(kLHintsBottom | kLHintsRight, 0, 0, 5, 1 ) );
63  evdb::Canvas::fCanvas->cd();
64  fDisplay3DPad = new Display3DPad("fDisplay3DPad","3D Display",
65  0.0, 0.0, 1.0, 1.0, "");
66 
67  this->Connect("CloseWindow()",
68  "gar::evd::Display3DView",
69  this,
70  "CloseWindow()");
71 
73 
74  evdb::Canvas::fCanvas->Update();
75  }
76 
77  //......................................................................
79  {
80  if (fHeaderPad) { delete fHeaderPad; fHeaderPad = nullptr; }
81  if (fMC) { delete fMC; fMC = nullptr; }
82  }
83 
84  //......................................................................
86  {
87  delete this;
88  }
89 
90  //......................................................................
91  void Display3DView::Draw(const char* /*opt*/)
92  {
93 
95  evdb::Canvas::fCanvas->Update();
96 
97  TVirtualViewer3D *viewer = fDisplay3DPad->Pad()->GetViewer3D("pad");
98  viewer->PreferLocalFrame();
99  viewer->ResetCameras();
100  viewer->PadPaint(fDisplay3DPad->Pad());
101 
102  }
103 
104  //......................................................................
106  {
108 
109  TGButton *b = (TGButton *)gTQSender;
110  int id = b->WidgetId();
111 
112  // id values are set in lines 41 - 42
113  if(id == 4){
114  rawopt->fDrawRawOrReco = 0;
115  fRawDraw->SetState(kButtonDown);
116  fRecoDraw->SetState(kButtonUp);
117  }
118  else if(id == 3){
119  rawopt->fDrawRawOrReco = 1;
120  fRawDraw->SetState(kButtonUp);
121  fRecoDraw->SetState(kButtonDown);
122  }
123 
124  TVirtualPad *ori = gPad;
125 
126  evdb::Canvas::fCanvas->cd();
127  evdb::Canvas::fCanvas->Modified();
128  evdb::Canvas::fCanvas->Update();
129 
130  ori->cd();
131 
132  return;
133  }
134 
135  //......................................................................
137  {
139 
140  //TGButton *b = (TGButton *)gTQSender;
141  //int id = b->WidgetId();
142  // set button states TODO
143 
144  TVirtualPad *ori = gPad;
145 
146  evdb::Canvas::fCanvas->cd();
147  evdb::Canvas::fCanvas->Modified();
148  evdb::Canvas::fCanvas->Update();
149 
150  ori->cd();
151 
152  return;
153  }
154  }
155 }// end namespace
156 ////////////////////////////////////////////////////////////////////////
int fEnableMCTruthCheckBox
1 to have the check box appear, 0 otherwise
A drawing pad showing a 3D rendering of the detector.
Definition: Display3DPad.h:39
Display3DPad * fDisplay3DPad
Definition: Display3DView.h:42
void Draw(const char *opt="")
Definition: HeaderPad.cxx:44
void Draw(const char *opt="")
LArSoft includes.
Definition: InfoTransfer.h:33
TGRadioButton * fRecoDraw
Draw Reconstructed information only.
Definition: Display3DView.h:47
HeaderPad * fHeaderPad
Pad showing 3D view of the detector.
Definition: Display3DView.h:43
General GArSoft Utilities.
TGRadioButton * fRawDraw
Draw Raw information only.
Definition: Display3DView.h:46
static bool * b
Definition: config.cpp:1043
TGCheckButton * fMCOn
Display MC truth information.
Definition: Display3DView.h:45
Display3DView(TGMainFrame *mf)
MCBriefPad * fMC
Short summary of MC event.
Definition: Display3DView.h:44