ATLAS Offline Software
Loading...
Searching...
No Matches
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/********************************************************************
6NAME: MissingEtCaloCnv_p3.cxx
7PURPOSE: Transient/Persisten converter for MissingEtCalo class
8********************************************************************/
9
10// AthenaPoolCnvSvc includes
12
13// MissingETEvent includes
16
17// RecTPCnv includes
20
21// MissingET converter
23
24
25void 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
55void 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}
static const MissingETCnv_p1 metCnv
virtual Source getSource() const
virtual void persToTrans(const MissingEtCalo_p3 *persObj, MissingEtCalo *transObj, MsgStream &msg) const override
virtual void transToPers(const MissingEtCalo *transObj, MissingEtCalo_p3 *persObj, MsgStream &msg) const override
std::vector< float > m_allTheData
void setEtSumCalo(CaloIndex aCalo, double theEtSum)
double etSumCalo(CaloIndex aCalo) const
double exCalo(CaloIndex aCalo) const
void setExCalo(CaloIndex aCalo, double theEx)
void setNCellCalo(CaloIndex aCalo, unsigned int theNCell)
unsigned int ncellCalo(CaloIndex aCalo) const
void setEyCalo(CaloIndex aCalo, double theEy)
double eyCalo(CaloIndex aCalo) const