ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonConditions
MuonCondCabling
RPC_CondCabling
src
CMAidentity.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
RPC_CondCabling/CMAidentity.h
"
6
7
#include <iomanip>
8
#include <string>
9
10
const
char
CMAidentity::CoverageTAG
[3][5] = {{
"even"
}, {
"odd"
}, {
""
}};
11
12
bool
CMAidentity::coverage
(
const
std::string& side,
CMAcoverage
& cov) {
13
for
(
int
i =
EvenSectors
; i <=
AllSectors
; ++i) {
14
std::string tag(
CoverageTAG
[i]);
15
if
(side == tag) {
16
cov = (
CMAcoverage
)i;
17
return
true
;
18
}
19
}
20
return
false
;
21
}
22
23
const
std::string
CMAidentity::name
(
const
ViewType
view,
const
CMAcoverage
coverage
) {
24
std::string cover(
CMAidentity::covtag
(
coverage
));
25
std::string side = view ==
ViewType::Eta
?
"Eta"
: (view ==
ViewType::Phi
?
"Phi"
:
"NoView"
);
26
std::string v_name = cover + side +
"CMA"
;
27
return
v_name;
28
}
29
CMAidentity::CMAidentity
(
const
defineParams
& pars) :
m_params
{pars} {}
30
31
CMAidentity::CMAidentity
(
ViewType
view,
CMAcoverage
side,
int
number
,
int
eta_index
,
int
phi_index
,
int
PAD_index
,
int
Ixx_index
) {
32
m_params
.view = view;
33
m_params
.coverage = side;
34
m_params
.seqNumber =
number
;
35
m_params
.etaIndex =
eta_index
;
36
m_params
.phiIndex =
phi_index
;
37
m_params
.padIndex =
PAD_index
;
38
m_params
.IxxIndex =
Ixx_index
;
39
}
40
41
CMAidentity::CMAidentity
(
ViewType
view,
CMAcoverage
side,
int
number
) {
42
m_params
.view = view;
43
m_params
.coverage = side;
44
m_params
.seqNumber =
number
;
45
}
46
47
CMAidentity::CMAidentity
(
ViewType
view,
CMAcoverage
side,
Offline_indexes
& indexes) {
48
m_params
.view = view;
49
m_params
.coverage = side;
50
m_params
.etaIndex = indexes.first;
51
m_params
.phiIndex = indexes.second;
52
}
53
54
CMAidentity::CMAidentity
(
ViewType
view,
CMAcoverage
side,
int
PAD,
int
Ixx) {
55
m_params
.view = view;
56
m_params
.coverage = side;
57
m_params
.padIndex = PAD;
58
m_params
.IxxIndex = Ixx;
59
}
60
61
bool
CMAidentity::operator==
(
const
CMAidentity
&
id
)
const
{
62
if
(
m_params
.view ==
id
.type() &&
m_params
.coverage ==
id
.coverage()) {
63
if
(
number
() >= 0)
64
if
(
number
() ==
id
.
number
())
return
true
;
65
66
if
(
m_params
.etaIndex >= 0)
67
if
(
m_params
.etaIndex ==
id
.eta_index() &&
m_params
.phiIndex ==
id
.phi_index())
return
true
;
68
69
if
(
m_params
.padIndex >= 0)
70
if
(
m_params
.padIndex ==
id
.PAD_index() &&
m_params
.IxxIndex ==
id
.Ixx_index())
return
true
;
71
}
72
return
false
;
73
}
74
75
bool
CMAidentity::operator!=
(
const
CMAidentity
&
id
)
const
{
return
!(*
this
== id); }
76
77
bool
CMAidentity::operator<
(
const
CMAidentity
&
id
)
const
{
78
if
(*
this
==
id
)
return
false
;
79
if
(
m_params
.view <
id
.type())
return
true
;
80
if
(
m_params
.coverage <
id
.coverage())
return
true
;
81
int
id1 =
m_params
.etaIndex * 10 +
m_params
.phiIndex;
82
int
id2 =
id
.eta_index() * 10 +
id
.phi_index();
83
return
id1 < id2;
84
}
85
86
CMAidentity
&
CMAidentity::operator+=
(
const
CMAidentity
&
id
) {
87
if
(*
this
!=
id
)
return
*
this
;
88
if
(
m_params
.seqNumber == -1)
m_params
.seqNumber =
id
.number();
89
if
(
m_params
.etaIndex == -1)
m_params
.etaIndex =
id
.eta_index();
90
if
(
m_params
.phiIndex == -1)
m_params
.phiIndex =
id
.phi_index();
91
if
(
m_params
.padIndex == -1)
m_params
.padIndex =
id
.PAD_index();
92
if
(
m_params
.IxxIndex == -1)
m_params
.IxxIndex =
id
.Ixx_index();
93
return
*
this
;
94
}
95
96
void
CMAidentity::inversion
() {
m_params
.IxxIndex = (
m_params
.IxxIndex == 0) ? 1 : 0; }
97
98
std::ostream&
operator<<
(std::ostream& stream,
const
CMAidentity
&
id
) {
99
char
exttag[5] = {
' '
,
' '
,
' '
,
' '
,
'\0'
};
100
const
char
* tag =
CMAidentity::covtag
(
id
.
m_params
.coverage);
101
for
(
int
i = 0; i < 5; ++i) {
102
if
(tag[i] ==
'\0'
)
break
;
103
exttag[i] = tag[i];
104
}
105
106
std::string
covtag
(exttag);
107
108
std::string
type
= (
id
.type() == Phi) ?
" phi cma "
+
covtag
:
" eta cma "
+
covtag
;
109
if
(!
covtag
.empty())
type
=
type
+
" "
;
110
stream <<
type
<< std::setw(2) <<
id
.number() <<
": Eta "
;
111
stream << std::setw(2) <<
id
.eta_index();
112
stream <<
" Phi "
<< std::setw(2) <<
id
.phi_index();
113
stream <<
" PAD "
<< std::setw(2) <<
id
.PAD_index();
114
stream <<
" Ixx "
<< std::setw(2) <<
id
.Ixx_index();
115
return
stream;
116
}
117
ViewType
CMAidentity::type
()
const
{
return
m_params
.view; }
118
CMAcoverage
CMAidentity::coverage
()
const
{
return
m_params
.coverage; }
119
int
CMAidentity::number
()
const
{
return
m_params
.seqNumber; }
120
int
CMAidentity::eta_index
()
const
{
return
m_params
.etaIndex; }
121
int
CMAidentity::phi_index
()
const
{
return
m_params
.phiIndex; }
122
int
CMAidentity::PAD_index
()
const
{
return
m_params
.padIndex; }
123
int
CMAidentity::Ixx_index
()
const
{
return
m_params
.IxxIndex; }
operator<<
std::ostream & operator<<(std::ostream &stream, const CMAidentity &id)
Definition
CMAidentity.cxx:98
CMAidentity.h
CMAcoverage
CMAcoverage
Definition
CMAidentity.h:14
AllSectors
@ AllSectors
Definition
CMAidentity.h:14
EvenSectors
@ EvenSectors
Definition
CMAidentity.h:14
ViewType
ViewType
Definition
RPCdef.h:8
Phi
@ Phi
Definition
RPCdef.h:8
Eta
@ Eta
Definition
RPCdef.h:8
CMAidentity::CMAidentity
CMAidentity(const defineParams &pars)
Definition
CMAidentity.cxx:29
CMAidentity::operator+=
CMAidentity & operator+=(const CMAidentity &)
Definition
CMAidentity.cxx:86
CMAidentity::name
static const std::string name(const ViewType, const CMAcoverage)
Definition
CMAidentity.cxx:23
CMAidentity::covtag
static const char * covtag(const CMAcoverage co)
Definition
CMAidentity.h:24
CMAidentity::coverage
CMAcoverage coverage() const
Definition
CMAidentity.cxx:118
CMAidentity::number
int number() const
Definition
CMAidentity.cxx:119
CMAidentity::inversion
void inversion()
Definition
CMAidentity.cxx:96
CMAidentity::operator!=
bool operator!=(const CMAidentity &) const
Definition
CMAidentity.cxx:75
CMAidentity::operator==
bool operator==(const CMAidentity &) const
Definition
CMAidentity.cxx:61
CMAidentity::type
ViewType type() const
Definition
CMAidentity.cxx:117
CMAidentity::Ixx_index
int Ixx_index() const
Definition
CMAidentity.cxx:123
CMAidentity::operator<
bool operator<(const CMAidentity &) const
Definition
CMAidentity.cxx:77
CMAidentity::CoverageTAG
static const char CoverageTAG[3][5]
Definition
CMAidentity.h:10
CMAidentity::coverage
static bool coverage(const std::string &, CMAcoverage &)
Definition
CMAidentity.cxx:12
CMAidentity::PAD_index
int PAD_index() const
Definition
CMAidentity.cxx:122
CMAidentity::Offline_indexes
std::pair< int, int > Offline_indexes
Definition
CMAidentity.h:18
CMAidentity::eta_index
int eta_index() const
Definition
CMAidentity.cxx:120
CMAidentity::phi_index
int phi_index() const
Definition
CMAidentity.cxx:121
CMAidentity::m_params
defineParams m_params
Definition
CMAidentity.h:43
CMAidentity::defineParams
Definition
CMAidentity.h:27
Generated on
for ATLAS Offline Software by
1.17.0