ATLAS Offline Software
MissingEtTruthCnv_p2.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 
7 NAME: MissingEtTruthCnv_p2.cxx
8 PACKAGE: offline/Reconstruction/RecTPCnv
9 
10 AUTHORS: I. Vukotic
11 CREATED: May 2009
12 
13 PURPOSE: Transient/Persisten converter for MissingEtTruth class
14 ********************************************************************/
15 
16 // AthenaPoolCnvSvc includes
18 
19 // MissingETEvent includes
22 
23 // RecTPCnv includes
26 
27 // MissingET converter
28 static const MissingETCnv_p2 metCnv;
29 
31 // methods:
33 
34 void MissingEtTruthCnv_p2::persToTrans( const MissingEtTruth_p2* pers, MissingEtTruth* trans, MsgStream& /* msg */) const {
35  // std::cout << "Loading MissingEtTruth from persistent state..."<< std::endl;
36  std::vector<float>::const_iterator i = pers->m_allTheData.begin();
37  auto TI0 = static_cast<MissingEtTruth::TruthIndex>(0);
38  auto TI1 = static_cast<MissingEtTruth::TruthIndex>(1);
39  auto TI2 = static_cast<MissingEtTruth::TruthIndex>(2);
40  trans->setExTruth(TI0, *i); ++i;
41  trans->setExTruth(TI1, *i); ++i;
42  trans->setExTruth(TI2, *i); ++i;
43  trans->setEyTruth(TI0, *i); ++i;
44  trans->setEyTruth(TI1, *i); ++i;
45  trans->setEyTruth(TI2, *i); ++i;
46  trans->setEtSumTruth(TI0, *i); ++i;
47  trans->setEtSumTruth(TI1, *i); ++i;
48  trans->setEtSumTruth(TI2, *i); ++i;
49 
50  if (pers->m_allTheData.size()>9) {
51  metCnv.persToTrans(trans, i);
52  // std::cout<<"==> "<<trans->m_ex<<"\t"<<trans->m_ey<<"\t"<<trans->m_etSum<<"\t";
53  // if (trans->m_regions)
54  // std::cout<<"has regions"<<trans->m_regions->m_exReg[0]<<std::endl;
55  // else
56  // std::cout<<"no regions"<<std::endl;
57  }
58  // std::cout<<trans->m_exTruth[0]<<"\t"<<trans->m_exTruth[1]<<"\t"<<trans->m_exTruth[2]<<std::endl;
59  // std::cout<<trans->m_etSumTruth[0]<<"\t"<<trans->m_etSumTruth[1]<<"\t"<<trans->m_etSumTruth[2]<<std::endl;
60  // std::cout<<pers->m_allTheData.size()<<std::endl;
61  return;
62 }
63 
64 void MissingEtTruthCnv_p2::transToPers( const MissingEtTruth* trans, MissingEtTruth_p2* pers, MsgStream& /*msg*/ ) const {
65 
66  // std::cout << "Creating persistent state of MissingEtTruth..."<< std::endl;
67 
68  pers->m_allTheData.reserve(9);
69  pers->m_allTheData.push_back(trans->exTruth(static_cast<MissingEtTruth::TruthIndex>(0)));
70  pers->m_allTheData.push_back(trans->exTruth(static_cast<MissingEtTruth::TruthIndex>(1)));
71  pers->m_allTheData.push_back(trans->exTruth(static_cast<MissingEtTruth::TruthIndex>(2)));
72  pers->m_allTheData.push_back(trans->eyTruth(static_cast<MissingEtTruth::TruthIndex>(0)));
73  pers->m_allTheData.push_back(trans->eyTruth(static_cast<MissingEtTruth::TruthIndex>(1)));
74  pers->m_allTheData.push_back(trans->eyTruth(static_cast<MissingEtTruth::TruthIndex>(2)));
75  pers->m_allTheData.push_back(trans->etSumTruth(static_cast<MissingEtTruth::TruthIndex>(0)));
76  pers->m_allTheData.push_back(trans->etSumTruth(static_cast<MissingEtTruth::TruthIndex>(1)));
77  pers->m_allTheData.push_back(trans->etSumTruth(static_cast<MissingEtTruth::TruthIndex>(2)));
78  if( trans->getSource() >= 0 && trans->getSource() < 1000 ){
79  metCnv.transToPers(trans, pers->m_allTheData);
80  // std::cout<<"==> "<<trans->m_ex<<"\t"<<trans->m_ey<<"\t"<<trans->m_etSum<<"\t";
81  // if (trans->m_regions)
82  // std::cout<<"has regions"<<trans->m_regions->m_exReg[0]<<std::endl;
83  // else
84  // std::cout<<"no regions"<<std::endl;
85  }
86  // std::cout<<trans->m_exTruth[0]<<"\t"<<trans->m_exTruth[1]<<"\t"<<trans->m_exTruth[2]<<std::endl;
87  // std::cout<<trans->m_etSumTruth[0]<<"\t"<<trans->m_etSumTruth[1]<<"\t"<<trans->m_etSumTruth[2]<<std::endl;
88  // std::cout<<pers->m_allTheData.size()<<std::endl;
89  return;
90 }
MissingEtTruth
Definition: MissingEtTruth.h:28
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
MissingETCnv_p2
Definition: MissingETCnv_p2.h:24
MissingEtTruthCnv_p2::transToPers
virtual void transToPers(const MissingEtTruth *transObj, MissingEtTruth_p2 *persObj, MsgStream &msg) const override
Definition: MissingEtTruthCnv_p2.cxx:64
MissingEtTruth::TruthIndex
TruthIndex
Definition: MissingEtTruth.h:41
MissingET::getSource
virtual Source getSource() const
Definition: MissingET.cxx:171
MissingEtTruth_p2::m_allTheData
std::vector< float > m_allTheData
Definition: MissingEtTruth_p2.h:39
lumiFormat.i
int i
Definition: lumiFormat.py:85
T_AthenaPoolTPConverter.h
MissingETCnv_p2::transToPers
virtual void transToPers(const MissingET *transObj, MissingET_p2 *persObj, MsgStream &msg) const override
Definition: MissingETCnv_p2.cxx:38
MissingEtTruth::eyTruth
double eyTruth(TruthIndex aTruth) const
Definition: MissingEtTruth.cxx:152
MissingEtTruthCnv_p2::persToTrans
virtual void persToTrans(const MissingEtTruth_p2 *persObj, MissingEtTruth *transObj, MsgStream &msg) const override
Definition: MissingEtTruthCnv_p2.cxx:34
MissingEtTruth_p2
Definition: MissingEtTruth_p2.h:25
MissingEtTruth.h
MissingEtTruthCnv_p2.h
MissingETCnv_p2.h
MissingEtTruth::setEtSumTruth
void setEtSumTruth(TruthIndex aTruth, double theEtSum)
Definition: MissingEtTruth.cxx:116
MissingETCnv_p2::persToTrans
virtual void persToTrans(const MissingET_p2 *persObj, MissingET *transObj, MsgStream &msg) const override
Definition: MissingETCnv_p2.cxx:32
MissingEtTruth::etSumTruth
double etSumTruth(TruthIndex aTruth) const
Definition: MissingEtTruth.cxx:157
MissingEtTruth::setExTruth
void setExTruth(TruthIndex aTruth, double theEx)
Definition: MissingEtTruth.cxx:102