Public Types | Public Member Functions | Private Attributes | List of all members
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 114 of file TrackMaker.h.

Member Typedef Documentation

Definition at line 116 of file TrackMaker.h.

Member Function Documentation

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

add one OptionalPointElement

Definition at line 120 of file TrackMaker.h.

121  {
122  if (isTrackFitInfosInit() && ope.isTrackFitInfoSet()) {
123  outTrackFitHitInfos->push_back(ope.getTrackFitHitInfo());
124  }
125  }
std::unique_ptr< std::vector< recob::TrackFitHitInfo > > outTrackFitHitInfos
Definition: TrackMaker.h:194
bool isTrackFitInfosInit()
check initialization of the output vector of TrackFitHitInfos
Definition: TrackMaker.h:162
void trkmkr::OptionalOutputs::addPoint ( OptionalPointElement ope,
art::Ptr< recob::Hit hptr 
)
inline

add one OptionalPointElement and the corresponding hit

Definition at line 128 of file TrackMaker.h.

129  {
130  if (isSpacePointsInit() && ope.isSpacePointSet()) {
131  outSpacePointHitPairs->emplace_back(ope.getSpacePoint(), hptr);
132  }
133  addPoint(ope);
134  }
std::unique_ptr< std::vector< SpHitPair > > outSpacePointHitPairs
Definition: TrackMaker.h:195
void addPoint(OptionalPointElement &ope)
add one OptionalPointElement
Definition: TrackMaker.h:120
bool isSpacePointsInit()
check initialization of the output vector of SpHitPair
Definition: TrackMaker.h:168
void trkmkr::OptionalOutputs::initSpacePoints ( )
inline

initialize the output vector of SpHitPair

Definition at line 156 of file TrackMaker.h.

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

initialize the output vector of TrackFitHitInfos

Definition at line 150 of file TrackMaker.h.

151  {
152  outTrackFitHitInfos = std::make_unique<std::vector<recob::TrackFitHitInfo>>();
153  }
std::unique_ptr< std::vector< recob::TrackFitHitInfo > > outTrackFitHitInfos
Definition: TrackMaker.h:194
bool trkmkr::OptionalOutputs::isSpacePointsInit ( )
inline

check initialization of the output vector of SpHitPair

Definition at line 168 of file TrackMaker.h.

169  {
170  return bool(outSpacePointHitPairs);
171  }
std::unique_ptr< std::vector< SpHitPair > > outSpacePointHitPairs
Definition: TrackMaker.h:195
int bool
Definition: qglobal.h:345
bool trkmkr::OptionalOutputs::isTrackFitInfosInit ( )
inline

check initialization of the output vector of TrackFitHitInfos

Definition at line 162 of file TrackMaker.h.

163  {
164  return bool(outTrackFitHitInfos);
165  }
std::unique_ptr< std::vector< recob::TrackFitHitInfo > > outTrackFitHitInfos
Definition: TrackMaker.h:194
int bool
Definition: qglobal.h:345
void trkmkr::OptionalOutputs::reset ( )
inline

reset the stored vectors

Definition at line 137 of file TrackMaker.h.

138  {
139  if (isTrackFitInfosInit()) {
140  outTrackFitHitInfos.reset();
142  }
143  if (isSpacePointsInit()) {
144  outSpacePointHitPairs.reset();
145  initSpacePoints();
146  }
147  }
void initTrackFitInfos()
initialize the output vector of TrackFitHitInfos
Definition: TrackMaker.h:150
std::unique_ptr< std::vector< recob::TrackFitHitInfo > > outTrackFitHitInfos
Definition: TrackMaker.h:194
std::unique_ptr< std::vector< SpHitPair > > outSpacePointHitPairs
Definition: TrackMaker.h:195
bool isTrackFitInfosInit()
check initialization of the output vector of TrackFitHitInfos
Definition: TrackMaker.h:162
void initSpacePoints()
initialize the output vector of SpHitPair
Definition: TrackMaker.h:156
bool isSpacePointsInit()
check initialization of the output vector of SpHitPair
Definition: TrackMaker.h:168
std::vector<SpHitPair> trkmkr::OptionalOutputs::spacePointHitPairs ( )
inline

get the output vector of SpHitPair by releasing and moving

Definition at line 184 of file TrackMaker.h.

185  {
186  if (!isSpacePointsInit())
187  throw std::logic_error("outSpacePointHitPairs is not available (any more?).");
188  auto tmp = *outSpacePointHitPairs;
189  outSpacePointHitPairs.reset();
190  return tmp;
191  }
string tmp
Definition: languages.py:63
std::unique_ptr< std::vector< SpHitPair > > outSpacePointHitPairs
Definition: TrackMaker.h:195
bool isSpacePointsInit()
check initialization of the output vector of SpHitPair
Definition: TrackMaker.h:168
std::vector<recob::TrackFitHitInfo> trkmkr::OptionalOutputs::trackFitHitInfos ( )
inline

get the output vector of TrackFitHitInfos by releasing and moving

Definition at line 174 of file TrackMaker.h.

175  {
176  if (!isTrackFitInfosInit())
177  throw std::logic_error("outTrackFitHitInfos is not available (any more?).");
178  auto tmp = *outTrackFitHitInfos;
179  outTrackFitHitInfos.reset();
180  return tmp;
181  }
std::unique_ptr< std::vector< recob::TrackFitHitInfo > > outTrackFitHitInfos
Definition: TrackMaker.h:194
string tmp
Definition: languages.py:63
bool isTrackFitInfosInit()
check initialization of the output vector of TrackFitHitInfos
Definition: TrackMaker.h:162

Member Data Documentation

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

Definition at line 195 of file TrackMaker.h.

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

Definition at line 194 of file TrackMaker.h.


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