LArSoft  v07_13_02
Liquid Argon Software toolkit - http://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 23 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().

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

134 {
135 }

Member Function Documentation

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

Definition at line 29 of file Printable.cxx.

References s.

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  }
Float_t s
Definition: plot.C:23
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 32 of file Ortho3DView.h.

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

Implements evdb::Canvas.

Definition at line 139 of file Ortho3DView.cxx.

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

Referenced by Ortho3DView(), and PrintTag().

140 {
142  i != fOrtho3DPads.end(); ++i) {
143  Ortho3DPad* pad = *i;
144  pad->Draw();
145  }
146 }
intermediate_table::const_iterator const_iterator
std::vector< Ortho3DPad * > fOrtho3DPads
Graphics pads.
Definition: Ortho3DView.h:42
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 33 of file Ortho3DView.h.

References Draw().

33 { 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 46 of file Ortho3DView.h.

Referenced by Ortho3DView().

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

Graphics pads.

Definition at line 42 of file Ortho3DView.h.

Referenced by Draw(), and Ortho3DView().

TGCompositeFrame* evd::Ortho3DView::fWidgetFrame
private

Frame holding widgets.

Definition at line 47 of file Ortho3DView.h.

Referenced by Ortho3DView().

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

Definition at line 48 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: