ATLAS Offline Software
Loading...
Searching...
No Matches
detail Namespace Reference

Typedefs

using CountIParticle_t
using CountTrackParticle_t
using JetCondTag_t
using JetTag_t
template<typename T>
using defaultAccessor_t = decltype(defaultAccessor<T>)
using uchar = unsigned char
using uint = unsigned int
using ushort = unsigned short
using ull = unsigned long long
using ul = unsigned long
using ll = long long

Functions

std::pair< std::string, int > extract_histogram_tag (const std::string &histo_name)
 Extract tag/LB number from per-LBN histogram name.
bool isCustom (const Primitive &p)
bool isCustom (const Primitive::Type &t)
template<typename T, typename I, typename A, typename S = T>
std::function< T(I)> get (const std::string &source, A ass, T def)
template<typename T, typename A = defaultAccessor_t<T>>
void addInput (T &c, const Primitive &input, A a=defaultAccessor< T >)

Variables

template<typename T>
auto defaultAccessor = [](typename T::input_type in){ return in; }

Typedef Documentation

◆ CountIParticle_t

Initial value:

Definition at line 9 of file CountIParticleAlg.h.

◆ CountTrackParticle_t

Initial value:
BTaggingContainer_v1 BTaggingContainer
Definition of the current "BTagging container version".
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".

Definition at line 10 of file CountTrackParticleAlg.h.

◆ defaultAccessor_t

template<typename T>
using detail::defaultAccessor_t = decltype(defaultAccessor<T>)

Definition at line 41 of file PrimitiveHelpers.h.

◆ JetCondTag_t

◆ JetTag_t

◆ ll

using detail::ll = long long

Definition at line 48 of file PrimitiveHelpers.h.

◆ uchar

using detail::uchar = unsigned char

Definition at line 43 of file PrimitiveHelpers.h.

◆ uint

using detail::uint = unsigned int

Definition at line 44 of file PrimitiveHelpers.h.

◆ ul

using detail::ul = unsigned long

Definition at line 47 of file PrimitiveHelpers.h.

◆ ull

using detail::ull = unsigned long long

Definition at line 46 of file PrimitiveHelpers.h.

◆ ushort

using detail::ushort = unsigned short

Definition at line 45 of file PrimitiveHelpers.h.

Function Documentation

◆ addInput()

template<typename T, typename A = defaultAccessor_t<T>>
void detail::addInput ( T & c,
const Primitive & input,
A a = defaultAccessor<T> )

Definition at line 51 of file PrimitiveHelpers.h.

51 {
52 using I = typename T::input_type;
53 using Tp = Primitive::Type;
54 std::string s = input.source;
55 std::string t = input.target.empty() ? input.source : input.target;
57 const char cz = char(0);
58 const char cm = char(-1);
59 const char sm = short(-1);
60 switch (input.type) {
61 case Tp::PRECISION_CUSTOM: // intentional fall-through
62 case Tp::CUSTOM: throw std::logic_error("custom type unsupported");
63 case Tp::UCHAR: c.add(t, get<uchar,I,A>(s,a,cz), cz); return;
64 case Tp::CHAR: c.add(t, get<char,I,A>(s,a,cm), cm); return;
65 case Tp::USHORT: c.add(t, get<ushort,I,A>(s,a,cz), cz); return;
66 case Tp::SHORT: c.add(t, get<short,I,A>(s,a,sm), sm); return;
67 case Tp::UINT: c.add(t, get<uint,I,A>(s,a,0), 0); return;
68 case Tp::INT: c.add(t, get<int,I,A>(s,a,-1), -1); return;
69 case Tp::ULONG: c.add(t, get<ul,I,A>(s,a,0), 0); return;
70 case Tp::LONG: c.add(t, get<long,I,A>(s,a,-1), -1); return;
71 case Tp::ULL: c.add(t, get<ull,I,A>(s,a,0), 0); return;
72 case Tp::LL: c.add(t, get<ll,I,A>(s,a,-1), -1); return;
73 case Tp::HALF: c.add(t, get<float,I,A>(s,a,NAN), NAN, h); return;
74 case Tp::FLOAT: c.add(t, get<float,I,A>(s,a,NAN), NAN); return;
75 case Tp::DOUBLE: c.add(t, get<double,I,A>(s,a,NAN), NAN); return;
76 case Tp::UINT2UCHAR: c.add(t, get<uchar,I,A,uint>(s,a,0), 0); return;
77 case Tp::INT2CHAR: c.add(t, get<char,I,A,int>(s,a,cm), cm); return;
78 case Tp::UINT2USHORT: c.add(t, get<ushort,I,A,uint>(s,a,0), 0); return;
79 case Tp::INT2SHORT: c.add(t, get<short,I,A,int>(s,a,sm), sm); return;
80 case Tp::UL2ULL: c.add(t, get<ull,I,A,ul>(s,a,0),0); return;
81 }
82 }
#define I(x, y, z)
Definition MD5.cxx:116
Header file for AthHistogramAlgorithm.
TList * a
std::function< T(I)> get(const std::string &source, A ass, T def)

