LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
evd::Ortho3DView Class Reference

View of event shoing orthographic view of 3D objects. More...

#include "Ortho3DView.h"

Inheritance diagram for evd::Ortho3DView:
evdb::Canvas evdb::Printable

Public Member Functions

 Ortho3DView (TGMainFrame *mf)
 
virtual ~Ortho3DView ()
 
const char * Description () const
 
const char * PrintTag () const
 
void Draw (const char *opt="")
 
virtual void Print (const char *f)
 
void Connect ()
 Make signal/slot connections. More...
 

Static Public Member Functions

static void AddToListOfPrintables (const char *name, evdb::Printable *p)
 
static void RemoveFromListOfPrintables (evdb::Printable *p)
 
static std::map< std::string, evdb::Printable * > & GetPrintables ()
 

Protected Attributes

TGCompositeFrame * fFrame
 Graphics frame. More...
 
TGLayoutHints * fLayout
 Layout hints for frame. More...
 
TRootEmbeddedCanvas * fEmbCanvas
 Embedded canvas. More...
 
TCanvas * fCanvas
 The ROOT drawing canvas. More...
 
unsigned short fXsize
 Size of the canvas;. More...
 
unsigned short fYsize
 Size of the canvas;. More...
 
float fAspectRatio
 fYsize/fXsize More...
 

Private Attributes

std::vector< Ortho3DPad * > fOrtho3DPads
 Graphics pads. More...
 
TGCompositeFrame * fMetaFrame
 Frame holding root canvas and widget frame. More...
 
TGCompositeFrame * fWidgetFrame
 Frame holding widgets. More...
 
std::vector< TGCompositeFrame * > fWidgetSubFrames
 

Detailed Description

View of event shoing orthographic view of 3D objects.

Definition at line 21 of file Ortho3DView.h.

Constructor & Destructor Documentation

evd::Ortho3DView::Ortho3DView ( TGMainFrame *  mf)

Definition at line 22 of file Ortho3DView.cxx.

References Draw(), evdb::Canvas::fCanvas, evdb::Canvas::fEmbCanvas, evdb::Canvas::fFrame, evdb::Canvas::fLayout, fMetaFrame, fOrtho3DPads, fWidgetFrame, fWidgetSubFrames, evd::Ortho3DPad::GetMarkerSize(), evd::kNoProj, evd::kXZ, evd::kYZ, proj, and evd::Ortho3DPad::SetMSizeEntry().

