LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
evdb::View2D Class Reference

#include "View2D.h"

Public Member Functions

 View2D ()
 
 ~View2D ()
 
void Draw ()
 
void Clear ()
 
TMarker & AddMarker (double x, double y, int c, int st, double sz)
 
TPolyMarker & AddPolyMarker (int n, int c, int st, double sz)
 
TLine & AddLine (double x1, double y1, double x2, double y2)
 
TPolyLine & AddPolyLine (int n, int c, int w, int s)
 
TArc & AddArc (double x, double t, double r, double a=0., double b=360.)
 
TBox & AddBox (double x1, double y1, double x2, double y2)
 
TText & AddText (double x, double y, const char *text)
 
TLatex & AddLatex (double x, double y, const char *text)
 

Private Attributes

std::list< TMarker * > fMarkerL
 
std::list< TPolyMarker * > fPolyMarkerL
 
std::list< TLine * > fLineL
 
std::list< TPolyLine * > fPolyLineL
 
std::list< TArc * > fArcL
 
std::list< TBox * > fBoxL
 
std::list< TText * > fTextL
 
std::list< TLatex * > fLatexL
 

Static Private Attributes

static std::list< TMarker * > fgMarkerL
 
static std::list< TPolyMarker * > fgPolyMarkerL
 
static std::list< TLine * > fgLineL
 
static std::list< TPolyLine * > fgPolyLineL
 
static std::list< TArc * > fgArcL
 
static std::list< TBox * > fgBoxL
 
static std::list< TText * > fgTextL
 
static std::list< TLatex * > fgLatexL
 

Detailed Description

Definition at line 22 of file View2D.h.

Constructor & Destructor Documentation

evdb::View2D::View2D ( void  )

Definition at line 75 of file View2D.cxx.

76  {
77  }
evdb::View2D::~View2D ( )

Definition at line 81 of file View2D.cxx.

82  {
83  // Make sure to return all our objects to where they came from
84  Clear();
85  }
void Clear()
Definition: View2D.cxx:109

Member Function Documentation

TArc & evdb::View2D::AddArc ( double  x,
double  t,
double  r,
double  a = 0.,
double  b = 360. 
)

Definition at line 238 of file View2D.cxx.

239  {
240  TArc* a = 0;
241  if(fgArcL.empty()){
242  a = new TArc(x,y,r,p1,p2);
243  a->SetBit(kCanDelete,kFALSE);
244  }
245  else {
246  a = fgArcL.back();
247  fgArcL.pop_back();
248 
249  a->SetX1(x);
250  a->SetY1(y);
251  a->SetR1(r);
252  a->SetR2(r);
253  a->SetPhimin(p1);
254  a->SetPhimax(p2);
255  }
256 
257  fArcL.push_back(a);
258  return *a;
259  }
Float_t x
Definition: compare.C:6
Float_t y
Definition: compare.C:6
std::list< TArc * > fArcL
Definition: View2D.h:58
static std::list< TArc * > fgArcL
Definition: View2D.h:47
TBox & evdb::View2D::AddBox ( double  x1,
double  y1,
double  x2,
double  y2 
)

Definition at line 263 of file View2D.cxx.

References evdb::TBoxClipped::TBoxClipped().

Referenced by evd::TQPad::Draw(), evd::RecoBaseDrawer::Hit2D(), evd::RecoBaseDrawer::OpFlashOrtho(), evd::RawDataDrawer::QueueDrawingBoxes(), and evd::RecoBaseDrawer::Wire2D().

264  {
265  TBox* b = 0;
266  if(fgBoxL.empty()){
267  b = new TBoxClipped(x1,y1,x2,y2);
268  b->SetBit(kCanDelete,kFALSE);
269  }
270  else {
271  b = fgBoxL.back();
272  fgBoxL.pop_back();
273 
274  b->SetX1(x1);
275  b->SetY1(y1);
276  b->SetX2(x2);
277  b->SetY2(y2);
278  }
279 
280  fBoxL.push_back(b);
281  return *b;
282  }
static std::list< TBox * > fgBoxL
Definition: View2D.h:48
Float_t y1[n_points_granero]
Definition: compare.C:5
Float_t x1[n_points_granero]
Definition: compare.C:5
std::list< TBox * > fBoxL
Definition: View2D.h:59
Float_t y2[n_points_geant4]
Definition: compare.C:26
Float_t x2[n_points_geant4]
Definition: compare.C:26
TLatex & evdb::View2D::AddLatex ( double  x,
double  y,
const char *  text 
)

