00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "Stiostream.h"
00021 #include "StEEmcSmdGeom.h"
00022 #include "PhysicalConstants.h"
00023
00024 ClassImp(StEEmcSmdGeom);
00025
00027 StEEmcSmdGeom *StEEmcSmdGeom::sInstance = 0;
00028
00029 StEEmcSmdGeom::StEEmcSmdGeom() : EEmcSmdGeom() {
00030
00031 }
00032
00033 StEEmcSmdGeom::~StEEmcSmdGeom() {
00034 delete sInstance;
00035 sInstance = 0;
00036 }
00037
00038
00039 StEEmcSmdGeom* StEEmcSmdGeom::instance() {
00040 if(!sInstance){
00041 sInstance = new StEEmcSmdGeom();
00042 sInstance->init();
00043 }
00044 return sInstance;
00045 }
00046
00047
00048
00049 StEEmcSmdGeom* StEEmcSmdGeom::instance(intVec sectorIdVec) {
00050 if(!sInstance){
00051 sInstance = new StEEmcSmdGeom();
00052 sInstance->setSectors(sectorIdVec);
00053 sInstance->init();
00054 }
00055 return sInstance;
00056 }
00057
00058
00060
00061
00062
00063 Int_t StEEmcSmdGeom::getEEmcISec(const Int_t iPlane,
00064 const StThreeVectorD& point) const {
00065
00066 const TVector3 myPoint ( point[0], point[1], point[2] );
00067 Int_t val = EEmcSmdGeom::getEEmcISec( iPlane, myPoint );
00068
00069 return val;
00070 }
00071
00073
00074
00075
00076
00077 const StructEEmcStrip*
00078 StEEmcSmdGeom::getDcaStripPtr(const Int_t iPlane,
00079 const Int_t iSec,
00080 const StThreeVectorD& point,
00081 Float_t* dca) const {
00082
00083 const TVector3 myPoint( point[0], point[1], point[2] );
00084 return EEmcSmdGeom::getDcaStripPtr( iPlane, iSec, myPoint, dca );
00085
00086 }
00087
00088 const StructEEmcStrip*
00089 StEEmcSmdGeom::getDcaStripPtr(const Int_t iPlane,
00090 StThreeVectorD& point,
00091 Float_t* dca) const {
00092
00093 TVector3 myPoint( point[0], point[1], point[2] );
00094 return EEmcSmdGeom::getDcaStripPtr( iPlane, myPoint, dca );
00095
00096 }
00097
00099
00100
00101
00102
00103
00104
00105
00106
00107 StThreeVectorD StEEmcSmdGeom::getIntersection ( Int_t iSec,
00108 Int_t iUStrip,
00109 Int_t iVStrip ) const {
00110
00111 TVector3 myPoint = EEmcSmdGeom::getIntersection(iSec,iUStrip,iVStrip);
00112 StThreeVectorD point = StThreeVectorD( myPoint[0], myPoint[1], myPoint[2] );
00113 return point;
00114
00115 }
00116
00117 StThreeVectorD StEEmcSmdGeom::getIntersection ( const StructEEmcStrip *u,
00118 const StructEEmcStrip *v ) const {
00119
00120 TVector3 myPoint = EEmcSmdGeom::getIntersection(u,v);
00121 StThreeVectorD point = StThreeVectorD( myPoint[0], myPoint[1], myPoint[2] );
00122 return point;
00123
00124 }
00125
00127
00128 StThreeVectorD StEEmcSmdGeom::getstripEnd( const StructEEmcStrip &strip,
00129 const Int_t endId ) const {
00130
00131 TVector3 myPoint = EEmcSmdGeom::getstripEnd( strip, endId );
00132 return StThreeVectorD( myPoint[0], myPoint[1], myPoint[2] );
00133
00134 }
00135
00137
00138
00139
00140
00141 pairD StEEmcSmdGeom::getEEmcSmdPhiMinMax(const Int_t iPlane, const Int_t iSec) const
00142 {
00143 pairD phiMinMax;
00144 float phiMin, phiMax;
00145
00146 int iUV, antiClockIUV, clockIUV;
00147 int antiClockISec, clockISec;
00148
00149 iUV = kEEmcSmdMapUV[iPlane][iSec];
00150
00151 if(iUV >= 0) {
00152 phiMin = getEEmcSector(iUV, iSec).phiMin;
00153 phiMax = getEEmcSector(iUV, iSec).phiMax;
00154 }
00155 else {
00156
00157 if(iSec != 0) antiClockISec = iSec - 1;
00158 else antiClockISec = 11;
00159 antiClockIUV = kEEmcSmdMapUV[iPlane][antiClockISec];
00160
00161 phiMax = getEEmcSector(antiClockIUV,antiClockISec).phiMin;
00162
00163 if(iSec != 11) clockISec = iSec + 1;
00164 else clockISec = 0;
00165 clockIUV = kEEmcSmdMapUV[iPlane][clockISec];
00166 phiMin=getEEmcSector(clockIUV,clockISec).phiMax;
00167 }
00168 phiMinMax.first = (double) phiMin;
00169 phiMinMax.second = (double) phiMax;
00170
00171 return phiMinMax;
00172 }
00173
00174
00175
00176
00177 float StEEmcSmdGeom::getEEmcSmdDelPhi(const Int_t iPlane, const Int_t iSec) const
00178 {
00179 float delPhi;
00180 pairD phiMinMax = getEEmcSmdPhiMinMax(iPlane, iSec);
00181 delPhi = (float) phiMinMax.second - (float)phiMinMax.first;
00182 if(iSec == kEEmcSmdSectorIdPhiCrossPi - 1) delPhi = 2*pi + delPhi;
00183
00184 return delPhi;
00185 }
00186
00187
00188
00189
00190 float StEEmcSmdGeom::getEEmcSmdCenterPhi(const Int_t iPlane,
00191 const Int_t iSec) const
00192 {
00193 float centerPhi;
00194 pairD phiMinMax = getEEmcSmdPhiMinMax(iPlane, iSec);
00195 centerPhi = 0.5*((float) phiMinMax.second + (float)phiMinMax.first);
00196 if(iSec == kEEmcSmdSectorIdPhiCrossPi - 1) {
00197 if(centerPhi <= 0) centerPhi= M_PI + centerPhi;
00198 else centerPhi = M_PI - centerPhi;
00199 }
00200
00201 return centerPhi;
00202 }
00203
00205
00206 void StEEmcSmdGeom::printSectorPhis(const Int_t iPlane, const Int_t iSec,
00207 ostream& os ) const {
00208 int iUV;
00209 iUV = kEEmcSmdMapUV[iPlane][iSec];
00210
00211 os << "------EEmcSmdGeom::printPhis()------" << endl;
00212 os << " planeId = " << iPlane + 1 << " sectorId = " << iSec + 1 << endl;
00213 if(iUV >= 0)
00214 os << " " << kEEmcSmdUVChar[iUV] << " Sector" << endl;
00215 else
00216 os << " Empty" << endl;
00217 os << " delPhi = " << getEEmcSmdDelPhi(iPlane, iSec)/degree <<
00218 " " << "centerPhi = " << getEEmcSmdCenterPhi(iPlane, iSec)/degree
00219 << endl;
00220
00221 }