22  : evdb::Canvas(mf)
23 {
24  // Remove everything that's in the main frame by default.
25 
26  mf->RemoveFrame(fEmbCanvas);
27  mf->RemoveFrame(fFrame);
28 
29  // Make meta frame to hold graphics pad and our widgets.
30 
31  fMetaFrame = new TGHorizontalFrame(mf);
32 
33  // Refill main frame, replacing root canvas with meta frame.
34 
35  mf->AddFrame(fMetaFrame, fLayout);
36  mf->AddFrame(fFrame);
37 
38  // Add two frames inside the meta frame.
39  // Add a vertical frame on the left to hold our widgets.
40  // Add root canvas on the right.
41 
42  fWidgetFrame = new TGVerticalFrame(fMetaFrame);
43  fEmbCanvas->ReparentWindow(fMetaFrame);
44  fMetaFrame->AddFrame(fWidgetFrame, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandY));
45  fMetaFrame->AddFrame(fEmbCanvas, fLayout);
46 
47  // Make vertically stacked subpads and widget subframes.
48 
49  int npad = 2;
50  for (int ipad = 0; ipad < npad; ++ipad) {
53  std::string projname;
54  switch (ipad) {
55  case 0:
56  proj = kXZ;
57  projname = "XZ";
58  break;
59  case 1:
60  proj = kYZ;
61  projname = "YZ";
62  break;
63  default:
64  throw cet::exception("Ortho3DView")
65  << __func__ << ": unknown projection pad " << ipad << "\n";
66  } // switch
67 
68  std::string padname = std::string("Ortho3DPad") + projname;
69  std::string padtitle = projname + std::string(" View");
70  double ylo = double(npad - ipad - 1) / double(npad);
71  double yhi = double(npad - ipad) / double(npad);
72  Ortho3DPad* pad = new Ortho3DPad(padname.c_str(), padtitle.c_str(), proj, 0.0, ylo, 1.0, yhi);
73  fOrtho3DPads.push_back(pad);
74 
75  // Add subframe for this pad's widgets.
76 
77  TGCompositeFrame* wframe = new TGVerticalFrame(fWidgetFrame);
78  fWidgetSubFrames.push_back(wframe);
79  fWidgetFrame->AddFrame(wframe, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandY));
80 
81  // Add widgets.
82 
83  // Label.
84 
85  TGLabel* label = new TGLabel(wframe, padtitle.c_str());
86  wframe->AddFrame(label, new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 1));
87 
88  // Unzoom button.
89 
90  TGTextButton* unzoom = new TGTextButton(wframe, "&Unzoom");
91  wframe->AddFrame(unzoom, new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 1));
92  unzoom->Connect("Clicked()", "evd::Ortho3DPad", pad, "UnZoom(=true)");
93 
94  // Marker size entry.
95 
96  TGCompositeFrame* msize_frame = new TGHorizontalFrame(wframe);
97  wframe->AddFrame(msize_frame, new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 1));
98  int val = pad->GetMarkerSize();
99  TGNumberEntry* msize_entry = new TGNumberEntry(msize_frame,
100  val,
101  3,
102  -1,
103  TGNumberFormat::kNESInteger,
104  TGNumberFormat::kNEANonNegative,
105  TGNumberFormat::kNELLimitMin,
106  1.);
107  msize_frame->AddFrame(msize_entry);
108  pad->SetMSizeEntry(msize_entry);
109 
110  TGLabel* msize_label = new TGLabel(msize_frame, "Marker Size");
111  msize_frame->AddFrame(msize_label, new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 0, 0, 1));
112  msize_entry->Connect("ValueSet(Long_t)", "evd::Ortho3DPad", pad, "SetMSize()");
113  }
114 
115  // Draw everything and update canvas.
116 
117  Draw();
118  evdb::Canvas::fCanvas->Update();
119 }
TGCompositeFrame * fFrame
Graphics frame.
Definition: Canvas.h:39
TCanvas * fCanvas
The ROOT drawing canvas.
Definition: Canvas.h:42
TGLayoutHints * fLayout
Layout hints for frame.
Definition: Canvas.h:40
OrthoProj_t
Definition: OrthoProj.h:12
void Draw(const char *opt="")
TGCompositeFrame * fMetaFrame
Frame holding root canvas and widget frame.
Definition: Ortho3DView.h:44
std::vector< TGCompositeFrame * > fWidgetSubFrames
Definition: Ortho3DView.h:46
TGCompositeFrame * fWidgetFrame
Frame holding widgets.
Definition: Ortho3DView.h:45
Float_t proj
Definition: plot.C:35
std::vector< Ortho3DPad * > fOrtho3DPads
Graphics pads.
Definition: Ortho3DView.h:40
TRootEmbeddedCanvas * fEmbCanvas
Embedded canvas.
Definition: Canvas.h:41
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
evd::Ortho3DView::~Ortho3DView ( )
virtual

Definition at line 123 of file Ortho3DView.cxx.

123 {}

Member Function Documentation

void evdb::Printable::AddToListOfPrintables ( const char *  name,
evdb::Printable p 
)
staticinherited

Definition at line 29 of file Printable.cxx.

Referenced by evdb::Canvas::Connect(), evdb::ObjListCanvas::Connect(), evdb::Printable::Description(), and evdb::testCanvas1::testCanvas1().

31  {
32  std::string s(name);
33 
34  if (gsPrintables[s] == 0) {
35  gsPrintables[s] = p;
36  }
37  else {
38  if (gsPrintables[s] != p) {
39  std::cerr << "Printable: Name " << name << " reused.\n";
40  std::abort();
41  }
42  }
43  }
static std::map< std::string, evdb::Printable * > gsPrintables
Definition: Printable.cxx:14
void evdb::Canvas::Connect ( )
inherited

Make signal/slot connections.

Definition at line 68 of file Canvas.cxx.

References evdb::Printable::AddToListOfPrintables(), and evdb::Canvas::Description().

Referenced by evd::CalorView::CalorView(), evdb::Canvas::Description(), evd::Display3DView::Display3DView(), and evdb::DisplayWindow::DisplayWindow().

