ATLAS Offline Software
InDetBSErrContainerCnv_p2.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
8 {
9  (persCont->m_bsErrs).reserve(transCont->size());
10  for (const std::pair<IdentifierHash, int>* bsErr: *transCont) {
11  if (bsErr==nullptr) {
12  log << MSG::WARNING << "const std::pair<IdentifierHash, int>* is nullptr and skipped." << endmsg;
13  continue;
14  }
15  (persCont->m_bsErrs).push_back(*bsErr);
16  }
17 
18  }
19 
20 void InDetBSErrContainerCnv_p2::persToTrans(const InDetBSErrContainer_p2* persCont, InDetBSErrContainer* transCont, MsgStream& /*log*/)
21 {
22  transCont->reserve((persCont->m_bsErrs).size());
23  for (const std::pair<IdentifierHash, int>& bsErr: persCont->m_bsErrs) {
24  transCont->push_back(std::make_unique<std::pair<IdentifierHash, int>>(bsErr));
25  }
26 
27  }
28 
29 //================================================================
31  std::unique_ptr<InDetBSErrContainer> trans{std::make_unique<InDetBSErrContainer>()};
32  persToTrans(persObj, trans.get(), log);
33  return trans.release();
34 }
DataVector::reserve
void reserve(size_type n)
Attempt to preallocate enough memory for a specified number of elements.
make_unique
std::unique_ptr< T > make_unique(Args &&... args)
Definition: SkimmingToolEXOT5.cxx:23
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
DataVector< std::pair< IdentifierHash, int > >
InDetBSErrContainer_p2
Definition: InDetBSErrContainer_p2.h:16
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
InDetBSErrContainerCnv_p2::persToTrans
virtual void persToTrans(const InDetBSErrContainer_p2 *persCont, InDetBSErrContainer *transCont, MsgStream &log)
Definition: InDetBSErrContainerCnv_p2.cxx:20
InDetBSErrContainerCnv_p2.h
InDetBSErrContainerCnv_p2::createTransient
virtual InDetBSErrContainer * createTransient(const InDetBSErrContainer_p2 *persObj, MsgStream &log)
Definition: InDetBSErrContainerCnv_p2.cxx:30
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
InDetBSErrContainer_p2::m_bsErrs
std::vector< std::pair< IdentifierHash, int > > m_bsErrs
Definition: InDetBSErrContainer_p2.h:23
InDetBSErrContainerCnv_p2::transToPers
virtual void transToPers(const InDetBSErrContainer *transCont, InDetBSErrContainer_p2 *persCont, MsgStream &log)
Definition: InDetBSErrContainerCnv_p2.cxx:7