LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
trkmkr::OptionalOutputs Struct Reference

Struct holding optional TrackMaker outputs. More...

#include "TrackMaker.h"

Public Types

typedef std::pair< recob::SpacePoint, art::Ptr< recob::Hit > > SpHitPair
 

Public Member Functions

void addPoint (OptionalPointElement &ope)
 add one OptionalPointElement More...
 
void addPoint (OptionalPointElement &ope, art::Ptr< recob::Hit > hptr)
 add one OptionalPointElement and the corresponding hit More...
 
void reset ()
 reset the stored vectors More...
 
void initTrackFitInfos ()
 initialize the output vector of TrackFitHitInfos More...
 
void initSpacePoints ()
 initialize the output vector of SpHitPair More...
 
bool isTrackFitInfosInit ()
 check initialization of the output vector of TrackFitHitInfos More...
 
bool isSpacePointsInit ()
 check initialization of the output vector of SpHitPair More...
 
std::vector< recob::TrackFitHitInfotrackFitHitInfos ()
 get the output vector of TrackFitHitInfos by releasing and moving More...
 
std::vector< SpHitPairspacePointHitPairs ()
 get the output vector of SpHitPair by releasing and moving More...
 

Private Attributes

std::unique_ptr< std::vector< recob::TrackFitHitInfo > > outTrackFitHitInfos
 
std::unique_ptr< std::vector< SpHitPair > > outSpacePointHitPairs
 

Detailed Description

Struct holding optional TrackMaker outputs.

This struct holds the optional outputs of track making and hides their details to the actual track making tools. In this way, adding a new optional output will affect only those tools that produce such new ouput.

It stores a unique_ptr to the vector of each optional output object (meant to be per-track). Track making tools need to init the outional outputs they will produce, so that only the unique_ptrs that are needed are actually created. Functions are provided (called addPoint) to add point-by-point elements (see OptionalPointElement). When the output objects are returned, the unique_ptr is reset, so that no new elements should be added and a new initialization is needed.

Author
G. Cerati (FNAL, MicroBooNE)
Date
2017
Version
1.0

Definition at line 108 of file TrackMaker.h.

Member Typedef Documentation

Definition at line 110 of file TrackMaker.h.

Member Function Documentation

void trkmkr::OptionalOutputs::addPoint ( OptionalPointElement ope)
inline

add one OptionalPointElement

Definition at line 113 of file TrackMaker.h.

References trkmkr::OptionalPointElement::getTrackFitHitInfo(), and trkmkr::OptionalPointElement::isTrackFitInfoSet().

Referenced by trkmkr::TrackCreationBookKeeper::addPoint().

114  {
115  if (isTrackFitInfosInit() && ope.isTrackFitInfoSet()) {
116  outTrackFitHitInfos->push_back(ope.getTrackFitHitInfo());
117  }
118  }
std::unique_ptr< std::vector< recob::TrackFitHitInfo > > outTrackFitHitInfos
Definition: TrackMaker.h:170
bool isTrackFitInfosInit()
check initialization of the output vector of TrackFitHitInfos
Definition: TrackMaker.h:147
void trkmkr::OptionalOutputs::addPoint ( OptionalPointElement ope,
art::Ptr< recob::Hit hptr 
)
inline

add one OptionalPointElement and the corresponding hit

Definition at line 120 of file TrackMaker.h.

References trkmkr::OptionalPointElement::getSpacePoint(), and trkmkr::OptionalPointElement::isSpacePointSet().

121  {
122  if (isSpacePointsInit() && ope.isSpacePointSet()) {
123  outSpacePointHitPairs->emplace_back(ope.getSpacePoint(), hptr);
124  }
125  addPoint(ope);
126  }
std::unique_ptr< std::vector< SpHitPair > > outSpacePointHitPairs
Definition: TrackMaker.h:171
void addPoint(OptionalPointElement &ope)
add one OptionalPointElement
Definition: TrackMaker.h:113
bool isSpacePointsInit()
check initialization of the output vector of SpHitPair
Definition: TrackMaker.h:149
void trkmkr::OptionalOutputs::initSpacePoints ( )
inline

initialize the output vector of SpHitPair

Definition at line 145 of file TrackMaker.h.

Referenced by TrackProducerFromTrack::produce(), TrackProducerFromTrackTrajectory::produce(), and TrackProducerFromPFParticle::produce().

145 { outSpacePointHitPairs = std::make_unique<std::vector<SpHitPair>>(); }
std::unique_ptr< std::vector< SpHitPair > > outSpacePointHitPairs
Definition: TrackMaker.h:171
void trkmkr::OptionalOutputs::initTrackFitInfos ( )
inline

initialize the output vector of TrackFitHitInfos

Definition at line 140 of file TrackMaker.h.

Referenced by TrackProducerFromTrack::produce(), TrackProducerFromTrackTrajectory::produce(), TrackProducerFromPFParticle::produce(), trkf::KalmanFilterTrajectoryFitter::produce(), and trkf::KalmanFilterFinalTrackFitter::produce().

