ATLAS Offline Software
Loading...
Searching...
No Matches
MissingEtTruthCnv_p3.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
5/********************************************************************
6NAME: MissingEtTruthCnv_p3.cxx
7PACKAGE: offline/Reconstruction/RecTPCnv
8PURPOSE: Transient/Persisten converter for MissingEtTruth class
9********************************************************************/
10
11// AthenaPoolCnvSvc includes
13
14// MissingETEvent includes
17
18// RecTPCnv includes
21
22// MissingET converter
24
25
26void MissingEtTruthCnv_p3::persToTrans( const MissingEtTruth_p3* pers, MissingEtTruth* trans, MsgStream& /* msg */) const {
27 // std::cout << "Loading MissingEtTruth from persistent state..."<< std::endl;
28
29 std::vector<float>::const_iterator i = pers->m_allTheData.begin();
30
31 //float version;
32 //version = (*i);
33 ++i; // as there is just one it is not used.
34
35 int size= static_cast<int>(*i); ++i;
36 for (int vi=0;vi<size;++vi){
37 auto ti = static_cast<MissingEtTruth::TruthIndex>(vi);
38 trans->setExTruth(ti, *i); ++i;
39 trans->setEyTruth(ti, *i); ++i;
40 trans->setEtSumTruth(ti, *i); ++i;
41 }
42
43 if ( i != pers->m_allTheData.end()) {
44 metCnv.persToTrans(trans, i);
45 }
46
47 // for (unsigned int vi=0;vi<trans->m_exTruth.size();++vi)
48 // std::cout<<"IN EtTruth ex: "<<trans->m_exTruth[vi]<<"\tey: "<<trans->m_eyTruth[vi]<<"\tet: "<<trans->m_etSumTruth[vi]<<std::endl;
49
50 return;
51}
52
53
54
55void MissingEtTruthCnv_p3::transToPers( const MissingEtTruth* trans, MissingEtTruth_p3* pers, MsgStream& /*msg*/ ) const {
56
57 // std::cout << "Creating persistent state of MissingEtTruth..."<< std::endl;
58
59 pers->m_allTheData.push_back(3.0); // storing version number
60
61 pers->m_allTheData.reserve(MissingEtTruth::Size * 3 + 1);
62
63 pers->m_allTheData.push_back(MissingEtTruth::Size);
64 for (int vi=0;vi<MissingEtTruth::Size;++vi){
65 auto ti = static_cast<MissingEtTruth::TruthIndex>(vi);
66 pers->m_allTheData.push_back(trans->exTruth(ti));
67 pers->m_allTheData.push_back(trans->eyTruth(ti));
68 pers->m_allTheData.push_back(trans->etSumTruth(ti));
69 }
70
71 if( trans->getSource() >= 0 && trans->getSource() < 1000 ){
72 metCnv.transToPers(trans, pers->m_allTheData);
73 }
74
75 // for (unsigned int vi=0;vi<trans->m_exTruth.size();++vi)
76 // std::cout<<"OUT EtTruth ex: "<<trans->m_exTruth[vi]<<"\tey: "<<trans->m_eyTruth[vi]<<"\tet: "<<trans->m_etSumTruth[vi]<<std::endl;
77
78 return;
79}
static const MissingETCnv_p1 metCnv
virtual Source getSource() const
virtual void transToPers(const MissingEtTruth *transObj, MissingEtTruth_p3 *persObj, MsgStream &msg) const override
virtual void persToTrans(const MissingEtTruth_p3 *persObj, MissingEtTruth *transObj, MsgStream &msg) const override
std::vector< float > m_allTheData
double exTruth(TruthIndex aTruth) const
void setEyTruth(TruthIndex aTruth, double theEy)
double etSumTruth(TruthIndex aTruth) const
void setEtSumTruth(TruthIndex aTruth, double theEtSum)
double eyTruth(TruthIndex aTruth) const
void setExTruth(TruthIndex aTruth, double theEx)