69  {
70  // Make connections for drawing and printing
71  // IoModule::Instance()->Connect("NewEvent()",
72  // "evdb::Canvas",this,"Draw()");
74  }
virtual const char * Description() const
Definition: Canvas.h:33
static void AddToListOfPrintables(const char *name, evdb::Printable *p)
Definition: Printable.cxx:29
const char* evd::Ortho3DView::Description ( ) const
inlinevirtual

Reimplemented from evdb::Canvas.

Definition at line 31 of file Ortho3DView.h.

31 { return "Orthographic 3D Detector Display"; }
void evd::Ortho3DView::Draw ( const char *  opt = "")
virtual

Implements evdb::Canvas.

Definition at line 127 of file Ortho3DView.cxx.

References evd::Ortho3DPad::Draw(), and fOrtho3DPads.

Referenced by Ortho3DView(), and PrintTag().

128 {
130  ++i) {
131  Ortho3DPad* pad = *i;
132  pad->Draw();
133  }
134 }
intermediate_table::const_iterator const_iterator
std::vector< Ortho3DPad * > fOrtho3DPads
Graphics pads.
Definition: Ortho3DView.h:40
std::map< std::string, evdb::Printable * > & evdb::Printable::GetPrintables ( )
staticinherited

Definition at line 61 of file Printable.cxx.

References evdb::gsPrintables.

Referenced by evdb::Printable::Description(), evdb::EventDisplay::postProcessEvent(), and evdb::PrintDialog::PrintDialog().

62  {
63  return gsPrintables;
64  }
static std::map< std::string, evdb::Printable * > gsPrintables
Definition: Printable.cxx:14
void evdb::Canvas::Print ( const char *  f)
virtualinherited

Implements evdb::Printable.

Definition at line 88 of file Canvas.cxx.

References evdb::Canvas::fCanvas.

Referenced by evdb::Canvas::Description().

88 { fCanvas->Print(f); }
TCanvas * fCanvas
The ROOT drawing canvas.
Definition: Canvas.h:42
TFile f
Definition: plotHisto.C:6
const char* evd::Ortho3DView::PrintTag ( ) const
inlinevirtual

Reimplemented from evdb::Canvas.

Definition at line 32 of file Ortho3DView.h.

References Draw().

32 { return "larortho3d"; }
void evdb::Printable::RemoveFromListOfPrintables ( evdb::Printable p)
staticinherited

Definition at line 47 of file Printable.cxx.

Referenced by evdb::Printable::Description(), evdb::Printable::~Printable(), and evdb::testCanvas1::~testCanvas1().

48  {
51  for (; itr!=itrEnd; ++itr) {
52  if ( itr->second == p) {
53  gsPrintables.erase(itr);
54  return;
55  }
56  }
57  }
intermediate_table::iterator iterator
static std::map< std::string, evdb::Printable * > gsPrintables
Definition: Printable.cxx:14

Member Data Documentation

float evdb::Canvas::fAspectRatio
protectedinherited

fYsize/fXsize

Definition at line 46 of file Canvas.h.

Referenced by evdb::Canvas::Canvas().

TRootEmbeddedCanvas* evdb::Canvas::fEmbCanvas
protectedinherited
TGCompositeFrame* evdb::Canvas::fFrame
protectedinherited
TGLayoutHints* evdb::Canvas::fLayout
protectedinherited
TGCompositeFrame* evd::Ortho3DView::fMetaFrame
private

Frame holding root canvas and widget frame.

Definition at line 44 of file Ortho3DView.h.

Referenced by Ortho3DView().

std::vector<Ortho3DPad*> evd::Ortho3DView::fOrtho3DPads
private

Graphics pads.

Definition at line 40 of file Ortho3DView.h.

Referenced by Draw(), and Ortho3DView().

TGCompositeFrame* evd::Ortho3DView::fWidgetFrame
private

Frame holding widgets.

Definition at line 45 of file Ortho3DView.h.

Referenced by Ortho3DView().

std::vector<TGCompositeFrame*> evd::Ortho3DView::fWidgetSubFrames
private

Definition at line 46 of file Ortho3DView.h.

Referenced by Ortho3DView().

unsigned short evdb::Canvas::fXsize
protectedinherited
unsigned short evdb::Canvas::fYsize
protectedinherited

The documentation for this class was generated from the following files: