TotallyCheatTrackingAlg.cxx
Go to the documentation of this file.
1 /**
2  * @file larexamples/Algorithms/TotallyCheatTracks/TotallyCheatTrackingAlg.cxx
3  * @brief Algorithm to "reconstruct" trajectories from simulated particles.
4  * @author Gianluca Petrillo (petrillo@fnal.gov)
5  * @date December 26, 2017
6  * @see larexamples/Algorithms/TotallyCheatTracks/TotallyCheatTrackingAlg.h
7  * @ingroup TotallyCheatTracks
8  *
9  */
10 
11 // algorithm header
13 
14 // LArSoft libraries
15 #include "larcorealg/Geometry/geo_vectors_utils.h" // geo::vect namespace
16 
17 // C/C++ standard libraries
18 #include <utility> // std::move()
19 
20 
21 //------------------------------------------------------------------------------
22 //--- lar::example::TotallyCheatTrackingAlg implementation
23 //------------------------------------------------------------------------------
25  (simb::MCParticle const& mcParticle) const
26 {
29 
30  for (auto const& pair: mcParticle.Trajectory()) {
31  pos.push_back
32  (geo::vect::rounded01(geo::vect::toPoint(pair.first.Vect()), 1e-8));
33  mom.push_back
34  (geo::vect::rounded01(geo::vect::toVector(pair.second.Vect()), 1e-8));
35  } // for
36 
37  return { { std::move(pos), std::move(mom), true }, mcParticle.PdgCode() };
38 } // lar::example::TotallyCheatTrackingAlg::makeTrack()
39 
40 
41 //------------------------------------------------------------------------------
Utilities to extend the interface of geometry vectors.
int PdgCode() const
Definition: MCParticle.h:212
const simb::MCTrajectory & Trajectory() const
Definition: MCParticle.h:253
::geo::Point_t toPoint(Point const &p)
Convert the specified point into a geo::Point_t.
Algorithm to "reconstruct" trajectories from simulated particles.
::geo::Vector_t toVector(Vector const &v)
Convert the specified vector into a geo::Vector_t.
Pseudo-track object for TotallyCheatTracks example.
Definition: CheatTrack.h:52
const double e
def move(depos, offset)
Definition: depos.py:107
lar::example::CheatTrack makeTrack(simb::MCParticle const &mcParticle) const
Returns a reconstructed track from the specified particle.
tracking::Positions_t Positions_t
Type of trajectory point list.
Definition: Trajectory.h:79
tracking::Momenta_t Momenta_t
Type of momentum list.
Definition: Trajectory.h:82
Vector rounded01(Vector const &v, Scalar tol)
Returns a vector with all components rounded if close to 0, -1 or +1.