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 > &vecvec, 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 108 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 397 of file TauDecayModeNNClassifier.cxx.

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

◆ Log10Robust()

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

Definition at line 380 of file TauDecayModeNNClassifier.cxx.

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

◆ 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 386 of file TauDecayModeNNClassifier.cxx.

387 {
388 auto cmp_pt = [](const T lhs, const T rhs) { return lhs->pt() > rhs->pt(); };
389 std::sort(vec.begin(), vec.end(), cmp_pt);
390 if (vec.size() > n_obj)
391 {
392 vec.erase(vec.begin() + n_obj, vec.end());
393 }
394 }
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: