StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
EEmcSmdGeom.h
1 
32 #ifndef EEMCSMDGEOM_H
33 #define EEMCSMDGEOM_H
34 
35 #include <iostream>
36 
37 #include "TObject.h"
38 #include "TVector3.h"
39 #include "TString.h"
40 
41 #include "StEEmcUtil/EEmcGeom/EEmcGeomDefs.h"
42 
43 #include <vector>
44 #ifndef ST_NO_NAMESPACES
45 using std::vector;
46 using std::cout;
47 #endif
48 
50  float zPlane[kEEmcNumSmdPlanes]; // Z of planes
51  float rOffset[kEEmcNumSmdPlanes]; // radius offsets
52  float stripWidth; // width of strip
53 };
54 
56  int stripId; // strip Id 1-288 (283 for edge sector)
57  int UVId; // 1 for U and 2 for V
58  int sectorId; // sector Id 1-12
59  int planeId; // plane Id (depth) 1-3
60 };
61 
63  StructEEmcStripId stripStructId; // including 4 Ids
64  TVector3 end1; // one end of strip
65  TVector3 end2; // the other end of strip
66  float length; // length of strip
67 };
68 
69 ostream& operator<<(ostream &os, const StructEEmcStrip &strip);
70 
71 // Define vector of strip pointers and its Iterator
72 #ifndef ST_NO_TEMPLATE_DEF_ARGS
73 typedef vector<int> intVec;
74 typedef vector<StructEEmcStrip*> EEmcStripPtrVec;
75 #else
76 typedef vector<int,allocator<int>> intVec;
77 typedef vector<StructEEmcStrip*,allocator<StructEEmcStrip*>> EEmcStripPtrVec;
78 #endif
79 typedef vector<StructEEmcStrip*>::iterator EEmcStripPtrVecIter;
80 
81 
83  int sectorId;
84  int planeId;
85  float phiMin; // minimun phi
86  float phiMax; // maximum phi
87  float rMin; // minimum radius
88  float rMax; // maximum radius
89  EEmcStripPtrVec stripPtrVec;
90 };
91 
92 class EEmcSmdGeom : public TObject {
93 public:
94 
95  EEmcSmdGeom();
96  virtual ~EEmcSmdGeom();
97 
98 protected:
99 
100  StructEEmcSmdParam mEEmcSmdParam;
101  StructEEmcSmdSector mEEmcSector[kEEmcNumSmdUVs][kEEmcNumSectors];
102  EEmcStripPtrVec mStripPtrVector;
104  bool mIsSectorIn[kEEmcNumSectors];
105  int kEEmcSmdMap_iPlane[kEEmcNumSmdUVs][kEEmcNumSectors];
106 
107  void buildSmdGeom();
108 
109  static EEmcSmdGeom* sInstance;
110 
111 public:
114  const StructEEmcStrip* getDcaStripPtr(const Int_t iPlane, const TVector3& point, Float_t* dca) const;
115  const StructEEmcStrip* getDcaStripPtr(const Int_t iPlane, const Int_t iSec, const TVector3& point, Float_t* dca) const;
116 
117 
118  static EEmcSmdGeom* instance(); // handle the only instance
119  static EEmcSmdGeom* instance(intVec sectorIdVec);
120 
121  void init(); // init the dbase
122 
124  void buildStripPtrVector();
125 
127  void setSectors(const intVec sectorIdVec);
128 
130  bool IsSectorIn(const Int_t iSec) const {return mIsSectorIn[iSec];}
131 
133  StructEEmcStrip initStrip() const;
134 
136  StructEEmcSmdParam &getEEmcSmdParam() {return mEEmcSmdParam;}
137  const StructEEmcSmdParam &getEEmcSmdParam() const {return mEEmcSmdParam;}
138 
140  StructEEmcSmdSector &getEEmcSector(const Int_t iUV, const Int_t iSec) {return mEEmcSector[iUV][iSec];}
141  const StructEEmcSmdSector &getEEmcSector(const Int_t iUV, const Int_t iSec) const {return mEEmcSector[iUV][iSec];}
142 
144  Int_t getEEmcISec(const Int_t iPlane, const TVector3& point) const;
145 
147  StructEEmcStrip* getStripPtr(const Int_t iStrip, const Int_t iUV, const Int_t iSec);
148  const StructEEmcStrip* getStripPtr(const Int_t iStrip, const Int_t iUV, const Int_t iSec) const;
149 
158  const StructEEmcStrip* getDca2Strip(const Int_t iUV, const TVector3& point, Float_t* dca) const;
159 
160 
169  TVector3 getIntersection ( Int_t iSec, Int_t iUStrip, Int_t iVStrip, const TVector3 &vertex ) const;
170 
178  TVector3 getIntersection ( const StructEEmcStrip *u, const StructEEmcStrip *v, const TVector3 &vertex ) const;
179 
181  TVector3 getIntersection ( Int_t iSec, Int_t iUStrip, Int_t iVStrip ) const;
183  TVector3 getIntersection ( Int_t iSec, Float_t iUStrip, Float_t iVStrip ) const
184  { return getIntersection( iSec, (Int_t)iUStrip, (Int_t)iVStrip ); }
186  TVector3 getIntersection ( const StructEEmcStrip *u, const StructEEmcStrip *v ) const;
187 
188 
192  Int_t getNStrips ( Int_t iSec, Int_t iUV ) const { return getEEmcSector(iUV,iSec).stripPtrVec.size(); }
193 
195  bool matchStrips(const StructEEmcStripId &stripStructId1, const StructEEmcStripId &stripStructId2, Int_t nTolerance) const;
196 
197  // mehtod for C-scripts
198 
200  TVector3 getstripEnd(const StructEEmcStrip &strip, const Int_t endId) const;
201 
202  //
203  // methods of printout
204  //
205 
206  void printGeom(ostream& os = cout) const;
207  void printSector(const StructEEmcSmdSector Sector, ostream& os = cout) const;
208  void printStrip(const StructEEmcStrip Strip, ostream& os = cout) const;
209  void printStripId(const StructEEmcStripId StripId, ostream& os = cout) const;
210  //void printSectorPhis(const Int_t iPlane, const Int_t iSec,ostream& os = cout);
211 
212  ClassDef(EEmcSmdGeom,1) // STAR Endcap Electromagnetic Calorimeter SMD Geometry Class
213 };
214 
215 #endif
216 
217 /*******************************************************************
218  *
219  *
220  * $Log: EEmcSmdGeom.h,v $
221  * Revision 1.10 2010/08/26 22:48:55 ogrebeny
222  * Improved constness
223  *
224  * Revision 1.9 2007/07/12 19:30:15 fisyak
225  * Add includes for ROOT 5.16
226  *
227  * Revision 1.8 2007/02/01 13:47:39 balewski
228  * bug fix in getDca2Strip(), more methodhs are public
229  *
230  * Revision 1.7 2007/01/26 00:51:08 balewski
231  * too strong protection
232  *
233  * Revision 1.6 2007/01/25 22:33:21 balewski
234  * add:
235  * - better writeup
236  * - new simpler to use method calculating dca fo track to strip, it is just a wrapper, some approximations were used, may fail at the sector boundary
237  *
238  * Revision 1.5 2007/01/12 23:53:14 jwebb
239  * Fix applied to eliminate parralax error in the EEmcSmdGeom::getIntersection()
240  * method.
241  *
242  * Revision 1.3 2004/07/01 15:35:50 jwebb
243  * Added placeholder method getIntersection(Int_t,Float_t,Float_t). For now
244  * it just calls the getIntersection with strips converted to integers.
245  * Later we will write code to handle fractional strips.
246  *
247  * Revision 1.2 2004/02/03 22:57:54 jwebb
248  * Added StEEmcSmdGeom::instance(), which is sort of needed...
249  *
250  * Revision 1.1 2004/01/29 15:26:10 jwebb
251  * The StEEmcSmdGeom class was split into two classes. All StRoot-independent
252  * code has been moved to EEmcSmdGeom. TVector3 replaces StThreeVectorD in
253  * all function calls in EEmcSmdGeom. StThreeVectorD wrappers are provided
254  * in StEEmcSmdGeom, for integration into Star framework.
255  *
256  * Revisions:
257  *
258  * 01/28/04 Jason Webb -- Renamed to EEmcSmdGeom, StRoot dependent code moved
259  * to a derived class StEEmcSmdGeom. The user interface for StEEmcSmdGeom
260  * should remain unchanged. Revision history for StEEmcSmdGeom moved to end
261  * of header file.
262  *
263  * Log: StEEmcSmdGeom.h,v
264  * Revision 1.6 2003/12/05 00:06:11 jwebb
265  * Member function added to return a vector pointing to the intersection of
266  * two strips.
267  *
268  * Revision 1.5 2003/10/15 15:26:03 wzhang
269  * improved and reorganized
270  *
271  * Revision 1.4 2003/08/22 15:14:03 wzhang
272  * Added ClassDef and method stripEnd
273  *
274  * Revision 1.3 2003/06/11 18:58:15 wzhang
275  * added geometry methods for StiEEmc
276  *
277  * Revision 1.2 2003/04/04 15:33:31 wzhang
278  * included EEmcGeomDefs.h & improved codes
279  *
280  * Revision 1.1 2003/03/28 15:50:00 balewski
281  * first
282  *
283  *
284  ****************************************************************/
bool IsSectorIn(const Int_t iSec) const
return sector status
Definition: EEmcSmdGeom.h:130
StructEEmcSmdSector mEEmcSector[kEEmcNumSmdUVs][kEEmcNumSectors]
general geometry variables
Definition: EEmcSmdGeom.h:101
StructEEmcSmdParam & getEEmcSmdParam()
return SMD geometry parameters
Definition: EEmcSmdGeom.h:136
int kEEmcSmdMap_iPlane[kEEmcNumSmdUVs][kEEmcNumSectors]
sector status.
Definition: EEmcSmdGeom.h:105
TVector3 getIntersection(Int_t iSec, Float_t iUStrip, Float_t iVStrip) const
Assumes nominal vertex (0,0,0)
Definition: EEmcSmdGeom.h:183
Int_t getNStrips(Int_t iSec, Int_t iUV) const
Definition: EEmcSmdGeom.h:192
Int_t getEEmcISec(const Int_t iPlane, const TVector3 &point) const
return index of a sector from a point in a plane
StructEEmcSmdSector & getEEmcSector(const Int_t iUV, const Int_t iSec)
return structure-sector from iUV and iSec
Definition: EEmcSmdGeom.h:140
const StructEEmcStrip * getDcaStripPtr(const Int_t iPlane, const TVector3 &point, Float_t *dca) const
virtual ~EEmcSmdGeom()
default empty destructor
Definition: EEmcSmdGeom.cxx:62
TVector3 getstripEnd(const StructEEmcStrip &strip, const Int_t endId) const
return strip-end of 3D-vector
bool mIsSectorIn[kEEmcNumSectors]
storage for all strip pointers
Definition: EEmcSmdGeom.h:104
void printGeom(ostream &os=cout) const
printout global geometry parameters
void init()
Initialize geometry class.
Definition: EEmcSmdGeom.cxx:68
StructEEmcStrip initStrip() const
instance and initialize a strip
void printSector(const StructEEmcSmdSector Sector, ostream &os=cout) const
printout sector-specific geometry parameters
EEmcStripPtrVec mStripPtrVector
storage for all strip pointers
Definition: EEmcSmdGeom.h:103
EEmcSmdGeom()
defaulty constructor
Definition: EEmcSmdGeom.cxx:56
bool matchStrips(const StructEEmcStripId &stripStructId1, const StructEEmcStripId &stripStructId2, Int_t nTolerance) const
match two strips
void buildStripPtrVector()
build mStripPtrVector
TVector3 getIntersection(Int_t iSec, Int_t iUStrip, Int_t iVStrip, const TVector3 &vertex) const
void setSectors(const intVec sectorIdVec)
set sectors for partial EEMC
void printStrip(const StructEEmcStrip Strip, ostream &os=cout) const
printout strip-specific geometry parameters
StructEEmcStrip * getStripPtr(const Int_t iStrip, const Int_t iUV, const Int_t iSec)
return a strip pointer from indices
const StructEEmcStrip * getDca2Strip(const Int_t iUV, const TVector3 &point, Float_t *dca) const
void printStripId(const StructEEmcStripId StripId, ostream &os=cout) const
printout stripStructId