ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Event
PyDumper
PyDumper
PyDumperDict.h
Go to the documentation of this file.
1
// This file's extension implies that it's C, but it's really -*- C++ -*-.
2
3
/*
4
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
5
*/
6
7
// $Id$
14
15
16
#include "
PyDumper/PySTLAdaptor.h
"
17
#include "
AthContainers/AuxElement.h
"
18
#include <set>
19
#include <cmath>
20
21
22
namespace
PyDumper
{
23
24
// Hack to return a float nan to python as a double nan without causing a FPE.
25
// Not doing anything will trap in pyroot.
26
// isnan() can also trap, so don't use that!
27
class
SafeFloatAccess
28
{
29
public
:
30
union
ieee754_float
31
{
32
float
f
;
33
34
/* This is the IEEE 754 single-precision format. */
35
struct
36
{
37
#if __BYTE_ORDER == __BIG_ENDIAN
38
unsigned
int
negative
:1;
39
unsigned
int
exponent
:8;
40
unsigned
int
mantissa
:23;
41
#endif
/* Big endian. */
42
#if __BYTE_ORDER == __LITTLE_ENDIAN
43
unsigned
int
mantissa
:23;
44
unsigned
int
exponent
:8;
45
unsigned
int
negative
:1;
46
#endif
/* Little endian. */
47
}
ieee
;
48
};
49
50
SafeFloatAccess
(
const
std::vector<float>& v) :
m_v
(v) {}
51
double
operator[]
(
size_t
i) {
52
ieee754_float
ff;
53
ff.f =
m_v
[i];
54
if
(ff.ieee.exponent == 0xff)
55
return
std::nan(
""
);
56
return
m_v
[i];
57
}
58
private
:
59
const
std::vector<float>&
m_v
;
60
};
61
62
63
class
Utils
64
{
65
public
:
66
static
67
std::vector<unsigned int>
getAuxIDVector
(
const
SG::AuxVectorData
& e)
68
{
69
const
SG::auxid_set_t
& ids = e.getAuxIDs();
70
std::vector<unsigned int> v (ids.begin(), ids.end());
71
std::sort
(v.begin(), v.end());
72
return
v;
73
}
74
static
75
std::vector<unsigned int>
getAuxIDVector
(
const
SG::AuxElement
& e)
76
{
77
const
SG::auxid_set_t
& ids = e.getAuxIDs();
78
std::vector<unsigned int> v (ids.begin(), ids.end());
79
std::sort
(v.begin(), v.end());
80
return
v;
81
}
82
};
83
84
85
}
86
87
88
89
struct
PyDumperDict
{
90
PyDumperDict
();
91
PyDumper::PySTLAdaptor<std::set<unsigned int>
>
s
;
92
PyDumper::PySTLAdaptor<std::set<unsigned int>
>
::iterator
s_i
;
93
};
AuxElement.h
Base class for elements of a container that can have aux data.
PySTLAdaptor.h
Helper for iterating over STL map classes.
iterator
PyDumper::PySTLAdaptor
Helper for iterating over STL map classes.
Definition
PySTLAdaptor.h:37
PyDumper::SafeFloatAccess::m_v
const std::vector< float > & m_v
Definition
PyDumperDict.h:59
PyDumper::SafeFloatAccess::SafeFloatAccess
SafeFloatAccess(const std::vector< float > &v)
Definition
PyDumperDict.h:50
PyDumper::SafeFloatAccess::operator[]
double operator[](size_t i)
Definition
PyDumperDict.h:51
PyDumper::Utils::getAuxIDVector
static std::vector< unsigned int > getAuxIDVector(const SG::AuxElement &e)
Definition
PyDumperDict.h:75
PyDumper::Utils::getAuxIDVector
static std::vector< unsigned int > getAuxIDVector(const SG::AuxVectorData &e)
Definition
PyDumperDict.h:67
SG::AuxVectorData
Manage lookup of vectors of auxiliary data.
Definition
AuxVectorData.h:164
SG::auxid_set_t
A set of aux data identifiers.
Definition
AuxTypes.h:47
PyDumper
Definition
PyDumperDict.h:22
SG::AuxElement
AuxElement(SG::AuxVectorData *container, size_t index)
Base class for elements of a container that can have aux data.
Utils
Definition
ProxyContainer.h:28
std::sort
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
Definition
DVL_algorithms.h:554
PyDumperDict::s
PyDumper::PySTLAdaptor< std::set< unsigned int > > s
Definition
PyDumperDict.h:91
PyDumperDict::PyDumperDict
PyDumperDict()
PyDumperDict::s_i
PyDumper::PySTLAdaptor< std::set< unsignedint > >::iterator s_i
Definition
PyDumperDict.h:92
PyDumper::SafeFloatAccess::ieee754_float
Definition
PyDumperDict.h:31
PyDumper::SafeFloatAccess::ieee754_float::negative
unsigned int negative
Definition
PyDumperDict.h:38
PyDumper::SafeFloatAccess::ieee754_float::mantissa
unsigned int mantissa
Definition
PyDumperDict.h:40
PyDumper::SafeFloatAccess::ieee754_float::ieee
struct PyDumper::SafeFloatAccess::ieee754_float::@060255103051114047334315152077073344367140163323 ieee
PyDumper::SafeFloatAccess::ieee754_float::f
float f
Definition
PyDumperDict.h:32
PyDumper::SafeFloatAccess::ieee754_float::exponent
unsigned int exponent
Definition
PyDumperDict.h:39
Generated on
for ATLAS Offline Software by
1.17.0