ATLAS Offline Software
Loading...
Searching...
No Matches
MuonML::InferenceUtils Namespace Reference

Classes

struct  SessionBackend

Typedefs

using SegmentQualityOrder = MuonR4::SegmentQualitySorter
 Common quality ordering for segment representatives, shared with MlMsTrackSeeder so that graph construction, component ranking and seeding use the same tie-break rules.

Functions

template<class SessionToolHandle>
SessionBackend sessionBackend (const SessionToolHandle &sessionTool)
float sigmoid (float x)
float reducedChi2 (const xAOD::MuonSegment &segment)
int compareFloat (float first, float second)
 Three-way float comparison which orders NaN after all numeric values.
int compareFloatDescending (float first, float second)
 Three-way descending comparison which also orders NaN last.

Typedef Documentation

◆ SegmentQualityOrder

Common quality ordering for segment representatives, shared with MlMsTrackSeeder so that graph construction, component ranking and seeding use the same tie-break rules.

Definition at line 62 of file InferenceUtils.h.

Function Documentation

◆ compareFloat()

int MuonML::InferenceUtils::compareFloat ( float first,
float second )
inline

Three-way float comparison which orders NaN after all numeric values.

Definition at line 43 of file InferenceUtils.h.

43 {
44 if (std::isnan(first)) return std::isnan(second) ? 0 : 1;
45 if (std::isnan(second)) return -1;
46 if (first < second) return -1;
47 if (first > second) return 1;
48 return 0;
49}

◆ compareFloatDescending()

int MuonML::InferenceUtils::compareFloatDescending ( float first,
float second )
inline

Three-way descending comparison which also orders NaN last.

Definition at line 52 of file InferenceUtils.h.

52 {
53 if (std::isnan(first)) return std::isnan(second) ? 0 : 1;
54 if (std::isnan(second)) return -1;
55 if (first > second) return -1;
56 if (first < second) return 1;
57 return 0;
58}

◆ reducedChi2()

float MuonML::InferenceUtils::reducedChi2 ( const xAOD::MuonSegment & segment)
inline

Definition at line 38 of file InferenceUtils.h.

38 {
39 return segment.chiSquared() / std::max(1.f, segment.numberDoF());
40}
float numberDoF() const
Returns the numberDoF.
float chiSquared() const

◆ sessionBackend()

template<class SessionToolHandle>
SessionBackend MuonML::InferenceUtils::sessionBackend ( const SessionToolHandle & sessionTool)

Definition at line 22 of file InferenceUtils.h.

22 {
23 if (const auto* cudaTool = dynamic_cast<const AthOnnx::OnnxRuntimeSessionToolCUDA*>(sessionTool.get())) {
24 return SessionBackend{true, cudaTool->deviceId()};
25 }
26 return SessionBackend{};
27}

◆ sigmoid()

float MuonML::InferenceUtils::sigmoid ( float x)
inline

Definition at line 29 of file InferenceUtils.h.

29 {
30 if (x >= 0.f) {
31 const float z = std::exp(-x);
32 return 1.f / (1.f + z);
33 }
34 const float z = std::exp(x);
35 return z / (1.f + z);
36}
#define x
#define z