ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonConditions
MuonCondGeneral
MuonCondData
src
NswT0Data.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
#include "
MuonCondData/NswT0Data.h
"
5
#include "
MuonIdHelpers/MmIdHelper.h
"
6
#include "
MuonIdHelpers/sTgcIdHelper.h
"
7
#include "
MuonIdHelpers/IMuonIdHelperSvc.h
"
8
9
#include "Identifier/Identifier.h"
10
#include "
Identifier/IdentifierHash.h
"
11
#include "
AthenaKernel/IOVInfiniteRange.h
"
12
#include "GeoModelKernel/throwExcept.h"
13
14
15
NswT0Data::NswT0Data
(
const
Muon::IMuonIdHelperSvc
* idHelperSvc):
16
m_idHelperSvc
{idHelperSvc} {
17
if
(
m_idHelperSvc
->hasMM()) {
18
const
MmIdHelper
& idHelper{
m_idHelperSvc
->mmIdHelper()};
19
m_data_mmg
.resize((idHelper.
detectorElement_hash_max
()+1)*idHelper.
gasGapMax
());
20
}
21
if
(
m_idHelperSvc
->hasSTGC()) {
22
const
sTgcIdHelper
& idHelper{
m_idHelperSvc
->stgcIdHelper()};
23
m_data_stg
.resize((idHelper.
detectorElement_hash_max
() +1)*(idHelper.
gasGapMax
()*3
/*3 channel types*/
));
24
25
}
26
}
27
28
std::size_t
NswT0Data::identToModuleIdx
(
const
Identifier
& chan_id)
const
{
29
const
IdentifierHash
hash =
m_idHelperSvc
->detElementHash(chan_id);
30
if
(
m_idHelperSvc
->isMM(chan_id)) {
31
const
MmIdHelper
& idHelper{
m_idHelperSvc
->mmIdHelper()};
32
return
static_cast<
std::size_t
>
(hash)*(idHelper.
gasGapMax
()) + (idHelper.
gasGap
(chan_id) -1);
33
}
else
if
(
m_idHelperSvc
->issTgc(chan_id)) {
34
const
sTgcIdHelper
& idHelper{
m_idHelperSvc
->stgcIdHelper()};
35
return
static_cast<
std::size_t
>
(hash)*(idHelper.
gasGapMax
() * 3
/*3 channel types*/
) +
36
(idHelper.
gasGap
(chan_id) -1 + idHelper.
gasGapMax
() * idHelper.
channelType
(chan_id));
37
}
38
THROW_EXCEPTION
(
"NswT0Data() - No MM or sTGC identifier"
);
39
return
-1;
40
}
41
42
void
NswT0Data::setData
(
const
Identifier
&
id
,
const
float
value){
43
std::size_t idx =
identToModuleIdx
(
id
);
44
ChannelArray
& data =
m_idHelperSvc
->isMM(
id
) ?
m_data_mmg
:
m_data_stg
;
45
std::size_t channelIdx{0};
46
if
(
m_idHelperSvc
->isMM(
id
)){
47
const
MmIdHelper
& idHelper{
m_idHelperSvc
->mmIdHelper()};
48
if
(data.at(idx).empty()) {
49
data.at(idx).resize(idHelper.
channelMax
(
id
));
50
}
51
channelIdx = idHelper.
channel
(
id
) -1;
52
}
else
{
53
const
sTgcIdHelper
& idHelper{
m_idHelperSvc
->stgcIdHelper()};
54
if
(data.at(idx).empty()) {
55
data.at(idx).resize(idHelper.
channelMax
(
id
));
56
}
57
channelIdx = idHelper.
channel
(
id
) -1;
58
}
59
data.at(idx).at(channelIdx) = value;
60
}
61
62
std::optional<float>
NswT0Data::getT0
(
const
Identifier
&
id
)
const
{
63
std::size_t idx =
identToModuleIdx
(
id
);
64
65
if
(
m_idHelperSvc
->isMM(
id
)) {
66
std::size_t channelId =
m_idHelperSvc
->mmIdHelper().channel(
id
) -1;
67
if
(
m_data_mmg
.size() <= idx ||
m_data_mmg
[idx].size() <= channelId){
68
return
std::nullopt;
69
}
70
return
m_data_mmg
[idx].at(channelId);
71
}
72
std::size_t channelId =
m_idHelperSvc
->stgcIdHelper().channel(
id
) - 1;
73
if
(
m_data_stg
.size() <= idx ||
m_data_stg
[idx].size() <= channelId) {
74
return
std::nullopt;
75
}
76
return
m_data_stg
[idx].at(channelId);
77
}
IMuonIdHelperSvc.h
IOVInfiniteRange.h
IdentifierHash.h
MmIdHelper.h
NswT0Data.h
IdentifierHash
This is a "hash" representation of an Identifier.
Definition
IdentifierHash.h:25
MmIdHelper
Definition
MmIdHelper.h:54
MmIdHelper::gasGapMax
static int gasGapMax()
Definition
MmIdHelper.cxx:859
MmIdHelper::channelMax
static int channelMax()
Definition
MmIdHelper.cxx:863
MmIdHelper::channel
int channel(const Identifier &id) const override
Definition
MmIdHelper.cxx:832
MmIdHelper::gasGap
int gasGap(const Identifier &id) const override
get the hashes
Definition
MmIdHelper.cxx:830
MuonIdHelper::detectorElement_hash_max
size_type detectorElement_hash_max() const
Definition
MuonIdHelper.h:173
Muon::IMuonIdHelperSvc
Interface for Helper service that creates muon Identifiers and can be used to print Identifiers.
Definition
IMuonIdHelperSvc.h:27
NswT0Data::m_idHelperSvc
const Muon::IMuonIdHelperSvc * m_idHelperSvc
Definition
NswT0Data.h:52
NswT0Data::NswT0Data
NswT0Data(const Muon::IMuonIdHelperSvc *idHelperSvc)
Definition
NswT0Data.cxx:15
NswT0Data::identToModuleIdx
std::size_t identToModuleIdx(const Identifier &channelId) const
The calibration data is internally stored as two jagged vectors, one for MM the other for sTGC.
Definition
NswT0Data.cxx:28
NswT0Data::m_data_mmg
ChannelArray m_data_mmg
Definition
NswT0Data.h:55
NswT0Data::setData
void setData(const Identifier &channelId, const float channelT0)
Set the t0 calibration constant for a given nsw channel.
Definition
NswT0Data.cxx:42
NswT0Data::ChannelArray
std::vector< std::vector< std::optional< float > > > ChannelArray
Definition
NswT0Data.h:54
NswT0Data::m_data_stg
ChannelArray m_data_stg
Definition
NswT0Data.h:56
NswT0Data::getT0
std::optional< float > getT0(const Identifier &channelId) const
Retrieve the t0 calibration constant for a given NSW channel.
Definition
NswT0Data.cxx:62
sTgcIdHelper
Definition
sTgcIdHelper.h:55
sTgcIdHelper::channelType
int channelType(const Identifier &id) const
Definition
sTgcIdHelper.cxx:1030
sTgcIdHelper::channelMax
static int channelMax()
Definition
sTgcIdHelper.cxx:1060
sTgcIdHelper::gasGapMax
static int gasGapMax()
Definition
sTgcIdHelper.cxx:1052
sTgcIdHelper::channel
int channel(const Identifier &id) const override
Definition
sTgcIdHelper.cxx:1035
sTgcIdHelper::gasGap
int gasGap(const Identifier &id) const override
get the hashes
Definition
sTgcIdHelper.cxx:1028
Identifier
Definition
IdentifierFieldParser.cxx:14
sTgcIdHelper.h
THROW_EXCEPTION
#define THROW_EXCEPTION(MESSAGE)
Definition
throwExcept.h:10
Generated on
for ATLAS Offline Software by
1.17.0