ATLAS Offline Software
LArLATOMEMapping.h
Go to the documentation of this file.
1 //Dear emacs, this is -*-c++-*-
2 
3 /*
4  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 #ifndef LARLATOMEMAPPING_H
8 #define LARLATOMEMAPPING_H
9 
11 #include "Identifier/Identifier.h"
13 
14 #include <vector>
15 //#include <algorithm>
16 #include <unordered_map>
22 #define N_LATOME_CHANNELS 320
23 
29 
34  friend class LArLATOMEMappingAlg; //The conditions alg filling this object
35 
36  public:
37  LArLATOMEMapping(unsigned nLatomes=0);
38 
43  HWIdentifier getChannelID(const unsigned int sourceID, const unsigned int chan) const;
44 
45 
46 
47  private:
48 
51 
52  std::vector<unsigned int> m_sourceID;
53  std::vector<std::vector< HWIdentifier> > m_onlineID;
54  std::unordered_map<unsigned,std::vector< HWIdentifier> > m_map;
55 
56 };
57 
58 
59 //Inline methods:
60 inline HWIdentifier LArLATOMEMapping::getChannelID(const unsigned int sourceID, const unsigned int chan) const {
61  auto it = m_map.find(sourceID);
62  if (ATH_UNLIKELY(it == m_map.end())) {
63  return m_hwidEmpty;
64  }
65  const std::vector<HWIdentifier>& chanVec = it->second;
66  if (ATH_UNLIKELY(chan > chanVec.size())) {
67  return m_hwidEmpty;
68  }
69  return chanVec[chan];
70 }
71 
72 #include "AthenaKernel/CLASS_DEF.h"
73 CLASS_DEF( LArLATOMEMapping, 219977637 , 1)
74 #include "AthenaKernel/CondCont.h"
76 
77 #endif
LArLATOMEMapping::getChannelID
HWIdentifier getChannelID(const unsigned int sourceID, const unsigned int chan) const
create a HWIdentifier from an Identifier
Definition: LArLATOMEMapping.h:60
LArLATOMEMapping::LArLATOMEMapping
LArLATOMEMapping(unsigned nLatomes=0)
Definition: LArLATOMEMapping.cxx:8
LArLATOMEMapping::m_map
std::unordered_map< unsigned, std::vector< HWIdentifier > > m_map
Definition: LArLATOMEMapping.h:54
skel.it
it
Definition: skel.GENtoEVGEN.py:423
LArLATOMEMapping::m_onlineID
std::vector< std::vector< HWIdentifier > > m_onlineID
Definition: LArLATOMEMapping.h:53
ATH_UNLIKELY
#define ATH_UNLIKELY(x)
Definition: AthUnlikelyMacros.h:17
LArLATOMEMapping
class to provide SC mapping
Definition: LArLATOMEMapping.h:28
HWIdentifier
Definition: HWIdentifier.h:13
LArLATOMEMappingAlg
class to fill SC mapping object from conditions DB
Definition: LArLATOMEMappingAlg.h:21
AthUnlikelyMacros.h
ReadCellNoiseFromCool.chan
chan
Definition: ReadCellNoiseFromCool.py:52
LArLATOMEMapping::m_sourceID
std::vector< unsigned int > m_sourceID
Definition: LArLATOMEMapping.h:52
HWIdentifier.h
LArLATOMEMapping::m_hwidEmpty
const HWIdentifier m_hwidEmpty
Invalid default instance of HWIdentifier.
Definition: LArLATOMEMapping.h:50
IdentifierHash.h
CONDCONT_DEF
CONDCONT_DEF(LArLATOMEMapping, 84043487)
CLASS_DEF
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
Definition: Control/AthenaKernel/AthenaKernel/CLASS_DEF.h:64
CLASS_DEF.h
macros to associate a CLID to a type