Definition at line 308 of file View2D.cxx.

Referenced by evd::AnalysisBaseDrawer::CalorInteractive(), evd::AnalysisBaseDrawer::CalorShower(), evd::AnalysisBaseDrawer::DrawDeDx(), evd::AnalysisBaseDrawer::DrawKineticEnergy(), and evd::SimulationDrawer::MCTruthShortText().

309  {
310  TLatex* itxt = 0;
311  if(fgLatexL.empty()){
312  itxt = new TLatex(x,y,text);
313  itxt->SetBit(kCanDelete,kFALSE);
314  }
315  else {
316  itxt = fgLatexL.back();
317  fgLatexL.pop_back();
318 
319  itxt->SetText(x,y,text);
320  itxt->SetTextAngle(0);
321  itxt->SetTextAlign(11);
322  }
323 
324  fLatexL.push_back(itxt);
325  return *itxt;
326  }
Float_t x
Definition: compare.C:6
Float_t y
Definition: compare.C:6
std::list< TLatex * > fLatexL
Definition: View2D.h:61
static std::list< TLatex * > fgLatexL
Definition: View2D.h:50
TLine & evdb::View2D::AddLine ( double  x1,
double  y1,
double  x2,
double  y2 
)

Definition at line 187 of file View2D.cxx.

Referenced by evd::AnalysisBaseDrawer::CalorInteractive(), evd::AnalysisBaseDrawer::CalorShower(), evd::RecoBaseDrawer::Draw2DSlopeEndPoints(), evd::AnalysisBaseDrawer::DrawDeDx(), evd::AnalysisBaseDrawer::DrawKineticEnergy(), evd::TWireProjPad::DrawLinesinView(), evd::RecoBaseDrawer::Hit2D(), evd::SimulationDrawer::MCTruthVectors2D(), evd::RecoBaseDrawer::OpFlash2D(), evd::RecoBaseDrawer::OpFlashOrtho(), evd::RecoBaseDrawer::Prong2D(), evd::RecoBaseDrawer::Seed2D(), evd::RecoBaseDrawer::SeedOrtho(), and evd::RecoBaseDrawer::Wire2D().

188  {
189  TLine* ln = 0;
190  if(fgLineL.empty()){
191  ln = new TLine(x1,y1,x2,y2);
192  ln->SetBit(kCanDelete,kFALSE);
193  }
194  else {
195  ln = fgLineL.back();
196  fgLineL.pop_back();
197 
198  ln->SetX1(x1);
199  ln->SetY1(y1);
200  ln->SetX2(x2);
201  ln->SetY2(y2);
202  }
203 
204  fLineL.push_back(ln);
205  return *ln;
206  }
Float_t y1[n_points_granero]
Definition: compare.C:5
Float_t x1[n_points_granero]
Definition: compare.C:5
Float_t y2[n_points_geant4]
Definition: compare.C:26
std::list< TLine * > fLineL
Definition: View2D.h:56
static std::list< TLine * > fgLineL
Definition: View2D.h:45
Float_t x2[n_points_geant4]
Definition: compare.C:26
TMarker & evdb::View2D::AddMarker ( double  x,
double  y,
int  c,
int  st,
double  sz 
)

Definition at line 124 of file View2D.cxx.

Referenced by evd::RecoBaseDrawer::Draw2DSlopeEndPoints(), evd::AnalysisBaseDrawer::DrawKineticEnergy(), evd::RecoBaseDrawer::DrawShowerOrtho(), evd::RecoBaseDrawer::DrawTrackVertexAssns2D(), evd::RecoBaseDrawer::EndPoint2D(), evd::RecoBaseDrawer::OpFlashOrtho(), evd::RecoBaseDrawer::Seed2D(), evd::RecoBaseDrawer::SeedOrtho(), evd::RecoBaseDrawer::Slice2D(), evd::TWireProjPad::UpdateSeedCurve(), evd::RecoBaseDrawer::Vertex2D(), and evd::RecoBaseDrawer::VertexOrtho().

