1 #ifndef TRAJECTORYMCSFITTER_H 2 #define TRAJECTORYMCSFITTER_H 44 Name(
"pIdHypothesis"),
45 Comment(
"Default particle Id Hypothesis to be used in the fit when not specified."),
49 Name(
"minNumSegments"),
50 Comment(
"Minimum number of segments the track is split into."),
54 Name(
"segmentLength"),
55 Comment(
"Nominal length of track segments used in the fit."),
59 Name(
"minHitsPerSegment"),
60 Comment(
"Exclude segments with less hits than this value."),
65 Comment(
"Number of steps for computing energy loss uptream to current segment."),
70 Comment(
"Default is MPV Landau. Choose 1 for MIP (constant); 2 for Bethe-Bloch."),
75 Comment(
"Minimum momentum value in likelihood scan."),
80 Comment(
"Maximum momentum value in likelihood scan."),
85 Comment(
"Step in momentum value in initial coase likelihood scan."),
90 Comment(
"Step in momentum value in fine grained likelihood scan."),
94 Name(
"fineScanWindow"),
95 Comment(
"Window size for fine grained likelihood scan around result of coarse scan."),
100 Comment(
"Angular resolution parameters used in Highland formula. Formula is angResol[0]/(p*p) + angResol[1]/p + angResol[2] + angResol[3]*p + angResol[4]*p*p. Unit is mrad."),
105 Comment(
"Parameters for tuning of Highland formula. Default is pdg value of 13.6. For values as in https://arxiv.org/abs/1703.0618 set to [0.1049,0.,11.0038,0,0]. Formula is hlParams[0]/(p*p) + hlParams[1]/p + hlParams[2] + hlParams[3]*p + hlParams[4]*p*p."),
109 Name(
"segLenTolerance"),
110 Comment(
"Tolerance in actual segment length (lower bound)."),
114 Name(
"applySCEcorr"),
115 Comment(
"Flag to turn the Space Charge Effect correction on/off."),
121 TrajectoryMCSFitter(
int pIdHyp,
int minNSegs,
double segLen,
int minHitsPerSegment,
int nElossSteps,
int eLossMode,
double pMin,
double pMax,
double pStepCoarse,
double pStep,
double fineScanWindow,
const std::array<double, 5>&
angResol,
const std::array<double, 5>&
hlParams,
double segLenTolerance,
bool applySCEcorr){
139 :
TrajectoryMCSFitter(p().
pIdHypothesis(),p().
minNumSegments(),p().
segmentLength(),p().
minHitsPerSegment(),p().
nElossSteps(),p().
eLossMode(),p().
pMin(),p().
pMax(),p().
pStepCoarse(),p().
pStep(),p().
fineScanWindow(),p().
angResol(),p().
hlParams(),p().
segLenTolerance(),p().
applySCEcorr()) {}
155 double mcsLikelihood(
double p,
double theta0x, std::vector<float>& dthetaij, std::vector<float>& seg_nradl, std::vector<float>& cumLen,
bool fwd,
int pid)
const;
159 ScanResult(
double ap,
double apUnc,
double alogL) : p(ap), pUnc(apUnc), logL(alogL) {}
163 const ScanResult doLikelihoodScan(std::vector<float>& dtheta, std::vector<float>& seg_nradlengths, std::vector<float>& cumLen,
bool fwdFit,
int pid,
float detAngResol)
const;
164 const ScanResult doLikelihoodScan(std::vector<float>& dtheta, std::vector<float>& seg_nradlengths, std::vector<float>& cumLen,
bool fwdFit,
int pid,
165 float pmin,
float pmax,
float pstep,
float detAngResol)
const;
174 if (
abs(pid)==13) {
return mumass; }
175 if (
abs(pid)==211) {
return pimass; }
176 if (
abs(pid)==321) {
return kmass; }
177 if (
abs(pid)==2212) {
return pmass; }
183 double GetE(
const double initial_E,
const double length_travelled,
const double mass)
const;
ScanResult(double ap, double apUnc, double alogL)
double energyLossBetheBloch(const double mass, const double e2) const
fhicl::Atom< int > minHitsPerSegment
fhicl::Atom< int > pIdHypothesis
void breakTrajInSegments(const recob::TrackTrajectory &traj, std::vector< size_t > &breakpoints, std::vector< float > &segradlengths, std::vector< float > &cumseglens) const
fhicl::Atom< int > eLossMode
double DetectorAngularResolution(const double uz) const
fhicl::Atom< int > nElossSteps
const recob::TrackTrajectory & Trajectory() const
Access to the stored recob::TrackTrajectory.
fhicl::Atom< double > pMax
ChannelGroupService::Name Name
fhicl::Atom< int > minNumSegments
fhicl::Atom< bool > applySCEcorr
recob::MCSFitResult fitMcs(const recob::TrackTrajectory &traj) const
const ScanResult doLikelihoodScan(std::vector< float > &dtheta, std::vector< float > &seg_nradlengths, std::vector< float > &cumLen, bool fwdFit, int pid, float detAngResol) const
TrajectoryMCSFitter(const Parameters &p)
fhicl::Atom< double > segLenTolerance
recob::MCSFitResult fitMcs(const recob::Trajectory &traj) const
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< Coord_t >, ROOT::Math::GlobalCoordinateSystemTag > Vector_t
Type for representation of momenta in 3D space. See recob::tracking::Coord_t for more details on the ...
std::array< double, 5 > angResol_
double mass(int pid) const
size_t NPoints() const
Returns the number of stored trajectory points.
A trajectory in space reconstructed from hits.
double GetE(const double initial_E, const double length_travelled, const double mass) const
double segLenTolerance() const
void linearRegression(const recob::TrackTrajectory &traj, const size_t firstPoint, const size_t lastPoint, recob::tracking::Vector_t &pcdir) const
double energyLossLandau(const double mass2, const double E2, const double x) const
std::array< double, 5 > hlParams_
std::vector< PointFlags_t > Flags_t
Type of point flag list.
Class storing the result of the Maximum Likelihood fit of Multiple Coulomb Scattering angles between ...
fhicl::Atom< double > pStep
A trajectory in space reconstructed from hits.
double HighlandFirstTerm(const double p) const
TrajectoryMCSFitter(int pIdHyp, int minNSegs, double segLen, int minHitsPerSegment, int nElossSteps, int eLossMode, double pMin, double pMax, double pStepCoarse, double pStep, double fineScanWindow, const std::array< double, 5 > &angResol, const std::array< double, 5 > &hlParams, double segLenTolerance, bool applySCEcorr)
Provides recob::Track data product.
Class for Maximum Likelihood fit of Multiple Coulomb Scattering angles between segments within a Trac...
fhicl::Atom< double > pStepCoarse
fhicl::Atom< double > segmentLength
double mcsLikelihood(double p, double theta0x, std::vector< float > &dthetaij, std::vector< float > &seg_nradl, std::vector< float > &cumLen, bool fwd, int pid) const
recob::MCSFitResult fitMcs(const recob::Track &track, int pid) const
constexpr double kBogusD
obviously bogus double value
fhicl::Sequence< double, 5 > hlParams
fhicl::Atom< double > pMin
recob::MCSFitResult fitMcs(const recob::Trajectory &traj, int pid) const
recob::MCSFitResult fitMcs(const recob::Track &track) const
fhicl::Atom< double > fineScanWindow
fhicl::Sequence< double, 5 > angResol
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track: