333 size_t nTPCClusters = TPCClusterlist.size();
336 for (
size_t i=0; i<5; ++i) trackparatend[i] = 0;
337 for (
size_t i=0; i<25; ++i) covmat[i] = 0;
342 float curvature_init=0.1;
344 float lambda_init = 0;
348 float x_other_end = 0;
367 float xpos = xpos_init;
372 P[0][0] = TMath::Sq(1);
373 P[1][1] = TMath::Sq(1);
374 P[2][2] = TMath::Sq(.5);
375 P[3][3] = TMath::Sq(.5);
376 P[4][4] = TMath::Sq(.5);
401 parvec[0] = ypos_init;
402 parvec[1] = zpos_init;
403 parvec[2] = curvature_init;
404 parvec[3] = phi_init;
405 parvec[4] = lambda_init;
406 TVectorF predstep(5);
422 for (
int i=0;i<5;++i)
I[i][i] = 1;
424 for (
size_t iTPCCluster=1; iTPCCluster<nTPCClusters; ++iTPCCluster)
427 float xh = TPCClusters[TPCClusterlist[iTPCCluster]].Position()[0];
428 float yh = TPCClusters[TPCClusterlist[iTPCCluster]].Position()[1];
429 float zh = TPCClusters[TPCClusterlist[iTPCCluster]].Position()[2];
434 std::cout <<
"Adding a new TPCCluster: " << xh <<
" " << yh <<
" " << zh <<
std::endl;
438 float curvature = parvec[2];
439 float phi = parvec[3];
440 float lambda = parvec[4];
450 float slope = TMath::Tan(lambda);
476 float dx = dxnum/dxdenom;
477 if (dx == 0) dx = 1
E-3;
487 F[0][3] = dx*slope*TMath::Cos(phi);
488 F[0][4] = dx*TMath::Sin(phi)*(-1.0-slope*slope);
492 F[1][3] = -dx*slope*TMath::Sin(phi);
493 F[1][4] = dx*TMath::Cos(phi)*(-1.0-slope*slope);
502 F[3][4] = dx*curvature*(-1.0-slope*slope);
517 std::cout <<
"x: " << xpos <<
" dx: " << dx <<
std::endl;
518 std::cout <<
" Parvec: y " << parvec[0] <<
" z " << parvec[1] <<
" c " << parvec[2] <<
" phi " << parvec[3] <<
" lambda " << parvec[4] <<
std::endl;
522 predstep[0] += slope*dx*TMath::Sin(phi);
523 predstep[1] += slope*dx*TMath::Cos(phi);
524 predstep[3] += slope*dx*curvature;
528 std::cout <<
" Predstep: y " << predstep[0] <<
" z " << predstep[1] <<
" c " << predstep[2] <<
" phi " << predstep[3] <<
" lambda " << predstep[4] <<
std::endl;
535 std::cout <<
"PPred Matrix: " <<
std::endl;
539 ytilde[0] = yh - predstep[0];
540 ytilde[1] = zh - predstep[1];
541 float ydistsq = ytilde.Norm2Sqr();
542 if (ydistsq > roadsq)
544 unused_TPCClusters.insert(iTPCCluster);
552 TVector3 trajPerp(0.0, predstep[0],predstep[1]);
553 float rTrj = trajPerp.Mag();
554 TVector3 trajStepPerp(0.0, sin(predstep[3]),cos(predstep[3]));
555 impactAngle = trajPerp.Dot(trajStepPerp) / rTrj;
556 impactAngle = acos(
abs(impactAngle));
557 float IROC_OROC_boundary = (
euclid->GetIROCOuterRadius() +
euclid->GetOROCInnerRadius())/2.0;
558 bool In_CROC = rTrj <=
euclid->GetIROCInnerRadius();
559 bool In_IROC =
euclid->GetIROCInnerRadius() < rTrj && rTrj <= IROC_OROC_boundary;
560 bool InIOROC = IROC_OROC_boundary < rTrj && rTrj <=
euclid->GetOROCPadHeightChangeRadius();
561 bool InOOROC =
euclid->GetOROCPadHeightChangeRadius() < rTrj;
562 float typicalResidual = 1.0;
565 }
else if (In_IROC) {
567 }
else if (InIOROC) {
569 }
else if (InOOROC) {
573 chisquared += ytilde.Norm2Sqr()/TMath::Sq(typicalResidual);
576 std::cout <<
"ytilde (residuals): " <<
std::endl;
596 std::cout <<
"Inverted S Matrix: " <<
std::endl;
607 float yprev = parvec[0];
608 float zprev = parvec[1];
609 parvec = predstep +
K*ytilde;
613 trajpts.emplace_back(xpos,parvec[0],parvec[1]);
615 float d_length = TMath::Sqrt( dx*dx + TMath::Sq(parvec[0]-yprev) + TMath::Sq(parvec[1]-zprev) );
619 float valSig = TPCClusters[TPCClusterlist[iTPCCluster]].Signal();
622 std::pair pushme = std::make_pair(valSig,d_length);
623 dSigdXs.push_back( pushme );
628 if (dSigdXs.size()>0) dSigdXs.pop_back();
632 for (
size_t i=0; i<5; ++i)
634 trackparatend[i] = parvec[i];
636 trackparatend[5] =
xpos;
639 std::cout <<
"Track params at end (y, z, curv, phi, lambda) " << trackparatend[0] <<
" " << trackparatend[1] <<
" " <<
640 trackparatend[2] <<
" " << trackparatend[3] <<
" " << trackparatend[4] <<
std::endl;
655 for (
size_t i=0; i<5; ++i)
657 for (
size_t j=0; j<5; ++j)
659 covmat[icov] =
P[i][j];
float fKalCurvStepUncSq
constant uncertainty term on each step of the Kalman fit – squared, for curvature ...
float fTPCClusterResid__IROC_b
float fKalPhiStepUncSq
constant uncertainty term on each step of the Kalman fit – squared, for phi
float fRoadYZinFit
cut in cm for dropping TPCClusters from tracks in fit
std::pair< float, std::string > P
art::ServiceHandle< geo::GeometryGAr > euclid
float fTPCClusterResid__CROC_b
parameters to estimate residuals in YZ plane
float fTPCClusterResid_IOROC_b
float fMinIonizGapCut
Don't compute dEdx for this dx or larger.
int fPrintLevel
debug printout: 0: none, 1: just track parameters and residuals, 2: all
float fTPCClusterResid__CROC_m
float fKalCovZYMeasure
constant uncertainty term on measurement in Kalman (the R matrix)
float fTPCClusterResolYZ
pad size in cm in YZ to determine step size
float fTPCClusterResid__IROC_m
float fTPCClusterResid_OOROC_m
float fTPCClusterResolX
drift direction contribution to determine step size (resolution of a TPCCluster)
float fTPCClusterResid_OOROC_b
unsigned int fInitialTPNTPCClusters
number of TPCClusters to use for initial trackpar estimate, if present
float fKalLambdaStepUncSq
constant uncertainty term on each step of the Kalman fit – squared, for lambda
QTextStream & endl(QTextStream &s)
float fTPCClusterResid_IOROC_m
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)