ATLAS Offline Software
LArPhysWaveContainerCnv.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
14 
15 static const LArPhysWaveSubsetCnv_p1 TPconverter1;
16 
19 {
20  MsgStream log(msgSvc(), "LArPhysWaveContainerCnv" );
21  log << MSG::DEBUG << "WRITING LArPhysWaveContainer" << endmsg;
22  LArPhysWavePersType* persObj = TPconverter1.createPersistentConst( transObj, log );
23  log << MSG::DEBUG << "WRITING LArPhysWaveContainer Success !" << endmsg;
24  return persObj;
25 }
26 
29 {
30  MsgStream log(msgSvc(), "LArPhysWaveContainerCnv" );
31  log<<MSG::DEBUG<<"READING PHYS WAVE"<<endmsg;
32  static const pool::Guid p1_guid("87E436E2-6FF4-42D3-BC70-6650C076E589");
33  static const pool::Guid p0_guid("C1108D27-6D30-41E8-892D-2AB127B868C9");
34  if( compareClassGuid(p1_guid) ) {
35  // using unique_ptr ensures deletion of the persistent object
36  std::unique_ptr< LArPhysWaveSubset_p1 > col_vect( poolReadObject< LArPhysWaveSubset_p1 >() );
37  log << MSG::DEBUG << "READING LArPhysWaveSubset_p1" << endmsg;
38  LArPhysWaveTransType* transObj = TPconverter1.createTransientConst( col_vect.get(), log );
39  log << MSG::DEBUG << "READING LArPhysWaveSubset_p1 Success !" << endmsg;
40  return transObj;
41  }
42  else if(compareClassGuid(p0_guid)){
43  MsgStream log(msgSvc(), "LArPhysWaveContainerCnv" );
44  log << MSG::DEBUG << " READING LArPhysWaveSubset (before TP split)" << endmsg;
45 
46  std::unique_ptr< LArConditionsSubset<LArPhysWave> > subset ( poolReadObject< LArConditionsSubset<LArPhysWave> >() );
47 
48  return (createTransient(subset.get()));
49  }
50  throw std::runtime_error("Unsupported persistent version of LArPhysWaveCnv");
51 }
52 
53 
54 
55 
58 {
59 
60  MsgStream log(msgSvc(), "LArPedestalCompleteCnv" );
61  log << MSG::DEBUG << "LArPhysWaveContainerCnv::createTransient orig " << endmsg;
62 
64 
65  // Copy from orig to result
66 
67  result->assign (*orig,
68  [] (const LArPhysWave& from,
69  LArPhysWave& to)
70  { to = from; });
71 #if 0
72  result->m_gain = orig->m_gain;
73  result->m_channel = orig->m_channel;
74  result->m_groupingType = orig->m_groupingType;
75 
76 
77  for (unsigned int w=0;w<orig->m_subset.size();++w){ // copy of subset
78  std::vector<LArPhysWave> ochvec;
79  for (unsigned int q=0;q<orig->m_subset[w].second.size();++q){
80  ochvec.push_back(orig->m_subset[w].second[q]);
81  }
82  unsigned int ofebid=orig->m_subset[w].first;
83  std::pair<unsigned int, std::vector<LArPhysWave> > opair(ofebid,ochvec);
84  result->m_subset.push_back(opair);
85  }
86 
87 
88  for(unsigned int w=0;w<orig->m_correctionVec.size();++w){ // copy of correctionVec
89  LArPhysWave ovec=orig->m_correctionVec[w].second;
90  unsigned int ofebid=orig->m_correctionVec[w].first;
91  std::pair<unsigned int, LArPhysWave> opair(ofebid, ovec);
92  result->m_correctionVec.push_back(opair);
93  }
94 
95  result->m_subsetMap.swap(orig->m_subsetMap); // copy of subsetMap (what's this?)
96 #endif
97 
98  log << MSG::DEBUG <<"No T/P split copy ok."<<endmsg;
99 
100  return (result);
101 }
LArPhysWaveSubset_p1
persistent class container of LArPhysWave data.
Definition: LArPhysWaveSubset_p1.h:28
get_generator_info.result
result
Definition: get_generator_info.py:21
LArConditionsSubset::m_gain
unsigned int m_gain
Definition: LArConditionsSubset.h:259
LArConditionsSubset::m_channel
unsigned int m_channel
Definition: LArConditionsSubset.h:260
LArConditionsSubset::m_subset
SubsetVector m_subset
Definition: LArConditionsSubset.h:258
LArConditionsSubset::m_correctionVec
CorrectionVec m_correctionVec
Definition: LArConditionsSubset.h:262
LArPhysWave
Definition: LArPhysWave.h:14
LArPhysWaveContainerCnv.h
AthenaPool converter LArPhysWaveContainer.
pool::Guid
::Guid Guid
Definition: T_AthenaPoolCustCnv.h:19
LArPhysWaveContainerCnv::createPersistent
LArPhysWavePersType * createPersistent(LArPhysWaveTransType *transObj)
Definition: LArPhysWaveContainerCnv.cxx:18
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
TPConverterConstBase::createPersistentConst
virtual PERS * createPersistentConst(const TRANS *transObj, MsgStream &log) const
T_AthenaPoolCoolMultChanCnv::poolReadObject
P * poolReadObject()
Read object of type P.
LArConditionsSubset::m_subsetMap
SubsetMap m_subsetMap
Definition: LArConditionsSubset.h:257
LArConditionsSubset
template class for use for I/O of conditions data
Definition: LArConditionsSubset.h:122
LArConditionsSubset.h
This file defines the template class used for I/O of conditions data.
LArPhysWaveSubsetCnv_p1
Definition: LArPhysWaveSubsetCnv_p1.h:20
LArConditionsSubset::m_groupingType
unsigned int m_groupingType
Definition: LArConditionsSubset.h:261
CxxUtils::to
CONT to(RANGE &&r)
Definition: ranges.h:39
LArPhysWaveSubsetCnv_p1.h
DEBUG
#define DEBUG
Definition: page_access.h:11
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
extractSporadic.q
list q
Definition: extractSporadic.py:98
LArPhysWaveContainerCnv::createTransient
LArPhysWaveTransType * createTransient()
method to be implemented by the developer.
Definition: LArPhysWaveContainerCnv.cxx:28
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.
python.IoTestsLib.w
def w
Definition: IoTestsLib.py:200
TPConverterConstBase::createTransientConst
virtual TRANS * createTransientConst(const PERS *persObj, MsgStream &log) const