All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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::TrackFitHitInfo
trackFitHitInfos ()
 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 125 of file TrackMaker.h.

Member Typedef Documentation

Definition at line 127 of file TrackMaker.h.

Member Function Documentation

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

add one OptionalPointElement

Definition at line 131 of file TrackMaker.h.

132  {
133  if (isTrackFitInfosInit() && ope.isTrackFitInfoSet()) {
134  outTrackFitHitInfos->push_back(ope.getTrackFitHitInfo());
135  }
136  }
std::unique_ptr< std::vector< recob::TrackFitHitInfo > > outTrackFitHitInfos
Definition: TrackMaker.h:205
bool isTrackFitInfosInit()
check initialization of the output vector of TrackFitHitInfos
Definition: TrackMaker.h:173
void trkmkr::OptionalOutputs::addPoint ( OptionalPointElement ope,
art::Ptr< recob::Hit hptr 
)
inline

add one OptionalPointElement and the corresponding hit

Definition at line 139 of file TrackMaker.h.

140  {
141  if (isSpacePointsInit() && ope.isSpacePointSet()) {
142  outSpacePointHitPairs->emplace_back(ope.getSpacePoint(), hptr);
143  }
144  addPoint(ope);
145  }
std::unique_ptr< std::vector< SpHitPair > > outSpacePointHitPairs
Definition: TrackMaker.h:206
void addPoint(OptionalPointElement &ope)
add one OptionalPointElement
Definition: TrackMaker.h:131
bool isSpacePointsInit()
check initialization of the output vector of SpHitPair
Definition: TrackMaker.h:179
void trkmkr::OptionalOutputs::initSpacePoints ( )
inline

initialize the output vector of SpHitPair

Definition at line 167 of file TrackMaker.h.

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

initialize the output vector of TrackFitHitInfos

Definition at line 161 of file TrackMaker.h.

162  {
163  outTrackFitHitInfos = std::make_unique<std::vector<recob::TrackFitHitInfo>>();
164  }
std::unique_ptr< std::vector< recob::TrackFitHitInfo > > outTrackFitHitInfos
Definition: TrackMaker.h:205
bool trkmkr::OptionalOutputs::isSpacePointsInit ( )
inline

check initialization of the output vector of SpHitPair

Definition at line 179 of file TrackMaker.h.

180  {
181  return bool(outSpacePointHitPairs);
182  }
static constexpr bool
std::unique_ptr< std::vector< SpHitPair > > outSpacePointHitPairs
Definition: TrackMaker.h:206
bool trkmkr::OptionalOutputs::isTrackFitInfosInit ( )
inline

check initialization of the output vector of TrackFitHitInfos

Definition at line 173 of file TrackMaker.h.

174  {
175  return bool(outTrackFitHitInfos);
176  }
static constexpr bool
std::unique_ptr< std::vector< recob::TrackFitHitInfo > > outTrackFitHitInfos
Definition: TrackMaker.h:205
void trkmkr::OptionalOutputs::reset ( )
inline

reset the stored vectors

Definition at line 148 of file TrackMaker.h.

149  {
150  if (isTrackFitInfosInit()) {
151  outTrackFitHitInfos.reset();
153  }
154  if (isSpacePointsInit()) {
155  outSpacePointHitPairs.reset();
156  initSpacePoints();
157  }
158  }
void initTrackFitInfos()
initialize the output vector of TrackFitHitInfos
Definition: TrackMaker.h:161
std::unique_ptr< std::vector< recob::TrackFitHitInfo > > outTrackFitHitInfos
Definition: TrackMaker.h:205
std::unique_ptr< std::vector< SpHitPair > > outSpacePointHitPairs
Definition: TrackMaker.h:206
bool isTrackFitInfosInit()
check initialization of the output vector of TrackFitHitInfos
Definition: TrackMaker.h:173
void initSpacePoints()
initialize the output vector of SpHitPair
Definition: TrackMaker.h:167
bool isSpacePointsInit()
check initialization of the output vector of SpHitPair
Definition: TrackMaker.h:179
std::vector<SpHitPair> trkmkr::OptionalOutputs::spacePointHitPairs ( )
inline

get the output vector of SpHitPair by releasing and moving

Definition at line 195 of file TrackMaker.h.

196  {
197  if (!isSpacePointsInit())
198  throw std::logic_error("outSpacePointHitPairs is not available (any more?).");
199  auto tmp = *outSpacePointHitPairs;
200  outSpacePointHitPairs.reset();
201  return tmp;
202  }
std::unique_ptr< std::vector< SpHitPair > > outSpacePointHitPairs
Definition: TrackMaker.h:206
bool isSpacePointsInit()
check initialization of the output vector of SpHitPair
Definition: TrackMaker.h:179
std::vector<recob::TrackFitHitInfo> trkmkr::OptionalOutputs::trackFitHitInfos ( )
inline

get the output vector of TrackFitHitInfos by releasing and moving

Definition at line 185 of file TrackMaker.h.

186  {
187  if (!isTrackFitInfosInit())
188  throw std::logic_error("outTrackFitHitInfos is not available (any more?).");
189  auto tmp = *outTrackFitHitInfos;
190  outTrackFitHitInfos.reset();
191  return tmp;
192  }
std::unique_ptr< std::vector< recob::TrackFitHitInfo > > outTrackFitHitInfos
Definition: TrackMaker.h:205
bool isTrackFitInfosInit()
check initialization of the output vector of TrackFitHitInfos
Definition: TrackMaker.h:173

Member Data Documentation

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

Definition at line 206 of file TrackMaker.h.

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

Definition at line 205 of file TrackMaker.h.


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