Public Types | Public Member Functions | Static Public Attributes | Private Attributes | List of all members
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
 

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 52 of file CheatTrack.h.

Member Typedef Documentation

Type of the particle ID.

Definition at line 56 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 72 of file CheatTrack.h.

73  : fTraj(std::move(traj))
74  , fPDGID(pid)
75  {}
recob::Trajectory fTraj
The trejectory of this track.
Definition: CheatTrack.h:143
PDGID_t fPDGID
Particle ID in PDG standard.
Definition: CheatTrack.h:144
def move(depos, offset)
Definition: depos.py:107

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 168 of file CheatTrack.h.

172 {
173 
174  // we could use ROOT's TDatabasePDG to get the name of the ID, but we'd rather
175  // not depend on ROOT here...
176  out << firstIndent
177  << "particle: ";
178  auto const* pPDGinfo = TDatabasePDG::Instance()->GetParticle(particleId());
179  if (pPDGinfo) out << pPDGinfo->GetName() << " (ID=" << particleId() << ")";
180  else out << "ID " << particleId();
181  out << "; momentum: " << momentum() << " GeV/c; ";
182  trajectory().Dump(std::forward<Stream>(out), verbosity, indent, "");
183 
184 } // lar::example::CheatTrack::dump()
PDGID_t particleId() const
Returns the particle ID, in PDG standard.
Definition: CheatTrack.h:89
double momentum() const
Returns the initial momentum of the particle [MeV].
Definition: CheatTrack.h:86
recob::Trajectory const & trajectory() const
Returns the trajectory of this track.
Definition: CheatTrack.h:79
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

Definition at line 130 of file CheatTrack.h.

134  { dump(std::forward<Stream>(out), verbosity, indent, indent); }
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:168
bool lar::example::CheatTrack::hasParticleId ( ) const
inline

Returns whether the particle ID is valid.

Definition at line 92 of file CheatTrack.h.

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

Returns the initial momentum of the particle [MeV].

Definition at line 86 of file CheatTrack.h.

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

Returns the particle ID, in PDG standard.

Definition at line 89 of file CheatTrack.h.

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

Returns the trajectory of this track.

Definition at line 79 of file CheatTrack.h.

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

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 153 of file CheatTrack.h.

154  { track.dump(out); return out; }

Member Data Documentation

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

Default verbosity level.

Definition at line 102 of file CheatTrack.h.

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

Particle ID in PDG standard.

Definition at line 144 of file CheatTrack.h.

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

The trejectory of this track.

Definition at line 143 of file CheatTrack.h.

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

Value of a particle ID that denotes it as invalid.

Definition at line 59 of file CheatTrack.h.

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

Maximum verbosity level.

Definition at line 106 of file CheatTrack.h.


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