125  {
126  // Each "Add" function follows this same pattern. If there are no cached
127  // objects of the right type we make a new one as instructed. If there are
128  // some in the cache, we take possession of one and reset it to the state
129  // this new caller wants.
130 
131  TMarker* m = 0;
132  if(fgMarkerL.empty()){
133  m = new TMarker(x,y,st);
134  m->SetBit(kCanDelete,kFALSE);
135  m->SetMarkerColor(c);
136  m->SetMarkerSize(sz);
137  }
138  else{
139  m = fgMarkerL.back();
140  fgMarkerL.pop_back();
141 
142  m->SetX(x);
143  m->SetY(y);
144  m->SetMarkerSize(sz);
145  m->SetMarkerColor(c);
146  m->SetMarkerStyle(st);
147  }
148 
149  // In either case, we have to remember we have it so that we can give it back
150  // when we're done with it.
151  fMarkerL.push_back(m);
152  return *m;
153  }
Float_t x
Definition: compare.C:6
Float_t y
Definition: compare.C:6
static std::list< TMarker * > fgMarkerL
Definition: View2D.h:43
std::list< TMarker * > fMarkerL
Definition: View2D.h:54
TPolyLine & evdb::View2D::AddPolyLine ( int  n,
int  c,
int  w,
int  s 
)

Definition at line 210 of file View2D.cxx.

Referenced by evd::RecoBaseDrawer::BezierTrack2D(), evd::RecoBaseDrawer::Cluster2D(), evd::TQPad::Draw(), evd::RecoBaseDrawer::DrawPFParticleOrtho(), evd::RecoBaseDrawer::DrawTrack2D(), evd::RecoBaseDrawer::DrawTrackOrtho(), evd::SimulationDrawer::MCTruthOrtho(), evd::RecoBaseDrawer::Prong2D(), evd::RecoBaseDrawer::Slice2D(), and evd::TWireProjPad::UpdateSeedCurve().

211  {
212  TPolyLine* pl = 0;
213  if(fgPolyLineL.empty()){
214  pl = new TPolyLine(n);
215  pl->SetBit(kCanDelete,kFALSE);
216  pl->SetLineColor(c);
217  pl->SetLineWidth(w);
218  pl->SetLineStyle(s);
219  }
220  else {
221  pl = fgPolyLineL.back();
222  fgPolyLineL.pop_back();
223 
224  pl->SetPolyLine(0);
225  pl->SetPolyLine(n); // reset elements in PolyLine
226  pl->SetOption("");
227  pl->SetLineColor(c);
228  pl->SetLineWidth(w);
229  pl->SetLineStyle(s);
230  }
231 
232  fPolyLineL.push_back(pl);
233  return *pl;
234  }
Float_t s
Definition: plot.C:23
static std::list< TPolyLine * > fgPolyLineL
Definition: View2D.h:46
std::list< TPolyLine * > fPolyLineL
Definition: View2D.h:57
Char_t n[5]
Float_t w
Definition: plot.C:23
TPolyMarker & evdb::View2D::AddPolyMarker ( int  n,
int  c,
int  st,
double  sz 
)

Definition at line 157 of file View2D.cxx.

Referenced by evd::AnalysisBaseDrawer::CalorInteractive(), evd::AnalysisBaseDrawer::CalorShower(), evd::AnalysisBaseDrawer::DrawDeDx(), evd::RecoBaseDrawer::DrawPFParticleOrtho(), evd::RecoBaseDrawer::DrawSpacePointOrtho(), evd::RecoBaseDrawer::DrawTrackOrtho(), and evd::SimulationDrawer::MCTruthOrtho().

