18 #include "StTpcDb/StTpcDb.h"
19 #include "StSvtCoordinateTransform.hh"
20 #include "StCoordinates.hh"
21 #include "StGlobals.hh"
22 #include "StMessMgr.h"
23 #include "StSvtClassLibrary/StSvtConfig.hh"
24 #include "StSvtClassLibrary/StSvtGeometry.hh"
25 #include "StSvtClassLibrary/StSvtWaferGeometry.hh"
26 #include "StSvtClassLibrary/StSvtHybridCollection.hh"
27 #include "StSvtClassLibrary/StSvtHybridDriftVelocity.hh"
28 #include "StSvtClassLibrary/StSvtHybridDriftCurve.hh"
29 #include "StSvtClassLibrary/StSvtT0.hh"
34 #include "St_svtCorrectionC.h"
35 #include "St_svtHybridDriftVelocityC.h"
36 #if defined (__SUNPRO_CC) && __SUNPRO_CC >= 0x500
37 using namespace units;
39 static Int_t _debug = 0;
42 StSvtCoordinateTransform::StSvtCoordinateTransform() {
45 mDeltaDriftVelocity = 1;
46 mPoly9 =
new TF1(
"mPoly9",
"pol9(0)",0.0,6.0);
51 StSvtCoordinateTransform::StSvtCoordinateTransform(
StTpcDb* ) {
57 StSvtCoordinateTransform::~StSvtCoordinateTransform()
60 if (mFlag&1)
delete mgeom; mgeom=0;
64 void StSvtCoordinateTransform::setParamPointers( srs_srspar_st* param,
80 void StSvtCoordinateTransform::setParamPointers( srs_srspar_st* param,
99 void StSvtCoordinateTransform::setVelocityScale(
double deltaV){
101 mDeltaDriftVelocity = deltaV;
104 void StSvtCoordinateTransform::setParamPointers(
StSvtGeometry* geom,
117 void StSvtCoordinateTransform::setParamPointers(
StSvtGeometry* geom,
132 void StSvtCoordinateTransform::setParamPointers(
StSvtGeometry* geom,
143 mdriftVelCorr = driftVelCorr;
155 this->operator()(a,b);
156 this->operator()(b,c);
171 this->operator()(a,b, Id);
173 this->operator()(b,c);
183 b.setLayer(a.layer());
184 b.setLadder(a.ladder());
185 b.setWafer(a.wafer());
186 b.setHybrid(a.hybrid());
189 b.setPosition(
StThreeVector<double>(d->CalcU(a.barrel(),a.ladder(),a.wafer(),a.hybrid(),a.timebucket(),a.anode()),
190 d->CalcV(a.hybrid(),a.anode()),
203 b.setLayer(a.layer());
204 b.setLadder(a.ladder());
205 b.setWafer(a.wafer());
206 b.setHybrid(a.hybrid());
210 b.setTimeBucket(-99);
213 b.setTimeBucket(d->UnCalcU(b.barrel(),b.ladder(),b.wafer(),b.hybrid(),a.position().x()));
214 b.setAnode(d->UnCalcV(b.hybrid(),a.position().y()));
228 LocaltoGlobal(a, x, -1);
243 Int_t layer = (
id/1000);
245 Int_t ladder =
id%100;
246 Int_t wafer = (
id - 1000*layer)/100;
250 GlobaltoLocal( a.position(), b, Id, -1);
252 if( b.position().x() < 0) b.setHybrid(1);
285 index = mgeom->getWaferIndex(mgeom->getBarrelID(a.layer(),a.ladder()),(
int)a.ladder(),(int)a.wafer());
289 if (index >= 0 && index < 216)
297 if (_debug) waferGeom->print();
299 Double_t xl[3] = {a.position().x(), a.position().y(), a.position().z()};
300 if (_debug) cout <<
"xl \t" << xl[0] <<
"\t" << xl[1] <<
"\t" << xl[2] << endl;
302 waferGeom->LocalToMaster(xl,xg);
303 if (_debug) cout <<
"xg \t" << xg[0] <<
"\t" << xg[1] <<
"\t" << xg[2] << endl;
304 x.setX(xg[0]); x.setY(xg[1]); x.setZ(xg[2]);
305 if (_debug) cout <<
"x \t" << x.x() <<
"\t" << x.y() <<
"\t" << x.z() << endl;
346 index = mgeom->getWaferIndex(HardWarePos%10000);
349 if (index >= 0 && index<216)
354 b.position().setX(-999);
355 b.position().setY(-999);
356 b.position().setZ(-999);
369 Double_t xg[3] = {x.x(), x.y(), x.z()};
371 if (_debug) waferGeom->print();
372 if (_debug) cout <<
"xg \t" << xg[0] <<
"\t" << xg[1] <<
"\t" << xg[2] << endl;
374 waferGeom->MasterToLocal(xg,xl);
375 if (_debug) cout <<
"xl \t" << xl[0] <<
"\t" << xl[1] <<
"\t" << xl[2] << endl;
376 b.position().setX(xl[0]); b.position().setY(xl[1]); b.position().setZ(xl[2]);
377 if (_debug) cout <<
"x \t" << b.position().x() <<
"\t" << b.position().y() <<
"\t" << b.position().z() << endl;
396 GlobaltoLocal(GlobalPosition, LocalPosition, HardWarePos, -1);
398 return (fabs(LocalPosition.position().y()) <3.1525)? 1:0;
410 GlobaltoLocal(GlobalPosition, LocalPosition, HardWarePos, -1);
413 if( fabs(LocalPosition.position().x()) < 3.1525 &&
414 fabs(LocalPosition.position().z()) < 0.15 )
return 1;