ATLAS Offline Software
Loading...
Searching...
No Matches
LArLATOMEMapping.h
Go to the documentation of this file.
1//Dear emacs, this is -*-c++-*-
2
3/*
4 Copyright (C) 2002-2026 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>
21#define N_LATOME_CHANNELS 320
22
26
28
33 friend class LArLATOMEMappingAlg; //The conditions alg filling this object
34
35 public:
36 LArLATOMEMapping(unsigned nLatomes=0);
37
42 HWIdentifier getChannelID(const unsigned int sourceID, const unsigned int chan) const;
43 std::vector<HWIdentifier> getChFromSource(const unsigned int sourceID) 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:
60inline HWIdentifier LArLATOMEMapping::getChannelID(const unsigned int sourceID, const unsigned int chan) const {
61 auto it = m_map.find(sourceID);
62 if (it == m_map.end()) [[unlikely]] {
63 return m_hwidEmpty;
64 }
65 const std::vector<HWIdentifier>& chanVec = it->second;
66 if (chan >= chanVec.size()) [[unlikely]] {
67 return m_hwidEmpty;
68 }
69 return chanVec[chan];
70}
71
72// Lets make it possible to do this in two stages if needed: Return only the chanVec vector for a given LATOME source ID:
73inline std::vector<HWIdentifier> LArLATOMEMapping::getChFromSource(const unsigned int sourceID) const{
74 auto it = m_map.find(sourceID);
75 if (it == m_map.end()) [[unlikely]] {
76 return {m_hwidEmpty} ;
77 }
78
79 return it->second ;
80}
81
82
84CLASS_DEF( LArLATOMEMapping, 219977637 , 1)
85#include "AthenaKernel/CondCont.h"
87
88#endif
#define CONDCONT_DEF(...)
Definition CondCont.h:1413
macros to associate a CLID to a type
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
class to provide SC mapping
std::vector< std::vector< HWIdentifier > > m_onlineID
LArLATOMEMapping(unsigned nLatomes=0)
const HWIdentifier m_hwidEmpty
Invalid default instance of HWIdentifier.
std::unordered_map< unsigned, std::vector< HWIdentifier > > m_map
friend class LArLATOMEMappingAlg
class which fills object from conditions DB
HWIdentifier getChannelID(const unsigned int sourceID, const unsigned int chan) const
create a HWIdentifier from an Identifier
std::vector< unsigned int > m_sourceID
std::vector< HWIdentifier > getChFromSource(const unsigned int sourceID) const
#define unlikely(x)