StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StiDetPolygon.h
1 //StiDetPolygon.h
2 //M.L. Miller (Yale Software)
3 //06/01
4 
5 /*
6  StiDetPolygon is derived from StiPolygon and is meant to represent an easily navigable geometrical
7  representation of a generic "cylindrical" collider detector. That is, it preserves the genreal cylindrical
8  symmetry of the detector while allowing for detector planes assembled in polygons. Navigation is meant
9  to preceed by stepping from one polygon to the other.
10 
11  Each polygon has n-sides, and each side will hold a pointer to a detector object. Therefore, navigation
12  can proceed without any information about the detector itself
13 
14  BEWARE!!! StiDetPolygon is derived from a concrete base class (generally this is a poor design), so don't push it too far!
15 
16 */
17 
18 #ifndef StiDetPolygon_HH
19 #define StiDetPolygon_HH
20 
21 #include <map>
22 #include "StiPolygon.h"
23 
24 using std::map;
25 using std::multimap;
26 
27 class StiDetector;
28 class StiDetPolygonSide;
29 
30 class StiDetPolygon : public StiPolygon
31 {
32 public:
33 
34  //typedef multimap<unsigned int, StiDetector*> det_polygon_map;
35  typedef multimap<unsigned int, StiDetPolygonSide*> det_polygon_map;
36  typedef det_polygon_map::value_type det_polygon_map_ValType;
37 
38  StiDetPolygon();
39  StiDetPolygon(unsigned int nsides, double phi0, double r);
40  virtual ~StiDetPolygon();
41 
42  //Access
43 
44  //Number of detectors
45  unsigned int numberOfDetectors() const;
46 
47  //Does each side have a detector associated with it?
48  bool isValid() const;
49 
50  //Add a detector to the polygon
51  void push_back(StiDetector*);
52 
53  void clear();
54  void clearAndDestroy();
55  void reset();
56 
57  //Dereference cerrent iterator
58  StiDetector* operator*() const;
59 
60  //Set iterator to position closest to this angle
61  void setToAngle(double angle);
62 
63  //return pointer to detector for a given side
64  StiDetector* detector(unsigned int side) const;
65 
66  //return pointer to detector closest to this angle
67  StiDetector* detector(double angle) const;
68 
69  //Navigation
70 
71  //iterate through side container
72 
73  //Move plus in phi
74  void operator++();
75  //Move minus in phi
76  void operator--();
77 
78 
79  //Utility
80  unsigned int side(double angle, bool debug=false) const;
81 
82  void print() const; //stream msidemap
83 
84 protected:
85  det_polygon_map msidemap;
86  det_polygon_map::const_iterator mcurrent;
87 
88 private:
89 
90 };
91 
92 #endif