ATLAS Offline Software
NswCalibDbThresholdData.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
8 #include "Identifier/Identifier.h"
9 
10 
11 // general functions ---------------------------------
13  m_mmIdHelper(mmIdHelper),
14  m_stgcIdHelper(stgcIdHelper)
15 {
16 }
17 
18 
19 // setting functions ---------------------------------
20 
21 // setData
22 void
24  unsigned long long channelId = chnlId.get_compact();
25  if(m_data.find(channelId) != m_data.end()) return;
26  // storing as vector is not optimal, but keep for now in case we'll add more data in the future
27  m_data[channelId].push_back(threshold);
28 }
29 
30 // setZero
31 void
33  m_zero[tech] = threshold;
34 }
35 
36 
37 // retrieval functions -------------------------------
38 
39 // getChannelIds
40 std::vector<Identifier>
41 NswCalibDbThresholdData::getChannelIds(const std::string tech, const std::string side) const {
42  std::vector<Identifier> keys;
43  keys.reserve(m_data.size());
44  for (const auto& p : m_data) {
45  keys.emplace_back(p.first);
46  }
47 
48  if(tech.empty() && side.empty()) return keys;
49  std::vector<Identifier> chnls;
50 
51  for(unsigned int i=0; i<keys.size(); ++i){
52  bool isMM = m_mmIdHelper.is_mm(keys[i]);
53  bool isSTGC = m_stgcIdHelper.is_stgc(keys[i]);
55  if(!isSTGC && tech == "STGC") continue;
56  if(!isMM && tech == "MM") continue;
57  if(eta<=0 && side == "A") continue;
58  if(eta>=0 && side == "C") continue;
59  chnls.push_back(keys[i]);
60  }
61  return chnls;
62 }
63 
64 // getThreshold
65 bool
67  unsigned long long channelId = chnlId.get_compact();
68  ChannelMap::const_iterator chan_itr = m_data.find(channelId);
70  if(chan_itr != m_data.end() && chan_itr->second.size() == 1) {
71  threshold = chan_itr->second[0];
72  return true;
73  }
74  // if channelId doesn't exist in buffer, use 0 channel data ("all channels"), if exists
76 
77  ZeroMap::const_iterator zero_itr = m_zero.find(tech);
78  if (zero_itr != m_zero.end()) {
79  threshold = zero_itr->second;
80  return true;
81  }
82  threshold = 0.;
83  return false;
84 }
85 
86 
87 
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
sTgcIdHelper.h
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
NswCalibDbThresholdData::ThrsldTechType
ThrsldTechType
Definition: NswCalibDbThresholdData.h:26
NswCalibDbThresholdData::m_zero
ZeroMap m_zero
Definition: NswCalibDbThresholdData.h:49
NswCalibDbThresholdData::ThrsldTechType::STGC
@ STGC
TRT::Hit::side
@ side
Definition: HitInfo.h:83
MuonIdHelper::is_stgc
bool is_stgc(const Identifier &id) const
Definition: MuonIdHelper.cxx:798
NswCalibDbThresholdData::setData
void setData(const Identifier &, const float)
Definition: NswCalibDbThresholdData.cxx:23
lumiFormat.i
int i
Definition: lumiFormat.py:92
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
NswCalibDbThresholdData::ThrsldTechType::MM
@ MM
MmIdHelper.h
MuonIdHelper::is_mm
bool is_mm(const Identifier &id) const
Definition: MuonIdHelper.cxx:801
CaloCondBlobAlgs_fillNoiseFromASCII.channelId
channelId
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:122
NswCalibDbThresholdData::m_data
ChannelMap m_data
Definition: NswCalibDbThresholdData.h:48
NswCalibDbThresholdData::NswCalibDbThresholdData
NswCalibDbThresholdData(const MmIdHelper &, const sTgcIdHelper &)
Definition: NswCalibDbThresholdData.cxx:12
threshold
Definition: chainparser.cxx:74
sTgcIdHelper
Definition: sTgcIdHelper.h:55
MuonIdHelper::stationEta
int stationEta(const Identifier &id) const
Definition: MuonIdHelper.cxx:809
NswCalibDbThresholdData::getChannelIds
std::vector< Identifier > getChannelIds(const std::string="", const std::string="") const
Definition: NswCalibDbThresholdData.cxx:41
NswCalibDbThresholdData::m_stgcIdHelper
const sTgcIdHelper & m_stgcIdHelper
Definition: NswCalibDbThresholdData.h:53
Identifier::get_compact
value_type get_compact(void) const
Get the compact id.
MmIdHelper
Definition: MmIdHelper.h:54
NswCalibDbThresholdData::setZero
void setZero(ThrsldTechType, const float)
Definition: NswCalibDbThresholdData.cxx:32
NswCalibDbThresholdData::getThreshold
bool getThreshold(const Identifier &, float &) const
Definition: NswCalibDbThresholdData.cxx:66
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:790
NswCalibDbThresholdData::m_mmIdHelper
const MmIdHelper & m_mmIdHelper
Definition: NswCalibDbThresholdData.h:52
dumpTgcDigiThreshold.threshold
list threshold
Definition: dumpTgcDigiThreshold.py:34
NswCalibDbThresholdData.h