ATLAS Offline Software
Loading...
Searching...
No Matches
MuonR4::AuthorHierachy Struct Reference

Implemenation of the utility class. More...

#include <AuthorHierachy.h>

Collaboration diagram for MuonR4::AuthorHierachy:

Public Types

using Author = xAOD::Muon::Author

Public Member Functions

unsigned authorRank (const Author author) const
 Ranks the author according to the list above.
bool operator() (const Author a, const Author b) const
 Sorting operator between two Author values based on the author rank.
template<detail::hasAuthor ObjType>
bool operator() (const ObjType &a, const ObjType &b) const
 Ranks two objects satisfying the hasAuthor concept according to their Author rank.
template<Acts::PointerConcept ObjPtr>
bool operator() (const ObjPtr &a, const ObjPtr &b) const
 Ranks two pointers according to the Author rank of the objects they are pointing to.
template<detail::hasAuthor ObjType>
bool operator() (const DataVector< ObjType > &a, const DataVector< ObjType > &b) const
 Ranks two Data vector collections of objects satisfying the hasAuthor concept according to their Author rank.
template<detail::hasAuthor ObjType>
bool operator() (const DataVector< ObjType > *a, const DataVector< ObjType > *b) const
 Ranks two pointers of data vectors according to the authorRank of the underlying data vector.

Detailed Description

Implemenation of the utility class.

Definition at line 35 of file AuthorHierachy.h.

Member Typedef Documentation

◆ Author

using MuonR4::AuthorHierachy::Author = xAOD::Muon::Author

Definition at line 36 of file AuthorHierachy.h.

Member Function Documentation

◆ authorRank()

unsigned MuonR4::AuthorHierachy::authorRank ( const Author author) const

Ranks the author according to the list above.

Definition at line 12 of file AuthorHierachy.cxx.

12 {
13 switch (author) {
14 using enum Author;
15 case MuidCo: return 0;
16 case MuGirl: return 1;
17 case STACO: return 2;
18 case MuTagIMO: return 3;
19
20 case CaloScore:
21 case CaloTag: return 4;
22 case MuidSA: return 5;
23 case NumberOfMuonAuthors: break;
24 default:
25 THROW_EXCEPTION("The author "<<author<<" is not supported");
26 }
27 return std::numeric_limits<unsigned>::max();
28 }
@ STACO
Tracks produced by STACO.
@ MuGirl
MuGirl.
xAOD::Muon::Author Author
#define THROW_EXCEPTION(MESSAGE)
Definition throwExcept.h:10

◆ operator()() [1/5]

bool MuonR4::AuthorHierachy::operator() ( const Author a,
const Author b ) const

Sorting operator between two Author values based on the author rank.

Definition at line 9 of file AuthorHierachy.cxx.

9 {
10 return authorRank(a) < authorRank(b);
11 }
static Double_t a
unsigned authorRank(const Author author) const
Ranks the author according to the list above.

◆ operator()() [2/5]

template<detail::hasAuthor ObjType>
bool MuonR4::AuthorHierachy::operator() ( const DataVector< ObjType > & a,
const DataVector< ObjType > & b ) const
inline

Ranks two Data vector collections of objects satisfying the hasAuthor concept according to their Author rank.

It is assumed that all objects in the collection have the same author.

Definition at line 60 of file AuthorHierachy.h.

60 {
61 if (a.empty() || b.empty()) {
62 return !a.empty();
63 }
64 // Check in the debug build that there is only one author in each vector
65 assert(std::all_of(a.begin(), a.end(), [&](const auto obj){
66 return obj->author() == a.at(0)->author();
67 }));
68 assert(std::all_of(b.begin(), b.end(), [&](const auto obj){
69 return obj->author() == b.at(0)->author();
70 }));
71
72 return (*this)(a.front(), b.front());
73 }

◆ operator()() [3/5]

template<detail::hasAuthor ObjType>
bool MuonR4::AuthorHierachy::operator() ( const DataVector< ObjType > * a,
const DataVector< ObjType > * b ) const
inline

Ranks two pointers of data vectors according to the authorRank of the underlying data vector.

Definition at line 77 of file AuthorHierachy.h.

77 {
78 assert( a != nullptr);
79 assert( b != nullptr);
80 return (*this)(*a, *b);
81 }

◆ operator()() [4/5]

template<Acts::PointerConcept ObjPtr>
bool MuonR4::AuthorHierachy::operator() ( const ObjPtr & a,
const ObjPtr & b ) const
inline

Ranks two pointers according to the Author rank of the objects they are pointing to.

Definition at line 51 of file AuthorHierachy.h.

51 {
52 assert(a != nullptr);
53 assert(b != nullptr);
54 return (*this)(*a, *b);
55 }

◆ operator()() [5/5]

template<detail::hasAuthor ObjType>
bool MuonR4::AuthorHierachy::operator() ( const ObjType & a,
const ObjType & b ) const
inline

Ranks two objects satisfying the hasAuthor concept according to their Author rank.

Definition at line 45 of file AuthorHierachy.h.

45 {
46 return (*this)(a.author(), b.author());
47 }

The documentation for this struct was generated from the following files: