ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonPhaseII
Event
MuonTrackEvent
MuonTrackEvent
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"
10
#include "
AthContainers/DataVector.h
"
11
12
#include <concepts>
13
23
namespace
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
35
struct
AuthorHierachy
{
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::Po
int
erConcept 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>
60
bool
operator()
(
const
DataVector<ObjType>
&
a
,
const
DataVector<ObjType>
& b)
const
{
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
DataVector.h
An STL vector of pointers that by default owns its pointed-to elements.
Muon.h
a
static Double_t a
Definition
LArPhysWaveHECTool.cxx:38
DataVector
Derived DataVector<T>.
Definition
DataVector.h:795
MuonR4::detail::hasAuthor
All objects can be arranged by the AuthorHierachy, if they satisfy the hasAuthor concept.
Definition
AuthorHierachy.h:28
MuonR4
This header ties the generic definitions in this package.
Definition
GlobalPattern.h:14
detail
Definition
extract_histogram_tag.cxx:14
MuonR4::AuthorHierachy
Implemenation of the utility class.
Definition
AuthorHierachy.h:35
MuonR4::AuthorHierachy::operator()
bool operator()(const Author a, const Author b) const
Sorting operator between two Author values based on the author rank.
Definition
AuthorHierachy.cxx:9
MuonR4::AuthorHierachy::operator()
bool operator()(const ObjType &a, const ObjType &b) const
Ranks two objects satisfying the hasAuthor concept according to their Author rank.
Definition
AuthorHierachy.h:45
MuonR4::AuthorHierachy::operator()
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...
Definition
AuthorHierachy.h:60
MuonR4::AuthorHierachy::authorRank
unsigned authorRank(const Author author) const
Ranks the author according to the list above.
Definition
AuthorHierachy.cxx:12
MuonR4::AuthorHierachy::operator()
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.
Definition
AuthorHierachy.h:77
MuonR4::AuthorHierachy::operator()
bool operator()(const ObjPtr &a, const ObjPtr &b) const
Ranks two pointers according to the Author rank of the objects they are pointing to.
Definition
AuthorHierachy.h:51
MuonR4::AuthorHierachy::Author
xAOD::Muon::Author Author
Definition
AuthorHierachy.h:36
Generated on
for ATLAS Offline Software by
1.17.0