23 #include "cetlib_except/exception.h" 90 std::multimap<double, KHitTrack> newmap;
105 newmap.insert(std::make_pair(s, trh));
130 std::vector<recob::tracking::Point_t> xyz;
131 std::vector<recob::tracking::Vector_t> pxpypz;
132 std::vector<recob::tracking::SMatrixSym55> cov;
133 std::vector<recob::TrajectoryPointFlags> outFlags;
153 xyz.push_back({pos[0], pos[1], pos[2]});
160 double p = std::sqrt(mom[0] * mom[0] + mom[1] * mom[1] + mom[2] * mom[2]);
161 if (p == 0.)
throw cet::exception(
"KGTrack") << __func__ <<
": null momentum\n";
162 pxpypz.push_back({mom[0], mom[1], mom[2]});
175 const std::shared_ptr<const Surface> psurf(
176 new SurfXYZPlane(pos[0], pos[1], pos[2], mom[0], mom[1], mom[2]));
179 if (!dist)
throw cet::exception(
"KGTrack") << __func__ <<
": error propagation failed\n";
180 for (
int i = 0; i < 5; ++i) {
181 for (
int j = 0; j < 5; ++j)
188 cov.push_back(covar);
196 if (xyz.size() >= 2) {
204 std::move(cov.front()),
205 std::move(cov.back()),
217 std::vector<unsigned int>& hittpindex)
const 230 const std::shared_ptr<const KHitBase>&
hit = track.
getHit();
231 if (
const KHitWireX* phit = dynamic_cast<const KHitWireX*>(&*hit)) {
235 hittpindex.push_back(counter - 1);
238 else if (
const KHitWireLine* phit = dynamic_cast<const KHitWireLine*>(&*hit)) {
242 hittpindex.push_back(counter - 1);
256 double oldxyz[3] = {0., 0., 0.};
260 double s = ele.first;
266 double tmom = std::sqrt(mom[0] * mom[0] + mom[1] * mom[1] + mom[2] * mom[2]);
273 double dx = xyz[0] - oldxyz[0];
274 double dy = xyz[1] - oldxyz[1];
275 double dz = xyz[2] - oldxyz[2];
276 len += std::sqrt(dx * dx + dy * dy + dz * dz);
280 std::ios_base::fmtflags
f = out.flags();
281 out <<
"State " << std::setw(4) << n <<
", path=" << std::setw(8) << std::fixed
282 << std::setprecision(2) << s <<
", length=" << std::setw(8) << len
283 <<
", x=" << std::setw(8) << xyz[0] <<
", y=" << std::setw(8) << xyz[1]
284 <<
", z=" << std::setw(8) << xyz[2] <<
", dx=" << std::setw(8) << mom[0]
285 <<
", dy=" << std::setw(8) << mom[1] <<
", dz=" << std::setw(8) << mom[2]
286 <<
", plane=" << std::setw(1) << plane <<
"\n";
302 return trg.
Print(out);
const TrackError & getError() const
Track error matrix.
void reserve(size_type n)
const std::shared_ptr< const KHitBase > & getHit() const
Measurement.
void fillHits(art::PtrVector< recob::Hit > &hits, std::vector< unsigned int > &hittpindex) const
Fill a PtrVector of Hits.
static constexpr Mask_t makeMask(Flags...flags)
Returns a bit mask with only the specified bit set.
void recalibrate()
Recalibrate track map.
int getMeasPlane() const
Measurement plane index.
const KHitTrack & endTrack() const
Track at end point.
Kalman filter wire-time measurement on a SurfWireX surface.
ROOT::Math::SMatrix< Double32_t, 5, 5, ROOT::Math::MatRepSym< Double32_t, 5 >> SMatrixSym55
void addTrack(const KHitTrack &trh)
Add track.
void fillTrack(detinfo::DetectorPropertiesData const &detProp, recob::Track &track, int id) const
Fill a recob::Track.
auto counter(T begin, T end)
Returns an object to iterate values from begin to end in a range-for loop.
std::ostream & operator<<(std::ostream &out, const KGTrack &trg)
Output operator.
void push_back(Ptr< U > const &p)
void getPosition(double xyz[3]) const
Get position of track.
double getPath() const
Propagation distance.
Propagate to SurfXYZPlane surface.
std::optional< double > err_prop(KETrack &tre, const std::shared_ptr< const Surface > &psurf, PropDirection dir, bool doDedx, KTrack *ref=0, TrackMatrix *prop_matrix=0) const
Propagate with error, but without noise.
bool isNull() const noexcept
Provides recob::Track data product.
Set of flags pertaining a point of the track.
Detector simulation of raw signals on wires.
std::multimap< double, KHitTrack > fTrackMap
KHitTrack collection, indexed by path distance.
constexpr double dist(const TReal *x, const TReal *y, const unsigned int dimension)
void getMomentum(double mom[3]) const
Get momentum vector of track.
std::ostream & Print(std::ostream &out) const
Printout.
Kalman filter wire-time measurement on a SurfWireLine surface.
void setPath(double path)
Set propagation distance.
TrackCollectionProxyElement< TrackCollProxy > Track
Proxy to an element of a proxy collection of recob::Track objects.
A collection of KHitTracks.
second_as<> second
Type of time stored in seconds, in double precision.
bool isValid() const
Validity flag.
double getChisq() const
Fit chisquare.
const KHitTrack & startTrack() const
Track at start point.
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track:
cet::coded_exception< error, detail::translate > exception
bool isValid() const
Test if track is valid.