All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Private Member Functions | List of all members
anab::MVAReader< T, N > Class Template Reference

#include <MVAReader.h>

Inheritance diagram for anab::MVAReader< T, N >:
anab::FVectorReader< T, N > anab::MVAWrapperBase anab::FVectorWrapperBase

Public Member Functions

 MVAReader (const art::Event &evt, const art::InputTag &tag)
 
std::vector< FeatureVector< N >
> const & 
outputs () const
 Access the vector of the feature vectors. More...
 
std::array< float, NgetOutput (size_t key) const
 Get copy of the MVA output vector at index "key". More...
 
std::array< float, NgetOutput (art::Ptr< T > const &item) const
 Get copy of the MVA output vector idicated with art::Ptr::key(). More...
 
std::array< float, NgetOutput (std::vector< art::Ptr< T > > const &items) const
 Get MVA results accumulated over the vector of items (eg. over hits associated to a cluster). More...
 
std::array< float, NgetOutput (std::vector< art::Ptr< T > > const &items, std::vector< float > const &weights) const
 
std::array< float, NgetOutput (std::vector< art::Ptr< T > > const &items, std::function< float(T const &)> fweight) const
 
const std::string & outputName (size_t index) const
 Meaning/name of the index'th column in the collection of MVA output vectors. More...
 
- Public Member Functions inherited from anab::FVectorReader< T, N >
 FVectorReader (const art::Event &evt, const art::InputTag &tag)
 
T const & item (size_t key) const
 Access data product at index "key". More...
 
std::vector< T > const & items () const
 
std::vector< FeatureVector< N >
> const & 
vectors () const
 Access the vector of the feature vectors. More...
 
std::array< float, NgetVector (size_t key) const
 Get copy of the feature vector at index "key". More...
 
std::array< float, NgetVector (art::Ptr< T > const &item) const
 Get copy of the feature vector idicated with art::Ptr::key(). More...
 
size_t size () const
 Get the number of contained items (no. of data product objects equal to no. of feature vectors). More...
 
size_t length () const
 Get the length of a single feature vector. More...
 
const std::string & dataTag () const
 Get the input tag (string representation) of data product used to calculate feature vectors. More...
 
const art::Handle< std::vector
< T > > & 
dataHandle () const
 Access the data product handle. More...
 
const std::string & columnName (size_t index) const
 Meaning/name of the index'th column in the collection of feature vectors. More...
 
int getIndex (const std::string &name) const
 Index of column with given name, or -1 if name not found. More...
 

Static Public Member Functions

static std::unique_ptr< MVAReadercreate (const art::Event &evt, const art::InputTag &tag)
 
- Static Public Member Functions inherited from anab::FVectorReader< T, N >
static std::unique_ptr
< FVectorReader
create (const art::Event &evt, const art::InputTag &tag)
 

Private Member Functions

 MVAReader (const art::Event &evt, const art::InputTag &tag, bool &success)
 Not-throwing constructor. More...
 

Additional Inherited Members

- Protected Member Functions inherited from anab::FVectorReader< T, N >
 FVectorReader (const art::Event &evt, const art::InputTag &tag, bool &success)
 Not-throwing constructor. More...
 
- Protected Member Functions inherited from anab::FVectorWrapperBase
std::string getProductName (std::type_info const &ti) const
 
size_t getProductHash (std::type_info const &ti) const
 
- Protected Member Functions inherited from anab::MVAWrapperBase
template<class T , size_t N>
std::array< float, NpAccumulate (std::vector< art::Ptr< T > > const &items, std::vector< FeatureVector< N > > const &outs) const
 
template<class T , size_t N>
std::array< float, NpAccumulate (std::vector< art::Ptr< T > > const &items, std::vector< float > const &weights, std::vector< FeatureVector< N > > const &outs) const
 
template<class T , size_t N>
std::array< float, NpAccumulate (std::vector< art::Ptr< T > > const &items, std::function< float(T const &)> fweight, std::vector< FeatureVector< N > > const &outs) const
 
template<class T , size_t N>
std::array< float, NpAccumulate (std::vector< art::Ptr< T > > const &items, std::function< float(art::Ptr< T > const &)> fweight, std::vector< FeatureVector< N > > const &outs) const
 
template<class T , size_t N>
std::array< float, NpAccumulate (std::vector< art::Ptr< T > > const &items, std::vector< FeatureVector< N > > const &outs, std::array< char, N > const &mask) const
 

Detailed Description

template<class T, size_t N>
class anab::MVAReader< T, N >

Helper for reading the reconstructed objects of type T together with associated N-outputs MVA results with their metadata (this class is not a data product).

Definition at line 104 of file MVAReader.h.

Constructor & Destructor Documentation

template<class T , size_t N>
anab::MVAReader< T, N >::MVAReader ( const art::Event &  evt,
const art::InputTag &  tag 
)
inline

Create the wrapper for MVA data stored in the event evt with the provided input tag (the same tag which was used to save MVA results with MVAWriter class). Throws exception if data products not found in the event.

