ATLAS Offline Software
CutBookkeepersLocalCache.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef EVENT_BOOKKEEPER_TOOLS__CUT_BOOKKEEPERS_LOCAL_CACHE_H
6 #define EVENT_BOOKKEEPER_TOOLS__CUT_BOOKKEEPERS_LOCAL_CACHE_H
7 
11 
12 
15 {
16  std::vector<std::unique_ptr<xAOD::CutBookkeeperContainer>> cont;
17  std::vector<std::unique_ptr<xAOD::CutBookkeeperAuxContainer>> aux;
18 
19  bool empty() const { return cont.empty(); }
20  std::size_t size() const { return cont.size(); }
21  xAOD::CutBookkeeperContainer *at(std::size_t n) const { return cont.at(n).get(); }
22  void clear() { cont.clear(); aux.clear(); }
23 
24  // Helper function to initialise the cache
26  size_t size,
27  bool extend = false)
28  {
29  if (!target.empty() && !extend) {
30  return;
31  }
32 
33  size_t toAdd = size - target.size();
34  for (std::size_t i = 0; i < toAdd; ++i) {
35  auto container = std::make_unique<xAOD::CutBookkeeperContainer>();
36  auto auxContainer = std::make_unique<xAOD::CutBookkeeperAuxContainer>();
37  container->setStore(auxContainer.get());
38  target.cont.push_back(std::move(container));
39  target.aux.push_back(std::move(auxContainer));
40  }
41  }
42 };
43 
44 #endif // EVENT_BOOKKEEPER_TOOLS__CUT_BOOKKEEPERS_LOCAL_CACHE_H
CutBookkeepersLocalCache::size
std::size_t size() const
Definition: CutBookkeepersLocalCache.h:20
CutBookkeepersLocalCache::cont
std::vector< std::unique_ptr< xAOD::CutBookkeeperContainer > > cont
Definition: CutBookkeepersLocalCache.h:16
CutBookkeeperAuxContainer.h
CutBookkeepersLocalCache::clear
void clear()
Definition: CutBookkeepersLocalCache.h:22
CutBookkeepersLocalCache::prepareContainers
static void prepareContainers(CutBookkeepersLocalCache &target, size_t size, bool extend=false)
Definition: CutBookkeepersLocalCache.h:25
CutBookkeepersLocalCache
Helper in-memory structure.
Definition: CutBookkeepersLocalCache.h:15
lumiFormat.i
int i
Definition: lumiFormat.py:92
CutBookkeepersLocalCache::aux
std::vector< std::unique_ptr< xAOD::CutBookkeeperAuxContainer > > aux
Definition: CutBookkeepersLocalCache.h:17
beamspotman.n
n
Definition: beamspotman.py:731
CutBookkeeperContainer.h
xAOD::CutBookkeeperContainer_v1
Container that holds the Container of all CutBookkeepers.
Definition: CutBookkeeperContainer_v1.h:27
DeMoUpdate.toAdd
bool toAdd
Definition: DeMoUpdate.py:1304
CutBookkeepersLocalCache::at
xAOD::CutBookkeeperContainer * at(std::size_t n) const
Definition: CutBookkeepersLocalCache.h:21
CutBookkeepersLocalCache::empty
bool empty() const
Definition: CutBookkeepersLocalCache.h:19
COOLRates.target
target
Definition: COOLRates.py:1106