ATLAS Offline Software
NswT0Data.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
8 
9 #include "Identifier/Identifier.h"
12 #include "GeoModelKernel/throwExcept.h"
13 
14 
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 unsigned int NswT0Data::identToModuleIdx(const Identifier& chan_id) const{
30  if (m_idHelperSvc->isMM(chan_id)) {
31  const MmIdHelper& idHelper{m_idHelperSvc->mmIdHelper()};
32  return static_cast<unsigned int>(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<unsigned int>(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){
45  uint channelIdx{0};
46  if(m_idHelperSvc->isMM(id)){
47  const MmIdHelper& idHelper{m_idHelperSvc->mmIdHelper()};
48  if(data.at(idx).empty()) data.at(idx).resize(idHelper.channelMax(id), 0.f);
49  channelIdx = idHelper.channel(id) -1;
50  } else {
51  const sTgcIdHelper& idHelper{m_idHelperSvc->stgcIdHelper()};
52  if(data.at(idx).empty()) data.at(idx).resize(idHelper.channelMax(id), 0.f);
53  channelIdx = idHelper.channel(id) -1;
54  }
55  data.at(idx).at(channelIdx) = value;
56 }
57 
58 bool NswT0Data::getT0(const Identifier& id, float& value) const {
60  if (m_idHelperSvc->isMM(id)) {
61  if (m_data_mmg.size() <= idx) return false;
64  return true;
65  }
67  if(m_data_stg.size() <= idx) return false;
68  if(m_data_stg[idx].size() <= idx) return false;
70  return true;
71 }
NswT0Data::getT0
bool getT0(const Identifier &channelId, float &channelT0) const
Definition: NswT0Data.cxx:58
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
Muon::IMuonIdHelperSvc::stgcIdHelper
virtual const sTgcIdHelper & stgcIdHelper() const =0
access to TgcIdHelper
sTgcIdHelper.h
athena.value
value
Definition: athena.py:124
NswT0Data::m_data_stg
ChannelArray m_data_stg
Definition: NswT0Data.h:43
Muon::IMuonIdHelperSvc::mmIdHelper
virtual const MmIdHelper & mmIdHelper() const =0
access to CscIdHelper
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
uint
unsigned int uint
Definition: LArOFPhaseFill.cxx:20
NswT0Data::m_data_mmg
ChannelArray m_data_mmg
Definition: NswT0Data.h:42
sTgcIdHelper::channel
int channel(const Identifier &id) const override
Definition: sTgcIdHelper.cxx:1032
NswT0Data::ChannelArray
std::vector< std::vector< float > > ChannelArray
Definition: NswT0Data.h:41
MmIdHelper.h
CaloCondBlobAlgs_fillNoiseFromASCII.channelId
channelId
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:121
IOVInfiniteRange.h
NswT0Data::identToModuleIdx
unsigned int identToModuleIdx(const Identifier &chan_id) const
Definition: NswT0Data.cxx:28
Muon::IMuonIdHelperSvc::isMM
virtual bool isMM(const Identifier &id) const =0
returns whether this is a MM Identifier or not
IdentifierHash.h
sTgcIdHelper
Definition: sTgcIdHelper.h:55
NswT0Data::NswT0Data
NswT0Data(const Muon::IMuonIdHelperSvc *idHelperSvc)
Definition: NswT0Data.cxx:15
THROW_EXCEPTION
#define THROW_EXCEPTION(MESSAGE)
Definition: throwExcept.h:10
NswT0Data.h
MmIdHelper::channel
int channel(const Identifier &id) const override
Definition: MmIdHelper.cxx:832
MmIdHelper
Definition: MmIdHelper.h:54
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:108
NswT0Data::setData
void setData(const Identifier &channelId, const float channelT0)
Definition: NswT0Data.cxx:42
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
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:39
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
Muon::IMuonIdHelperSvc::issTgc
virtual bool issTgc(const Identifier &id) const =0
returns whether this is a sTGC Identifier or not
IMuonIdHelperSvc.h
Muon::IMuonIdHelperSvc::detElementHash
virtual IdentifierHash detElementHash(const Identifier &id) const =0
Returns the detector element hash associated to an Identifier.
Identifier
Definition: IdentifierFieldParser.cxx:14