158  {
159  TPolyMarker* pm = 0;
160  if(fgPolyMarkerL.empty()){
161  pm = new TPolyMarker(n);
162  pm->SetBit(kCanDelete,kFALSE);
163  pm->SetMarkerColor(c);
164  pm->SetMarkerStyle(st);
165  pm->SetMarkerSize(sz);
166  }
167  else {
168  pm = fgPolyMarkerL.back();
169  fgPolyMarkerL.pop_back();
170 
171  // The first call to SetPolyMarker with the 0
172  // deletes the current set of points before trying
173  // to make a new set
174  pm->SetPolyMarker(0);
175  pm->SetPolyMarker(n);
176  pm->SetMarkerColor(c);
177  pm->SetMarkerSize(sz);
178  pm->SetMarkerStyle(st);
179  }
180 
181  fPolyMarkerL.push_back(pm);
182  return *pm;
183  }
static std::list< TPolyMarker * > fgPolyMarkerL
Definition: View2D.h:44
std::list< TPolyMarker * > fPolyMarkerL
Definition: View2D.h:55
Char_t n[5]
TText & evdb::View2D::AddText ( double  x,
double  y,
const char *  text 
)

Definition at line 286 of file View2D.cxx.

Referenced by evd::RecoBaseDrawer::Cluster2D(), evd::RecoBaseDrawer::DrawTrackOrtho(), evd::RecoBaseDrawer::DrawTrackVertexAssns2D(), evd::RecoBaseDrawer::EndPoint2D(), evd::HeaderDrawer::Header(), evd::RecoBaseDrawer::Prong2D(), evd::RecoBaseDrawer::Slice2D(), and evd::RecoBaseDrawer::Vertex2D().

287  {
288  TText* itxt = 0;
289  if(fgTextL.empty()) {
290  itxt = new TText(x,y,text);
291  itxt->SetBit(kCanDelete,kFALSE);
292  }
293  else {
294  itxt = fgTextL.back();
295  fgTextL.pop_back();
296 
297  itxt->SetText(x,y,text);
298  itxt->SetTextAngle(0);
299  itxt->SetTextAlign(11);
300  }
301 
302  fTextL.push_back(itxt);
303  return *itxt;
304  }
Float_t x
Definition: compare.C:6
Float_t y
Definition: compare.C:6
std::list< TText * > fTextL
Definition: View2D.h:60
static std::list< TText * > fgTextL
Definition: View2D.h:49
void evdb::View2D::Clear ( )

Definition at line 109 of file View2D.cxx.

Referenced by evd::HeaderPad::Draw(), evd::MCBriefPad::Draw(), evd::CalorPad::Draw(), evd::TWireProjPad::Draw(), evd::Ortho3DPad::Draw(), and evd::TWireProjPad::DrawLinesinView().

110  {
111  // Empty each of our lists, appending them back onto the static ones
112  fgMarkerL.splice(fgMarkerL.end(), fMarkerL);
113  fgArcL.splice(fgArcL.end(), fArcL);
114  fgBoxL.splice(fgBoxL.end(), fBoxL);
115  fgPolyLineL.splice(fgPolyLineL.end(), fPolyLineL);
116  fgLineL.splice(fgLineL.end(), fLineL);
118  fgTextL.splice(fgTextL.end(), fTextL);
119  fgLatexL.splice(fgLatexL.end(), fLatexL);
120  }
static std::list< TBox * > fgBoxL
Definition: View2D.h:48
std::list< TBox * > fBoxL
Definition: View2D.h:59
static std::list< TPolyMarker * > fgPolyMarkerL
Definition: View2D.h:44
static std::list< TPolyLine * > fgPolyLineL
Definition: View2D.h:46
std::list< TPolyMarker * > fPolyMarkerL
Definition: View2D.h:55
std::list< TLatex * > fLatexL
Definition: View2D.h:61
std::list< TArc * > fArcL
Definition: View2D.h:58
std::list< TPolyLine * > fPolyLineL
Definition: View2D.h:57
static std::list< TLatex * > fgLatexL
Definition: View2D.h:50
std::list< TLine * > fLineL
Definition: View2D.h:56
static std::list< TMarker * > fgMarkerL
Definition: View2D.h:43
static std::list< TLine * > fgLineL
Definition: View2D.h:45
static std::list< TArc * > fgArcL
Definition: View2D.h:47
std::list< TText * > fTextL
Definition: View2D.h:60
std::list< TMarker * > fMarkerL
Definition: View2D.h:54
static std::list< TText * > fgTextL
Definition: View2D.h:49
void evdb::View2D::Draw ( )

Definition at line 89 of file View2D.cxx.

