00001
00002 #include "StThreeVectorF.hh"
00003 #include "StEvent/StTpcHit.h"
00004 #include "TMath.h"
00005
00006
00007
00008
00009
00010
00011 int TpcLocalTransform(StThreeVectorD& aPoint, int& aSector, int& aRow,
00012 float& aU, double& aPhi){
00013 static int tNPadAtRow[45]={
00014 88,96,104,112,118,126,134,142,150,158,166,174,182,
00015 98,100,102,104,106,106,108,110,112,112,114,116,118,120,122,122,
00016 124,126,128,128,130,132,134,136,138,138,140,142,144,144,144,144};
00017 static double tSectToPhi[24]={2.,1.,0.,11.,10.,9.,8. ,7. ,6.,5.,4.,3.,
00018 4.,5.,6., 7., 8.,9.,10.,11.,0.,1.,2.,3.};
00019
00020
00021 static double tPadWidthInner = 0.335;
00022 static double tPadWidthOuter = 0.67;
00023
00024 static double tPi = TMath::Pi();
00025
00026 aPhi = aPoint.phi();
00027 if(aPhi<0.) aPhi+=(2*tPi);
00028 aPhi += tPi/12.;
00029 if(aPhi>2*tPi) aPhi-=2*tPi;
00030 int tiPhi = (int) (aPhi/tPi*6.);
00031 if(aPoint.z()<0) {
00032 aSector = (tiPhi<3)? 3-tiPhi : 15-tiPhi;
00033 }
00034 else{
00035 aSector = (tiPhi<4)? 21+tiPhi : 9+tiPhi;
00036 }
00037 aPhi = tSectToPhi[aSector-1]*tPi/6.;
00038
00039
00040
00041
00042
00043
00044 float tR = aPoint.x()*cos(aPhi)+aPoint.y()*sin(aPhi);
00045 aU = -aPoint.x()*sin(aPhi)+aPoint.y()*cos(aPhi);
00046
00047
00048 if(tR<57.6) {
00049 aRow = 0;
00050 return 1;
00051 }
00052 float radmax = 62.4;
00053 float spacing= 4.8;
00054 aRow=1;
00055 while(tR>radmax && aRow<46){
00056 aRow++;
00057 if(aRow==8){
00058 radmax = 96.2;
00059 spacing = 5.2;
00060 }
00061 else{
00062 if (aRow==13){
00063 radmax = 126.195;
00064 spacing = 2.0;
00065 }
00066 else{
00067 radmax+=spacing;
00068 }
00069 }
00070 }
00071 if(aRow>45){
00072
00073 return 2;
00074 }
00075
00076
00077 double tPadWidth = aRow<14? tPadWidthInner : tPadWidthOuter;
00078 if(fabs(aU) > tNPadAtRow[aRow-1]*tPadWidth/2.){
00079 return 3;
00080 }
00081
00082 return 0;
00083 }
00084
00085
00086
00087
00088
00089