ATLAS Offline Software
Loading...
Searching...
No Matches
IDCInDetBSErrContainerCnv_p1.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#include <algorithm> // std::min_element, std::max_element
7
9{
10 const auto vect = transCont->getAll();
11 persCont->m_bsErrs.reserve(vect.size());
12 for(const auto& v : vect) persCont->m_bsErrs.emplace_back(v.first, v.second);
13}
14
16{
17 for (const std::pair<IdentifierHash, uint64_t>& bsErr: persCont->m_bsErrs) {
18 transCont->setOrDrop(bsErr.first, bsErr.second);
19 }
20 }
21
22//================================================================
24 size_t g = 0;
25 if (persObj->m_bsErrs.begin()!=persObj->m_bsErrs.end()) {
26 auto maxhash = std::max_element(persObj->m_bsErrs.begin(), persObj->m_bsErrs.end());
27 g = maxhash->first + 1;
28 }
29 std::unique_ptr<IDCInDetBSErrContainer> trans = std::make_unique<IDCInDetBSErrContainer>(g, std::numeric_limits<IDCInDetBSErrContainer::ErrorCode>::min());
30 persToTrans(persObj, trans.get(), log);
31 return trans.release();
32}
33
virtual IDCInDetBSErrContainer * createTransient(const InDetBSErrContainer64_p1 *persObj, MsgStream &log)
virtual void transToPers(const IDCInDetBSErrContainer *transCont, InDetBSErrContainer64_p1 *persCont, MsgStream &log)
virtual void persToTrans(const InDetBSErrContainer64_p1 *persCont, IDCInDetBSErrContainer *transCont, MsgStream &log)
IDC like storage for BS errors, TODO, customise implementation further so that we store int rather th...
bool setOrDrop(size_t i, const T &value)
Set the value for the given hash.
std::vector< std::pair< size_t, T > > getAll() const
Make a vector of hashes and values, convenient for iteration and other uses.
std::vector< std::pair< IdentifierHash, uint64_t > > m_bsErrs