ATLAS Offline Software
MissingEtCaloCnv_p3.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 /********************************************************************
6 NAME: MissingEtCaloCnv_p3.cxx
7 PURPOSE: Transient/Persisten converter for MissingEtCalo class
8 ********************************************************************/
9 
10 // AthenaPoolCnvSvc includes
12 
13 // MissingETEvent includes
16 
17 // RecTPCnv includes
20 
21 // MissingET converter
22 static const MissingETCnv_p3 metCnv;
23 
24 
25 void MissingEtCaloCnv_p3::persToTrans( const MissingEtCalo_p3* pers, MissingEtCalo* trans, MsgStream& /* msg */ ) const {
26 
27 // std::cout << "Loading MissingEtCalo from persistent state..."<< std::endl;
28  std::vector<float>::const_iterator i=pers->m_allTheData.begin();
29 
30  union conv{ unsigned int i; float f; } c;
31 
32  //float version;
33  //version = (*i);
34  ++i; // as there is just one it is not used.
35 
36  int size= static_cast<int>(*i); ++i;
37  for (int vi=0;vi<size;++vi){
38  auto ci = static_cast<MissingEtCalo::CaloIndex>(vi);
39  trans->setExCalo(ci, *i); ++i;
40  trans->setEyCalo(ci, *i); ++i;
41  trans->setEtSumCalo(ci, *i); ++i;
42  c.f=(*i); trans->setNCellCalo(ci, c.i); ++i;
43  }
44 
45  if ( i != pers->m_allTheData.end()) {
46  metCnv.persToTrans(trans, i);
47  }
48 
49 // for (unsigned int vi=0;vi<trans->m_exCalo.size();++vi)
50 // std::cout<<"IN EtCalo ex: "<<trans->m_exCalo[vi]<<"\tey: "<<trans->m_eyCalo[vi]<<"\tet: "<<trans->m_etSumCalo[vi]<<"\tnCells: "<<trans->m_nCellsCalo[vi]<<std::endl;
51 
52  return;
53 }
54 
55 void MissingEtCaloCnv_p3::transToPers( const MissingEtCalo* trans, MissingEtCalo_p3* pers, MsgStream& /* msg */ )const {
56 
57 // std::cout << "Creating persistent state of MissingEtCalo..."<< std::endl;
58 
59  union conv{ unsigned int i; float f; } c;
60 
61  pers->m_allTheData.push_back(3.0); // storing version number
62 
63  pers->m_allTheData.reserve(MissingEtCalo::Size * 4 + 1);
64 
65  pers->m_allTheData.push_back(MissingEtCalo::Size);
66 
67  for (int vi=0;vi<MissingEtCalo::Size;++vi){
68  auto ci = static_cast<MissingEtCalo::CaloIndex>(vi);
69  pers->m_allTheData.push_back(trans->exCalo(ci));
70  pers->m_allTheData.push_back(trans->eyCalo(ci));
71  pers->m_allTheData.push_back(trans->etSumCalo(ci));
72  c.i=trans->ncellCalo(ci); pers->m_allTheData.push_back(c.f);
73  }
74 
75  if( trans->getSource() >= 0 && trans->getSource() < 1000 )
76  metCnv.transToPers( trans, pers->m_allTheData );
77 
78 // for (unsigned int vi=0;vi<trans->m_exCalo.size();++vi)
79 // std::cout<<"OUT EtCalo ex: "<<trans->m_exCalo[vi]<<"\tey: "<<trans->m_eyCalo[vi]<<"\tet: "<<trans->m_etSumCalo[vi]<<"\tnCells: "<<trans->m_nCellsCalo[vi]<<std::endl;
80 
81  return;
82 }
MissingET.h
MissingEtCalo::CaloIndex
CaloIndex
Definition: MissingEtCalo.h:40
MissingEtCalo::setNCellCalo
void setNCellCalo(CaloIndex aCalo, unsigned int theNCell)
Definition: MissingEtCalo.cxx:174
MissingEtCalo::setEtSumCalo
void setEtSumCalo(CaloIndex aCalo, double theEtSum)
Definition: MissingEtCalo.cxx:166
MissingEtCalo
Definition: MissingEtCalo.h:27
MissingEtCalo::ncellCalo
unsigned int ncellCalo(CaloIndex aCalo) const
Definition: MissingEtCalo.cxx:233
MissingEtCaloCnv_p3::transToPers
virtual void transToPers(const MissingEtCalo *transObj, MissingEtCalo_p3 *persObj, MsgStream &msg) const override
Definition: MissingEtCaloCnv_p3.cxx:55
MissingET::getSource
virtual Source getSource() const
Definition: MissingET.cxx:171
MissingEtCalo::etSumCalo
double etSumCalo(CaloIndex aCalo) const
Definition: MissingEtCalo.cxx:228
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
lumiFormat.i
int i
Definition: lumiFormat.py:85
MissingEtCalo::exCalo
double exCalo(CaloIndex aCalo) const
Definition: MissingEtCalo.cxx:218
MissingETCnv_p3.h
T_AthenaPoolTPConverter.h
MissingEtCalo::setExCalo
void setExCalo(CaloIndex aCalo, double theEx)
Definition: MissingEtCalo.cxx:152
MissingEtCalo.h
hist_file_dump.f
f
Definition: hist_file_dump.py:135
MissingEtCalo::Size
@ Size
Definition: MissingEtCalo.h:57
MissingEtCalo_p3
Definition: MissingEtCalo_p3.h:19
MissingEtCalo_p3::m_allTheData
std::vector< float > m_allTheData
Definition: MissingEtCalo_p3.h:33
MissingETCnv_p3::persToTrans
virtual void persToTrans(const MissingET_p3 *persObj, MissingET *transObj, MsgStream &msg) const override
Definition: MissingETCnv_p3.cxx:32
MissingEtCalo::setEyCalo
void setEyCalo(CaloIndex aCalo, double theEy)
Definition: MissingEtCalo.cxx:159
MissingEtCaloCnv_p3::persToTrans
virtual void persToTrans(const MissingEtCalo_p3 *persObj, MissingEtCalo *transObj, MsgStream &msg) const override
Definition: MissingEtCaloCnv_p3.cxx:25
MissingETCnv_p3::transToPers
virtual void transToPers(const MissingET *transObj, MissingET_p3 *persObj, MsgStream &msg) const override
Definition: MissingETCnv_p3.cxx:38
MissingEtCalo::eyCalo
double eyCalo(CaloIndex aCalo) const
Definition: MissingEtCalo.cxx:223
MissingEtCaloCnv_p3.h
python.compressB64.c
def c
Definition: compressB64.py:93
MissingETCnv_p3
Definition: MissingETCnv_p3.h:22
pdg_comparison.conv
conv
Definition: pdg_comparison.py:321