All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Public Attributes | List of all members
sbn::MVAPID Class Reference

#include <MVAPID.h>

Public Member Functions

 MVAPID ()
 
void AddScore (int pdg, float score)
 
std::pair< int, float > BestIter () const
 
int BestPDG () const
 
float BestScore () const
 

Public Attributes

std::map< int, float > mvaScoreMap
 

Detailed Description

Definition at line 9 of file MVAPID.h.

Constructor & Destructor Documentation

sbn::MVAPID::MVAPID ( )
inline

Definition at line 11 of file MVAPID.h.

11 {}

Member Function Documentation

void sbn::MVAPID::AddScore ( int  pdg,
float  score 
)

Definition at line 8 of file MVAPID.cc.

9 {
10  if (!mvaScoreMap.try_emplace(pdg, score).second)
11  throw cet::exception("MVAPID") << "Failed to add entry: " << pdg << " to MVA PID score map as it already exists" << std::endl;
12 }
var pdg
Definition: selectors.fcl:14
BEGIN_PROLOG or score(default)}sbnd_crttrackmatchingalg_crID
std::map< int, float > mvaScoreMap
Definition: MVAPID.h:13
std::pair< int, float > sbn::MVAPID::BestIter ( ) const

Definition at line 14 of file MVAPID.cc.

15 {
16  auto iter = std::max_element(mvaScoreMap.begin(), mvaScoreMap.end(), [](auto const& lhs, auto const& rhs) { return lhs.second < rhs.second; });
17 
18  if (iter == mvaScoreMap.end()) {
19  mf::LogError("MVAPID") << "Failed to find max element in map" << std::endl;
20  return {-1, std::numeric_limits<float>::lowest()};
21  }
22 
23  return *iter;
24 }
std::map< int, float > mvaScoreMap
Definition: MVAPID.h:13
int sbn::MVAPID::BestPDG ( ) const
inline

Definition at line 18 of file MVAPID.h.

18 { return this->BestIter().first; }; // Returns the hypothesis with the highest score
std::pair< int, float > BestIter() const
Definition: MVAPID.cc:14
float sbn::MVAPID::BestScore ( ) const
inline

Definition at line 19 of file MVAPID.h.

19 { return this->BestIter().second; }; // Returns the highest score from any hypothesis
std::pair< int, float > BestIter() const
Definition: MVAPID.cc:14

Member Data Documentation

std::map<int, float> sbn::MVAPID::mvaScoreMap

Definition at line 13 of file MVAPID.h.


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