LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
lar::example::CheatTrack Class Reference

Pseudo-track object for TotallyCheatTracks example. More...

#include "CheatTrack.h"

Public Types

using PDGID_t = int
 Type of the particle ID. More...
 

Public Member Functions

 CheatTrack ()=default
 Default constructor, only for ROOT I/O (do not use it!). More...
 
 CheatTrack (recob::Trajectory &&traj, PDGID_t pid)
 Constructor from trajectory (stolen) and particle ID. More...
 
recob::Trajectory const & trajectory () const
 Returns the trajectory of this track. More...
 
Access to data
double momentum () const
 Returns the initial momentum of the particle [MeV]. More...
 
PDGID_t particleId () const
 Returns the particle ID, in PDG standard. More...
 
bool hasParticleId () const
 Returns whether the particle ID is valid. More...
 

Static Public Attributes

static constexpr PDGID_t InvalidParticleID = 0
 Value of a particle ID that denotes it as invalid. More...
 

Private Attributes

recob::Trajectory fTraj
 The trejectory of this track. More...
 
PDGID_t fPDGID = InvalidParticleID
 Particle ID in PDG standard. More...
 

Related Functions

(Note that these are not member functions.)

std::ostream & operator<< (std::ostream &out, lar::example::CheatTrack const &track)
 

Printing data

static constexpr unsigned int DefaultDumpVerbosity = 1U
 Default verbosity level. More...
 
static constexpr unsigned int MaxDumpVerbosity = recob::Trajectory::MaxDumpVerbosity
 Maximum verbosity level. More...
 
template<typename Stream >
void dump (Stream &&out, unsigned int verbosity, std::string indent, std::string firstIndent) const
 Prints the content of this object into an output stream. More...
 
template<typename Stream >
void dump (Stream &&out, unsigned int verbosity=DefaultDumpVerbosity, std::string indent="") const
 Default verbosity level. More...
 

Detailed Description

Pseudo-track object for TotallyCheatTracks example.

This class represents a reconstructed track via a trajectory in phase space (position plus momentum), sampled in many points, and in addition a particle identification code representing the type of the original particle.

It is expected to be unrealistically precise for a reconstructed object, by being constructed from simulated "truth" information.

This track object does not implement the standard interface of a LArSoft track (recob::Track). It can present a standard LArSoft recob::Trajectory though.

Definition at line 50 of file CheatTrack.h.

Member Typedef Documentation

Type of the particle ID.

Definition at line 53 of file CheatTrack.h.

Constructor & Destructor Documentation

lar::example::CheatTrack::CheatTrack ( )
default

Default constructor, only for ROOT I/O (do not use it!).

lar::example::CheatTrack::CheatTrack ( recob::Trajectory &&  traj,
PDGID_t  pid 
)
inline

Constructor from trajectory (stolen) and particle ID.

Parameters
trajthe reconstructed trajectory of the track
pidparticle ID, in PDG standard

The trajectory in traj is moved into this object, and it will not be valid in the caller scope any more.

Definition at line 69 of file CheatTrack.h.

69 : fTraj(std::move(traj)), fPDGID(pid) {}
recob::Trajectory fTraj
The trejectory of this track.
Definition: CheatTrack.h:135
PDGID_t fPDGID
Particle ID in PDG standard.
Definition: CheatTrack.h:136

Member Function Documentation

template<typename Stream >
void lar::example::CheatTrack::dump ( Stream &&  out,
unsigned int  verbosity,
std::string  indent,
std::string  firstIndent 
) const

Prints the content of this object into an output stream.

Template Parameters
Streamtype of the output text stream
Parameters
outthe output text stream
verbositythe amount of information printed (default: DefaultDumpVerbosity)
indentindentation string for all output except the first line (default: none)
firstIndentindentation string for the first line (default: as indent)

Verbosity level is the same as the one of recob::Trajectory::Dump(). In addition, the momentum and particle ID are always printed.

Definition at line 160 of file CheatTrack.h.

References recob::Trajectory::Dump(), momentum(), particleId(), and trajectory().

Referenced by dump(), and operator<<().

