ATLAS Offline Software
LArRampCompleteCnv.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
11 #include "LArRampCompleteCnv.h"
13 
14 static const LArRampSubsetCnv_p1 TPconverter;
15 
18 {
19  MsgStream log(msgSvc(), "LArRampCompleteCnv" );
20  //log << MSG::DEBUG << "LArRampComplete write" << endmsg;
21  LArRampPersType* persObj = TPconverter.createPersistentConst( transObj, log );
22  //log << MSG::DEBUG << "Success" << endmsg;
23  return persObj;
24 }
25 
28 {
29  static const pool::Guid p1_guid("BB629283-BDF5-4FA8-93F4-5D8C2F201364");
30  static const pool::Guid p0_guid("4019776D-D528-4401-9CBD-7956C4B00607");
31  if( compareClassGuid(p1_guid) ) {
32  // using unique_ptr ensures deletion of the persistent object
33  std::unique_ptr< LArRampSubset_p1 > col_vect( poolReadObject< LArRampSubset_p1 >() );
34  MsgStream log(msgSvc(), "LArRampCompleteCnv" );
35  //log << MSG::INFO << "Reading LArRampSubset_p1" << endmsg;
36  return TPconverter.createTransientConst( col_vect.get(), log );
37  }
38  else if( compareClassGuid(p0_guid) ) {
39  // subset from before TP separation
40 
41  MsgStream log(msgSvc(), "LArRampCompleteCnv" );
42  log << MSG::DEBUG << "Reading LArRampSubset (original)" << endmsg;
43 
44  std::unique_ptr< LArConditionsSubset<LArRampP> > subset ( poolReadObject< LArConditionsSubset<LArRampP> >() );
45  // Here we must convert from LArRampP to LArRampP1
46 
47  log << MSG::DEBUG << "subset ptr " << subset.get() << endmsg;
48 
49  return (createTransient(subset.get()));
50 
51  }
52  throw std::runtime_error("Unsupported persistent version of LArRampCompleteCnv");
53 }
54 
57 {
58 
59  MsgStream log(msgSvc(), "LArRampCompleteCnv" );
60  log << MSG::DEBUG << "LArRampCompleteCnv::createTransient orig " << orig << endmsg;
61 
63 
64  // Copy LArRampP subset to LArRampP1
65  LArRampCopy copier;
66  copier.copyOldtoNew(orig, result);
67 
68  return (result);
69 }
70 
71 // Copy LArRampP subset to LArRampP1
72 void
75 {
76  newRamp->assign (*oldRamp,
77  [] (const LArRampP& from,
78  LArRampP1& to)
79  {
80  to.m_vRamp = from.m_vRamp;
81  });
82 }
83 
LArRampCompleteCnv::createPersistent
virtual LArRampPersType * createPersistent(LArRampTransType *transObj)
Definition: LArRampCompleteCnv.cxx:17
get_generator_info.result
result
Definition: get_generator_info.py:21
LArRampP1
Persistent data for LArRamp Copied from LAr.
Definition: LArRampP1.h:24
LArRampCopy
Definition: LArRampCompleteCnv.h:37
pool::Guid
::Guid Guid
Definition: T_AthenaPoolCustCnv.h:19
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
LArRampCopy::copyOldtoNew
void copyOldtoNew(const LArConditionsSubset< LArRampP > *oldRamp, LArConditionsSubset< LArRampP1 > *newRamp)
Definition: LArRampCompleteCnv.cxx:73
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
TPConverterConstBase::createPersistentConst
virtual PERS * createPersistentConst(const TRANS *transObj, MsgStream &log) const
LArRampCompleteCnv.h
AthenaPool converter LArRampComplete.
LArConditionsSubset< LArRampP1 >
Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Current Athena::TPCnvVers::Current Athena::TPCnvVers::Current LArConditionsSubset< LArRampP1 >
Definition: LArCondTPCnv.cxx:95
T_AthenaPoolCoolMultChanCnv::poolReadObject
P * poolReadObject()
Read object of type P.
LArConditionsSubset
template class for use for I/O of conditions data
Definition: LArConditionsSubset.h:122
LArRampP
Persistent data for LArRamp Copied from LAr.
Definition: LArRampP.h:24
LArRampSubsetCnv_p1.h
LArRampP::m_vRamp
std::vector< float > m_vRamp
Definition: LArRampP.h:29
CxxUtils::to
CONT to(RANGE &&r)
Definition: ranges.h:39
LArRampCompleteCnv::createTransient
virtual LArRampTransType * createTransient()
method to be implemented by the developer.
Definition: LArRampCompleteCnv.cxx:27
LArRampSubset_p1
persistent class container of LArConditionsSubset for LArRamp data.
Definition: LArRampSubset_p1.h:30
DEBUG
#define DEBUG
Definition: page_access.h:11
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
LArRampSubsetCnv_p1
Definition: LArRampSubsetCnv_p1.h:20
T_AthenaPoolCustCnv< COLL_T, ELEM_T >::compareClassGuid
virtual bool compareClassGuid(const Guid &clid) const
Compare POOL class GUID with the one of the object being read.
LArConditionsSubset::assign
void assign(const LArConditionsSubset< U > &other, COPIER copier)
Copy from another subset object.
Definition: LArConditionsSubset.h:339
TPConverterConstBase::createTransientConst
virtual TRANS * createTransientConst(const PERS *persObj, MsgStream &log) const