ATLAS Offline Software
NswT0Data.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
7 #include "Identifier/Identifier.h"
9 
10 #include "GeoModelHelpers/throwExcept.h"
12  m_idHelperSvc{idHelperSvc} {
13  if (m_idHelperSvc->hasMM()) {
14  const MmIdHelper& idHelper{m_idHelperSvc->mmIdHelper()};
15  m_data_mmg.resize((idHelper.detectorElement_hash_max()+1)*idHelper.gasGapMax());
16  }
17  if (m_idHelperSvc->hasSTGC()) {
18  const sTgcIdHelper& idHelper{m_idHelperSvc->stgcIdHelper()};
19  m_data_stg.resize((idHelper.detectorElement_hash_max() +1)*(idHelper.gasGapMax()*3 /*3 channel types*/));
20 
21  }
22 }
23 
24 unsigned int NswT0Data::identToModuleIdx(const Identifier& chan_id) const{
26  if (m_idHelperSvc->isMM(chan_id)) {
27  const MmIdHelper& idHelper{m_idHelperSvc->mmIdHelper()};
28  return static_cast<unsigned int>(hash)*(idHelper.gasGapMax()) + (idHelper.gasGap(chan_id) -1);
29  } else if (m_idHelperSvc->issTgc(chan_id)) {
30  const sTgcIdHelper& idHelper{m_idHelperSvc->stgcIdHelper()};
31  return static_cast<unsigned int>(hash)*(idHelper.gasGapMax() * 3 /*3 channel types*/) +
32  (idHelper.gasGap(chan_id) -1 + idHelper.gasGapMax() * idHelper.channelType(chan_id));
33  }
34  THROW_EXCEPTION("NswT0Data() - No MM or sTGC identifier");
35  return -1;
36 }
37 
38 void NswT0Data::setData(const Identifier& id, const float value){
41  uint channelIdx{0};
42  if(m_idHelperSvc->isMM(id)){
43  const MmIdHelper& idHelper{m_idHelperSvc->mmIdHelper()};
44  if(data.at(idx).empty()) data.at(idx).resize(idHelper.channelMax(id), 0.f);
45  channelIdx = idHelper.channel(id) -1;
46  } else {
47  const sTgcIdHelper& idHelper{m_idHelperSvc->stgcIdHelper()};
48  if(data.at(idx).empty()) data.at(idx).resize(idHelper.channelMax(id), 0.f);
49  channelIdx = idHelper.channel(id) -1;
50  }
51  data.at(idx).at(channelIdx) = value;
52 }
53 
54 bool NswT0Data::getT0(const Identifier& id, float& value) const {
56  if (m_idHelperSvc->isMM(id)) {
57  if (m_data_mmg.size() <= idx) return false;
60  return true;
61  }
63  if(m_data_stg.size() <= idx) return false;
65  return true;
66 }
NswT0Data::getT0
bool getT0(const Identifier &channelId, float &channelT0) const
Definition: NswT0Data.cxx:54
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:122
NswT0Data::m_data_stg
ChannelArray m_data_stg
Definition: NswT0Data.h:37
THROW_EXCEPTION
#define THROW_EXCEPTION(MSG)
Definition: MMReadoutElement.cxx:48
Muon::IMuonIdHelperSvc::mmIdHelper
virtual const MmIdHelper & mmIdHelper() const =0
access to CscIdHelper
uint
unsigned int uint
Definition: LArOFPhaseFill.cxx:20
NswT0Data::m_data_mmg
ChannelArray m_data_mmg
Definition: NswT0Data.h:36
sTgcIdHelper::channel
int channel(const Identifier &id) const override
Definition: sTgcIdHelper.cxx:1027
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
NswT0Data::ChannelArray
std::vector< std::vector< float > > ChannelArray
Definition: NswT0Data.h:35
MmIdHelper.h
CaloCondBlobAlgs_fillNoiseFromASCII.channelId
channelId
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:122
IOVInfiniteRange.h
NswT0Data::identToModuleIdx
unsigned int identToModuleIdx(const Identifier &chan_id) const
Definition: NswT0Data.cxx:24
Muon::IMuonIdHelperSvc::isMM
virtual bool isMM(const Identifier &id) const =0
returns whether this is a MM Identifier or not
sTgcIdHelper
Definition: sTgcIdHelper.h:55
NswT0Data::NswT0Data
NswT0Data(const Muon::IMuonIdHelperSvc *idHelperSvc)
Definition: NswT0Data.cxx:11
NswT0Data.h
MmIdHelper::channel
int channel(const Identifier &id) const override
Definition: MmIdHelper.cxx:800
MmIdHelper
Definition: MmIdHelper.h:54
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:109
NswT0Data::setData
void setData(const Identifier &channelId, const float channelT0)
Definition: NswT0Data.cxx:38
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:26
NswT0Data::m_idHelperSvc
const Muon::IMuonIdHelperSvc * m_idHelperSvc
Definition: NswT0Data.h:33
IdentifierHash
Definition: IdentifierHash.h:38
Muon::IMuonIdHelperSvc::issTgc
virtual bool issTgc(const Identifier &id) const =0
returns whether this is a sTGC Identifier or not
Muon::IMuonIdHelperSvc::detElementHash
virtual IdentifierHash detElementHash(const Identifier &id) const =0
Returns the detector element hash associated to an Identifier.