164 {
165 
166  // we could use ROOT's TDatabasePDG to get the name of the ID, but we'd rather
167  // not depend on ROOT here...
168  out << firstIndent << "particle: ";
169  auto const* pPDGinfo = TDatabasePDG::Instance()->GetParticle(particleId());
170  if (pPDGinfo)
171  out << pPDGinfo->GetName() << " (ID=" << particleId() << ")";
172  else
173  out << "ID " << particleId();
174  out << "; momentum: " << momentum() << " GeV/c; ";
175  trajectory().Dump(std::forward<Stream>(out), verbosity, indent, "");
176 
177 } // lar::example::CheatTrack::dump()
PDGID_t particleId() const
Returns the particle ID, in PDG standard.
Definition: CheatTrack.h:82
std::string indent(std::size_t const i)
double momentum() const
Returns the initial momentum of the particle [MeV].
Definition: CheatTrack.h:79
recob::Trajectory const & trajectory() const
Returns the trajectory of this track.
Definition: CheatTrack.h:72
void Dump(Stream &&out, unsigned int verbosity, std::string indent, std::string indentFirst) const
Prints trajectory content into a stream.
template<typename Stream >
void lar::example::CheatTrack::dump ( Stream &&  out,
unsigned int  verbosity = DefaultDumpVerbosity,
std::string  indent = "" 
) const
inline

Default verbosity level.

Definition at line 122 of file CheatTrack.h.

References dump(), and art::detail::indent().

125  {
126  dump(std::forward<Stream>(out), verbosity, indent, indent);
127  }
std::string indent(std::size_t const i)
void dump(Stream &&out, unsigned int verbosity, std::string indent, std::string firstIndent) const
Prints the content of this object into an output stream.
Definition: CheatTrack.h:160
bool lar::example::CheatTrack::hasParticleId ( ) const
inline

Returns whether the particle ID is valid.

Definition at line 85 of file CheatTrack.h.

References InvalidParticleID, and particleId().

85 { return particleId() != InvalidParticleID; }
PDGID_t particleId() const
Returns the particle ID, in PDG standard.
Definition: CheatTrack.h:82
static constexpr PDGID_t InvalidParticleID
Value of a particle ID that denotes it as invalid.
Definition: CheatTrack.h:56
double lar::example::CheatTrack::momentum ( ) const
inline

Returns the initial momentum of the particle [MeV].

Definition at line 79 of file CheatTrack.h.

References recob::Trajectory::StartMomentum(), and trajectory().

Referenced by dump().

79 { return trajectory().StartMomentum(); }
double StartMomentum() const
Computes and returns the modulus of momentum at the first point [GeV/c].
Definition: Trajectory.h:363
recob::Trajectory const & trajectory() const
Returns the trajectory of this track.
Definition: CheatTrack.h:72
PDGID_t lar::example::CheatTrack::particleId ( ) const
inline

Returns the particle ID, in PDG standard.

Definition at line 82 of file CheatTrack.h.

References fPDGID.

Referenced by dump(), and hasParticleId().

82 { return fPDGID; }
PDGID_t fPDGID
Particle ID in PDG standard.
Definition: CheatTrack.h:136
recob::Trajectory const& lar::example::CheatTrack::trajectory ( ) const
inline

Returns the trajectory of this track.

Definition at line 72 of file CheatTrack.h.

References fTraj.

Referenced by dump(), and momentum().

72 { return fTraj; }
recob::Trajectory fTraj
The trejectory of this track.
Definition: CheatTrack.h:135

Friends And Related Function Documentation

std::ostream & operator<< ( std::ostream &  out,
lar::example::CheatTrack const &  track 
)
related

Prints the content of the track into a text stream.

Definition at line 143 of file CheatTrack.h.

References dump().

144  {
145  track.dump(out);
146  return out;
147  }
Float_t track
Definition: plot.C:35

Member Data Documentation

constexpr unsigned int lar::example::CheatTrack::DefaultDumpVerbosity = 1U
static

Default verbosity level.

Definition at line 95 of file CheatTrack.h.

PDGID_t lar::example::CheatTrack::fPDGID = InvalidParticleID
private

Particle ID in PDG standard.

Definition at line 136 of file CheatTrack.h.

Referenced by particleId().

recob::Trajectory lar::example::CheatTrack::fTraj
private

The trejectory of this track.

Definition at line 135 of file CheatTrack.h.

Referenced by trajectory().

constexpr PDGID_t lar::example::CheatTrack::InvalidParticleID = 0
static

Value of a particle ID that denotes it as invalid.

Definition at line 56 of file CheatTrack.h.

Referenced by hasParticleId().

constexpr unsigned int lar::example::CheatTrack::MaxDumpVerbosity = recob::Trajectory::MaxDumpVerbosity
static

Maximum verbosity level.

Definition at line 98 of file CheatTrack.h.


The documentation for this class was generated from the following file: