All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 // nusimdata libraries
18 #include "nusimdata/SimulationBase/MCParticle.h"
19 
20 // C/C++ standard libraries
21 #include <utility> // std::move()
22 
23 
24 //------------------------------------------------------------------------------
25 //--- lar::example::TotallyCheatTrackingAlg implementation
26 //------------------------------------------------------------------------------
28  (simb::MCParticle const& mcParticle) const
29 {
32 
33  for (auto const& pair: mcParticle.Trajectory()) {
34  pos.push_back
35  (geo::vect::rounded01(geo::vect::toPoint(pair.first.Vect()), 1e-8));
36  mom.push_back
37  (geo::vect::rounded01(geo::vect::toVector(pair.second.Vect()), 1e-8));
38  } // for
39 
40  return { { std::move(pos), std::move(mom), true }, mcParticle.PdgCode() };
41 } // lar::example::TotallyCheatTrackingAlg::makeTrack()
42 
43 
44 //------------------------------------------------------------------------------
::geo::Point_t toPoint(Point const &p)
Convert the specified point into a geo::Point_t.
Algorithm to &quot;reconstruct&quot; 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
Utilities to extend the interface of geometry vectors.
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.
do i e