Functors.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // $Id: Functors.h,v 1.1.1.1 2010-12-22 16:18:52 p-nusoftart Exp $
3 //
4 // Define a set of useful functions for managing lists of drawable
5 // objects
6 //
7 // messier@indiana.edu
8 ////////////////////////////////////////////////////////////////////////
9 #ifndef EVDFUNCTORS_H
10 #define EVDFUNCTORS_H
11 #include "TObject.h"
12 #include "TMarker.h"
13 #include "TPolyMarker.h"
14 #include "TLine.h"
15 #include "TPolyLine.h"
16 #include "TArc.h"
17 #include "TBox.h"
18 #include "TMarker3DBox.h"
19 #include "TPolyMarker3D.h"
20 #include "TPolyLine3D.h"
21 #include "TText.h"
22 #include "TLatex.h"
23 
24 #include <iostream>
25 
26 struct draw_tobject {
27  void operator()(TObject* x) {
28  // Do not draw poly lines if they have no points. Otherwise ROOT crashes
29  if (dynamic_cast<TPolyLine*>(x)) {
30  if (dynamic_cast<TPolyLine*>(x)->GetN() < 2) return;
31  }
32  else if (dynamic_cast<TPolyLine3D*>(x)) {
33  if (dynamic_cast<TPolyLine3D*>(x)->GetN() < 2) return;
34  }
35 
36  x->Draw();
37  }
38 };
39 
40 struct delete_marker {void operator()(TMarker* x) { delete x; }};
41 struct delete_polymarker {void operator()(TPolyMarker* x) { delete x; }};
42 struct delete_line {void operator()(TLine* x) { delete x; }};
43 struct delete_polyline {void operator()(TPolyLine* x) { delete x; }};
44 struct delete_arc {void operator()(TArc* x) { delete x; }};
45 struct delete_box {void operator()(TBox* x) { delete x; }};
46 struct delete_text {void operator()(TText* x) { delete x; }};
47 struct delete_latex {void operator()(TLatex* x) { delete x; }};
48 
49 struct delete_marker3dbox {void operator()(TMarker3DBox* x) {delete x;}};
50 struct delete_polymarker3d{void operator()(TPolyMarker3D* x){delete x;}};
51 struct delete_polyline3d {void operator()(TPolyLine3D* x) {delete x;}};
52 
53 #endif
54 ////////////////////////////////////////////////////////////////////////
void operator()(TMarker3DBox *x)
Definition: Functors.h:49
void operator()(TLine *x)
Definition: Functors.h:42
void operator()(TPolyMarker *x)
Definition: Functors.h:41
void operator()(TArc *x)
Definition: Functors.h:44
void operator()(TObject *x)
Definition: Functors.h:27
void operator()(TText *x)
Definition: Functors.h:46
void operator()(TBox *x)
Definition: Functors.h:45
void operator()(TPolyLine *x)
Definition: Functors.h:43
void operator()(TPolyMarker3D *x)
Definition: Functors.h:50
void operator()(TMarker *x)
Definition: Functors.h:40
list x
Definition: train.py:276
void operator()(TPolyLine3D *x)
Definition: Functors.h:51
void operator()(TLatex *x)
Definition: Functors.h:47