ATLAS Offline Software
ActsVolumeIdToDetectorElementCollectionMap.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3  */
4 #ifndef ACTSTRK_ActsVolumeIdToDetectorElementCollectionMap_H
5 #define ACTSTRK_ActsVolumeIdToDetectorElementCollectionMap_H
6 #include <vector>
7 #include <array>
8 #include <stdexcept>
10 
11 
12 namespace ActsTrk {
14  public:
16  void registerCollection( unsigned int volume_id, const InDetDD::SiDetectorElementCollection *collection) {
17  std::vector<const InDetDD::SiDetectorElementCollection *>::const_iterator iter=std::find(m_collections.begin(), m_collections.end(), collection);
18  unsigned char col_i;
19  if (iter == m_collections.end()) {
20  assert(m_collections.size()<256u);
21  col_i=static_cast<unsigned char>(m_collections.size());
22  m_collections.push_back(collection);
23  }
24  else {
25  assert( iter - m_collections.begin()< 256u);
26  col_i = static_cast<unsigned char>(iter - m_collections.begin());
27  }
28  if (m_collectionId.at(volume_id) != 0 && m_collectionId.at(volume_id) != col_i) {
29  throw std::runtime_error("Volume id maps to multiple detector element collections.");
30  }
31  m_collectionId.at(volume_id) = col_i;
32  }
33  const InDetDD::SiDetectorElementCollection *collection(unsigned int volume_id) const {
34  return m_collections.at( volume_id >= m_collectionId.size() ? static_cast<unsigned char>(0u) : m_collectionId[volume_id] );
35  }
36  const std::array<unsigned char,256> &collecionMap() const { return m_collectionId; }
37  const std::vector<const InDetDD::SiDetectorElementCollection*> &collections() const { return m_collections; }
38 
39  private:
40  std::array<unsigned char,256> m_collectionId{};
41  std::vector<const InDetDD::SiDetectorElementCollection*> m_collections;
42  };
43 }
44 
45 
46 #include "AthenaKernel/CLASS_DEF.h"
47 #include "AthenaKernel/CondCont.h"
49 CONDCONT_MIXED_DEF(ActsTrk::ActsVolumeIdToDetectorElementCollectionMap, 1289614908);
50 
51 #endif
createLinkingScheme.iter
iter
Definition: createLinkingScheme.py:62
CondCont.h
Hold mappings of ranges to condition objects.
InDetDD::SiDetectorElementCollection
Definition: SiDetectorElementCollection.h:27
ActsTrk::ActsVolumeIdToDetectorElementCollectionMap::m_collections
std::vector< const InDetDD::SiDetectorElementCollection * > m_collections
Definition: ActsVolumeIdToDetectorElementCollectionMap.h:41
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
ActsTrk::ActsVolumeIdToDetectorElementCollectionMap::collecionMap
const std::array< unsigned char, 256 > & collecionMap() const
Definition: ActsVolumeIdToDetectorElementCollectionMap.h:36
ActsTrk::ActsVolumeIdToDetectorElementCollectionMap::m_collectionId
std::array< unsigned char, 256 > m_collectionId
Definition: ActsVolumeIdToDetectorElementCollectionMap.h:40
ActsTrk::ActsVolumeIdToDetectorElementCollectionMap::collections
const std::vector< const InDetDD::SiDetectorElementCollection * > & collections() const
Definition: ActsVolumeIdToDetectorElementCollectionMap.h:37
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:77
ActsTrk::ActsVolumeIdToDetectorElementCollectionMap::registerCollection
void registerCollection(unsigned int volume_id, const InDetDD::SiDetectorElementCollection *collection)
Definition: ActsVolumeIdToDetectorElementCollectionMap.h:16
CONDCONT_MIXED_DEF
CONDCONT_MIXED_DEF(ActsTrk::ActsVolumeIdToDetectorElementCollectionMap, 1289614908)
ActsTrk::ActsVolumeIdToDetectorElementCollectionMap::ActsVolumeIdToDetectorElementCollectionMap
ActsVolumeIdToDetectorElementCollectionMap()
Definition: ActsVolumeIdToDetectorElementCollectionMap.h:15
SiDetectorElementCollection.h
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:67
ActsTrk
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Definition: MSTrackingVolumeBuilder.cxx:24
CLASS_DEF.h
macros to associate a CLID to a type
ActsTrk::ActsVolumeIdToDetectorElementCollectionMap
Definition: ActsVolumeIdToDetectorElementCollectionMap.h:13
ActsTrk::ActsVolumeIdToDetectorElementCollectionMap::collection
const InDetDD::SiDetectorElementCollection * collection(unsigned int volume_id) const
Definition: ActsVolumeIdToDetectorElementCollectionMap.h:33