ATLAS Offline Software
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 /********************************************************************
6 NAME: MissingEtTruthCnv_p3.cxx
7 PACKAGE: offline/Reconstruction/RecTPCnv
8 PURPOSE: Transient/Persisten converter for MissingEtTruth class
9 ********************************************************************/
10 
11 // AthenaPoolCnvSvc includes
13 
14 // MissingETEvent includes
17 
18 // RecTPCnv includes
21 
22 // MissingET converter
23 static const MissingETCnv_p3 metCnv;
24 
25 
26 void 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 
55 void 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 }
MissingEtTruth
Definition: MissingEtTruth.h:28
MissingEtTruth_p3
Definition: MissingEtTruth_p3.h:19
MissingET.h
MissingEtTruth::setEyTruth
void setEyTruth(TruthIndex aTruth, double theEy)
Definition: MissingEtTruth.cxx:109
MissingEtTruth::exTruth
double exTruth(TruthIndex aTruth) const
Definition: MissingEtTruth.cxx:147
MissingEtTruthCnv_p3::transToPers
virtual void transToPers(const MissingEtTruth *transObj, MissingEtTruth_p3 *persObj, MsgStream &msg) const override
Definition: MissingEtTruthCnv_p3.cxx:55
MissingEtTruth::TruthIndex
TruthIndex
Definition: MissingEtTruth.h:41
MissingEtTruth_p3::m_allTheData
std::vector< float > m_allTheData
Definition: MissingEtTruth_p3.h:33
MissingEtTruthCnv_p3::persToTrans
virtual void persToTrans(const MissingEtTruth_p3 *persObj, MissingEtTruth *transObj, MsgStream &msg) const override
Definition: MissingEtTruthCnv_p3.cxx:26
MissingET::getSource
virtual Source getSource() const
Definition: MissingET.cxx:171
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
lumiFormat.i
int i
Definition: lumiFormat.py:85
MissingETCnv_p3.h
T_AthenaPoolTPConverter.h
MissingEtTruth::Size
@ Size
Definition: MissingEtTruth.h:59
MissingEtTruth::eyTruth
double eyTruth(TruthIndex aTruth) const
Definition: MissingEtTruth.cxx:152
MissingETCnv_p3::persToTrans
virtual void persToTrans(const MissingET_p3 *persObj, MissingET *transObj, MsgStream &msg) const override
Definition: MissingETCnv_p3.cxx:32
MissingEtTruth.h
MissingETCnv_p3::transToPers
virtual void transToPers(const MissingET *transObj, MissingET_p3 *persObj, MsgStream &msg) const override
Definition: MissingETCnv_p3.cxx:38
MissingEtTruth::setEtSumTruth
void setEtSumTruth(TruthIndex aTruth, double theEtSum)
Definition: MissingEtTruth.cxx:116
MissingEtTruthCnv_p3.h
MissingEtTruth::etSumTruth
double etSumTruth(TruthIndex aTruth) const
Definition: MissingEtTruth.cxx:157
MissingEtTruth::setExTruth
void setExTruth(TruthIndex aTruth, double theEx)
Definition: MissingEtTruth.cxx:102
MissingETCnv_p3
Definition: MissingETCnv_p3.h:22