diff --git a/inc/TrkStrawHitInfo.hh b/inc/TrkStrawHitInfo.hh index e30d96a..d744832 100644 --- a/inc/TrkStrawHitInfo.hh +++ b/inc/TrkStrawHitInfo.hh @@ -36,6 +36,9 @@ namespace mu2e float rdresid = 0, rdresidmvar = -1.0, rdresidpvar = -1.0; // reference distance residual and associated measurement and parameter variances float wdot = 0; // cosine of the angle between the track and wire XYZVectorF poca; // POCA + float uwirephi = 0; // cylindrical phi around wire of uPOCA + float ustrawdist = 0; // unsigned uDOCA to straw center + float ustrawphi = 0; // cylindrical phi around straw center of uPOCA // not sure if we still want these bool dhit = false; bool dactive = false; diff --git a/inc/TrkStrawHitInfoMC.hh b/inc/TrkStrawHitInfoMC.hh index 72ca31c..b5e1816 100644 --- a/inc/TrkStrawHitInfoMC.hh +++ b/inc/TrkStrawHitInfoMC.hh @@ -26,6 +26,10 @@ namespace mu2e float twdot = -1000.0; // dot product between track and wire directions float tau = -1000.0; // threshold cluster distance to the wire along the perpedicular particle path float cdist = -1000.0; // threshold cluster distance to the wire + float phi = -1000.0; // cylindrical phi around wire of POCA + float lang = -1000.0; // lorentz angle + float strawdoca = -1000.0; // true transverse distance at POCA of the particle to the straw center + float strawphi = -1000.0; // cylindrical phi around straw center of POCA XYZVectorF cpos; // threshold cluster position }; } diff --git a/src/InfoMCStructHelper.cc b/src/InfoMCStructHelper.cc index ac2add5..86e7679 100644 --- a/src/InfoMCStructHelper.cc +++ b/src/InfoMCStructHelper.cc @@ -119,8 +119,6 @@ namespace mu2e { } void InfoMCStructHelper::fillHitInfoMC(const KalSeedMC& kseedmc, TrkStrawHitInfoMC& tshinfomc, const TrkStrawHitMC& tshmc) { - const Tracker& tracker = *GeomHandle(); - const SimPartStub& simPart = kseedmc.simParticle(tshmc._spindex); tshinfomc.pdg = simPart._pdg; tshinfomc.startCode = simPart._proc; @@ -134,22 +132,19 @@ namespace mu2e { tshinfomc.edep = tshmc._energySum; tshinfomc.mom = std::sqrt(tshmc._mom.mag2()); tshinfomc.cpos = tshmc._cpos; - - // find the step midpoint - const Straw& straw = tracker.getStraw(tshmc._strawId); - auto mcsep = tshmc._cpos-XYZVectorF(straw.getMidPoint()); - auto wdir = XYZVectorF(straw.getDirection()); - tshinfomc.len = mcsep.Dot(wdir); - auto mdir = tshmc._mom.Unit(); - auto mcperp = mdir.Cross(wdir).Unit(); - double dperp = mcperp.Dot(mcsep); - tshinfomc.twdot = mdir.Dot(wdir); - tshinfomc.dist = fabs(dperp); - auto wperp = wdir.Cross(mcperp); - tshinfomc.tau = mcsep.Dot(wperp); - tshinfomc.cdist = sqrt(tshinfomc.dist*tshinfomc.dist+tshinfomc.tau*tshinfomc.tau); - tshinfomc.ambig = dperp > 0 ? -1 : 1; // follow TrkPoca convention - tshinfomc.doca = -1*dperp; + tshinfomc.len = tshmc._wireLen; + tshinfomc.twdot = tshmc._wireDot; + tshinfomc.doca = tshmc._wireDOCA; + tshinfomc.dist = fabs(tshmc._wireDOCA); + tshinfomc.strawdoca = tshmc._strawDOCA; + tshinfomc.phi = tshmc._wirePhi; + tshinfomc.strawphi = tshmc._strawPhi; + tshinfomc.lang = fabs(fmod(tshmc._wirePhi,M_PI)); + if (tshinfomc.lang > M_PI_2) tshinfomc.lang = M_PI - tshinfomc.lang; + tshinfomc.lang = M_PI_2 - tshinfomc.lang; // currently in tshinfo lang is calculated perpendicular to drift direction + tshinfomc.tau = tshmc._wireTau; + tshinfomc.cdist = sqrt(tshinfomc.doca*tshinfomc.doca+tshinfomc.tau*tshinfomc.tau); + tshinfomc.ambig = tshmc._wireDOCA > 0 ? 1 : -1; } void InfoMCStructHelper::fillAllSimInfos(const KalSeedMC& kseedmc, const PrimaryParticle& primary, std::vector>& all_siminfos, int n_generations, int n_match) { diff --git a/src/InfoStructHelper.cc b/src/InfoStructHelper.cc index 8d2c92f..26db9a1 100644 --- a/src/InfoStructHelper.cc +++ b/src/InfoStructHelper.cc @@ -5,7 +5,6 @@ #include "TrkAna/inc/InfoStructHelper.hh" #include "Offline/RecoDataProducts/inc/TrkStrawHitSeed.hh" #include "KinKal/Trajectory/CentralHelix.hh" -#include "Offline/TrackerGeom/inc/Tracker.hh" #include "Offline/Mu2eKinKal/inc/WireHitState.hh" #include #include @@ -241,10 +240,8 @@ namespace mu2e { std::vector tshinfos; // loop over hits static StrawHitFlag active(StrawHitFlag::active); - const Tracker& tracker = *GeomHandle(); for(std::vector::const_iterator ihit=kseed.hits().begin(); ihit != kseed.hits().end(); ++ihit) { TrkStrawHitInfo tshinfo; - auto const& straw = tracker.getStraw(ihit->strawId()); tshinfo.state = ihit->_ambig; tshinfo.usetot = ihit->_kkshflag.hasAnyProperty(KKSHFlag::tot); @@ -300,16 +297,11 @@ namespace mu2e { tshinfo.rdresidmvar = ihit->_rdresidmvar; tshinfo.rdresidpvar = ihit->_rdresidpvar; - // find nearest segment - auto ikseg = kseed.nearestSegment(ihit->_ptoca); - if(ikseg != kseed.segments().end()){ - auto tdir(ikseg->momentum3().Unit()); - tshinfo.wdot = tdir.Dot(straw.getDirection()); - } - auto const& wiredir = straw.getDirection(); - auto const& mid = straw.getMidPoint(); - auto hpos = mid + wiredir*ihit->_wdist; - tshinfo.poca = XYZVectorF(hpos); + tshinfo.wdot = ihit->_wdot; + tshinfo.poca = ihit->_upoca; + tshinfo.ustrawdist = ihit->_ustrawdist; + tshinfo.ustrawphi = ihit->_ustrawphi; + tshinfo.uwirephi = ihit->_uwirephi; // count correlations with other TSH // OBSOLETE: replace this with a test for KinKal StrawHitClusters