ATLAS Offline Software
LArOFCCompleteCnv.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 "LArOFCCompleteCnv.h"
13 
14 static const LArOFCSubsetCnv_p1 TPconverter;
15 
18 {
19  MsgStream log(msgSvc(), "LArOFCCompleteCnv" );
20  //log << MSG::DEBUG << "LArOFCComplete write" << endmsg;
21  LArOFCPersType* persObj = TPconverter.createPersistentConst( transObj, log );
22  //log << MSG::DEBUG << "Success" << endmsg;
23  return persObj;
24 }
25 
28  static const pool::Guid p1_guid("0A1DE2E2-90E4-4A24-BC6E-2092EDC9FDF6");
29  static const pool::Guid p0_guid("3E5389EF-D163-4099-91D9-D3F0EE06C1CD");
30 
31  if( compareClassGuid(p1_guid) ) {
32  // using unique_ptr ensures deletion of the persistent object
33  std::unique_ptr< LArOFCSubset_p1 > col_vect( poolReadObject< LArOFCSubset_p1 >() );
34  MsgStream log(msgSvc(), "LArOFCCompleteCnv" );
35  //log << MSG::INFO << "Reading LArOFCSubset_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(), "LArOFCCompleteCnv" );
42  log << MSG::DEBUG << "Reading LArOFCSubset (original)" << endmsg;
43 
44  std::unique_ptr< LArConditionsSubset<LArOFCP> > subset ( poolReadObject< LArConditionsSubset<LArOFCP> >() );
45  // Here we must convert from LArOFCP to LArOFCP1
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 LArOFCCompleteCnv");
53 }
54 
57 {
58 
59  MsgStream log(msgSvc(), "LArOFCCompleteCnv" );
60  log << MSG::DEBUG << "LArOFCCompleteCnv::createTransient orig " << orig << endmsg;
61 
63 
64  // Copy LArOFCP subset to LArOFCP1
65  LArOFCCopy copier;
66  copier.copyOldtoNew(orig, result);
67 
68  return (result);
69 }
70 
71 // Copy LArOFCP subset to LArOFCP1
72 void
75 {
76  newOFC->assign (*oldOFC,
77  [] (const LArOFCP& from,
78  LArOFCP1& to)
79  {
80  to = LArOFCP1 (from.m_timeOffset,
81  25./24,
82  from.m_vOFC_a,
83  from.m_vOFC_b);
84  });
85 }
LArOFCP1
c-struct reproducing the structure of the persistent data
Definition: LArOFCP1.h:22
get_generator_info.result
result
Definition: get_generator_info.py:21
LArOFCCompleteCnv::createPersistent
virtual LArOFCPersType * createPersistent(LArOFCTransType *transObj)
Definition: LArOFCCompleteCnv.cxx:17
LArConditionsSubset< LArOFCP1 >
Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Current LArConditionsSubset< LArOFCP1 >
Definition: LArCondTPCnv.cxx:75
LArOFCCompleteCnv.h
AthenaPool converter LArOfcComplete.
LArOFCP::m_vOFC_a
std::vector< std::vector< float > > m_vOFC_a
Definition: LArOFCP.h:22
LArOFCP::m_vOFC_b
std::vector< std::vector< float > > m_vOFC_b
Definition: LArOFCP.h:23
pool::Guid
::Guid Guid
Definition: T_AthenaPoolCustCnv.h:19
LArOFCP::m_timeOffset
float m_timeOffset
Definition: LArOFCP.h:20
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
LArOFCCompleteCnv::createTransient
virtual LArOFCTransType * createTransient()
method to be implemented by the developer.
Definition: LArOFCCompleteCnv.cxx:27
TPConverterConstBase::createPersistentConst
virtual PERS * createPersistentConst(const TRANS *transObj, MsgStream &log) const
T_AthenaPoolCoolMultChanCnv::poolReadObject
P * poolReadObject()
Read object of type P.
LArOFCSubset_p1
persistent class container of LArConditionsSubset for LArOFC data.
Definition: LArOFCSubset_p1.h:30
LArConditionsSubset
template class for use for I/O of conditions data
Definition: LArConditionsSubset.h:122
CxxUtils::to
CONT to(RANGE &&r)
Definition: ranges.h:39
LArOFCSubsetCnv_p1.h
LArOFCCopy
Definition: LArOFCCompleteCnv.h:37
DEBUG
#define DEBUG
Definition: page_access.h:11
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
LArOFCP
c-struct reproducing the structure of the persistent data
Definition: LArOFCP.h:15
LArOFCCopy::copyOldtoNew
void copyOldtoNew(const LArConditionsSubset< LArOFCP > *oldOFC, LArConditionsSubset< LArOFCP1 > *newOFC)
Definition: LArOFCCompleteCnv.cxx:73
LArOFCSubsetCnv_p1
Definition: LArOFCSubsetCnv_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