19 #include "cetlib_except/exception.h" 38 throw cet::exception(
"KGTrack") <<
"Starting track is not valid.\n";
64 throw cet::exception(
"KGTrack") <<
"Starting track is not valid.\n";
87 throw cet::exception(
"KGTrack") <<
"Adding invalid track to KGTrack.\n";
99 std::multimap<double, KHitTrack> newmap;
114 newmap.insert(std::make_pair(s, trh));
138 std::vector<recob::tracking::Point_t> xyz;
139 std::vector<recob::tracking::Vector_t> pxpypz;
140 std::vector<recob::tracking::SMatrixSym55> cov;
141 std::vector<recob::TrajectoryPointFlags> outFlags;
160 xyz.push_back({pos[0], pos[1], pos[2]});
167 double p = std::sqrt(mom[0]*mom[0] + mom[1]*mom[1] + mom[2]*mom[2]);
169 throw cet::exception(
"KGTrack") << __func__ <<
": null momentum\n";
170 pxpypz.push_back({mom[0], mom[1], mom[2]});
183 const std::shared_ptr<const Surface> psurf(
new SurfXYZPlane(pos[0], pos[1], pos[2],
184 mom[0], mom[1], mom[2]));
187 if (!dist.is_initialized())
188 throw cet::exception(
"KGTrack") << __func__ <<
": error propagation failed\n";
189 for(
int i=0; i<5; ++i) {
190 for(
int j=0; j<5; ++j)
197 cov.push_back(covar);
206 if(xyz.size() >= 2) {
207 track =
recob::Track(std::move(xyz), std::move(pxpypz), std::move(outFlags),
208 true, this->
startTrack().PdgCode(), totChi2, ndof,
209 std::move(cov.front()), std::move(cov.back()),
id);
220 std::vector<unsigned int>& hittpindex)
const 226 unsigned int counter = 0;
232 const std::shared_ptr<const KHitBase>&
hit = track.
getHit();
233 if(
const KHitWireX* phit = dynamic_cast<const KHitWireX*>(&*hit)) {
237 hittpindex.push_back(counter-1);
240 else if(
const KHitWireLine* phit = dynamic_cast<const KHitWireLine*>(&*hit)) {
244 hittpindex.push_back(counter-1);
257 double oldxyz[3] = {0., 0., 0.};
261 double s = ele.first;
267 double tmom = std::sqrt(mom[0]*mom[0] + mom[1]*mom[1] + mom[2]*mom[2]);
274 double dx = xyz[0] - oldxyz[0];
275 double dy = xyz[1] - oldxyz[1];
276 double dz = xyz[2] - oldxyz[2];
277 len += std::sqrt(dx*dx + dy*dy + dz*dz);
281 std::ios_base::fmtflags
f = out.flags();
282 out <<
"State " << std::setw(4) << n
283 <<
", path=" << std::setw(8) << std::fixed << std::setprecision(2) << s
284 <<
", length=" << std::setw(8) << len
285 <<
", x=" << std::setw(8) << xyz[0]
286 <<
", y=" << std::setw(8) << xyz[1]
287 <<
", z=" << std::setw(8) << xyz[2]
288 <<
", dx=" << std::setw(8) << mom[0]
289 <<
", dy=" << std::setw(8) << mom[1]
290 <<
", dz=" << std::setw(8) << mom[2]
291 <<
", plane=" << std::setw(1) << plane
308 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 fillTrack(recob::Track &track, int id) const
Fill a recob::Track.
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.
void addTrack(const KHitTrack &trh)
Add track.
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > SMatrixSym55
boost::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.
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.
KGTrack(int prefplane)
Constructor.
Detector simulation of raw signals on wires.
std::multimap< double, KHitTrack > fTrackMap
KHitTrack collection, indexed by path distance.
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.
bool isValid() const
Validity flag.
double getChisq() const
Fit chisquare.
const KHitTrack & startTrack() const
Track at start point.
art framework interface to geometry description
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.