Definition at line 121 of file MVAReader.h.

121  :
122  FVectorReader<T, N>(evt, tag)
123  { }
TCEvent evt
Definition: DataStructs.cxx:8
template<class T , size_t N>
anab::MVAReader< T, N >::MVAReader ( const art::Event &  evt,
const art::InputTag &  tag,
bool &  success 
)
inlineprivate

Not-throwing constructor.

Definition at line 159 of file MVAReader.h.

159  :
160  FVectorReader<T, N>(evt, tag, success)
161  { }
TCEvent evt
Definition: DataStructs.cxx:8

Member Function Documentation

template<class T , size_t N>
static std::unique_ptr<MVAReader> anab::MVAReader< T, N >::create ( const art::Event &  evt,
const art::InputTag &  tag 
)
inlinestatic

Create the wrapper for MVA data stored in the event evt with the provided input tag (the same tag which was used to save MVA results with MVAWriter class). Returns nullptr if data products not found in the event.

Definition at line 110 of file MVAReader.h.

111  {
112  bool success;
113  std::unique_ptr<MVAReader> ptr(new MVAReader(evt, tag, success));
114  if (success) { return ptr; }
115  else { return nullptr; }
116  }
MVAReader(const art::Event &evt, const art::InputTag &tag)
Definition: MVAReader.h:121
TCEvent evt
Definition: DataStructs.cxx:8
template<class T , size_t N>
std::array<float, N> anab::MVAReader< T, N >::getOutput ( size_t  key) const
inline

Get copy of the MVA output vector at index "key".

Definition at line 129 of file MVAReader.h.

130  { return FVectorReader<T, N>::getVector(key); }
std::array< float, N > getVector(size_t key) const
Get copy of the feature vector at index &quot;key&quot;.
Definition: MVAReader.h:54
template<class T , size_t N>
std::array<float, N> anab::MVAReader< T, N >::getOutput ( art::Ptr< T > const &  item) const
inline

Get copy of the MVA output vector idicated with art::Ptr::key().

Definition at line 133 of file MVAReader.h.

134  { return FVectorReader<T, N>::getVector(item.key()); }
std::array< float, N > getVector(size_t key) const
Get copy of the feature vector at index &quot;key&quot;.
Definition: MVAReader.h:54
T const & item(size_t key) const
Access data product at index &quot;key&quot;.
Definition: MVAReader.h:43
template<class T , size_t N>
std::array<float, N> anab::MVAReader< T, N >::getOutput ( std::vector< art::Ptr< T > > const &  items) const
inline

Get MVA results accumulated over the vector of items (eg. over hits associated to a cluster).

Definition at line 137 of file MVAReader.h.

138  { return pAccumulate(items, FVectorReader<T, N>::vectors()); }
std::array< float, N > pAccumulate(std::vector< art::Ptr< T > > const &items, std::vector< FeatureVector< N > > const &outs) const
template<class T , size_t N>
std::array<float, N> anab::MVAReader< T, N >::getOutput ( std::vector< art::Ptr< T > > const &  items,
std::vector< float > const &  weights 
) const
inline

Get MVA results accumulated with provided weights over the vector of items (eg. over clusters associated to a track, weighted by the cluster size; or over hits associated to a cluster, weighted by the hit area).

Definition at line 143 of file MVAReader.h.

145  { return pAccumulate(items, weights, FVectorReader<T, N>::vectors()); }
std::array< float, N > pAccumulate(std::vector< art::Ptr< T > > const &items, std::vector< FeatureVector< N > > const &outs) const
template<class T , size_t N>
std::array<float, N> anab::MVAReader< T, N >::getOutput ( std::vector< art::Ptr< T > > const &  items,
std::function< float(T const &)>  fweight 
) const
inline

Get MVA results accumulated with provided weighting function over the vector of items (eg. over clusters associated to a track, weighted by the cluster size; or over hits associated to a cluster, weighted by the hit area).

Definition at line 150 of file MVAReader.h.

152  { return pAccumulate(items, fweight, FVectorReader<T, N>::vectors()); }
std::array< float, N > pAccumulate(std::vector< art::Ptr< T > > const &items, std::vector< FeatureVector< N > > const &outs) const
template<class T , size_t N>
const std::string& anab::MVAReader< T, N >::outputName ( size_t  index) const
inline

Meaning/name of the index'th column in the collection of MVA output vectors.

Definition at line 155 of file MVAReader.h.

155 { return FVectorReader<T, N>::columnName(index); }
const std::string & columnName(size_t index) const
Meaning/name of the index&#39;th column in the collection of feature vectors.
Definition: MVAReader.h:79
template<class T , size_t N>
std::vector< FeatureVector<N> > const& anab::MVAReader< T, N >::outputs ( ) const
inline

Access the vector of the feature vectors.

Definition at line 126 of file MVAReader.h.

126 { return FVectorReader<T, N>::vectors(); }
std::vector< FeatureVector< N > > const & vectors() const
Access the vector of the feature vectors.
Definition: MVAReader.h:47

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