54 Name(
"defaultMomInGeV"),
55 Comment(
"Default momentum estimate value (all other options are set to " 56 "false, or if the estimate is not available)."),
59 Name(
"momFromMCSCollection"),
60 Comment(
"Flag used to get initial momentum estimate from MCSFitResult " 61 "collection specified by mcsInputTag."),
64 Comment(
"InputTag of MCSFitResult collection.")};
66 Name(
"momFromCombAndPid"),
67 Comment(
"Flag used to get initial momentum estimate from either range " 68 "or mcs fit, based on particle id and containement (from " 69 "contInputTag collection)."),
73 Comment(
"InputTag of CosmicTag collection for containement.")};
75 Name(
"pidFromCollection"),
76 Comment(
"Flag used to get initial particle id estimate from ParticleID " 77 "collection specified by pidInputTag."),
80 Comment(
"InputTag of ParticleID collection.")};
82 Name(
"pidFromLengthCut"),
83 Comment(
"Particle ID based on length: if shorted than cut is assumed " 84 "to be a proton, if longer a muon; disabled if negative."),
88 Comment(
"Default particle id hypothesis (all other options are set to " 89 "false, or if the estimate is not available)."),
93 Comment(
"Assume track direction as the one giving positive dot product " 94 "with vector specified by dirVec."),
98 Comment(
"Fhicl sequence defining the vector used when dirFromVec=true. " 99 "It must have 3 elements.")};
101 Name(
"alwaysInvertDir"),
102 Comment(
"If true, fit all tracks from end to vertex assuming inverted " 106 Name(
"keepInputTrajectoryPoints"),
107 Comment(
"Option to keep positions and directions from input " 108 "trajectory/track. The fit will provide only covariance matrices, " 109 "chi2, ndof, particle Id and absolute momentum. It may also modify " 110 "the trajectory point flags. In order to avoid inconsistencies, it " 111 "has to be used with the following fitter options all set to false: " 112 "sortHitsByPlane, sortOutputHitsMinLength, skipNegProp."),
145 auto d =
p_().options().dirVec();
150 (
p_().fitter().sortHitsByPlane() ||
p_().fitter().sortOutputHitsMinLength() ||
151 p_().fitter().skipNegProp())) {
153 <<
"Incompatible configuration parameters: keepInputTrajectoryPoints " 154 "needs the following fitter options all set to false: " 155 "sortHitsByPlane, sortOutputHitsMinLength, skipNegProp." 160 <<
"Incompatible configuration parameters: momFromMCSCollection and " 161 "momFromCombAndPid cannot be both true at the same time." 166 <<
"Incompatible configuration parameters: pidFromCollection and " 167 "pidFromLengthCut cannot be respectively true and >0. at the same " 173 <<
"Incompatible configuration parameters: alwaysInvertDir and " 174 "dirFromVec cannot be both true at the same time." 254 const int tkID)
const;
283 const std::vector<recob::MCSFitResult>*
mcs =
nullptr;
284 const std::vector<anab::CosmicTag>*
cont =
nullptr;
285 const std::vector<anab::ParticleID>* pid =
nullptr;
303 const double mom =
getMomentum(traj, pid, flipDirection, tkID);
316 if (!fitok)
return false;
327 const int tkID)
const 331 double mcsmom = (isFlip ?
mcs->at(tkID).bwdMomentum() :
mcs->at(tkID).fwdMomentum());
333 if (mcsmom > 0.01 && mcsmom < 7.) mom = mcsmom;
340 if (pidtmp == 211 || pidtmp == 13)
345 if (isContained ==
false) {
347 double mcsmom = (isFlip ? mcsresult.bwdMomentum() : mcsresult.fwdMomentum());
350 if (mcsmom > 0.01 && mcsmom < 7. && mcsmom > mom) mom = mcsmom;
358 const int tkID)
const 369 const int tkID)
const 389 <<
"Option keepInputTrajectoryPoints not compatible with " 390 "doTrackFitHitInfo, please set doTrackFitHitInfo to false in the " 397 std::vector<unsigned int> flagsmap(np, -1);
398 for (
unsigned int i = 0; i < np; ++i)
401 for (
unsigned int p = 0;
p < np; ++
p) {
412 tcbk.setTotChi2(outTrack.
Chi2());
int getParticleID(const recob::TrackTrajectory &traj, const int tkID) const
set the particle ID hypothesis
art::InputTag mcsInputTag_
fhicl::Atom< art::InputTag > mcsInputTag
bool makeTrackImpl(const detinfo::DetectorPropertiesData &detProp, const recob::TrackTrajectory &traj, const int tkID, const std::vector< art::Ptr< recob::Hit >> &inHits, const SMatrixSym55 &covVtx, const SMatrixSym55 &covEnd, recob::Track &outTrack, std::vector< art::Ptr< recob::Hit >> &outHits, OptionalOutputs &optionals) const
function that actually calls the fitter
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.
fhicl::Atom< int > defaultPdgId
art::InputTag pidInputTag_
art::InputTag contInputTag_
bool makeTrack(const detinfo::DetectorPropertiesData &detProp, const recob::Track &track, const std::vector< art::Ptr< recob::Hit >> &inHits, recob::Track &outTrack, std::vector< art::Ptr< recob::Hit >> &outHits, OptionalOutputs &optionals) const override
override of TrackMaker virtual function with recob::Track as argument
const recob::TrackTrajectory & Trajectory() const
Access to the stored recob::TrackTrajectory.
KalmanFilterFitTrackMaker(Parameters const &p)
Constructor from Parameters.
recob::tracking::SMatrixSym55 SMatrixSym55
ChannelGroupService::Name Name
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.
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
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
Vector_t VertexDirection() const
Returns the direction of the trajectory at the first point.
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 ...
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.
tracking::SMatrixSym55 SMatrixSym55
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:
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
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
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
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