141  {
142  outTrackFitHitInfos = std::make_unique<std::vector<recob::TrackFitHitInfo>>();
143  }
std::unique_ptr< std::vector< recob::TrackFitHitInfo > > outTrackFitHitInfos
Definition: TrackMaker.h:170
bool trkmkr::OptionalOutputs::isSpacePointsInit ( )
inline

check initialization of the output vector of SpHitPair

Definition at line 149 of file TrackMaker.h.

149 { return bool(outSpacePointHitPairs); }
std::unique_ptr< std::vector< SpHitPair > > outSpacePointHitPairs
Definition: TrackMaker.h:171
bool trkmkr::OptionalOutputs::isTrackFitInfosInit ( )
inline

check initialization of the output vector of TrackFitHitInfos

Definition at line 147 of file TrackMaker.h.

Referenced by trkf::TrackKalmanFitter::fillResult(), and trkmkr::KalmanFilterFitTrackMaker::restoreInputPoints().

147 { return bool(outTrackFitHitInfos); }
std::unique_ptr< std::vector< recob::TrackFitHitInfo > > outTrackFitHitInfos
Definition: TrackMaker.h:170
void trkmkr::OptionalOutputs::reset ( )
inline

reset the stored vectors

Definition at line 128 of file TrackMaker.h.

Referenced by trkmkr::TrackCreationBookKeeper::TrackCreationBookKeeper().

129  {
130  if (isTrackFitInfosInit()) {
131  outTrackFitHitInfos.reset();
133  }
134  if (isSpacePointsInit()) {
135  outSpacePointHitPairs.reset();
136  initSpacePoints();
137  }
138  }
void initTrackFitInfos()
initialize the output vector of TrackFitHitInfos
Definition: TrackMaker.h:140
std::unique_ptr< std::vector< recob::TrackFitHitInfo > > outTrackFitHitInfos
Definition: TrackMaker.h:170
std::unique_ptr< std::vector< SpHitPair > > outSpacePointHitPairs
Definition: TrackMaker.h:171
bool isTrackFitInfosInit()
check initialization of the output vector of TrackFitHitInfos
Definition: TrackMaker.h:147
void initSpacePoints()
initialize the output vector of SpHitPair
Definition: TrackMaker.h:145
bool isSpacePointsInit()
check initialization of the output vector of SpHitPair
Definition: TrackMaker.h:149
std::vector<SpHitPair> trkmkr::OptionalOutputs::spacePointHitPairs ( )
inline

get the output vector of SpHitPair by releasing and moving

Definition at line 160 of file TrackMaker.h.

References tmp.

Referenced by TrackProducerFromTrack::produce(), TrackProducerFromTrackTrajectory::produce(), and TrackProducerFromPFParticle::produce().

161  {
162  if (!isSpacePointsInit())
163  throw std::logic_error("outSpacePointHitPairs is not available (any more?).");
164  auto tmp = *outSpacePointHitPairs;
165  outSpacePointHitPairs.reset();
166  return tmp;
167  }
Float_t tmp
Definition: plot.C:35
std::unique_ptr< std::vector< SpHitPair > > outSpacePointHitPairs
Definition: TrackMaker.h:171
bool isSpacePointsInit()
check initialization of the output vector of SpHitPair
Definition: TrackMaker.h:149
std::vector<recob::TrackFitHitInfo> trkmkr::OptionalOutputs::trackFitHitInfos ( )
inline

get the output vector of TrackFitHitInfos by releasing and moving

Definition at line 151 of file TrackMaker.h.

References tmp.

Referenced by TrackProducerFromTrack::produce(), TrackProducerFromTrackTrajectory::produce(), TrackProducerFromPFParticle::produce(), trkf::KalmanFilterTrajectoryFitter::produce(), and trkf::KalmanFilterFinalTrackFitter::produce().

152  {
153  if (!isTrackFitInfosInit())
154  throw std::logic_error("outTrackFitHitInfos is not available (any more?).");
155  auto tmp = *outTrackFitHitInfos;
156  outTrackFitHitInfos.reset();
157  return tmp;
158  }
Float_t tmp
Definition: plot.C:35
std::unique_ptr< std::vector< recob::TrackFitHitInfo > > outTrackFitHitInfos
Definition: TrackMaker.h:170
bool isTrackFitInfosInit()
check initialization of the output vector of TrackFitHitInfos
Definition: TrackMaker.h:147

Member Data Documentation

std::unique_ptr<std::vector<SpHitPair> > trkmkr::OptionalOutputs::outSpacePointHitPairs
private

Definition at line 171 of file TrackMaker.h.

std::unique_ptr<std::vector<recob::TrackFitHitInfo> > trkmkr::OptionalOutputs::outTrackFitHitInfos
private

Definition at line 170 of file TrackMaker.h.


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