ATLAS Offline Software
Loading...
Searching...
No Matches
AuthorHierachy.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4#ifndef MUONTRACKEVENT_AuthorHierachy_H
5#define MUONTRACKEVENT_AuthorHierachy_H
6
7#include "xAODMuon/Muon.h"
8
9#include "Acts/Utilities/PointerTraits.hpp"
11
12#include <concepts>
13
23namespace MuonR4 {
24
25 namespace detail {
28 template <typename ObjType> concept hasAuthor = requires(const ObjType& obj) {
29 { obj.author() } -> std::same_as<xAOD::Muon::Author>;
30 };
31
32 static_assert(hasAuthor<xAOD::Muon>);
33 }
34
36 using Author = xAOD::Muon::Author;
38 unsigned authorRank(const Author author) const;
41 bool operator()(const Author a, const Author b) const;
44 template <detail::hasAuthor ObjType>
45 bool operator()(const ObjType&a ,const ObjType& b) const {
46 return (*this)(a.author(), b.author());
47 }
48
50 template <Acts::PointerConcept ObjPtr>
51 bool operator()(const ObjPtr& a, const ObjPtr& b) const {
52 assert(a != nullptr);
53 assert(b != nullptr);
54 return (*this)(*a, *b);
55 }
56
59 template <detail::hasAuthor ObjType>
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 }
74
76 template <detail::hasAuthor ObjType>
77 bool operator()(const DataVector<ObjType>* a, const DataVector<ObjType>* b) const {
78 assert( a != nullptr);
79 assert( b != nullptr);
80 return (*this)(*a, *b);
81 }
82 };
83
84}
85
86#endif
An STL vector of pointers that by default owns its pointed-to elements.
static Double_t a
Derived DataVector<T>.
Definition DataVector.h:795
All objects can be arranged by the AuthorHierachy, if they satisfy the hasAuthor concept.
This header ties the generic definitions in this package.
Implemenation of the utility class.
bool operator()(const Author a, const Author b) const
Sorting operator between two Author values based on the author rank.
bool operator()(const ObjType &a, const ObjType &b) const
Ranks two objects satisfying the hasAuthor concept according to their Author rank.
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 Auth...
unsigned authorRank(const Author author) const
Ranks the author according to the list above.
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.
bool operator()(const ObjPtr &a, const ObjPtr &b) const
Ranks two pointers according to the Author rank of the objects they are pointing to.
xAOD::Muon::Author Author