ATLAS Offline Software
Loading...
Searching...
No Matches
tauRecTools::TauDecayModeNNHelper Class Reference

A closely related class that provides helper functions. More...

#include <TauDecayModeNNClassifier.h>

Collaboration diagram for tauRecTools::TauDecayModeNNHelper:

Public Member Functions

 TauDecayModeNNHelper ()=delete

Static Public Member Functions

static float Log10Robust (const float val, const float min_val=0.)
template<typename T>
static void sortAndKeep (std::vector< T > &vec, const std::size_t n_obj)
 sort the objects and only keep the leading N objects in the vector
template<typename T>
static void initMapKeys (std::map< std::string, T > &empty_map, const std::set< std::string > &keys)
 initialise the map with a set of defined keys

Detailed Description

A closely related class that provides helper functions.

Definition at line 105 of file TauDecayModeNNClassifier.h.

Constructor & Destructor Documentation

◆ TauDecayModeNNHelper()

tauRecTools::TauDecayModeNNHelper::TauDecayModeNNHelper ( )
delete

Member Function Documentation

◆ initMapKeys()

template<typename T>
void tauRecTools::TauDecayModeNNHelper::initMapKeys ( std::map< std::string, T > & empty_map,
const std::set< std::string > & keys )
static

initialise the map with a set of defined keys

Parameters
empty_mapthe map to be initialised
keysa set that contains the keys for the map

the template type can be any type the map does not necessary need to be empty

Definition at line 396 of file TauDecayModeNNClassifier.cxx.

398 {
399 // T can be any type
400 for (const auto &key : keys)
401 {
402 empty_map[key];
403 }
404 }

◆ Log10Robust()

float tauRecTools::TauDecayModeNNHelper::Log10Robust ( const float val,
const float min_val = 0. )
static

Definition at line 379 of file TauDecayModeNNClassifier.cxx.

380 {
381 return TMath::Log10(std::max(val, min_val));
382 }

◆ sortAndKeep()

template<typename T>
void tauRecTools::TauDecayModeNNHelper::sortAndKeep ( std::vector< T > & vec,
const std::size_t n_obj )
static

sort the objects and only keep the leading N objects in the vector

Parameters
veca vector of physics object pointers
n_objnumber of leading pT objects to keep

the template type must have pt() method (e.g. PFO*, TauTrack*) objects are sorted by pT in descending order the redundant objects will not be used

Definition at line 385 of file TauDecayModeNNClassifier.cxx.

386 {
387 auto cmp_pt = [](const T lhs, const T rhs) { return lhs->pt() > rhs->pt(); };
388 std::sort(vec.begin(), vec.end(), cmp_pt);
389 if (vec.size() > n_obj)
390 {
391 vec.erase(vec.begin() + n_obj, vec.end());
392 }
393 }
std::vector< size_t > vec
unsigned long long T
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.

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