Referenced by evd::HeaderPad::Draw(), evd::MCBriefPad::Draw(), evd::CalorPad::Draw(), evd::TWireProjPad::Draw(), evd::Ortho3DPad::Draw(), evd::TWireProjPad::DrawLinesinView(), and evd::TWireProjPad::UpdateSeedCurve().

90  {
91  // Want to clip all of our objects inside the axis frame. Note, TBox doesn't
92  // obey this flag, have to use TBoxClipped to do it by hand. Unfortunately
93  // we have to change global state, and we can't just put it back at the end
94  // of the function, because this has to be set at Paint() time.
95  gPad->SetBit(TGraph::kClipFrame, true);
96 
97  for_each(fArcL.begin(), fArcL.end(), draw_tobject());
98  for_each(fBoxL.begin(), fBoxL.end(), draw_tobject());
99  for_each(fPolyLineL.begin(), fPolyLineL.end(), draw_tobject());
100  for_each(fLineL.begin(), fLineL.end(), draw_tobject());
101  for_each(fMarkerL.begin(), fMarkerL.end(), draw_tobject());
102  for_each(fPolyMarkerL.begin(),fPolyMarkerL.end(),draw_tobject());
103  for_each(fTextL.begin(), fTextL.end(), draw_tobject());
104  for_each(fLatexL.begin(), fLatexL.end(), draw_tobject());
105  }
std::list< TBox * > fBoxL
Definition: View2D.h:59
std::list< TPolyMarker * > fPolyMarkerL
Definition: View2D.h:55
std::list< TLatex * > fLatexL
Definition: View2D.h:61
std::list< TArc * > fArcL
Definition: View2D.h:58
std::list< TPolyLine * > fPolyLineL
Definition: View2D.h:57
std::list< TLine * > fLineL
Definition: View2D.h:56
std::list< TText * > fTextL
Definition: View2D.h:60
std::list< TMarker * > fMarkerL
Definition: View2D.h:54

Member Data Documentation

std::list<TArc*> evdb::View2D::fArcL
private

Definition at line 58 of file View2D.h.

std::list<TBox*> evdb::View2D::fBoxL
private

Definition at line 59 of file View2D.h.

std::list< TArc * > evdb::View2D::fgArcL
staticprivate

Definition at line 47 of file View2D.h.

Referenced by evdb::TBoxClipped::Paint().

std::list< TBox * > evdb::View2D::fgBoxL
staticprivate

Definition at line 48 of file View2D.h.

Referenced by evdb::TBoxClipped::Paint().

std::list< TLatex * > evdb::View2D::fgLatexL
staticprivate

Definition at line 50 of file View2D.h.

Referenced by evdb::TBoxClipped::Paint().

std::list< TLine * > evdb::View2D::fgLineL
staticprivate

Definition at line 45 of file View2D.h.

Referenced by evdb::TBoxClipped::Paint().

std::list< TMarker * > evdb::View2D::fgMarkerL
staticprivate

Definition at line 43 of file View2D.h.

Referenced by evdb::TBoxClipped::Paint().

std::list< TPolyLine * > evdb::View2D::fgPolyLineL
staticprivate

Definition at line 46 of file View2D.h.

Referenced by evdb::TBoxClipped::Paint().

std::list< TPolyMarker * > evdb::View2D::fgPolyMarkerL
staticprivate

Definition at line 44 of file View2D.h.

Referenced by evdb::TBoxClipped::Paint().

std::list< TText * > evdb::View2D::fgTextL
staticprivate

Definition at line 49 of file View2D.h.

Referenced by evdb::TBoxClipped::Paint().

std::list<TLatex*> evdb::View2D::fLatexL
private

Definition at line 61 of file View2D.h.

std::list<TLine*> evdb::View2D::fLineL
private

Definition at line 56 of file View2D.h.

std::list<TMarker*> evdb::View2D::fMarkerL
private

Definition at line 54 of file View2D.h.

std::list<TPolyLine*> evdb::View2D::fPolyLineL
private

Definition at line 57 of file View2D.h.

std::list<TPolyMarker*> evdb::View2D::fPolyMarkerL
private

Definition at line 55 of file View2D.h.

std::list<TText*> evdb::View2D::fTextL
private

Definition at line 60 of file View2D.h.


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