ATLAS Offline Software
LArRoIMap.cxx
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration.
3  */
17 
18 
23 LArRoIMap::LArRoIMap (TT_ID layer_hash_max)
24  : m_layer_hash_max (layer_hash_max)
25 {
26 }
27 
28 
33 {
34  auto it = m_offmap.find (channel_id);
35  if (it == m_offmap.end()) {
36  return m_layer_hash_max + 1;
37  }
38  return it->second;
39 }
40 
41 
46 {
47  auto it = m_onlmap.find (id);
48  if (it == m_onlmap.end()) {
49  return m_layer_hash_max + 1;
50  }
51  return it->second;
52 }
53 
54 
58 const std::vector<LArRoIMap::COLL_ID>&
59 LArRoIMap::collectionID (const TT_ID& RoIid) const
60 {
61  auto it = m_roimap.find(RoIid);
62  if(it !=m_roimap.end()) {
63  return it->second;
64  }
65 
66  // It is expected to have request that may not be in the map.
67  // Not all TTs have all samplings. For example, at eta>1.8, there is no
68  // presampler.
69 
70  static const std::vector<COLL_ID> v ;
71  return v;
72 }
73 
74 
78 bool LArRoIMap::validID (const TT_ID& RoIid ) const
79 {
80  return m_roimap.find (RoIid) != m_roimap.end();
81 }
82 
83 
92  const HWIdentifier& sigId,
93  const HWIdentifier& robId,
94  TT_ID hashid_sam)
95 {
96  m_offmap[id] = hashid_sam;
97  m_onlmap[sigId] = hashid_sam;
98  std::vector<COLL_ID>& v = m_roimap[hashid_sam];
99  if (std::find (v.begin(), v.end(), robId) == v.end()) {
100  v.push_back (robId);
101  }
102 }
LArRoIMap::m_layer_hash_max
TT_ID m_layer_hash_max
Maximum hash ID.
Definition: LArRoIMap.h:85
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
LArRoIMap::addEntry
void addEntry(const Identifier &id, const HWIdentifier &sigId, const HWIdentifier &robId, TT_ID hashid_sam)
Add a new entry to the map.
Definition: LArRoIMap.cxx:91
LArRoIMap::m_roimap
std::unordered_map< TT_ID, std::vector< COLL_ID > > m_roimap
Map from trigger tower ID to list of ROBs.
Definition: LArRoIMap.h:94
skel.it
it
Definition: skel.GENtoEVGEN.py:396
HWIdentifier
Definition: HWIdentifier.h:13
LArRoIMap.h
Mapping between calorimeter trigger id to offline/online Identifier.
LArRoIMap::m_offmap
std::unordered_map< Identifier, TT_ID > m_offmap
Map from offline ID to trigger tower ID.
Definition: LArRoIMap.h:88
LArRoIMap::validID
bool validID(const TT_ID &tt_id) const
Check validity of a trigger tower ID.
Definition: LArRoIMap.cxx:78
createCoolChannelIdFile.channel_id
channel_id
Definition: createCoolChannelIdFile.py:52
LArRoIMap::LArRoIMap
LArRoIMap(TT_ID layer_hash_max)
Constructor.
Definition: LArRoIMap.cxx:23
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:220
LArRoIMap::m_onlmap
std::unordered_map< Identifier, TT_ID > m_onlmap
Map from online ID to trigger tower ID.
Definition: LArRoIMap.h:91
python.PyAthena.v
v
Definition: PyAthena.py:154
LArRoIMap::TT_ID
unsigned int TT_ID
Definition: LArRoIMap.h:34
LArRoIMap::trigTowerID
TT_ID trigTowerID(const Identifier &channel_id) const
Translate offline channel identifier to trigger tower ID.
Definition: LArRoIMap.cxx:32
LArRoIMap::collectionID
const std::vector< COLL_ID > & collectionID(const TT_ID &id) const
Get list of robIds for a given trigger tower ID.
Definition: LArRoIMap.cxx:59
Identifier
Definition: IdentifierFieldParser.cxx:14