14#include <FairTrackParam.h>
50 , fTrackLength(t.fTrackLength)
51 , fPidHypo(t.fPidHypo)
52 , fDistance(t.fDistance)
58 , fT0TtCov(t.fT0TtCov)
62 , fParamFirst(FairTrackParam(t.fParamFirst))
63 , fParamLast(FairTrackParam(t.fParamLast))
107 for (
int i = 0, k = 0; i < 3; i++)
108 for (
int j = 0; j <= i; j++, k++)
120 for (
int i = 0, k = 0; i < 3; i++)
121 for (
int j = 0; j <= i; j++, k++)
128 for (uint32_t iHit = 0; iHit <
fTofHit.size(); iHit++) {
138 for (uint32_t iHit = 0; iHit <
fTofHit.size(); iHit++) {
142 LOG(fatal) <<
" CbmTofTracklet::GetFirstInd, did only find " << iAddr;
183 double dZ = pHit->
GetZ();
185 if (pHit->
GetZ() <
fhit[0].GetZ()) dSign = -1;
187 LOG(debug) << Form(
"GetTex Bmon %7.3f, Z %7.1f, DZ %5.1f, Sign %2.0f, Tt %7.4f => Tex %7.3f, ",
fhit[0].
GetTime(), dZ,
188 dZ -
fhit[0].GetZ(), dSign,
fTt, dTex)
196 int32_t nValidHits = 0;
203 for (uint32_t iHit = 0; iHit <
fTofHit.size(); iHit++) {
205 if (nValidHits == 0) {
213 if (
fhit[iHit].GetZ() <
fhit[iHit1].GetZ()) dSign = -1.;
214 aR[nValidHits] = dDist1 + dSign *
Dist3D(&
fhit[iHit], &
fhit[iHit1]);
215 at[nValidHits] =
fhit[iHit].GetTime();
216 ae[nValidHits] = 0.1;
263 double sig_weight = 0;
264 double yoffset = at[0] - 10;
265 for (int32_t i = 0; i < nValidHits; i++) {
267 sig_weight = (ae[i] * ae[i]);
268 Rsum += (aR[i] / sig_weight);
269 tsum += (at[i] / sig_weight);
270 RRsum += (aR[i] * aR[i] / sig_weight);
271 Rtsum += (aR[i] * at[i] / sig_weight);
272 esum += (1 / sig_weight);
277 fT0 = (RRsum * tsum - Rsum * Rtsum) / det_cov_mat;
278 fTt = (-Rsum * tsum + esum * Rtsum) / det_cov_mat;
287 LOG(debug) << Form(
"Trkl size %u, validHits %d, Tt = %6.4f TtErr = %2.4f Bmon "
288 "= %6.2f BmonErr = %2.2f BmonTtCov = %6.4f",
298 for (uint32_t iHL = 0; iHL <
fhit.size() - 1; iHL++) {
300 for (uint32_t iHH = iHL + 1; iHH <
fhit.size(); iHH++) {
304 / (
fhit[iHH].GetR() -
fhit[iHL].GetR());
310 LOG(warning) <<
"No valid hit pair ";
313 fTt = dTt / (double) iNt;
324 for (uint32_t iHL = 0; iHL <
fhit.size() - 1; iHL++) {
326 for (uint32_t iHH = iHL + 1; iHH <
fhit.size(); iHH++) {
329 dTx += (
fhit[iHH].GetX() -
fhit[iHL].GetX()) / (
fhit[iHH].GetZ() -
fhit[iHL].GetZ());
340 for (uint32_t iHit = 0; iHit <
fTofHit.size(); iHit++) {
343 double dDZ = pHit->
GetZ() -
fhit[iHit].GetZ();
344 dXref +=
fhit[iHit].GetX() + dTx * dDZ;
349 LOG(error) <<
"DetId " << iDetId <<
", Nref " << iNref <<
" sizes " <<
fTofHit.size() <<
", " <<
fhit.size();
355 return pHit->
GetX() - dXref;
365 for (uint32_t iHL = 0; iHL <
fhit.size() - 1; iHL++) {
367 for (uint32_t iHH = iHL + 1; iHH <
fhit.size(); iHH++) {
369 dTy += (
fhit[iHH].GetY() -
fhit[iHL].GetY()) / (
fhit[iHH].GetZ() -
fhit[iHL].GetZ());
380 for (uint32_t iHit = 0; iHit <
fTofHit.size(); iHit++) {
383 double dDZ = pHit->
GetZ() -
fhit[iHit].GetZ();
384 dYref +=
fhit[iHit].GetY() + dTy * dDZ;
389 LOG(error) <<
"DetId " << iDetId <<
", Nref " << iNref <<
" sizes " <<
fTofHit.size() <<
", " <<
fhit.size();
395 return pHit->
GetY() - dYref;
406 for (uint32_t iHL = 0; iHL <
fhit.size() - 1; iHL++) {
408 for (uint32_t iHH = iHL + 1; iHH <
fhit.size(); iHH++) {
412 sqrt(pow((
fhit[iHH].GetX() -
fhit[iHL].GetX()), 2) + pow((
fhit[iHH].GetY() -
fhit[iHL].GetY()), 2)
413 + pow((
fhit[iHH].GetZ() -
fhit[iHL].GetZ()), 2));
415 if (
fhit[iHH].GetZ() <
fhit[iHL].GetZ()) dSign = -1.;
422 LOG(error) <<
"No valid hit pair ";
431 for (uint32_t iHit = 0; iHit <
fTofHit.size(); iHit++) {
435 if (
fhit[iHit].GetZ() < pHit->
GetZ()) dSign = -1;
436 dTref +=
fhit[iHit].GetTime() - dTt * dSign *
Dist3D(&
fhit[iHit], pHit);
440 LOG(error) <<
"DetId " << iDetId <<
", Nref " << Nref <<
" sizes " <<
fTofHit.size() <<
", " <<
fhit.size();
443 dTref /= (double) Nref;
444 double dTdif = pHit->
GetTime() - dTref;
452 for (uint32_t iHit = 0; iHit <
fTofHit.size(); iHit++) {
453 int32_t iHaddr =
fhit[iHit].GetAddress() & 0x003FFFFF;
459 if (iHaddr == iAddr)
return true;
466 for (uint32_t iHit = 0; iHit <
fTofHit.size(); iHit++) {
467 if ((
fhit[iHit].GetAddress() & 0x003FFFFF) == iAddr)
return iHit;
474 for (uint32_t iHit = 0; iHit <
fTofHit.size(); iHit++) {
475 if ((
fhit[iHit].GetAddress() & 0x003FFFFF) == iAddr)
return &
fhit[iHit];
485 fP[3] =
fhit[n].GetTime();
495 fP[3] =
fhit[n].GetTime();
527 LOG(info) << Form(
"TrklInfo: Nhits %d, Tt %6.3f, stations: ",
GetNofHits(),
GetTt());
529 for (int32_t iH = 0; iH <
GetNofHits(); iH++) {
530 LOG(info) << Form(
" Hit %2d: Ind %5d, det 0x%08x, addr 0x%08x, chi %6.3f, ae[]= %6.4f", iH,
fTofHit[iH],
537 double dDist =
sqrt(pow((pHit0->
GetX() - pHit1->
GetX()), 2) + pow((pHit0->
GetY() - pHit1->
GetY()), 2)
538 + pow((pHit0->
GetZ() - pHit1->
GetZ()), 2));
547 if (
fhit.size() >= iNhit) {
548 for (uint32_t iHL = 0; iHL < iNhit - 1; iHL++) {
549 for (uint32_t iHH = iHL + 1; iHH < iNhit; iHH++) {
555 if (iNt == 0) { LOG(debug) <<
" CbmTofTracklet::GetRefVel: No valid hit pair "; }
557 dVel = (double) iNt / dTt;
ClassImp(CbmConverterManager)
friend fvec sqrt(const fvec &a)
double GetCovariance(int index) const
void SetCovariance(int index, double cov)
std::string ToString() const
Return string representation of class.
Provides information on attaching a TofHit to a TofTrack.
virtual double GetTdif(int32_t iSmType, CbmTofHit *pHit)
double GetRefVel(uint32_t N)
virtual bool ContainsAddr(int32_t iAddr)
virtual CbmTofHit * HitPointerOfAddr(int32_t iAddr)
virtual int32_t HitIndexOfAddr(int32_t iAddr)
virtual double GetXdif(int32_t iSmType, CbmTofHit *pHit)
int32_t GetNofHits() const
virtual double GetMatChi2(int32_t iSm)
const double * GetPoint(int32_t n)
void Clear(Option_t *option="")
const double * GetFitPoint(int32_t n)
virtual ~CbmTofTracklet()
std::vector< double > fMatChi
std::vector< int32_t > fTofDet
std::vector< CbmTofHit > fhit
void SetParamLast(const FairTrackParam *par)
virtual double GetYdif(int32_t iSmType, CbmTofHit *pHit)
virtual void GetFairTrackParamLast()
CbmTofTrackletParam fTrackPar
double GetTex(CbmTofHit *pHit)
std::vector< int32_t > fTofHit
FairTrackParam fParamLast
int32_t GetFirstInd(int32_t iSmType)
virtual double Dist3D(CbmTofHit *pHit0, CbmTofHit *pHit1)