BBQ
vistpc.h
Go to the documentation of this file.
1 #ifndef __VISTPC_H__
2 #define __VISTPC_H__
3 
4 #include "TBBQManager.h"
5 
6 // C++
7 
8 #include <map>
9 #include <string>
10 #include <vector>
11 
12 // ROOT
13 
14 class TGeoMaterial;
15 class TGeoMedium;
16 class TGeoVolume;
17 
18 // Eve
19 
20 class TEveBoxSet;
21 class TEveElement;
22 class TEvePointSet;
23 class TEveQuadSet;
24 class TEveStraightLineSet;
25 
26 // GEAR
27 
28 namespace gear {
29  class GearMgr;
30  class TPCModule;
31  class TPCParameters;
32 }
33 
34 #ifndef __CINT__
35 #include "gearimpl/Vectors.h"
36 #else
37 namespace gear {
38  class Vector2D;
39 }
40 #endif
41 
42 // LCIO
43 
44 #include "EVENT/TrackerHit.h"
45 
46 namespace EVENT {
47  class LCEvent;
48  class TrackerHit;
49 }
50 
51 namespace IMPL {
52  class LCCollectionVec;
53 }
54 
65 class VisTPC {
66 public:
67 
68  //---------------------------------------------------------------------------
69  // Data types and structures
70 
76  };
77 
87  };
88 
112  struct PadMetric {
114 
115  float height;
116  float width;
117 
118  float center_x;
119  float center_y;
120 
121  float center_r;
122  float center_phi;
123 
124  float corners_polar[8];
126  };
127 
128  //---------------------------------------------------------------------------
129  // Constructor
130 
131  VisTPC(gear::GearMgr * aGearMgr = 0);
132  ~VisTPC() {};
133 
134  //---------------------------------------------------------------------------
136 
138 
140  float getDriftVelocity() {return driftVelocity;}
142  int getMaxPoints() {return maxPoints;}
143  int getOption(std::string& option) {
144  std::map<std::string, int>::iterator it = options.find(option);
145 
146  if (it == options.end())
147  throw "Option not found";
148 
149  return options[option];
150  }
151 
152  void setReadoutFrequency(float frequency) {readoutFrequency = frequency;}
153  void setDriftVelocity(float velocity) {driftVelocity = velocity;}
154  void setMaxDriftLength(float length) {maxDriftLength = length;}
155  void setMaxPoints(int points) {maxPoints = points;}
156  void setOption(std::string option, int value) {options[option] = value;}
157 
159 
160  //---------------------------------------------------------------------------
172 
173  void drawTPC();
174 
175  void drawModule(gear::TPCModule* aModule, TEveElement* parent = NULL);
176  void drawModules(TEveElement* parent = NULL);
177 
178  void drawPads(gear::TPCModule* aModule, TEveElement* parent = NULL);
179 
181 
182  //---------------------------------------------------------------------------
200 
201  void drawEvent(EVENT::LCEvent* event, std::vector<std::string> &selectedEntries, TEveElement* parent = NULL, const char* name = "Event");
202  void drawEvent(EVENT::LCEvent* event, TList &selectedEntries, TEveElement* parent = NULL, const char* name = "Event");
203  void drawHit(EVENT::TrackerHit* hit, TEvePointSet* parent, int wantTooltip = false);
204  TEveElement* drawHits(IMPL::LCCollectionVec* hits, int wantTooltip = true);
205  TEveElement* drawHits(const EVENT::TrackerHitVec& hits, int wantTooltip = true);
206  TEveElement* drawPulses(IMPL::LCCollectionVec* pulses);
207  TEveElement* drawTracks(IMPL::LCCollectionVec* tracks, TEveElement* parent = NULL);
208 
210 
211  //---------------------------------------------------------------------------
219 
220  void drawCircularPolygon(TEveStraightLineSet* ls, float r, int nDivisions, float z);
221  void drawCircularPolygon(TEveStraightLineSet* ls, float r, float phi_min, float phi_max, int nDivisions, float z);
222 
223  void drawPadBox(const PadMetric& pad, float z_front, float z_back, TEveBoxSet* bs);
224  void drawPadQuad(const PadMetric& pad, float z, TEveQuadSet* qs);
225 
226  const LCCollectionType_enum getCollectionType(const std::string&);
227 
233  void getGlobalPadMetric(const gear::TPCModule * aModule, const int padIndex, PadMetric& pad);
234 
240  void getLocalPadMetric(const gear::TPCModule * aModule, const int padIndex, PadMetric& pad);
241 
248  void toGlobal(const gear::TPCModule * aModule, TEveElement* element);
249 
251 
252  //---------------------------------------------------------------------------
260 
261  void drawTwoConnectingPads(const gear::TPCModule& aModule, TEveElement* parent, int pad1, int pad2, LeftRight_enum leftright);
262  void drawNearestPad(const gear::TPCModule& aModule, TEveElement* parent, int padIndex, const gear::Vector2D& position, int i);
263 
264  void testLeftRightNeighbour(int moduleID = 0);
265  void testLeftRightNeighbourWithPads(int moduleID, const std::vector<int>& pads, LeftRight_enum leftright);
266 
267  void testNearestPad(int moduleID = 0);
268  void testNearestPadWithPoints(int moduleID, const std::vector<gear::Vector2D>& points);
269 
270  void testNearestPadGlobal();
271  void testNearestPadGlobalWithPoints(const std::vector<gear::Vector2D>& points);
272 
274 
276  void updateGearMgr( gear::GearMgr * aGearMgr );
277 
278  //---------------------------------------------------------------------------
279  // Variables
280 protected:
281 
282  int debug;
283 
285 
286 
287  gear::GearMgr * gearMgr;
288  gear::TPCParameters const * tpcParameters;
289 
291 
297 
298  std::map<std::string, TGeoMaterial*> materials;
299  std::map<std::string, TGeoMedium*> media;
300  std::map<std::string, TGeoVolume*> volumes;
301 
303 
310 
313 
322 
324 
330 
331  std::map<std::string, int> options;
332 
334 
336 
339 
340 private:
341  ClassDef(VisTPC, 1);
342 };
343 
344 #endif
void drawModule(gear::TPCModule *aModule, TEveElement *parent=NULL)
Definition: vistpc.cxx:403
TEveElement * drawTracks(IMPL::LCCollectionVec *tracks, TEveElement *parent=NULL)
Definition: vistpc.cxx:1254
float driftVelocity
Definition: vistpc.h:312
void testNearestPadGlobal()
Definition: vistpc.cxx:2057
void drawPadBox(const PadMetric &pad, float z_front, float z_back, TEveBoxSet *bs)
Definition: vistpc.cxx:730
std::map< std::string, TGeoMedium * > media
Definition: vistpc.h:299
void toGlobal(const gear::TPCModule *aModule, TEveElement *element)
Transform a TEveElement to the global coordinate system of the detector using OpenGL matrix transform...
Definition: vistpc.cxx:2134
void setMaxPoints(int points)
Definition: vistpc.h:155
TEveElement * drawHits(IMPL::LCCollectionVec *hits, int wantTooltip=true)
Definition: vistpc.cxx:341
int maxPoints
Definition: vistpc.h:335
~VisTPC()
Definition: vistpc.h:132
void drawPadQuad(const PadMetric &pad, float z, TEveQuadSet *qs)
Definition: vistpc.cxx:776
void drawNearestPad(const gear::TPCModule &aModule, TEveElement *parent, int padIndex, const gear::Vector2D &position, int i)
Definition: vistpc.cxx:613
int coordinate_system
Definition: vistpc.h:113
Main visualization class. It is used to draw GEAR detector geometries and LCIO data. It is a self-contained class that depends only on ROOT, TEve, GEAR and LCIO. This means you can use this class outside and independent of BBQ.
Definition: vistpc.h:65
The PadMetric is used for holding the geometric properties of a pad.
Definition: vistpc.h:112
float center_r
Definition: vistpc.h:121
float corners_cartesian[8]
Definition: vistpc.h:125
float getDriftVelocity()
Definition: vistpc.h:140
float center_y
Definition: vistpc.h:119
void testLeftRightNeighbour(int moduleID=0)
Definition: vistpc.cxx:1773
int getMaxPoints()
Definition: vistpc.h:142
void setMaxDriftLength(float length)
Definition: vistpc.h:154
LCCollectionType_enum
Definition: vistpc.h:71
void drawTPC()
Definition: vistpc.cxx:1220
void testNearestPad(int moduleID=0)
Definition: vistpc.cxx:1929
LeftRight_enum
Definition: vistpc.h:84
std::map< std::string, int > options
Definition: vistpc.h:331
float maxDriftLength
This is used for the z-position of the endcap/modules.
Definition: vistpc.h:321
float center_x
Definition: vistpc.h:118
void setDriftVelocity(float velocity)
Definition: vistpc.h:153
void drawCircularPolygon(TEveStraightLineSet *ls, float r, int nDivisions, float z)
Definition: vistpc.cxx:108
void drawTwoConnectingPads(const gear::TPCModule &aModule, TEveElement *parent, int pad1, int pad2, LeftRight_enum leftright)
Definition: vistpc.cxx:1522
std::map< std::string, TGeoMaterial * > materials
Definition: vistpc.h:298
float outerFieldCageRadius
Radius of the outer field cage cylinder.
Definition: vistpc.h:337
TEveElement * drawPulses(IMPL::LCCollectionVec *pulses)
Definition: vistpc.cxx:1000
float center_phi
Definition: vistpc.h:122
void updateGearMgr(gear::GearMgr *aGearMgr)
A function to update the vistpc with information from a new gear file.
Definition: vistpc.cxx:2164
std::map< std::string, TGeoVolume * > volumes
Definition: vistpc.h:300
void getGlobalPadMetric(const gear::TPCModule *aModule, const int padIndex, PadMetric &pad)
Get the pad geometric properties in the global coordinate system of the detector. ...
Definition: vistpc.cxx:1705
VisTPC(gear::GearMgr *aGearMgr=0)
Definition: vistpc.cxx:78
ClassDef(VisTPC, 1)
void testNearestPadGlobalWithPoints(const std::vector< gear::Vector2D > &points)
Definition: vistpc.cxx:2102
const LCCollectionType_enum getCollectionType(const std::string &)
Definition: vistpc.cxx:1605
void drawModules(TEveElement *parent=NULL)
Definition: vistpc.cxx:556
gear::TPCParameters const * tpcParameters
Definition: vistpc.h:288
void testLeftRightNeighbourWithPads(int moduleID, const std::vector< int > &pads, LeftRight_enum leftright)
Definition: vistpc.cxx:1806
float innerFieldCageRadius
Radius of the inner field cage cylinder.
Definition: vistpc.h:338
int getOption(std::string &option)
Definition: vistpc.h:143
float readoutFrequency
Definition: vistpc.h:311
void getLocalPadMetric(const gear::TPCModule *aModule, const int padIndex, PadMetric &pad)
Get the pad geometric properties in the local coordinate system of the module.
Definition: vistpc.cxx:1613
void drawHit(EVENT::TrackerHit *hit, TEvePointSet *parent, int wantTooltip=false)
Definition: vistpc.cxx:270
float corners_polar[8]
Definition: vistpc.h:124
float getMaxDriftLength()
Definition: vistpc.h:141
float getReadoutFrequency()
Definition: vistpc.h:139
void drawEvent(EVENT::LCEvent *event, std::vector< std::string > &selectedEntries, TEveElement *parent=NULL, const char *name="Event")
Definition: vistpc.cxx:161
void setOption(std::string option, int value)
Definition: vistpc.h:156
void setReadoutFrequency(float frequency)
Definition: vistpc.h:152
gear::GearMgr * gearMgr
Definition: vistpc.h:287
void drawPads(gear::TPCModule *aModule, TEveElement *parent=NULL)
Definition: vistpc.cxx:802
void testNearestPadWithPoints(int moduleID, const std::vector< gear::Vector2D > &points)
Definition: vistpc.cxx:2024
int debug
Definition: vistpc.h:282