ATLAS Offline Software
TileRawDataNonConstContainer.h
Go to the documentation of this file.
1 // This file's extension implies that it's C, but it's really -*- C++ -*-.
2 /*
3  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
4 */
5 /*
6  */
7 // $Id$
16 #ifndef TILEEVENT_TILERAWDATANONCONSTCONTAINER_H
17 #define TILEEVENT_TILERAWDATANONCONSTCONTAINER_H
18 
19 
22 #include <vector>
23 
24 
33 template <typename COLLECTION>
35 {
36 public:
37  typedef typename COLLECTION::TElement element_t;
38 
40  void push_back (element_t* rc);
41 
42  typedef typename std::vector<std::unique_ptr<COLLECTION> >::iterator iterator;
43  iterator begin() { return m_colls.begin(); }
44  iterator end() { return m_colls.end(); }
45 
46 
47 private:
49  std::vector<std::unique_ptr<COLLECTION> > m_colls;
50 };
51 
52 
53 template <typename COLLECTION>
55 {
56  m_hashFunc.initialize(TileCablingService::getInstance()->getTileHWID(),
58  size_t ncoll = m_hashFunc.max();
59  m_colls.reserve (ncoll);
60  for (size_t i = 0; i < ncoll; i++) {
61  TileFragHash::ID frag = m_hashFunc.identifier(i);
62  m_colls.push_back (std::make_unique<COLLECTION> (frag, ownPolicy));
63  }
64 }
65 
66 
67 template <typename COLLECTION>
69 {
70  int frag = rc->frag_ID();
71  IdentifierHash fragHash = static_cast<IdentifierHash>(m_hashFunc(frag));
72  assert (fragHash < m_colls.size());
73  m_colls[fragHash]->push_back (rc);
74 }
75 
76 
77 #endif // not TILEEVENT_TILERAWDATANONCONSTCONTAINER_H
TileCablingService::getInstance
static const TileCablingService * getInstance()
get pointer to service instance
Definition: TileCablingService.cxx:24
TileRawDataNonConstContainer::begin
iterator begin()
Definition: TileRawDataNonConstContainer.h:43
TileFragHash.h
TileFragHash
Hash table for Tile fragments (==drawers ==collections in StoreGate)
Definition: TileFragHash.h:24
TileFragHash::Digitizer
@ Digitizer
Definition: TileFragHash.h:33
TileRawDataNonConstContainer
This is a minimal version of a TileRawDataContainer in which the saved collections remain non-const.
Definition: TileRawDataNonConstContainer.h:35
SG::OwnershipPolicy
OwnershipPolicy
describes the possible element ownership policies (see e.g. DataVector)
Definition: OwnershipPolicy.h:16
TileRawDataNonConstContainer::end
iterator end()
Definition: TileRawDataNonConstContainer.h:44
TileRawDataNonConstContainer< TileHitCollection >::iterator
std::vector< std::unique_ptr< TileHitCollection > >::iterator iterator
Definition: TileRawDataNonConstContainer.h:42
TileCablingService.h
lumiFormat.i
int i
Definition: lumiFormat.py:85
TileFragHash::ID
int ID
Definition: TileFragHash.h:28
TileRawDataNonConstContainer::push_back
void push_back(element_t *rc)
Definition: TileRawDataNonConstContainer.h:68
TileRawDataNonConstContainer::TileRawDataNonConstContainer
TileRawDataNonConstContainer(SG::OwnershipPolicy ownPolicy)
Definition: TileRawDataNonConstContainer.h:54
TileRawDataNonConstContainer::element_t
COLLECTION::TElement element_t
Definition: TileRawDataNonConstContainer.h:37
TileRawDataNonConstContainer::m_hashFunc
TileFragHash m_hashFunc
Definition: TileRawDataNonConstContainer.h:48
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
TileRawDataNonConstContainer::m_colls
std::vector< std::unique_ptr< COLLECTION > > m_colls
Definition: TileRawDataNonConstContainer.h:49