109 #include "StFtpcPoint.hh"
110 #include "StFtpcHit.h"
111 #include "StFtpcHitCollection.h"
112 #include "StDetectorId.h"
113 #include "StMessMgr.h"
135 SetNextHitNumber(-1);
164 SetResidualsToZero();
166 SetGlobalCoord(kFALSE);
173 StFtpcPoint::StFtpcPoint(
const StFtpcPoint &point)
180 SetNextHitNumber(-1);
183 SetResidualsToZero();
185 SetGlobalCoord(GetGlobalFlag());
192 StFtpcPoint::StFtpcPoint(Long_t row,
201 Float_t timepossigma,
217 SetNextHitNumber(-1);
223 SetNumberPads(n_pads);
224 SetNumberBins(n_bins);
231 SetPadPosSigma(padpossigma);
232 SetTimePosSigma(timepossigma);
246 SetResidualsToZero();
248 SetGlobalCoord(GetGlobalFlag());
255 StFtpcPoint::StFtpcPoint(Double_t *x, Int_t row)
264 SetNextHitNumber(-1);
293 SetResidualsToZero();
295 SetGlobalCoord(kFALSE);
302 StFtpcPoint::~StFtpcPoint()
309 void StFtpcPoint::TransformFtpc2Global()
317 if (!IsInGlobalCoord()) {
322 Int_t i = (org.z() < 0) ? 0 : 1;
325 org.setY(org.y() - StFtpcTrackingParams::Instance()->InstallationPointY(i));
326 org.setZ(org.z() - StFtpcTrackingParams::Instance()->InstallationPointZ(i));
329 org = StFtpcTrackingParams::Instance()->FtpcRotation(i) * org;
332 org.setY(org.y() + StFtpcTrackingParams::Instance()->InstallationPointY(i));
333 org.setZ(org.z() + StFtpcTrackingParams::Instance()->InstallationPointZ(i));
337 mCoord.SetX(transform.x());
338 mCoord.SetY(transform.y());
339 mCoord.SetZ(transform.z());
341 SetGlobalCoord(kTRUE);
346 LOG_WARN <<
"Hit is in global coordinates already! Not transformed." << endm;
353 void StFtpcPoint::TransformGlobal2Ftpc()
361 if (IsInGlobalCoord()) {
364 StThreeVectorD transform = StFtpcTrackingParams::Instance()->GlobalToTpcRotation() * (org - StFtpcTrackingParams::Instance()->TpcPositionInGlobal());
367 Int_t i = (transform.z() < 0) ? 0 : 1;
370 transform.setY(transform.y() - StFtpcTrackingParams::Instance()->InstallationPointY(i));
371 transform.setZ(transform.z() - StFtpcTrackingParams::Instance()->InstallationPointZ(i));
374 transform = StFtpcTrackingParams::Instance()->FtpcRotationInverse(i) * transform;
377 transform.setY(transform.y() + StFtpcTrackingParams::Instance()->InstallationPointY(i));
378 transform.setZ(transform.z() + StFtpcTrackingParams::Instance()->InstallationPointZ(i));
380 mCoord.SetX(transform.x());
381 mCoord.SetY(transform.y());
382 mCoord.SetZ(transform.z());
384 SetGlobalCoord(kFALSE);
389 LOG_WARN <<
"Hit is in local (FTPC) coordinates already! Not transformed." << endm;
402 ftpcHitCollection->addHit(point);
409 void StFtpcPoint::SetStFtpcHitCoord()
416 LOG_WARN <<
"StFtpcPoint: StFtpcHit does not exist! No changes done." << endm;
422 hit->setPosition(hitPos);
423 hit->setPositionError(hitErr);
429 void StFtpcPoint::SetResidualsToZero()
433 SetXPrimResidual(0.);
434 SetYPrimResidual(0.);
435 SetRPrimResidual(0.);
436 SetPhiPrimResidual(0.);
437 SetXGlobResidual(0.);
438 SetYGlobResidual(0.);
439 SetRGlobResidual(0.);
440 SetPhiGlobResidual(0.);
446 StFtpcTrack *StFtpcPoint::GetTrack(TObjArray *tracks)
const
450 return (
StFtpcTrack*)tracks->At(this->GetTrackNumber());
454 Int_t StFtpcPoint::GetDetectorId()
const
458 if (mPadRow >= 1 && mPadRow <= 10)
return kFtpcWestId;
459 else if (mPadRow >= 11 && mPadRow <= 20)
return kFtpcEastId;
461 LOG_INFO <<
"StFtpcPoint.mPadRow = " << mPadRow <<
" is out of range"<< endm;
467 Long_t StFtpcPoint::GetHardwarePosition()
const
476 return (mNumberBins<<20)
480 + this->GetDetectorId();
484 void StFtpcPoint::SetTrackedFlag(Bool_t tracked)
489 Long_t old_flag = GetFlags();
490 SetFlags((old_flag & 0xFFFFFFDF) | ((Long_t)tracked*32));
494 Bool_t StFtpcPoint::GetTrackedFlag()
498 return (Bool_t)(GetFlags() & (Long_t)32);
502 void StFtpcPoint::SetGlobalFlag(Bool_t global)
506 Long_t old_flag = GetFlags();
507 SetFlags((old_flag & 0xFFFFFFAF) | ((Long_t)global*64));
511 Bool_t StFtpcPoint::GetGlobalFlag()
515 return (Bool_t)(GetFlags() & (Long_t)64);
519 void StFtpcPoint::SetUnusableForTrackingFlag(Bool_t global)
523 Long_t old_flag = GetFlags();
524 SetFlags((old_flag & 0xFFFFFFAF) | ((Long_t)global*128));
528 Bool_t StFtpcPoint::GetUnusableForTrackingFlag()
532 return (Bool_t)(GetFlags() & (Long_t)128);
536 Bool_t StFtpcPoint::IsUsable()
540 return (Bool_t)((!GetTrackedFlag()) && !(GetUnusableForTrackingFlag()));
544 Bool_t StFtpcPoint::IsUnusable()
548 return (Bool_t)(GetTrackedFlag() || GetUnusableForTrackingFlag());
StMatrixD TpcToGlobalRotation()
transformation due to rotated and displaced TPC