21 size_t nTPCClusters = TPCClusterlist.size();
22 size_t firstTPCCluster = 0;
23 size_t farTPCCluster = TMath::Min(nTPCClusters-1, (
size_t) initialtpnTPCClusters);;
24 size_t intTPCCluster = farTPCCluster/2;
25 size_t lastTPCCluster = nTPCClusters-1;
27 float trackbeg[3] = {TPCClusters[TPCClusterlist[firstTPCCluster]].Position()[0],
28 TPCClusters[TPCClusterlist[firstTPCCluster]].Position()[1],
29 TPCClusters[TPCClusterlist[firstTPCCluster]].Position()[2]};
31 float tp1[3] = {TPCClusters[TPCClusterlist[intTPCCluster]].Position()[0],
32 TPCClusters[TPCClusterlist[intTPCCluster]].Position()[1],
33 TPCClusters[TPCClusterlist[intTPCCluster]].Position()[2]};
35 float tp2[3] = {TPCClusters[TPCClusterlist[farTPCCluster]].Position()[0],
36 TPCClusters[TPCClusterlist[farTPCCluster]].Position()[1],
37 TPCClusters[TPCClusterlist[farTPCCluster]].Position()[2]};
41 std::cout <<
"TPCCluster Dump in initial_trackpar_estimate: " <<
std::endl;
42 for (
size_t i=0;i<nTPCClusters;++i)
45 std::cout << i <<
" : " <<
46 TPCClusters[TPCClusterlist[ihf]].Position()[0] <<
" " <<
47 TPCClusters[TPCClusterlist[ihf]].Position()[1] <<
" " <<
48 TPCClusters[TPCClusterlist[ihf]].Position()[2] <<
std::endl;
53 std::cout <<
"first TPCCluster: " << firstTPCCluster <<
", inter TPCCluster: " << intTPCCluster <<
" " <<
" far TPCCluster: " << farTPCCluster <<
std::endl;
54 std::cout <<
"in the TPCCluster list: " << TPCClusterlist[firstTPCCluster] <<
" " << TPCClusterlist[intTPCCluster] <<
" " << TPCClusterlist[farTPCCluster] <<
std::endl;
55 std::cout <<
"First TPCCluster x, y, z: " << trackbeg[0] <<
" " << trackbeg[1] <<
" " << trackbeg[2] <<
std::endl;
56 std::cout <<
"Inter TPCCluster x, y, z: " << tp1[0] <<
" " << tp1[1] <<
" " << tp1[2] <<
std::endl;
57 std::cout <<
"Far TPCCluster x, y, z: " << tp2[0] <<
" " << tp2[1] <<
" " << tp2[2] <<
std::endl;
63 x_other_end = TPCClusters[TPCClusterlist[lastTPCCluster]].Position()[0];
68 curvature_init =
gar::rec::capprox(trackbeg[1],trackbeg[2],tp1[1],tp1[2],tp2[1],tp2[2],ycc,zcc);
80 std::vector<double> dtpcclusy;
81 std::vector<double> dtpcclusz;
82 for (
size_t i=0;i<nTPCClusters; ++i)
84 dtpcclusy.push_back(TPCClusters[TPCClusterlist[i]].Position()[1]);
85 dtpcclusz.push_back(TPCClusters[TPCClusterlist[i]].Position()[2]);
87 int ict = nTPCClusters;
88 ouchef(dtpcclusy.data(),dtpcclusz.data(),ict,dycc,dzcc,drcc,dchisq,ifail);
89 if (ifail == 0 && drcc != 0)
93 if (curvature_init < 0) drcc = -
std::abs(drcc);
98 curvature_init = 1.0/drcc;
102 phi_init = TMath::ATan2( trackbeg[2] - zcc, ycc - trackbeg[1] );
103 float phi2 = phi_init;
104 if (curvature_init<0) phi_init += TMath::Pi();
105 float radius_init = 10000;
106 if (curvature_init != 0) radius_init = 1.0/curvature_init;
108 float dx1 = tp2[0] -
xpos;
111 float dphi2 = TMath::ATan2(tp2[2]-zcc,ycc-tp2[1])-phi2;
112 if (dphi2 > TMath::Pi()) dphi2 -= 2.0*TMath::Pi();
113 if (dphi2 < -TMath::Pi()) dphi2 += 2.0*TMath::Pi();
114 lambda_init = TMath::ATan(1.0/((radius_init/dx1)*dphi2));
125 std::cout <<
"phi calc: dz, dy " << tp2[2]-trackbeg[2] <<
" " << tp2[1]-trackbeg[1] <<
std::endl;
126 std::cout <<
"initial curvature, phi, lambda: " << curvature_init <<
" " << phi_init <<
" " << lambda_init <<
std::endl;
void ouchef(double *x, double *y, int np, double &xcirccent, double &ycirccent, double &rcirc, double &chisq, int &ifail)
float capprox(float x1, float y1, float x2, float y2, float x3, float y3, float &xc, float &yc)
QTextStream & endl(QTextStream &s)