1 #include "StiHitTest.h"
6 #include "TMatrixDSym.h"
14 void StiHitTest::reset()
16 memset(fBeg, 0,fEnd-fBeg+1);
21 void StiHitTest::add(
double x,
double y,
double z)
23 double xx[3]; xx[0]=x;xx[1]=y;xx[2]=z;
27 void StiHitTest::add(
double x[3])
30 for (
int i=0;i<3;i++) {
32 for (
int j=0;j<3;j++) {
33 fM[i][j] += x[i]*x[j];
37 void StiHitTest::doIt()
40 if (fW[0]>=0.)
return;
41 for (
int i=0;i<3;i++) {fX[i]/=fN;}
43 for (
int i=0;i<9;i++) {d[i]/=fN;}
44 for (
int i=0;i<3;i++) {
45 for (
int j=0;j<3;j++) {
46 fM[i][j] -= fX[i]*fX[j];
48 TMatrixDSym Sym(3,fM[0],
"");
50 TMatrixD vecs = Sym.EigenVectors(vals);
52 memcpy(fW, vals.GetMatrixArray(),
sizeof(fW));
54 memcpy(fV[0],vecs.GetMatrixArray(),
sizeof(fV));
57 double StiHitTest::width(
int idx)
64 const double *StiHitTest::vector(
int idx)
70 double StiHitTest::yAngle()
const
72 double dy = fV[2][1];
double dx = fV[2][0];
73 if (dx<0) {dx=-dx;dy=-dy;}
74 return TMath::ATan2(dy,dx);
77 double StiHitTest::zAngle()
const
79 double dz = fV[2][2];
double dx = fV[2][0];
80 if (dx<0) {dx=-dx;dz=-dz;}
81 return TMath::ATan2(dz,dx);
92 enum {kMinRadTpc = 50};
93 if (StiDebug::Debug()<2)
return;
95 if (nTpcHits<11)
return;
97 static double Rxy[]={5,10,19,30,0};
98 int nHits=0,nHft=0,tally[9]={0};
100 TString forRxy(name); forRxy+=
"_xLoc";
102 for (it=tk->rbegin();it!=tk->rend();it++) {
104 if (!node->isValid())
continue;
106 if (!detector)
continue;
107 double rxy = node->getRxy();
108 if (rxy>kMinRadTpc)
break;
109 if (!detector->isActive())
continue;
114 if (node->getChi2()>1000)
continue;
115 rxy = sqrt(pow(hit->
x(),2)+pow(hit->y(),2));
116 if (rxy>kMinRadTpc)
break;
117 if (rxy<lastR) {StiDebug::Count(name,
"????");
return;}
121 for (;Rxy[ih];ih++) {
if (rxy<Rxy[ih])
break;}
122 tally[ih]++; nHits++;
123 StiDebug::Count(forRxy.Data(),rxy);
126 assert(strstr(name,
"After") || nHits==0 || nHits >=3);
127 TString ts(name);ts+=
"_siHits:siDets";
128 StiDebug::Count(ts.Data(),100.*nHits/nHft);
131 if (nHft) {StiDebug::Count(name,
"0000");}
132 else {StiDebug::Count(name,
"xxxx");}
136 for (
int i=0;i<4;i++) {
137 if (tally[i]>3) tally[i]=3;
140 StiDebug::Count(name,ts.Data());
Definition of Kalman Track.
static void hftHist(const char *tit, const StiKalmanTrack *tk)
const Float_t & x() const
Return the local x, y, z values.
const StiDetector * detector() const
int getPointCount(int detectorId=0) const
Return the number of hits associated with this track.
Definition of Kalman Track.