00001
00032 #ifndef EEMCSMDGEOM_H
00033 #define EEMCSMDGEOM_H
00034
00035 #include <iostream>
00036
00037 #include "TObject.h"
00038 #include "TVector3.h"
00039 #include "TString.h"
00040
00041 #include "StEEmcUtil/EEmcGeom/EEmcGeomDefs.h"
00042
00043 #include <vector>
00044 #ifndef ST_NO_NAMESPACES
00045 using std::vector;
00046 using std::cout;
00047 #endif
00048
00049 struct StructEEmcSmdParam {
00050 float zPlane[kEEmcNumSmdPlanes];
00051 float rOffset[kEEmcNumSmdPlanes];
00052 float stripWidth;
00053 };
00054
00055 struct StructEEmcStripId{
00056 int stripId;
00057 int UVId;
00058 int sectorId;
00059 int planeId;
00060 };
00061
00062 struct StructEEmcStrip{
00063 StructEEmcStripId stripStructId;
00064 TVector3 end1;
00065 TVector3 end2;
00066 float length;
00067 };
00068
00069 ostream& operator<<(ostream &os, const StructEEmcStrip &strip);
00070
00071
00072 #ifndef ST_NO_TEMPLATE_DEF_ARGS
00073 typedef vector<int> intVec;
00074 typedef vector<StructEEmcStrip*> EEmcStripPtrVec;
00075 #else
00076 typedef vector<int,allocator<int>> intVec;
00077 typedef vector<StructEEmcStrip*,allocator<StructEEmcStrip*>> EEmcStripPtrVec;
00078 #endif
00079 typedef vector<StructEEmcStrip*>::iterator EEmcStripPtrVecIter;
00080
00081
00082 struct StructEEmcSmdSector {
00083 int sectorId;
00084 int planeId;
00085 float phiMin;
00086 float phiMax;
00087 float rMin;
00088 float rMax;
00089 EEmcStripPtrVec stripPtrVec;
00090 };
00091
00092 class EEmcSmdGeom : public TObject {
00093 public:
00094
00095 EEmcSmdGeom();
00096 virtual ~EEmcSmdGeom();
00097
00098 protected:
00099
00100 StructEEmcSmdParam mEEmcSmdParam;
00101 StructEEmcSmdSector mEEmcSector[kEEmcNumSmdUVs][kEEmcNumSectors];
00102
00103 EEmcStripPtrVec mStripPtrVector;
00104 bool mIsSectorIn[kEEmcNumSectors];
00105 int kEEmcSmdMap_iPlane[kEEmcNumSmdUVs][kEEmcNumSectors];
00106
00107 void buildSmdGeom();
00108
00109 static EEmcSmdGeom* sInstance;
00110
00111 public:
00114 const StructEEmcStrip* getDcaStripPtr(const Int_t iPlane, const TVector3& point, Float_t* dca) const;
00115 const StructEEmcStrip* getDcaStripPtr(const Int_t iPlane, const Int_t iSec, const TVector3& point, Float_t* dca) const;
00116
00117
00118 static EEmcSmdGeom* instance();
00119 static EEmcSmdGeom* instance(intVec sectorIdVec);
00120
00121 void init();
00122
00124 void buildStripPtrVector();
00125
00127 void setSectors(const intVec sectorIdVec);
00128
00130 bool IsSectorIn(const Int_t iSec) const {return mIsSectorIn[iSec];}
00131
00133 StructEEmcStrip initStrip() const;
00134
00136 StructEEmcSmdParam &getEEmcSmdParam() {return mEEmcSmdParam;}
00137 const StructEEmcSmdParam &getEEmcSmdParam() const {return mEEmcSmdParam;}
00138
00140 StructEEmcSmdSector &getEEmcSector(const Int_t iUV, const Int_t iSec) {return mEEmcSector[iUV][iSec];}
00141 const StructEEmcSmdSector &getEEmcSector(const Int_t iUV, const Int_t iSec) const {return mEEmcSector[iUV][iSec];}
00142
00144 Int_t getEEmcISec(const Int_t iPlane, const TVector3& point) const;
00145
00147 StructEEmcStrip* getStripPtr(const Int_t iStrip, const Int_t iUV, const Int_t iSec);
00148 const StructEEmcStrip* getStripPtr(const Int_t iStrip, const Int_t iUV, const Int_t iSec) const;
00149
00158 const StructEEmcStrip* getDca2Strip(const Int_t iUV, const TVector3& point, Float_t* dca) const;
00159
00160
00169 TVector3 getIntersection ( Int_t iSec, Int_t iUStrip, Int_t iVStrip, const TVector3 &vertex ) const;
00170
00178 TVector3 getIntersection ( const StructEEmcStrip *u, const StructEEmcStrip *v, const TVector3 &vertex ) const;
00179
00181 TVector3 getIntersection ( Int_t iSec, Int_t iUStrip, Int_t iVStrip ) const;
00183 TVector3 getIntersection ( Int_t iSec, Float_t iUStrip, Float_t iVStrip ) const
00184 { return getIntersection( iSec, (Int_t)iUStrip, (Int_t)iVStrip ); }
00186 TVector3 getIntersection ( const StructEEmcStrip *u, const StructEEmcStrip *v ) const;
00187
00188
00192 Int_t getNStrips ( Int_t iSec, Int_t iUV ) const { return getEEmcSector(iUV,iSec).stripPtrVec.size(); }
00193
00195 bool matchStrips(const StructEEmcStripId &stripStructId1, const StructEEmcStripId &stripStructId2, Int_t nTolerance) const;
00196
00197
00198
00200 TVector3 getstripEnd(const StructEEmcStrip &strip, const Int_t endId) const;
00201
00202
00203
00204
00205
00206 void printGeom(ostream& os = cout) const;
00207 void printSector(const StructEEmcSmdSector Sector, ostream& os = cout) const;
00208 void printStrip(const StructEEmcStrip Strip, ostream& os = cout) const;
00209 void printStripId(const StructEEmcStripId StripId, ostream& os = cout) const;
00210
00211
00212 ClassDef(EEmcSmdGeom,1)
00213 };
00214
00215 #endif
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284