ATLAS Offline Software
TGCModuleMap.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 namespace MuonTGC_Cabling
8 {
9 
11  clear();
12 }
13 
16  advance(iter,entry);
17  return iter->first;
18 }
19 
22  advance(iter,entry);
23  return iter->second;
24 }
25 
28  advance(iter,entry);
29  TGCModuleId* moduleId = iter->second;
30  m_moduleMap.erase(iter);
31  return moduleId;
32 }
33 
34 void TGCModuleMap::insert(int connector, TGCModuleId* moduleId) {
35  if(m_moduleMap.find(connector) == m_moduleMap.end()) {
36  m_moduleMap.insert(std::pair<int,TGCModuleId*>(connector,moduleId));
37  } else {
38  // duplicate with key of connector
39  delete moduleId;
40  }
41  return;
42 }
43 
44 int TGCModuleMap::find(int connector) {
45  return distance(m_moduleMap.begin(),m_moduleMap.find(connector));
46 }
47 
48 int TGCModuleMap::size(void) {
49  return m_moduleMap.size();
50 }
51 
52 void TGCModuleMap::clear(void) {
53  for (auto& p : m_moduleMap) {
54  delete p.second;
55  }
56  m_moduleMap.clear();
57  return;
58 }
59 
60 } // end of namespace
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
MuonTGC_Cabling::TGCModuleMap::moduleId
TGCModuleId * moduleId(int entry)
Definition: TGCModuleMap.cxx:20
TGCModuleMap.h
MuonTGC_Cabling::TGCModuleMap::connector
int connector(int entry)
Definition: TGCModuleMap.cxx:14
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
MuonTGC_Cabling
Definition: TGCCable.h:13
MuonTGC_Cabling::TGCModuleMap::find
int find(int connector)
Definition: TGCModuleMap.cxx:44
MuonTGC_Cabling::TGCModuleMap::~TGCModuleMap
virtual ~TGCModuleMap(void)
Definition: TGCModuleMap.cxx:10
GetAllXsec.entry
list entry
Definition: GetAllXsec.py:132
MuonTGC_Cabling::TGCModuleMap::insert
void insert(int connector, TGCModuleId *moduleId)
Definition: TGCModuleMap.cxx:34
MuonTGC_Cabling::TGCModuleMap::popModuleId
TGCModuleId * popModuleId(int entry)
Definition: TGCModuleMap.cxx:26
MuonTGC_Cabling::TGCModuleMap::clear
void clear(void)
Definition: TGCModuleMap.cxx:52
MuonTGC_Cabling::TGCModuleMap::size
int size(void)
Definition: TGCModuleMap.cxx:48
MuonTGC_Cabling::TGCModuleMap::m_moduleMap
std::map< int, TGCModuleId * > m_moduleMap
Definition: TGCModuleMap.h:39
MuonTGC_Cabling::TGCModuleId
Definition: TGCModuleId.h:13
Amg::distance
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
Definition: GeoPrimitivesHelpers.h:54