140 #include "StMessMgr.h"
142 #include "StDetectorDbMaker/St_tpcPadConfigC.h"
143 #include "StDetectorDbMaker/St_tpcWirePlanesC.h"
144 #include "StDetectorDbMaker/St_tpcDimensionsC.h"
145 #include "StDetectorDbMaker/St_tpcElectronicsC.h"
146 #include "StDetectorDbMaker/St_tpcSlowControlSimC.h"
147 #include "StDetectorDbMaker/St_tpcGlobalPositionC.h"
148 #include "StDetectorDbMaker/St_tpcSectorPositionC.h"
149 #include "StDetectorDbMaker/St_tpcFieldCageC.h"
150 #include "StDetectorDbMaker/St_tpcPedestalC.h"
151 #include "StDetectorDbMaker/St_tpcPadResponseC.h"
152 #include "StDetectorDbMaker/St_tpcPadGainT0BC.h"
153 #include "StDbUtilities/StMagUtilities.h"
154 #include "StDetectorDbMaker/St_trgTimeOffsetC.h"
155 #include "TGeoMatrix.h"
162 static StTpcDb* instance() {
if (! gStTpcDb)
new StTpcDb();
return gStTpcDb;}
172 enum ETpcSectorRotationType {kUndefSector =-2,
188 kTotalTpcSectorRotaions =14};
192 TGeoTranslation *mShift[2];
194 TGeoHMatrix *mTpc2GlobMatrix;
195 TGeoHMatrix *mHalf[2];
196 TGeoHMatrix *mTpcSectorRotations[24][kTotalTpcSectorRotaions];
197 Float_t mDriftVel[2];
202 static Bool_t mOldScheme;
218 Float_t triggerTimeOffset() {
return 1e-6*(IsLaser() ? St_trgTimeOffsetC::instance()->laserOffset() : St_trgTimeOffsetC::instance()->offset());}
219 Float_t triggerTimeOffsetWest() {
return 1e-6*(IsLaser() ? St_trgTimeOffsetC::instance()->laserOffsetW(): 0);}
220 Bool_t IsLaser() {
return mTriggerId != 0;}
221 static Bool_t IsOldScheme() {
return mOldScheme;}
222 Double_t zGG() {
return mzGG;}
224 void SetDriftVelocity();
225 Float_t DriftVelocity(Int_t sector=24) {
return DriftVelocity(sector, 0);}
226 Float_t DriftVelocity(Int_t sector, Int_t row);
227 void SetTpcRotations();
228 void SetTpc2GlobalMatrix(TGeoHMatrix *m) {SetTpcRotationMatrix(m);}
229 void SetTpcRotationMatrix(TGeoHMatrix *m, Int_t sector = 0, Int_t k = kSupS2Tpc) {
230 if (sector == 0) {
if (m) *mTpc2GlobMatrix = *m;}
231 else {
if (m) *mTpcSectorRotations[sector-1][k] = *m;}
233 void SetDebug(Int_t m) {m_Debug = m;}
234 Int_t Debug() {
return m_Debug;}
235 void SetTriggerId(Int_t m) {mTriggerId = m;}
236 Int_t TriggerId() {
return mTriggerId;}
237 const TGeoHMatrix &Flip()
const {
return *mFlip;}
238 const TGeoHMatrix &TpcHalf(StBeamDirection part)
const {
return *mHalf[part];}
239 const TGeoTranslation &Shift(StBeamDirection part)
const {
return *mShift[part];}
240 const TGeoHMatrix &Tpc2GlobalMatrix()
const {
return *mTpc2GlobMatrix;}
241 const TGeoHMatrix &TpcRot(Int_t sector, Int_t k)
const {
return *mTpcSectorRotations[sector-1][k];}
242 const TGeoHMatrix &SupS2Tpc(Int_t sector = 1)
const {
return TpcRot(sector,kSupS2Tpc);}
243 const TGeoHMatrix &SupS2Glob(Int_t sector = 1)
const {
return TpcRot(sector,kSupS2Glob);}
244 const TGeoHMatrix &SubSInner2SupS(Int_t sector = 1)
const {
return TpcRot(sector,kSubSInner2SupS);}
245 const TGeoHMatrix &SubSOuter2SupS(Int_t sector = 1)
const {
return TpcRot(sector,kSubSOuter2SupS);}
246 const TGeoHMatrix &SubSInner2Tpc(Int_t sector = 1)
const {
return TpcRot(sector,kSubSInner2Tpc);}
247 const TGeoHMatrix &SubSOuter2Tpc(Int_t sector = 1)
const {
return TpcRot(sector,kSubSOuter2Tpc);}
248 const TGeoHMatrix &SubSInner2Glob(Int_t sector = 1)
const {
return TpcRot(sector,kSubSInner2Glob);}
249 const TGeoHMatrix &SubSOuter2Glob(Int_t sector = 1)
const {
return TpcRot(sector,kSubSOuter2Glob);}
251 const TGeoHMatrix &PadInner2SupS(Int_t sector = 1)
const {
return TpcRot(sector,kPadInner2SupS);}
252 const TGeoHMatrix &PadOuter2SupS(Int_t sector = 1)
const {
return TpcRot(sector,kPadOuter2SupS);}
253 const TGeoHMatrix &PadInner2Tpc(Int_t sector = 1)
const {
return TpcRot(sector,kPadInner2Tpc);}
254 const TGeoHMatrix &PadOuter2Tpc(Int_t sector = 1)
const {
return TpcRot(sector,kPadOuter2Tpc);}
255 const TGeoHMatrix &PadInner2Glob(Int_t sector = 1)
const {
return TpcRot(sector,kPadInner2Glob);}
256 const TGeoHMatrix &PadOuter2Glob(Int_t sector = 1)
const {
return TpcRot(sector,kPadOuter2Glob);}
258 const TGeoHMatrix &SubS2SupS(Int_t sector = 1, Int_t row = 1)
const {Int_t k = (row <= St_tpcPadConfigC::instance()->innerPadRows(sector)) ? kSubSInner2SupS : kSubSOuter2SupS;
return TpcRot(sector,k);}
259 const TGeoHMatrix &SubS2Tpc(Int_t sector = 1, Int_t row = 1)
const {Int_t k = (row <= St_tpcPadConfigC::instance()->innerPadRows(sector)) ? kSubSInner2Tpc : kSubSOuter2Tpc;
return TpcRot(sector,k);}
260 const TGeoHMatrix &SubS2Glob(Int_t sector = 1, Int_t row = 1)
const {Int_t k = (row <= St_tpcPadConfigC::instance()->innerPadRows(sector)) ? kSubSInner2Glob: kSubSOuter2Glob;
return TpcRot(sector,k);}
262 const TGeoHMatrix &Pad2SupS(Int_t sector = 1, Int_t row = 1)
const {Int_t k = (row <= St_tpcPadConfigC::instance()->innerPadRows(sector)) ? kPadInner2SupS: kPadOuter2SupS;
return TpcRot(sector,k);}
263 const TGeoHMatrix &Pad2Tpc(Int_t sector = 1, Int_t row = 1)
const {Int_t k = (row <= St_tpcPadConfigC::instance()->innerPadRows(sector)) ? kPadInner2Tpc: kPadOuter2Tpc;
return TpcRot(sector,k);}
264 const TGeoHMatrix &Pad2Glob(Int_t sector = 1, Int_t row = 1)
const {Int_t k = (row <= St_tpcPadConfigC::instance()->innerPadRows(sector)) ? kPadInner2Glob: kPadOuter2Glob;
return TpcRot(sector,k);}