ATLAS Offline Software
LArRampMCCnv.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 "LArRampMCCnv.h"
13 #include "LArRampCompleteCnv.h"
14 
15 static const LArRampSubsetCnv_p1 TPconverter;
16 
19 {
20  MsgStream log(msgSvc(), "LArRampMCCnv" );
21  //log << MSG::DEBUG << "LArRampMC write" << endmsg;
22  LArRampPersType* persObj = TPconverter.createPersistentConst( transObj, log );
23  //log << MSG::DEBUG << "Success" << endmsg;
24  return persObj;
25 }
26 
29 {
30  static const pool::Guid p1_guid("BB629283-BDF5-4FA8-93F4-5D8C2F201364");
31  static const pool::Guid p0_guid("4019776D-D528-4401-9CBD-7956C4B00607");
32  if( compareClassGuid(p1_guid) ) {
33  // using unique_ptr ensures deletion of the persistent object
34  std::unique_ptr< LArRampSubset_p1 > col_vect( poolReadObject< LArRampSubset_p1 >() );
35  MsgStream log(msgSvc(), "LArRampMCCnv" );
36  //log << MSG::INFO << "Reading LArRampSubset_p1" << endmsg;
37  return TPconverter.createTransientConst( col_vect.get(), log );
38  }
39  else if( compareClassGuid(p0_guid) ) {
40  // subset from before TP separation
41 
42  MsgStream log(msgSvc(), "LArRampMCCnv" );
43  log << MSG::INFO << "Reading LArRampSubset (original)" << endmsg;
44 
45  std::unique_ptr< LArConditionsSubset<LArRampP> > subset ( poolReadObject< LArConditionsSubset<LArRampP> >() );
46  // Here we must convert from LArRampP to LArRampP1
47 
48  log << MSG::INFO << "subset ptr " << subset.get() << endmsg;
49 
50  return (createTransient(subset.get()));
51 
52  }
53  throw std::runtime_error("Unsupported persistent version of LArRampMCCnv");
54 }
55 
58 {
59 
60  MsgStream log(msgSvc(), "LArRampMCCnv" );
61  log << MSG::INFO << "LArRampMCCnv::createTransient orig " << orig << endmsg;
62 
64 
65  // Copy LArRampP subset to LArRampP1
66  LArRampCopy copier;
67  copier.copyOldtoNew(orig, result);
68 
69  return (result);
70 }
71 
LArRampMCCnv::createTransient
virtual LArRampTransType * createTransient()
method to be implemented by the developer.
Definition: LArRampMCCnv.cxx:28
LArRampMCCnv::createPersistent
virtual LArRampPersType * createPersistent(LArRampTransType *transObj)
Definition: LArRampMCCnv.cxx:18
get_generator_info.result
result
Definition: get_generator_info.py:21
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
LArRampSubsetCnv_p1.h
LArRampSubset_p1
persistent class container of LArConditionsSubset for LArRamp data.
Definition: LArRampSubset_p1.h:30
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.
LArRampMCCnv.h
AthenaPool converter LArRampMC.
TPConverterConstBase::createTransientConst
virtual TRANS * createTransientConst(const PERS *persObj, MsgStream &log) const