311 size_t nTPCClusters = TPCClusterlist.size();
314 for (
size_t i=0; i<5; ++i) trackparatend[i] = 0;
315 for (
size_t i=0; i<25; ++i) covmat[i] = 0;
320 float curvature_init=0.1;
322 float lambda_init = 0;
326 float x_other_end = 0;
345 float zpos = zpos_init;
350 P[0][0] = TMath::Sq(1);
351 P[1][1] = TMath::Sq(1);
352 P[2][2] = TMath::Sq(.5);
353 P[3][3] = TMath::Sq(.5);
354 P[4][4] = TMath::Sq(.5);
379 parvec[0] = ypos_init;
380 parvec[1] = xpos_init;
381 parvec[2] = curvature_init;
382 parvec[3] = phi_init;
383 parvec[4] = lambda_init;
384 TVectorF predstep(5);
400 for (
int i=0;i<5;++i)
I[i][i] = 1;
402 for (
size_t iTPCCluster=1; iTPCCluster<nTPCClusters; ++iTPCCluster)
405 float xh = TPCClusters[TPCClusterlist[iTPCCluster]].Position()[0];
406 float yh = TPCClusters[TPCClusterlist[iTPCCluster]].Position()[1];
407 float zh = TPCClusters[TPCClusterlist[iTPCCluster]].Position()[2];
412 std::cout <<
"Adding a new TPCCluster: " << xh <<
" " << yh <<
" " << zh <<
std::endl;
416 float lambda = parvec[4];
417 float slope = TMath::Tan(lambda);
431 std::cout <<
"z: " << zpos <<
" adding new hit at z: " << zh <<
std::endl;
432 std::cout <<
" Parvec: y " << parvec[0] <<
" z " << parvec[1] <<
" c " << parvec[2] <<
" phi " << parvec[3] <<
" lambda " << parvec[4] <<
std::endl;
438 updatepar(parvec,zpos,xh,yh,zh,predstep,dlength);
442 std::cout <<
" Predstep: y " << predstep[0] <<
" z " << predstep[1] <<
" c " << predstep[2] <<
" phi " << predstep[3] <<
" lambda " << predstep[4] <<
std::endl;
448 TVectorF parvec_plus_dpar(5);
449 TVectorF predstepmod(5);
450 TVectorF derivvec(5);
451 for (
size_t ipar=0;ipar<5;++ipar)
453 float epsilon = 0.001;
454 parvec_plus_dpar = parvec;
455 parvec_plus_dpar[ipar] += epsilon;
457 updatepar(parvec_plus_dpar,zpos,xh,yh,zh,predstepmod,dldummy);
458 derivvec = (predstepmod - predstep);
459 derivvec *= (1.0/epsilon);
460 for (
size_t jpar=0; jpar<5; ++jpar)
462 F[jpar][ipar] = derivvec[jpar];
479 std::cout <<
"PPred Matrix: " <<
std::endl;
483 ytilde[0] = yh - predstep[0];
484 ytilde[1] = xh - predstep[1];
485 float ydistsq = ytilde.Norm2Sqr();
486 if (ydistsq > roadsq)
488 unused_TPCClusters.insert(iTPCCluster);
494 std::cout <<
"ytilde (residuals): " <<
std::endl;
514 std::cout <<
"Inverted S Matrix: " <<
std::endl;
525 parvec = predstep +
K*ytilde;
529 trajpts.emplace_back(parvec[1],parvec[0],zpos);
534 float valSig = TPCClusters[TPCClusterlist[iTPCCluster]].Signal();
537 std::pair pushme = std::make_pair(valSig,dlength);
538 dSigdXs.push_back( pushme );
543 if (dSigdXs.size()>0) dSigdXs.pop_back();
547 for (
size_t i=0; i<5; ++i)
549 trackparatend[i] = parvec[i];
551 trackparatend[5] =
zpos;
554 std::cout <<
"Track params at end (y, z, curv, phi, lambda) " << trackparatend[0] <<
" " << trackparatend[1] <<
" " <<
555 trackparatend[2] <<
" " << trackparatend[3] <<
" " << trackparatend[4] <<
std::endl;
571 for (
size_t i=0; i<5; ++i)
573 for (
size_t j=0; j<5; ++j)
575 covmat[icov] =
P[i][j];
int fPrintLevel
debug printout: 0: none, 1: just track parameters and residuals, 2: all
void updatepar(TVectorF &parvec, float zcur, float xh, float yh, float zh, TVectorF &predstep, float &dlength)
float fTPCClusterResolYZinFit
TPCCluster resolution parameter to use in fit.
float fMinIonizGapCut
Don't compute dEdx for this dx or larger.
float fKalPhiStepUncSq
constant uncertainty term on each step of the Kalman fit – squared, for phi
unsigned int fInitialTPNTPCClusters
number of TPCClusters to use for initial trackpar estimate, if present
std::pair< float, std::string > P
float fKalCurvStepUncSq
constant uncertainty term on each step of the Kalman fit – squared, for curvature ...
float fRoadYZinFit
cut in cm for dropping TPCClusters from tracks in fit
float fKalLambdaStepUncSq
constant uncertainty term on each step of the Kalman fit – squared, for lambda
QTextStream & endl(QTextStream &s)
int initial_trackpar_estimate(const std::vector< gar::rec::TPCCluster > &TPCClusters, std::vector< int > &TPCClusterlist, float &curvature_init, float &lambda_init, float &phi_init, float &xpos, float &ypos, float &zpos, float &x_other_end, unsigned int initialtpnTPCClusters, int printlevel)