ATLAS Offline Software
LArPedestalCompleteCnv.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 "LArPedestalCompleteCnv.h"
13 
14 static const LArPedestalSubsetCnv_p1 TPconverter1;
15 static const LArPedestalSubsetCnv_p2 TPconverter2;
16 
17 
20 {
21  MsgStream log(msgSvc(), "LArPedestalCompleteCnv" );
22  //log << MSG::DEBUG << "LArPedestalComplete write" << endmsg;
23  return TPconverter2.createPersistentConst( transObj, log );
24 }
25 
28 {
29  static const pool::Guid p2_guid("8BD3FE69-A3C4-418C-ACB9-E362CE524353");
30  static const pool::Guid p1_guid("E365F747-264B-4A0C-B80A-570DBE099881");
31  static const pool::Guid p0_guid("E17191DD-4C0A-4B1A-AE49-7D587C6BE3EE");
32 
33  if (compareClassGuid(p2_guid)) {
34  // using unique_ptr ensures deletion of the persistent object
35  std::unique_ptr< LArPedestalSubset_p2 > col_vect( poolReadObject< LArPedestalSubset_p2 >() );
36  MsgStream log(msgSvc(), "LArPedestalCompleteCnv" );
37  //log << MSG::INFO << "Reading LArPedestalSubset_p1" << endmsg;
38  return TPconverter2.createTransientConst( col_vect.get(), log );
39  }
40  else if( compareClassGuid(p1_guid) ) {
41  // using unique_ptr ensures deletion of the persistent object
42  std::unique_ptr< LArPedestalSubset_p1 > col_vect( poolReadObject< LArPedestalSubset_p1 >() );
43  MsgStream log(msgSvc(), "LArPedestalCompleteCnv" );
44  //log << MSG::INFO << "Reading LArPedestalSubset_p1" << endmsg;
45  return TPconverter1.createTransientConst( col_vect.get(), log );
46  }
47  else if( compareClassGuid(p0_guid) ) {
48  // subset from before TP separation
49 
50  MsgStream log(msgSvc(), "LArPedestalCompleteCnv" );
51  log << MSG::DEBUG << "Reading LArPedestalSubset (original)" << endmsg;
52 
53  std::unique_ptr< LArConditionsSubset<LArPedestalP> > subset ( poolReadObject< LArConditionsSubset<LArPedestalP> >() );
54  // Here we must convert from LArPedestalP to LArPedestalP1
55 
56  log << MSG::DEBUG << "subset ptr " << subset.get() << endmsg;
57 
58  return (createTransient(subset.get()));
59 
60  }
61  throw std::runtime_error("Unsupported persistent version of LArPedestalCompleteCnv");
62 }
63 
66 {
67 
68  MsgStream log(msgSvc(), "LArPedestalCompleteCnv" );
69  log << MSG::DEBUG << "LArPedestalCompleteCnv::createTransient orig " << orig << endmsg;
70 
72 
73  // Copy LArPedestalP subset to LArPedestalP1
74  LArPedestalCopy copier;
75  copier.copyOldtoNew(orig, result);
76 
77  return (result);
78 }
79 
80 
81 // Copy LArPedestalP subset to LArPedestalP1
82 void
85 {
86  newPedestal->assign (*oldPedestal,
87  [] (const LArPedestalP& from,
89  {
90  to.m_Pedestal = from.m_vPedestal.empty() ? 0 : from.m_vPedestal[0];
91  to.m_PedestalRMS = from.m_vPedestalRMS.empty() ? 0 : from.m_vPedestalRMS[0];
92  });
93 }
94 
95 
LArPedestalCopy
Definition: LArPedestalCompleteCnv.h:38
get_generator_info.result
result
Definition: get_generator_info.py:21
LArPedestalP1
Definition: LArPedestalP1.h:12
LArPedestalCopy::copyOldtoNew
void copyOldtoNew(const LArConditionsSubset< LArPedestalP > *oldPedestal, LArConditionsSubset< LArPedestalP1 > *newPedestal)
Definition: LArPedestalCompleteCnv.cxx:83
LArPedestalCompleteCnv::createTransient
virtual LArPedTransType * createTransient()
method to be implemented by the developer.
Definition: LArPedestalCompleteCnv.cxx:27
LArConditionsSubset< LArPedestalP1 >
Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Current Athena::TPCnvVers::Current LArConditionsSubset< LArPedestalP1 >
Definition: LArCondTPCnv.cxx:85
LArPedestalCompleteCnv.h
AthenaPool converter LArPedestalComplete.
LArPedestalSubsetCnv_p2
Definition: LArPedestalSubsetCnv_p2.h:19
LArPedestalP::m_vPedestalRMS
std::vector< float > m_vPedestalRMS
Definition: LArPedestalP.h:17
pool::Guid
::Guid Guid
Definition: T_AthenaPoolCustCnv.h:19
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
LArPedestalCompleteCnv::createPersistent
virtual LArPedPersType * createPersistent(LArPedTransType *transObj)
Definition: LArPedestalCompleteCnv.cxx:19
TPConverterConstBase::createPersistentConst
virtual PERS * createPersistentConst(const TRANS *transObj, MsgStream &log) const
LArPedestalSubsetCnv_p1
Definition: LArPedestalSubsetCnv_p1.h:20
T_AthenaPoolCoolMultChanCnv::poolReadObject
P * poolReadObject()
Read object of type P.
LArPedestalSubsetCnv_p1.h
LArPedestalP::m_vPedestal
std::vector< float > m_vPedestal
Definition: LArPedestalP.h:16
LArConditionsSubset
template class for use for I/O of conditions data
Definition: LArConditionsSubset.h:122
LArPedestalP
Definition: LArPedestalP.h:11
CxxUtils::to
CONT to(RANGE &&r)
Definition: ranges.h:32
LArPedestalSubset_p2
persistent class container of LArConditionsSubset for LArPedestal data.
Definition: LArPedestalSubset_p2.h:30
DEBUG
#define DEBUG
Definition: page_access.h:11
python.CaloCondTools.log
log
Definition: CaloCondTools.py: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