◆ extract_histogram_tag()

std::pair< std::string, int > detail::extract_histogram_tag ( const std::string & histo_name)

Extract tag/LB number from per-LBN histogram name.

This method supports naming conventions used in run2 and run3. It returns a histogram hame without LB number in it and a tag (LBN) extracted from the name. If histogram name does not have LBN in it then the name is returned without any change, and tag is set to -1.

Definition at line 16 of file extract_histogram_tag.cxx.

17{
18 std::smatch what;
19 if (std::regex_match(histo_name, what, ::lbRegex_run2)) {
20 try {
21 int tag = std::stoi(what.str(1));
22 return std::make_pair(what[2], tag);
23 } catch(std::exception &ex) {
24 // should not happen but be defensive and just ignore it
25 }
26 }
27 if (std::regex_match(histo_name, what, ::lbRegex_run3)) {
28 std::string const tagStr = what[3].length() > 0 ? what.str(3) : what.str(4);
29 try {
30 int tag = std::stoi(tagStr);
31 return std::make_pair(what[1], tag);
32 } catch(std::exception &ex) {
33 // should not happen but be defensive and just ignore it
34 }
35 }
36 return std::make_pair(histo_name, -1);
37}

◆ get()

template<typename T, typename I, typename A, typename S = T>
std::function< T(I)> detail::get ( const std::string & source,
A ass,
T def )

Definition at line 24 of file PrimitiveHelpers.h.

24 {
26 using rettype = decltype(ass(std::declval<I>()));
27 if constexpr (std::is_pointer<rettype>::value) {
28 return [acc, ass, def](I in) -> T {
29 const auto* associated = ass(in);
30 if (!associated) return def;
31 return acc(*associated);
32 };
33 } else {
34 return [acc, ass](I in) -> T { return acc(ass(in)); };
35 }
36 }
SG::ConstAccessor< T, ALLOC > ConstAccessor
Definition AuxElement.h:569
make the histogram assessment part of the config
Definition hcg.cxx:627

◆ isCustom() [1/2]

bool detail::isCustom ( const Primitive & p)

Definition at line 10 of file PrimitiveHelpers.cxx.

10 {
11 return isCustom(p.type);
12 }
bool isCustom(const Primitive &p)

◆ isCustom() [2/2]

bool detail::isCustom ( const Primitive::Type & t)

Definition at line 13 of file PrimitiveHelpers.cxx.

13 {
14 using Tp = Primitive::Type;
15 return std::unordered_set {
16 Tp::CUSTOM, Tp::PRECISION_CUSTOM
17 }.count(t);
18 }

Variable Documentation

◆ defaultAccessor

template<typename T>
auto detail::defaultAccessor = [](typename T::input_type in){ return in; }

Definition at line 39 of file PrimitiveHelpers.h.

39{ return in; };