ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
TrigT1CaloCalibConditions
src
L1CaloCoolChannelId.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
TrigT1CaloCalibConditions/L1CaloCoolChannelId.h
"
6
7
#include <sstream>
8
#include <iostream>
9
27
28
//==============================================================================
29
// constructor
30
//==============================================================================
34
L1CaloCoolChannelId::L1CaloCoolChannelId
()
35
:
m_id
(0)
36
{
37
}
38
39
//==============================================================================
40
// constructor
41
//==============================================================================
45
L1CaloCoolChannelId::L1CaloCoolChannelId
(
unsigned
int
crate
,
46
L1CaloModuleType
mType,
47
unsigned
int
module
,
48
unsigned
int
submodule,
49
unsigned
int
channel
,
50
bool
logical)
51
:
m_id
(0)
52
{
53
if
(logical) this->
setId
(crate, mType,
module
, submodule,
channel
);
54
else
{
55
unsigned
int
moduleIndex = this->
physicalToLogicalModule
(mType,
module
);
56
this->
setId
(crate, mType, moduleIndex, submodule,
channel
);
57
}
58
}
59
60
//==============================================================================
61
// constructor
62
//==============================================================================
66
L1CaloCoolChannelId::L1CaloCoolChannelId
(
unsigned
int
id
)
67
:
m_id
(
id
)
68
{
69
}
70
71
//==============================================================================
72
// copy constructor
73
//==============================================================================
77
L1CaloCoolChannelId::L1CaloCoolChannelId
(
const
L1CaloCoolChannelId
&
id
)
78
:
m_id
(
id
.
m_id
)
79
{
80
}
81
82
//==============================================================================
83
// setId
84
//==============================================================================
88
void
89
L1CaloCoolChannelId::setId
(
unsigned
int
crate
,
90
L1CaloModuleType
mType,
91
unsigned
int
module
,
92
unsigned
int
submodule,
93
unsigned
int
channel
)
94
{
95
m_id
= (
crate
& 0xff) << 24 | (
module
& 0x0f) << 16 |
96
(submodule & 0xff) << 8 | (
channel
& 0xff);
97
// We only have a limited number of module types that will
98
// provide conditions data, so convert module types here.
99
// Ignore any other module type.
100
101
m_id
|= ((
unsigned
int)mType & 0x0f) << 20;
102
103
// if (mType == L1CaloModuleType::Ppm) { m_id |= 0x00100000; }
104
// else if (mType == L1CaloModuleType::Cpm) { m_id |= 0x00200000; }
105
// else if (mType == L1CaloModuleType::Jem) { m_id |= 0x00300000; }
106
// else if (mType == L1CaloModuleType::Cmm) { m_id |= 0x00400000; }
107
// else if (mType == L1CaloModuleType::Tcm) { m_id |= 0x00500000; }
108
// else if (mType == L1CaloModuleType::L1CaloRod) { m_id |= 0x00600000; }
109
// else if (mType == L1CaloModuleType::Cam) { m_id |= 0x00700000; }
110
}
111
112
//==============================================================================
113
// getModuleType
114
//==============================================================================
119
L1CaloModuleType
120
L1CaloCoolChannelId::moduleType
()
const
121
{
122
unsigned
int
mTypeId = (
m_id
& 0x00f00000) >> 20;
123
return
L1CaloModuleType
((
L1CaloModuleType::L1CaloModuleEnum
)mTypeId);
124
}
125
127
// * Convert a typeId to a L1CaloModuleType
128
// * \return L1CaloModuleType
129
// */
130
//L1CaloModuleType
131
//L1CaloCoolChannelId::moduleType(unsigned int mTypeId) const
132
//{
133
// L1CaloModuleType mType = L1CaloModuleType::None;
134
// if (mTypeId == 1) { mType = L1CaloModuleType::Ppm; }
135
// else if (mTypeId == 2) { mType = L1CaloModuleType::Cpm; }
136
// else if (mTypeId == 3) { mType = L1CaloModuleType::Jem; }
137
// else if (mTypeId == 4) { mType = L1CaloModuleType::Cmm; }
138
// else if (mTypeId == 5) { mType = L1CaloModuleType::Tcm; }
139
// else if (mTypeId == 6) { mType = L1CaloModuleType::L1CaloRod; }
140
// else if (mTypeId == 7) { mType = L1CaloModuleType::Cam; }
141
// return mType;
142
//}
143
//
145
// * Convert a L1CaloModuleType to a typeId
146
// * \return unsigned int
147
// */
148
//unsigned int
149
//L1CaloCoolChannelId::moduleType(L1CaloModuleType mType) const
150
//{
151
// unsigned int mTypeId = 0;
152
// if (mType == L1CaloModuleType::Ppm) { mTypeId = 1; }
153
// else if (mType == L1CaloModuleType::Cpm) { mTypeId = 2; }
154
// else if (mType == L1CaloModuleType::Jem) { mTypeId = 3; }
155
// else if (mType == L1CaloModuleType::Cmm) { mTypeId = 4; }
156
// else if (mType == L1CaloModuleType::Tcm) { mTypeId = 5; }
157
// else if (mType == L1CaloModuleType::L1CaloRod) { mTypeId = 6; }
158
// else if (mType == L1CaloModuleType::Cam) { mTypeId = 7; }
159
// return mTypeId;
160
//}
161
162
unsigned
int
L1CaloCoolChannelId::module
(
bool
logical)
const
{
163
unsigned
int
logicalIndex = (
m_id
& 0x000f0000) >> 16;
164
if
(logical) {
165
return
logicalIndex;
166
}
else
{
167
return
this->
logicalToPhysicalModule
(this->
moduleType
(), logicalIndex);
168
}
169
}
170
171
unsigned
int
L1CaloCoolChannelId::logicalToPhysicalModule
(
L1CaloModuleType
mType,
unsigned
int
module)
const
{
172
if
(mType ==
L1CaloModuleType::Ppm
) {
return
module
+ 5; }
//Ppm
173
else
if
(mType ==
L1CaloModuleType::Cpm
) {
return
module
+ 5; }
//Cpm
174
else
if
(mType ==
L1CaloModuleType::Jem
) {
return
module
+ 4; }
//Jem
175
else
{
176
std::cout<<
"The physical position of module type: "
<<mType.
toString
()<<
" is not known. Returning the logical index instead !"
<<std::endl;
177
return
module
;
178
}
179
}
180
181
unsigned
int
L1CaloCoolChannelId::physicalToLogicalModule
(
L1CaloModuleType
mType,
unsigned
int
module)
const
{
182
if
(mType ==
L1CaloModuleType::Ppm
) {
return
module
- 5; }
//Ppm
183
else
if
(mType ==
L1CaloModuleType::Cpm
) {
return
module
- 5; }
//Cpm
184
else
if
(mType ==
L1CaloModuleType::Jem
) {
return
module
- 4; }
//Jem
185
else
{
186
std::cout<<
"The physical position of module type: "
<<mType.
toString
()<<
" is not known. Returning the logical index instead !"
<<std::endl;
187
return
module
;
188
}
189
}
190
191
192
//==============================================================================
193
// operator=
194
//==============================================================================
198
L1CaloCoolChannelId
&
199
L1CaloCoolChannelId::operator=
(
const
L1CaloCoolChannelId
&
id
)
200
{
201
if
(
this
!= &
id
)
m_id
=
id
.m_id;
202
return
*
this
;
203
}
204
205
bool
L1CaloCoolChannelId::operator<
(
const
L1CaloCoolChannelId
&
id
)
const
{
206
return
m_id
<
id
.m_id;
207
}
208
209
bool
L1CaloCoolChannelId::operator==
(
const
L1CaloCoolChannelId
&
id
)
const
{
210
return
m_id
==
id
.m_id;
211
}
212
213
std::ostream&
operator<<
(std::ostream& output,
const
L1CaloCoolChannelId
&
r
) {
214
output <<
"coolChannelId: 0x"
<< std::hex <<
r
.id() << std::dec <<
"("
<<
r
.id()<<
"), crate: "
<<
r
.crate()<<
", module: "
<<
r
.module()<<
", submodule: "
<<
r
.subModule()<<
", channel: "
<<
r
.channel();
215
return
output;
216
}
operator<<
std::ostream & operator<<(std::ostream &output, const L1CaloCoolChannelId &r)
Definition
L1CaloCoolChannelId.cxx:213
L1CaloCoolChannelId.h
L1CaloCoolChannelId
Encapsulates the ID of one channel of conditions data in COOL, ie the ID of a row in a table.
Definition
L1CaloCoolChannelId.h:10
L1CaloCoolChannelId::moduleType
L1CaloModuleType moduleType() const
Return module type of this channel ID.
Definition
L1CaloCoolChannelId.cxx:120
L1CaloCoolChannelId::physicalToLogicalModule
unsigned int physicalToLogicalModule(L1CaloModuleType mType, unsigned int module) const
L1CaloCoolChannelId::id
unsigned int id() const
Definition
L1CaloCoolChannelId.h:32
L1CaloCoolChannelId::operator=
L1CaloCoolChannelId & operator=(const L1CaloCoolChannelId &id)
Definition
L1CaloCoolChannelId.cxx:199
L1CaloCoolChannelId::operator==
bool operator==(const L1CaloCoolChannelId &id) const
Definition
L1CaloCoolChannelId.cxx:209
L1CaloCoolChannelId::operator<
bool operator<(const L1CaloCoolChannelId &id) const
Definition
L1CaloCoolChannelId.cxx:205
L1CaloCoolChannelId::L1CaloCoolChannelId
L1CaloCoolChannelId()
Create a L1CaloCoolChannelId from the integer ID field.
Definition
L1CaloCoolChannelId.cxx:34
L1CaloCoolChannelId::module
unsigned int module(bool logical=true) const
L1CaloCoolChannelId::crate
unsigned int crate() const
Definition
L1CaloCoolChannelId.h:25
L1CaloCoolChannelId::m_id
unsigned int m_id
Definition
L1CaloCoolChannelId.h:51
L1CaloCoolChannelId::setId
void setId(unsigned int crate, L1CaloModuleType mType, unsigned int module, unsigned int submodule, unsigned int channel)
Set the CoolChannelId value from its component fields.
Definition
L1CaloCoolChannelId.cxx:89
L1CaloCoolChannelId::logicalToPhysicalModule
unsigned int logicalToPhysicalModule(L1CaloModuleType mType, unsigned int module) const
L1CaloCoolChannelId::channel
unsigned int channel() const
Definition
L1CaloCoolChannelId.h:30
L1CaloModuleType
Infrastructure class encapsulating our known module types.
Definition
L1CaloModuleType.h:11
L1CaloModuleType::L1CaloModuleEnum
L1CaloModuleEnum
Definition
L1CaloModuleType.h:15
L1CaloModuleType::Cpm
@ Cpm
Definition
L1CaloModuleType.h:17
L1CaloModuleType::Jem
@ Jem
Definition
L1CaloModuleType.h:17
L1CaloModuleType::Ppm
@ Ppm
Definition
L1CaloModuleType.h:17
L1CaloModuleType::toString
const std::string toString() const
Compare with type value.
Definition
L1CaloModuleType.cxx:82
r
int r
Definition
globals.cxx:22
Generated on
for ATLAS Offline Software by
1.17.0