ATLAS Offline Software
Loading...
Searching...
No Matches
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
CutBookkeeperContainer_v1 CutBookkeeperContainer
Define the latest version of the CutBookkeeperContainer class.
Helper in-memory structure.
std::vector< std::unique_ptr< xAOD::CutBookkeeperContainer > > cont
std::vector< std::unique_ptr< xAOD::CutBookkeeperAuxContainer > > aux
xAOD::CutBookkeeperContainer * at(std::size_t n) const
static void prepareContainers(CutBookkeepersLocalCache &target, size_t size, bool extend=false)