ATLAS Offline Software
TRT_RDO_ContainerCnv_p0.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // Andrei Gaponenko <agaponenko@lbl.gov>, 2006
6 
8 
10 #include "InDetIdentifier/TRT_ID.h"
11 #include "MsgUtil.h"
12 
13 #include <string>
14 #include <iostream>
15 #include <sstream>
16 
17 
18 //================================================================
20  std::unique_ptr<TRT_RDO_Container> trans(std::make_unique<TRT_RDO_Container>(m_trtId->straw_layer_hash_max()));
21 
22  MSG_DEBUG(log,"Read RDO vector, size " << persObj->size());
23 
25  TRT_RDO_Container_p0::const_iterator last = persObj->end();
26  for (; it != last; ++it) {
27 
28  // Old persistent format used collection templated on the specific raw data type
29  const InDetRawDataCollection<TRT_LoLumRawData>* rdoCollOld = *it;
30 
31  if(!rdoCollOld) {
32  throw std::runtime_error("Got NULL collection reading old format TRT_RDO_Container");
33  }
34 
35  // Ugly cast... The new format does not need it in its converters.
36  const InDetRawDataCollection<TRT_RDORawData>* rdoColl = reinterpret_cast<const InDetRawDataCollection<TRT_RDORawData> *>(rdoCollOld);
37 
38  // Add to the container
39  if (trans->addCollection( rdoColl, rdoColl->identifyHash() ).isFailure()) {
40  log << MSG::FATAL << "[p0] TRT RDOs could not be added to the container!" << endmsg;
41  throw std::runtime_error("TRT_RDO_ContainerCnv_p0::createTransient(): TRT RDOs could not be added to the container!");
42  }
43  }
44 
45  return(trans.release());
46 }
47 
48 //================================================================
49 
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
TRT_RDO_Container.h
python.Constants.FATAL
int FATAL
Definition: Control/AthenaCommon/python/Constants.py:19
IdentifiableContainerMT::addCollection
virtual StatusCode addCollection(const T *coll, IdentifierHash hashId) override final
insert collection into container with id hash if IDC should not take ownership of collection,...
Definition: IdentifiableContainerMT.h:300
TRT_ID::straw_layer_hash_max
size_type straw_layer_hash_max(void) const
Definition: TRT_ID.h:920
TRT_RDO_ContainerCnv_p0::m_trtId
const TRT_ID * m_trtId
Definition: TRT_RDO_ContainerCnv_p0.h:20
skel.it
it
Definition: skel.GENtoEVGEN.py:423
TRT_ID.h
This is an Identifier helper class for the TRT subdetector. This class is a factory for creating comp...
InDetRawDataContainer
Definition: InDetRawDataContainer.h:27
InDetRawDataCollection::identifyHash
virtual IdentifierHash identifyHash() const override final
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
InDetRawDataCollection
Definition: InDetRawDataCollection.h:31
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
TRT_RDO_ContainerCnv_p0.h
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
MSG_DEBUG
#define MSG_DEBUG(log, x)
Definition: MsgUtil.h:15
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
TRT_RDO_ContainerCnv_p0::createTransient
virtual TRT_RDO_Container * createTransient(const TRT_RDO_Container_p0 *persObj, MsgStream &log)
Definition: TRT_RDO_ContainerCnv_p0.cxx:19
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
MsgUtil.h