ATLAS Offline Software
Public Member Functions | Static Public Member Functions | List of all members
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 More...
 
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 More...
 

Detailed Description

A closely related class that provides helper functions.

Definition at line 104 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 418 of file TauDecayModeNNClassifier.cxx.

420  {
421  // T can be any type
422  for (const auto &key : keys)
423  {
424  empty_map[key];
425  }
426  }

◆ Log10Robust()

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

Definition at line 401 of file TauDecayModeNNClassifier.cxx.

402  {
403  return TMath::Log10(std::max(val, min_val));
404  }

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

408  {
409  auto cmp_pt = [](const T lhs, const T rhs) { return lhs->pt() > rhs->pt(); };
410  std::sort(vec.begin(), vec.end(), cmp_pt);
411  if (vec.size() > n_obj)
412  {
413  vec.erase(vec.begin() + n_obj, vec.end());
414  }
415  }

The documentation for this class was generated from the following files:
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:12
std::sort
void sort(typename std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, typename std::reverse_iterator< DataModel_detail::iterator< DVL > > end, const Compare &comp)
Specialization of sort for DataVector/List.
Definition: DVL_algorithms.h:623
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37