1 #include "art/Utilities/ToolConfigTable.h" 
    2 #include "art/Utilities/ToolMacros.h" 
    3 #include "fhiclcpp/types/Atom.h" 
    4 #include "fhiclcpp/types/Sequence.h" 
    6 #include "art/Framework/Principal/Handle.h" 
    7 #include "art/Framework/Principal/Event.h" 
   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."),
 
  120       fhicl::Table<KalmanFilterFitTrackMaker::Options> 
options{
Name(
"options")};
 
  122       fhicl::Table<trkf::TrackKalmanFitter::Config> 
fitter{
Name(
"fitter")};
 
  123       fhicl::Table<trkf::TrajectoryMCSFitter::Config> 
mcsfit{
Name(
"mcsfit")};
 
  146         auto d = 
p_().options().dirVec();
 
  150       if (
p_().
options().keepInputTrajectoryPoints() &&
 
  151           (
p_().fitter().sortHitsByPlane() || 
p_().fitter().sortOutputHitsMinLength() ||
 
  152            p_().fitter().skipNegProp())) {
 
  153         throw cet::exception(
"KalmanFilterFitTrackMaker")
 
  154           << 
"Incompatible configuration parameters: keepInputTrajectoryPoints " 
  155              "needs the following fitter options all set to false: " 
  156              "sortHitsByPlane, sortOutputHitsMinLength, skipNegProp." 
  160         throw cet::exception(
"KalmanFilterFitTrackMaker")
 
  161           << 
"Incompatible configuration parameters: momFromMCSCollection and " 
  162              "momFromCombAndPid cannot be both true at the same time." 
  166         throw cet::exception(
"KalmanFilterFitTrackMaker")
 
  167           << 
"Incompatible configuration parameters: pidFromCollection and " 
  168              "pidFromLengthCut cannot be respectively true and >0. at the same " 
  173         throw cet::exception(
"KalmanFilterFitTrackMaker")
 
  174           << 
"Incompatible configuration parameters: alwaysInvertDir and " 
  175              "dirFromVec cannot be both true at the same time." 
  186         mcs = e.getValidHandle<std::vector<recob::MCSFitResult>>(
mcsInputTag_).product();
 
  191         pid = e.getValidHandle<std::vector<anab::ParticleID>>(
pidInputTag_).product();
 
  255                        const int tkID) 
const;
 
  284     const std::vector<recob::MCSFitResult>* 
mcs = 
nullptr;
 
  285     const std::vector<anab::CosmicTag>* 
cont = 
nullptr;
 
  286     const std::vector<anab::ParticleID>* 
pid = 
nullptr;
 
  304   const double mom = 
getMomentum(traj, pid, flipDirection, tkID); 
 
  317   if (!fitok) 
return false;
 
  318   if (
p_().
options().keepInputTrajectoryPoints()) {
 
  328                                                const int tkID)
 const 
  330   double mom = (mom_def_ > 0 ? mom_def_ : traj.
StartMomentum());
 
  331   if (momFromMCSColl_) {
 
  332     double mcsmom = (isFlip ? mcs->at(tkID).bwdMomentum() : mcs->at(tkID).fwdMomentum());
 
  334     if (mcsmom > 0.01 && mcsmom < 7.) mom = mcsmom;
 
  336   if (momFromCombAndPid_) {
 
  341     if (pidtmp == 211 || pidtmp == 13)
 
  345     mom = tmc.GetTrackMomentum(traj.
Length(), pidtmp);
 
  346     if (isContained == 
false) {
 
  347       auto mcsresult = mcsfitter.fitMcs(traj, pid);
 
  348       double mcsmom = (isFlip ? mcsresult.bwdMomentum() : mcsresult.fwdMomentum());
 
  351       if (mcsmom > 0.01 && mcsmom < 7. && mcsmom > mom) mom = mcsmom;
 
  359                                                  const int tkID)
 const 
  364   if (mom_len_cut_ > 0.) { 
return (traj.
Length() < mom_len_cut_ ? 2212 : 13); }
 
  370                                                    const int tkID)
 const 
  372   if (alwaysFlip_) { 
return true; }
 
  373   else if (dirFromVec_) {
 
  375     if (tdir.Dot(dirVec) < 0.) 
return true;
 
  389     throw cet::exception(
"KalmanFilterFitTrackMaker")
 
  390       << 
"Option keepInputTrajectoryPoints not compatible with " 
  391          "doTrackFitHitInfo, please set doTrackFitHitInfo to false in the " 
  398   std::vector<unsigned int> flagsmap(np, -1);
 
  399   for (
unsigned int i = 0; i < np; ++i)
 
  402   for (
unsigned int p = 0; 
p < np; ++
p) {
 
  413   tcbk.setTotChi2(outTrack.
Chi2());
 
  414   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
 
art::ToolConfigTable< Config > Parameters
 
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_
 
ROOT::Math::SMatrix< Double32_t, 5, 5, ROOT::Math::MatRepSym< Double32_t, 5 > > SMatrixSym55
 
const recob::TrackTrajectory & Trajectory() const 
Access to the stored recob::TrackTrajectory. 
 
KalmanFilterFitTrackMaker(Parameters const &p)
Constructor from Parameters. 
 
recob::tracking::SMatrixSym55 SMatrixSym55
 
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::Table< KalmanFilterFitTrackMaker::Options > options
 
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
 
process_name use argoneut_mc_hitfinder track
 
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 
 
Base abstract class for tools used to fit tracks. 
 
fhicl::Table< trkf::TrajectoryMCSFitter::Config > mcsfit
 
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. 
 
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. 
 
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 
 
constexpr mask_t< EnumType > mask(EnumType bit, OtherBits...otherBits)
Returns a mask with all specified bits set. 
 
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: 
 
double StartMomentum() const 
 
Concrete implementation of a tool to fit tracks with TrackKalmanFitter. 
 
BEGIN_PROLOG vertical distance to the surface Name
 
fhicl::Atom< bool > pidFromCollection
 
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 
 
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::Table< trkf::TrackKalmanFitter::Config > fitter
 
fhicl::Atom< bool > momFromMCSCollection
 
fhicl::Table< trkf::TrackStatePropagator::Config > propagator
 
Helper class to aid the creation of a recob::Track, keeping data vectors in sync. ...
 
then echo echo For and will not be changed by echo further linking echo echo B echo The symbol is in the uninitialized data multiple common symbols may appear with the echo same name If the symbol is defined the common echo symbols are treated as undefined references For more echo details on common see the discussion of warn common echo in *Note Linker options
 
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: 
 
fhicl::Atom< art::InputTag > contInputTag
 
const trkf::TrackKalmanFitter kalmanFitter