LArSoft
v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
|
#include "MVAWriter.h"
Public Member Functions | |
MVAWriter (art::ProducesCollector &collector, 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 202 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 210 of file MVAWriter.h.
|
inline |
Definition at line 231 of file MVAWriter.h.
Referenced by nnet::EmTrack< N >::make_clusters(), nnet::EmTrackClusterId2out::produce(), nnet::EmTrackClusterId::produce(), and nnet::EmTrackMichelId::produce().
|
inline |
Definition at line 235 of file MVAWriter.h.
|
inline |
Definition at line 239 of file MVAWriter.h.
|
inline |
Definition at line 243 of file MVAWriter.h.
|
inlineinherited |
Definition at line 96 of file MVAWriter.h.
Referenced by anab::MVAWriter< 4 >::addOutput(), and hit::DPRawHitFinder::produce().
|
inlineinherited |
Definition at line 100 of file MVAWriter.h.
|
inlineinherited |
Definition at line 104 of file MVAWriter.h.
|
inlineinherited |
Definition at line 108 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 251 of file MVAWriter.h.
Referenced by nnet::EmTrackClusterId2out::produce(), nnet::EmTrackClusterId::produce(), and nnet::EmTrackMichelId::produce().
|
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 262 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 276 of file MVAWriter.h.
|
inline |
Definition at line 286 of file MVAWriter.h.
|
inline |
Get copy of the MVA output vector for the type T, at index "key".
Definition at line 297 of file MVAWriter.h.
|
inline |
Get copy of the MVA output vector for the type T, idicated with art::Ptr::key().
Definition at line 304 of file MVAWriter.h.
|
inlineprotectedinherited |
Definition at line 29 of file MVAWrapperBase.h.
Referenced by anab::FVectorWriter< N >::getProductID(), and anab::FVectorWriter< N >::initOutputs().
|
protectedinherited |
|
inherited |
Definition at line 317 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 130 of file MVAWriter.h.
|
inlineinherited |
Get copy of the feature vector for the type T, idicated with art::Ptr::key().
Definition at line 141 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(), hit::DPRawHitFinder::produce(), nnet::EmTrackClusterId2out::produce(), nnet::EmTrackClusterId::produce(), and nnet::EmTrackMichelId::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 84 of file MVAWriter.h.
|
inlineinherited |
Definition at line 91 of file MVAWriter.h.
|
inherited |
Definition at line 374 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 126 of file MVAWriter.h.
|
protectedinherited |
Definition at line 73 of file MVAWrapperBase.h.
References trkf::fill().
|
protectedinherited |
Definition at line 119 of file MVAWrapperBase.h.
References trkf::fill(), and w.
|
protectedinherited |
Definition at line 173 of file MVAWrapperBase.h.
References trkf::fill(), and w.
|
protectedinherited |
Definition at line 227 of file MVAWrapperBase.h.
References trkf::fill(), and w.
|
protectedinherited |
Definition at line 285 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 341 of file MVAWriter.h.
References anab::FVectorWriter< N >::dataTypeRegistered(), anab::FVectorWriter< N >::fCollector, anab::FVectorWriter< N >::fInstanceName, anab::FVectorWriter< N >::fIsDescriptionRegistered, anab::FVectorWriter< N >::fRegisteredDataTypes, anab::FVectorWrapperBase::getProductName(), and art::ProducesCollector::produces().
Referenced by hit::DPRawHitFinder::DPRawHitFinder(), nnet::EmTrackClusterId::EmTrackClusterId(), nnet::EmTrackClusterId2out::EmTrackClusterId2out(), nnet::EmTrackMichelId::EmTrackMichelId(), and anab::FVectorWriter< 4 >::FVectorWriter().
|
inherited |
Check consistency and save all the results in the event.
Definition at line 404 of file MVAWriter.h.
References anab::FVectorWriter< N >::clearEventData(), anab::FVectorWriter< N >::descriptionExists(), util::empty(), 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(), nnet::EmTrack< N >::produce(), nnet::EmTrackClusterId2out::produce(), nnet::EmTrackClusterId::produce(), nnet::EmTrackMichelId::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 114 of file MVAWriter.h.
|
inline |
Definition at line 214 of file MVAWriter.h.
Referenced by nnet::EmTrack< N >::classify_hits(), nnet::EmTrack< N >::make_tracks(), nnet::EmTrackClusterId2out::produce(), nnet::EmTrackClusterId::produce(), and nnet::EmTrackMichelId::produce().
|
inline |
Definition at line 218 of file MVAWriter.h.
|
inline |
Definition at line 222 of file MVAWriter.h.
|
inline |
Definition at line 226 of file MVAWriter.h.
|
inlineinherited |
Definition at line 62 of file MVAWriter.h.
Referenced by anab::MVAWriter< 4 >::setOutput().
|
inlineinherited |
Definition at line 66 of file MVAWriter.h.
|
inlineinherited |
Definition at line 70 of file MVAWriter.h.
|
inlineinherited |
Definition at line 74 of file MVAWriter.h.
|
inlineinherited |
Get the number of contained feature vectors.
Definition at line 123 of file MVAWriter.h.
|
protectedinherited |
Definition at line 170 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().