LArSoft
v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
|
#include "MVAWriter.h"
Public Member Functions | |
MVAWriter (art::EDProducer *module, const char *name="") | |
void | setOutput (FVector_ID id, size_t key, std::array< float, N > const &values) |
void | setOutput (FVector_ID id, size_t key, std::array< double, N > const &values) |
void | setOutput (FVector_ID id, size_t key, std::vector< float > const &values) |
void | setOutput (FVector_ID id, size_t key, std::vector< double > const &values) |
void | addOutput (FVector_ID id, std::array< float, N > const &values) |
void | addOutput (FVector_ID id, std::array< double, N > const &values) |
void | addOutput (FVector_ID id, std::vector< float > const &values) |
void | addOutput (FVector_ID id, std::vector< double > const &values) |
template<class T > | |
std::array< float, N > | getOutput (std::vector< art::Ptr< T > > const &items) const |
template<class T > | |
std::array< float, N > | getOutput (std::vector< art::Ptr< T > > const &items, std::vector< float > const &weights) const |
template<class T > | |
std::array< float, N > | getOutput (std::vector< art::Ptr< T > > const &items, std::function< float(T const &)> fweight) const |
template<class T > | |
std::array< float, N > | getOutput (std::vector< art::Ptr< T > > const &items, std::function< float(art::Ptr< T > const &)> fweight) const |
template<class T > | |
std::array< float, N > | getOutput (size_t key) const |
Get copy of the MVA output vector for the type T, at index "key". More... | |
template<class T > | |
std::array< float, N > | getOutput (art::Ptr< T > const &item) const |
Get copy of the MVA output vector for the type T, idicated with art::Ptr::key(). More... | |
template<class T > | |
void | produces_using () |
template<class T > | |
FVector_ID | initOutputs (std::string const &dataTag, size_t dataSize, std::vector< std::string > const &names=std::vector< std::string >(N,"")) |
template<class T > | |
FVector_ID | initOutputs (art::InputTag const &dataTag, size_t dataSize, std::vector< std::string > const &names=std::vector< std::string >(N,"")) |
template<class T > | |
FVector_ID | initOutputs (art::InputTag const &dataTag, std::vector< std::string > const &names=std::vector< std::string >(N,"")) |
template<class T > | |
FVector_ID | initOutputs (std::vector< std::string > const &names=std::vector< std::string >(N,"")) |
template<class T > | |
anab::FVector_ID | initOutputs (std::string const &dataTag, size_t dataSize, std::vector< std::string > const &names) |
void | setVector (FVector_ID id, size_t key, std::array< float, N > const &values) |
void | setVector (FVector_ID id, size_t key, std::array< double, N > const &values) |
void | setVector (FVector_ID id, size_t key, std::vector< float > const &values) |
void | setVector (FVector_ID id, size_t key, std::vector< double > const &values) |
void | addVector (FVector_ID id, std::array< float, N > const &values) |
void | addVector (FVector_ID id, std::array< double, N > const &values) |
void | addVector (FVector_ID id, std::vector< float > const &values) |
void | addVector (FVector_ID id, std::vector< double > const &values) |
void | setDataTag (FVector_ID id, art::InputTag const &dataTag) |
Set tag of associated data products in case it was not ready at the initialization time. More... | |
void | saveOutputs (art::Event &evt) |
Check consistency and save all the results in the event. More... | |
size_t | size (FVector_ID id) const |
Get the number of contained feature vectors. More... | |
size_t | length () const |
Get the length of a single feature vector. More... | |
template<class T > | |
std::array< float, N > | getVector (size_t key) const |
Get copy of the feature vector for the type T, at index "key". More... | |
template<class T > | |
std::array< float, N > | getVector (art::Ptr< T > const &item) const |
Get copy of the feature vector for the type T, idicated with art::Ptr::key(). More... | |
template<class T > | |
anab::FVector_ID | getProductID () const |
Protected Member Functions | |
template<class T > | |
FVector_ID | getProductID () const |
std::string | getProductName (std::type_info const &ti) const |
size_t | getProductHash (std::type_info const &ti) const |
template<class T , size_t N> | |
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 > | pAccumulate (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, N > | pAccumulate (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, N > | pAccumulate (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, N > | pAccumulate (std::vector< art::Ptr< T > > const &items, std::vector< FeatureVector< N > > const &outs, std::array< char, N > const &mask) const |
Protected Attributes | |
std::vector< std::unique_ptr< std::vector< anab::FeatureVector< N > > > > | fVectors |
Helper for registering in the art::EDProducer all data products needed for N-output MVA results: keep MVADescriptions<N> for all types T in one collection while separate instance names are used for the MVA output value collections for each type T. Use one instance of this class per one MVA model, applied to one or more types.
Definition at line 163 of file MVAWriter.h.
|
inline |
Name provided to the constructor is used as an instance name for MVADescription<N> and FeatureVector<N> (for which it is combined with the processed data product names). Good idea is to use the name as an indication of what MVA model was used on the data (like eg. "emtrack" for outputs from a model distinguishing EM from track-like hits and clusters). The name is used as an instance name for the MVADescription data product which lets you to save multiple MVA results from a single art module.
Definition at line 172 of file MVAWriter.h.
|
inline |
Definition at line 181 of file MVAWriter.h.
References anab::FVectorWriter< N >::addVector().
|
inline |
Definition at line 182 of file MVAWriter.h.
References anab::FVectorWriter< N >::addVector().
|
inline |
Definition at line 183 of file MVAWriter.h.
References anab::FVectorWriter< N >::addVector().
|
inline |
Definition at line 184 of file MVAWriter.h.
References anab::FVectorWriter< N >::addVector().
|
inlineinherited |
Definition at line 79 of file MVAWriter.h.
Referenced by anab::MVAWriter< N >::addOutput(), and hit::DPRawHitFinder::produce().
|
inlineinherited |
Definition at line 80 of file MVAWriter.h.
|
inlineinherited |
Definition at line 81 of file MVAWriter.h.
|
inlineinherited |
Definition at line 82 of file MVAWriter.h.
|
inline |
Get MVA results accumulated over the vector of items (eg. over hits associated to a cluster). NOTE: MVA outputs for these items has to be added to the MVAWriter first!
Definition at line 190 of file MVAWriter.h.
|
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). NOTE: MVA outputs for these items has to be added to the MVAWriter first!
Definition at line 198 of file MVAWriter.h.
|
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). NOTE: MVA outputs for these items has to be added to the MVAWriter first!
Definition at line 207 of file MVAWriter.h.
|
inline |
Definition at line 212 of file MVAWriter.h.
|
inline |
Get copy of the MVA output vector for the type T, at index "key".
Definition at line 218 of file MVAWriter.h.
|
inline |
Get copy of the MVA output vector for the type T, idicated with art::Ptr::key().
Definition at line 222 of file MVAWriter.h.
|
inlineprotectedinherited |
Definition at line 31 of file MVAWrapperBase.h.
Referenced by anab::FVectorWriter< N >::getProductID(), and anab::FVectorWriter< N >::initOutputs().
|
protectedinherited |
|
inherited |
Definition at line 233 of file MVAWriter.h.
References anab::FVectorWriter< N >::fTypeHashToID, anab::FVectorWrapperBase::getProductHash(), and anab::FVectorWrapperBase::getProductName().
|
protectedinherited |
Definition at line 17 of file MVAWrapperBase.cxx.
Referenced by anab::FVectorReader< T, N >::FVectorReader(), anab::FVectorWriter< N >::getProductID(), anab::FVectorWriter< N >::initOutputs(), and anab::FVectorWriter< N >::produces_using().
|
inlineinherited |
Get copy of the feature vector for the type T, at index "key".
Definition at line 98 of file MVAWriter.h.
|
inlineinherited |
Get copy of the feature vector for the type T, idicated with art::Ptr::key().
Definition at line 108 of file MVAWriter.h.
|
inherited |
Initialize container for FeatureVectors and, if not yet done, the container for metadata, then creates metadata for data products of type T. FeatureVector container is initialized to hold dataSize vectors (if dataSize > 0): use setOutput() to store values. Returns index of collection which should be used when saving actual output values.
Referenced by anab::FVectorWriter< 4 >::FVectorWriter(), and hit::DPRawHitFinder::produce().
|
inlineinherited |
Definition at line 55 of file MVAWriter.h.
|
inlineinherited |
Initialize container for FeatureVectors and, if not yet done, the container for metadata, then creates metadata for data products of type T. FeatureVector container is initialized as EMPTY and vectors should be added with addOutput() function. Returns index of collection which should be used when adding actual output values.
Definition at line 70 of file MVAWriter.h.
|
inlineinherited |
Definition at line 75 of file MVAWriter.h.
|
inherited |
Definition at line 293 of file MVAWriter.h.
References anab::FVectorWriter< N >::dataTypeRegistered(), anab::FVectorWriter< N >::descriptionExists(), anab::FVectorWriter< N >::fDescriptions, anab::FVectorWriter< N >::fInstanceName, anab::FVectorWriter< N >::fTypeHashToID, anab::FVectorWriter< N >::fVectors, anab::FVectorWrapperBase::getProductHash(), anab::FVectorWrapperBase::getProductName(), and lar::dump::vector().
|
inlineinherited |
Get the length of a single feature vector.
Definition at line 94 of file MVAWriter.h.
|
protectedinherited |
Definition at line 80 of file MVAWrapperBase.h.
References trkf::fill().
|
protectedinherited |
Definition at line 127 of file MVAWrapperBase.h.
References trkf::fill(), and w.
|
protectedinherited |
Definition at line 181 of file MVAWrapperBase.h.
References trkf::fill(), and w.
|
protectedinherited |
Definition at line 235 of file MVAWrapperBase.h.
References trkf::fill(), and w.
|
protectedinherited |
Definition at line 293 of file MVAWrapperBase.h.
Register the collection of metadata type FVecDescription<N> (once for all data types for which vectors are saved) and the collection of FeatureVectors<N> (using data type name added to fInstanceName as instance name of the collection made for the type T).
Definition at line 258 of file MVAWriter.h.
References anab::FVectorWriter< N >::dataTypeRegistered(), anab::FVectorWriter< N >::fInstanceName, anab::FVectorWriter< N >::fIsDescriptionRegistered, anab::FVectorWriter< N >::fProducer, anab::FVectorWriter< N >::fRegisteredDataTypes, and anab::FVectorWrapperBase::getProductName().
Referenced by hit::DPRawHitFinder::DPRawHitFinder(), and anab::FVectorWriter< 4 >::FVectorWriter().
|
inherited |
Check consistency and save all the results in the event.
Definition at line 326 of file MVAWriter.h.
References anab::FVectorWriter< N >::clearEventData(), anab::FVectorWriter< N >::descriptionExists(), anab::FVectorWriter< N >::fDescriptions, anab::FVectorWriter< N >::fInstanceName, anab::FVectorWriter< N >::fRegisteredDataTypes, anab::FVectorWriter< N >::fVectors, n, and art::Event::put().
Referenced by hit::DPRawHitFinder::produce(), and anab::FVectorWriter< 4 >::setDataTag().
|
inlineinherited |
Set tag of associated data products in case it was not ready at the initialization time.
Definition at line 85 of file MVAWriter.h.
|
inline |
Definition at line 176 of file MVAWriter.h.
References anab::FVectorWriter< N >::setVector().
|
inline |
Definition at line 177 of file MVAWriter.h.
References anab::FVectorWriter< N >::setVector().
|
inline |
Definition at line 178 of file MVAWriter.h.
References anab::FVectorWriter< N >::setVector().
|
inline |
Definition at line 179 of file MVAWriter.h.
References anab::FVectorWriter< N >::setVector().
|
inlineinherited |
Definition at line 59 of file MVAWriter.h.
Referenced by anab::MVAWriter< N >::setOutput().
|
inlineinherited |
Definition at line 60 of file MVAWriter.h.
|
inlineinherited |
Definition at line 61 of file MVAWriter.h.
|
inlineinherited |
Definition at line 62 of file MVAWriter.h.
|
inlineinherited |
Get the number of contained feature vectors.
Definition at line 91 of file MVAWriter.h.
|
protectedinherited |
Definition at line 132 of file MVAWriter.h.
Referenced by anab::FVectorWriter< 4 >::addVector(), anab::FVectorWriter< 4 >::getVector(), anab::FVectorWriter< N >::initOutputs(), anab::FVectorWriter< N >::saveOutputs(), anab::FVectorWriter< 4 >::setVector(), and anab::FVectorWriter< 4 >::size().