ATLAS Offline Software
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 
IdentifiableValueContainer::getAll
std::vector< std::pair< size_t, T > > getAll() const
Make a vector of hashes and values, convenient for iteration and other uses.
Definition: IdentifiableValueContainer.h:93
IDCInDetBSErrContainerCnv_p1.h
IDCInDetBSErrContainer
IDC like storage for BS errors, TODO, customise implementation further so that we store int rather th...
Definition: IDCInDetBSErrContainer.h:19
InDetBSErrContainer64_p1
Definition: InDetBSErrContainer64_p1.h:15
python.CaloCondTools.g
g
Definition: CaloCondTools.py:15
IdentifiableValueContainer::setOrDrop
bool setOrDrop(size_t i, const T &value)
Set the value for the given hash.
Definition: IdentifiableValueContainer.h:129
IDCInDetBSErrContainerCnv_p1::createTransient
virtual IDCInDetBSErrContainer * createTransient(const InDetBSErrContainer64_p1 *persObj, MsgStream &log)
Definition: IDCInDetBSErrContainerCnv_p1.cxx:23
min
#define min(a, b)
Definition: cfImp.cxx:40
IDCInDetBSErrContainerCnv_p1::transToPers
virtual void transToPers(const IDCInDetBSErrContainer *transCont, InDetBSErrContainer64_p1 *persCont, MsgStream &log)
Definition: IDCInDetBSErrContainerCnv_p1.cxx:8
python.PyAthena.v
v
Definition: PyAthena.py:157
IDCInDetBSErrContainerCnv_p1::persToTrans
virtual void persToTrans(const InDetBSErrContainer64_p1 *persCont, IDCInDetBSErrContainer *transCont, MsgStream &log)
Definition: IDCInDetBSErrContainerCnv_p1.cxx:15
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
InDetBSErrContainer64_p1::m_bsErrs
std::vector< std::pair< IdentifierHash, uint64_t > > m_bsErrs
Definition: InDetBSErrContainer64_p1.h:20