55 Name(
"defaultMomInGeV"),
56 Comment(
"Default momentum estimate value (all other options are set to " 57 "false, or if the estimate is not available)."),
60 Name(
"momFromMCSCollection"),
61 Comment(
"Flag used to get initial momentum estimate from MCSFitResult " 62 "collection specified by mcsInputTag."),
65 Comment(
"InputTag of MCSFitResult collection.")};
67 Name(
"momFromCombAndPid"),
68 Comment(
"Flag used to get initial momentum estimate from either range " 69 "or mcs fit, based on particle id and containement (from " 70 "contInputTag collection)."),
74 Comment(
"InputTag of CosmicTag collection for containement.")};
76 Name(
"pidFromCollection"),
77 Comment(
"Flag used to get initial particle id estimate from ParticleID " 78 "collection specified by pidInputTag."),
81 Comment(
"InputTag of ParticleID collection.")};
83 Name(
"pidFromLengthCut"),
84 Comment(
"Particle ID based on length: if shorted than cut is assumed " 85 "to be a proton, if longer a muon; disabled if negative."),
89 Comment(
"Default particle id hypothesis (all other options are set to " 90 "false, or if the estimate is not available)."),
94 Comment(
"Assume track direction as the one giving positive dot product " 95 "with vector specified by dirVec."),
99 Comment(
"Fhicl sequence defining the vector used when dirFromVec=true. " 100 "It must have 3 elements.")};
102 Name(
"alwaysInvertDir"),
103 Comment(
"If true, fit all tracks from end to vertex assuming inverted " 107 Name(
"keepInputTrajectoryPoints"),
108 Comment(
"Option to keep positions and directions from input " 109 "trajectory/track. The fit will provide only covariance matrices, " 110 "chi2, ndof, particle Id and absolute momentum. It may also modify " 111 "the trajectory point flags. In order to avoid inconsistencies, it " 112 "has to be used with the following fitter options all set to false: " 113 "sortHitsByPlane, sortOutputHitsMinLength, skipNegProp."),
146 auto d =
p_().options().dirVec();
151 (
p_().fitter().sortHitsByPlane() ||
p_().fitter().sortOutputHitsMinLength() ||
152 p_().fitter().skipNegProp())) {
154 <<
"Incompatible configuration parameters: keepInputTrajectoryPoints " 155 "needs the following fitter options all set to false: " 156 "sortHitsByPlane, sortOutputHitsMinLength, skipNegProp." 161 <<
"Incompatible configuration parameters: momFromMCSCollection and " 162 "momFromCombAndPid cannot be both true at the same time." 167 <<
"Incompatible configuration parameters: pidFromCollection and " 168 "pidFromLengthCut cannot be respectively true and >0. at the same " 174 <<
"Incompatible configuration parameters: alwaysInvertDir and " 175 "dirFromVec cannot be both true at the same time." 232 const int tkID)
const;
261 const std::vector<recob::MCSFitResult>*
mcs =
nullptr;
262 const std::vector<anab::CosmicTag>*
cont =
nullptr;
263 const std::vector<anab::ParticleID>* pid =
nullptr;
281 const double mom =
getMomentum(traj, pid, flipDirection, tkID);
294 if (!fitok)
return false;
304 const int tkID)
const 308 double mcsmom = (isFlip ?
mcs->at(tkID).bwdMomentum() :
mcs->at(tkID).fwdMomentum());
310 if (mcsmom > 0.01 && mcsmom < 7.) mom = mcsmom;
317 if (pidtmp == 211 || pidtmp == 13)
322 if (isContained ==
false) {
324 double mcsmom = (isFlip ? mcsresult.bwdMomentum() : mcsresult.fwdMomentum());
327 if (mcsmom > 0.01 && mcsmom < 7. && mcsmom > mom) mom = mcsmom;
349 if (tdir.Dot(
dirVec) < 0.)
return true;
363 <<
"Option keepInputTrajectoryPoints not compatible with " 364 "doTrackFitHitInfo, please set doTrackFitHitInfo to false in the " 371 std::vector<unsigned int> flagsmap(np, -1);
372 for (
unsigned int i = 0; i < np; ++i)
375 for (
unsigned int p = 0; p < np; ++p) {
386 tcbk.setTotChi2(outTrack.
Chi2());
387 outTrack = tcbk.finalizeTrack(std::move(covs.first), std::move(covs.second));
int getParticleID(const recob::TrackTrajectory &traj, const int tkID) const
set the particle ID hypothesis
art::InputTag mcsInputTag_
fhicl::Atom< art::InputTag > mcsInputTag
const trkf::TrackStatePropagator prop
Fit tracks using Kalman Filter fit+smooth.
bool makeTrack(const detinfo::DetectorPropertiesData &detProp, const recob::TrackTrajectory &traj, const int tkID, const std::vector< art::Ptr< recob::Hit >> &inHits, recob::Track &outTrack, std::vector< art::Ptr< recob::Hit >> &outHits, OptionalOutputs &optionals) const override
static constexpr Flag_t NoPoint
The trajectory point is not defined.
int ParticleId() const
Access to various track properties.
fhicl::Atom< int > defaultPdgId
art::InputTag pidInputTag_
art::InputTag contInputTag_
KalmanFilterFitTrackMaker(Parameters const &p)
Constructor from Parameters.
recob::tracking::SMatrixSym55 SMatrixSym55
float Chi2() const
Access to various track properties.
size_t NumberTrajectoryPoints() const
Various functions related to the presence and the number of (valid) points.
bool fitTrack(detinfo::DetectorPropertiesData const &detProp, const recob::TrackTrajectory &traj, int tkID, const SMatrixSym55 &covVtx, const SMatrixSym55 &covEnd, const std::vector< art::Ptr< recob::Hit >> &hits, const double pval, const int pdgid, const bool flipDirection, recob::Track &outTrack, std::vector< art::Ptr< recob::Hit >> &outHits, trkmkr::OptionalOutputs &optionals) const
Fit track starting from TrackTrajectory.
Class for propagation of a trkf::TrackState to a recob::tracking::Plane.
ROOT::Math::SMatrix< Double32_t, 5, 5, ROOT::Math::MatRepSym< Double32_t, 5 >> SMatrixSym55
fhicl::Atom< art::InputTag > pidInputTag
constexpr Mask_t const & mask() const
Returns the entire set of bits as a bit mask.
recob::tracking::Vector_t dirVec
const trkf::TrajectoryMCSFitter mcsfitter
fhicl::Atom< double > defaultMomInGeV
fhicl::Atom< bool > momFromCombAndPid
std::pair< SMatrixSym55, SMatrixSym55 > Covariances() const
Access to position, momentum or covariance at the start and end of the track.
void restoreInputPoints(const recob::TrackTrajectory &traj, const std::vector< art::Ptr< recob::Hit >> &inHits, recob::Track &outTrack, std::vector< art::Ptr< recob::Hit >> &outHits, OptionalOutputs &optionals) const
recob::MCSFitResult fitMcs(const recob::TrackTrajectory &traj) const
Base abstract class for tools used to fit tracks.
constexpr HitIndex_t fromHit() const
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Vector_t VertexDirection() const
Returns the direction of the trajectory at the first point.
fhicl::Atom< bool > keepInputTrajectoryPoints
const std::vector< anab::CosmicTag > * cont
const std::vector< recob::MCSFitResult > * mcs
double Length(size_t startAt=0) const
Returns the approximate length of the trajectory.
bool makeTrackImpl(const detinfo::DetectorPropertiesData &detProp, const recob::TrackTrajectory &traj, const int tkID, const std::vector< art::Ptr< recob::Hit >> &inHits, const recob::tracking::SMatrixSym55 &covVtx, const recob::tracking::SMatrixSym55 &covEnd, recob::Track &outTrack, std::vector< art::Ptr< recob::Hit >> &outHits, OptionalOutputs &optionals) const
function that actually calls the fitter
const std::vector< anab::ParticleID > * pid
A trajectory in space reconstructed from hits.
T LocationAtPoint(unsigned int p) const
Position at point p. Use e.g. as:
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 ...
double StartMomentum() const
Concrete implementation of a tool to fit tracks with TrackKalmanFitter.
fhicl::Atom< bool > pidFromCollection
double getMomentum(const recob::TrackTrajectory &traj, const int pid, const bool isFlip, const int tkID) const
set the initial momentum estimate
fhicl::Atom< bool > alwaysInvertDir
void initEvent(const art::Event &e) override
initialize event: get collection of recob::MCSFitResult
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
void unset(Flag first, OtherFlags...others)
Unsets all specified flags.
bool HasMomentum() const
Returns whether information about the momentum is available.
fhicl::Atom< bool > momFromMCSCollection
Helper class to aid the creation of a recob::Track, keeping data vectors in sync. ...
Class for Maximum Likelihood fit of Multiple Coulomb Scattering angles between segments within a Trac...
trkf::TrackMomentumCalculator tmc
PointFlags_t const & FlagsAtPoint(size_t i) const
Access to i-th TrajectoryPoint or its Flags.
bool isTrackFitInfosInit()
check initialization of the output vector of TrackFitHitInfos
fhicl::Sequence< float, 3u > dirVec
bool isFlipDirection(const recob::TrackTrajectory &traj, const int tkID) const
decide whether to flip the direction or not
T MomentumVectorAtPoint(unsigned int p) const
Momentum vector at point p. Use e.g. as:
fhicl::Atom< double > pidFromLengthCut
Struct holding optional TrackMaker outputs.
Set of flags pertaining a point of the track.
fhicl::Atom< bool > dirFromVec
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track:
double GetTrackMomentum(double trkrange, int pdg) const
cet::coded_exception< error, detail::translate > exception
fhicl::Atom< art::InputTag > contInputTag
const trkf::TrackKalmanFitter kalmanFitter