Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes material p2r master #127

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 46 additions & 31 deletions RecoTracker/MkFitCore/src/PropagationMPlex.cc
Original file line number Diff line number Diff line change
Expand Up @@ -508,32 +508,51 @@ namespace mkfit {
// MT: This should be properly handled in both functions (expecting input in output parameters sucks).
outPar = inPar;

MPlexLL errorProp;
MPlexLS tmpInErr = inErr;
MPlexLV tmpInPar = inPar;

helixAtRFromIterativeCCS(inPar, inChg, msRad, outPar, errorProp, outFailFlag, N_proc, pflags);
for (int step=0;step<Config::Niter;step++) {

#ifdef DEBUG
if (debug && g_debug) {
for (int kk = 0; kk < N_proc; ++kk) {
dprintf("outErr before prop %d\n", kk);
for (int i = 0; i < 6; ++i) {
for (int j = 0; j < 6; ++j)
dprintf("%8f ", outErr.At(kk, i, j));
dprintf("\n");
}
dprintf("\n");
MPlexLL errorProp;

dprintf("errorProp %d\n", kk);
for (int i = 0; i < 6; ++i) {
for (int j = 0; j < 6; ++j)
dprintf("%8f ", errorProp.At(kk, i, j));
dprintf("\n");
}
dprintf("\n");
helixAtRFromIterativeCCS(tmpInPar, inChg, msRad, outPar, errorProp, outFailFlag, N_proc, pflags);

#ifdef DEBUG
if (debug && g_debug) {
for (int kk = 0; kk < N_proc; ++kk) {
dprintf("outErr before prop %d\n", kk);
for (int i = 0; i < 6; ++i) {
for (int j = 0; j < 6; ++j)
dprintf("%8f ", outErr.At(kk, i, j));
dprintf("\n");
}
dprintf("\n");

dprintf("errorProp %d\n", kk);
for (int i = 0; i < 6; ++i) {
for (int j = 0; j < 6; ++j)
dprintf("%8f ", errorProp.At(kk, i, j));
dprintf("\n");
}
dprintf("\n");
}
}
}
#endif

// Matriplex version of:
// result.errors = ROOT::Math::Similarity(errorProp, outErr);

// MultHelixProp can be optimized for CCS coordinates, see GenMPlexOps.pl
//need to double check this!
MPlexLL temp;
MultHelixProp(errorProp, tmpInErr, temp);
MultHelixPropTransp(errorProp, temp, outErr);

tmpInErr = outErr;
tmpInPar = outPar;

}

if (pflags.apply_material) {
MPlexQF hitsRl;
MPlexQF hitsXi;
Expand Down Expand Up @@ -562,14 +581,6 @@ namespace mkfit {

squashPhiMPlex(outPar, N_proc); // ensure phi is between |pi|

// Matriplex version of:
// result.errors = ROOT::Math::Similarity(errorProp, outErr);

// MultHelixProp can be optimized for CCS coordinates, see GenMPlexOps.pl
MPlexLL temp;
MultHelixProp(errorProp, outErr, temp);
MultHelixPropTransp(errorProp, temp, outErr);

/*
// To be used with: MPT_DIM = 1
if (fabs(sqrt(outPar[0]*outPar[0]+outPar[1]*outPar[1]) - msRad[0]) > 0.0001)
Expand Down Expand Up @@ -1031,8 +1042,11 @@ namespace mkfit {
if (radL < 1e-13f)
continue; //ugly, please fixme
const float theta = outPar.constAt(n, 5, 0);
const float pt = 1.f / outPar.constAt(n, 3, 0); //fixme, make sure it is positive?
const float ipt = outPar.constAt(n, 3, 0);
const float pt = 1.f / ipt; //fixme, make sure it is positive?
const float ipt2 = ipt * ipt;
const float p = pt / std::sin(theta);
const float pz = p * std::cos(theta);
const float p2 = p * p;
constexpr float mpi = 0.140; // m=140 MeV, pion
constexpr float mpi2 = mpi * mpi; // m=140 MeV, pion
Expand All @@ -1050,8 +1064,9 @@ namespace mkfit {
// const float thetaMSC2 = thetaMSC*thetaMSC;
const float thetaMSC = 0.0136f * (1.f + 0.038f * std::log(radL)) / (beta * p); // eq 32.15
const float thetaMSC2 = thetaMSC * thetaMSC * radL;
outErr.At(n, 4, 4) += thetaMSC2;
// outErr.At(n, 4, 5) += thetaMSC2;
outErr.At(n, 3, 3) += thetaMSC2 * pz * pz * ipt2 * ipt2;
outErr.At(n, 3, 5) -= thetaMSC2 * pz * ipt2;
outErr.At(n, 4, 4) += thetaMSC2 * p2 * ipt2;
outErr.At(n, 5, 5) += thetaMSC2;
//std::cout << "beta=" << beta << " p=" << p << std::endl;
//std::cout << "multiple scattering thetaMSC=" << thetaMSC << " thetaMSC2=" << thetaMSC2 << " radL=" << radL << std::endl;
Expand Down
Loading