ATLAS Offline Software
Loading...
Searching...
No Matches
NswT0Data Class Reference

Conditions data object to calibrate the timeoff set of each individual channel in the NSW. More...

#include <NswT0Data.h>

Collaboration diagram for NswT0Data:

Public Member Functions

 NswT0Data (const Muon::IMuonIdHelperSvc *idHelperSvc)
 ~NswT0Data ()=default
void setData (const Identifier &channelId, const float channelT0)
 Set the t0 calibration constant for a given nsw channel.
std::optional< float > getT0 (const Identifier &channelId) const
 Retrieve the t0 calibration constant for a given NSW channel.

Private Types

using ChannelArray = std::vector<std::vector<std::optional<float>>>

Private Member Functions

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.

Private Attributes

const Muon::IMuonIdHelperSvcm_idHelperSvc {}
ChannelArray m_data_mmg {}
ChannelArray m_data_stg {}

Detailed Description

Conditions data object to calibrate the timeoff set of each individual channel in the NSW.

Definition at line 26 of file NswT0Data.h.

Member Typedef Documentation

◆ ChannelArray

using NswT0Data::ChannelArray = std::vector<std::vector<std::optional<float>>>
private

Definition at line 54 of file NswT0Data.h.

Constructor & Destructor Documentation

◆ NswT0Data()

NswT0Data::NswT0Data ( const Muon::IMuonIdHelperSvc * idHelperSvc)

Definition at line 15 of file NswT0Data.cxx.

15 :
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}
static int gasGapMax()
size_type detectorElement_hash_max() const
const Muon::IMuonIdHelperSvc * m_idHelperSvc
Definition NswT0Data.h:52
ChannelArray m_data_mmg
Definition NswT0Data.h:55
ChannelArray m_data_stg
Definition NswT0Data.h:56
static int gasGapMax()

◆ ~NswT0Data()

NswT0Data::~NswT0Data ( )
default

Member Function Documentation

◆ getT0()

std::optional< float > NswT0Data::getT0 ( const Identifier & channelId) const

Retrieve the t0 calibration constant for a given NSW channel.

Parameters
channelIdIdentifier of the readout channel to calibrate

Definition at line 62 of file NswT0Data.cxx.

62 {
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}
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

◆ identToModuleIdx()

std::size_t NswT0Data::identToModuleIdx ( const Identifier & channelId) const
private

The calibration data is internally stored as two jagged vectors, one for MM the other for sTGC.

The outer vector is sorted by the module index which is a composition of the detElementHash && the gasgap. Transform the channel identifier to the module Index

Parameters
channelIdIdentifier of the channel to transform

Definition at line 28 of file NswT0Data.cxx.

28 {
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}
int gasGap(const Identifier &id) const override
get the hashes
int channelType(const Identifier &id) const
int gasGap(const Identifier &id) const override
get the hashes
#define THROW_EXCEPTION(MESSAGE)
Definition throwExcept.h:10

◆ setData()

void NswT0Data::setData ( const Identifier & channelId,
const float channelT0 )

Set the t0 calibration constant for a given nsw channel.

Parameters
channelIdIdentifier of the readout channel to calibrate
channelT0Calibration constantto be applied

Definition at line 42 of file NswT0Data.cxx.

42 {
43 std::size_t idx = identToModuleIdx(id);
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}
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
static int channelMax()
int channel(const Identifier &id) const override
std::vector< std::vector< std::optional< float > > > ChannelArray
Definition NswT0Data.h:54
static int channelMax()
int channel(const Identifier &id) const override

Member Data Documentation

◆ m_data_mmg

ChannelArray NswT0Data::m_data_mmg {}
private

Definition at line 55 of file NswT0Data.h.

55{};

◆ m_data_stg

ChannelArray NswT0Data::m_data_stg {}
private

Definition at line 56 of file NswT0Data.h.

56{};

◆ m_idHelperSvc

const Muon::IMuonIdHelperSvc* NswT0Data::m_idHelperSvc {}
private

Definition at line 52 of file NswT0Data.h.

52{};

The documentation for this class was generated from the following files: