ATLAS Offline Software
MissingETCnv_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 
7 NAME: MissingETCnv_p3.cxx
8 PACKAGE: offline/Reconstruction/RecTPCnv
9 
10 PURPOSE: Transient/Persisten converter for MissingET class
11 ********************************************************************/
12 
13 // AthenaPoolCnvSvc includes
15 
16 // MissingETEvent includes
19 
20 // RecTPCnv includes
23 
24 
25 // #include <stdlib.h> // not needed here?
26 
27 // region converter
28 static const MissingEtRegionsCnv_p3 regCnv;
29 
30 
31 
32 void MissingETCnv_p3::persToTrans( const MissingET_p3* pers, MissingET* trans, MsgStream& /* msg */ ) const {
33  std::vector<float>::const_iterator it=pers->m_AllTheData.begin();
34  persToTrans(trans, it);
35  return;
36 }
37 
38 void MissingETCnv_p3::transToPers( const MissingET* trans, MissingET_p3* pers, MsgStream& /* msg */ ) const {
39  transToPers(trans, pers->m_AllTheData);
40  return;
41 }
42 
43 
44 void MissingETCnv_p3::persToTrans( MissingET* trans, std::vector<float>::const_iterator i) const {
45 
46  //float version;
47  //version = (*i);
48  ++i; // as there is just one it is not used.
49 
50  union conv{ unsigned int i; float f; } c;
51  c.f=(*i); ++i;
52  MissingET::Source source = static_cast<MissingET::Source>(c.i>>1);
53  double ex = (*i);++i;
54  double ey = (*i);++i;
55  double etSum = (*i);++i;
56  std::unique_ptr<MissingEtRegions> regions;
57  if( c.i & 1) {
58  regions = std::make_unique<MissingEtRegions>();
59  regCnv.persToTrans( regions.get(), i);
60  }
61  *trans = MissingET (source,
62  std::move (regions),
63  ex, ey, etSum);
64 
65  // std::cout<<"IN source: "<<trans->m_source;
66  // std::cout<<"\tex: "<<trans->m_ex;
67  // std::cout<<"\tey: "<<trans->m_ey;
68  // std::cout<<"\tetSum: "<<trans->m_etSum;
69  // if (trans->m_regions != 0) std::cout<<"\thas Regions"<<std::endl; else std::cout<<"\tNO Regions"<<std::endl;
70 
71  return;
72 }
73 
74 void MissingETCnv_p3::transToPers( const MissingET* trans, std::vector<float> &all ) const {
75 
76  all.push_back(3.0); // storing version number
77 
78  // folding together m_source and if regions are present
79  unsigned int tmp=static_cast<unsigned int>(trans->getSource());
80  tmp <<= 1;
81  if( trans->getRegions() != 0) tmp|=1;
82 
83  union conv{ unsigned int i; float f; } c;
84  c.i=tmp;
85  all.push_back(c.f);
86 
87  // simple types
88  all.push_back(trans->etx());
89  all.push_back(trans->ety());
90  all.push_back(trans->sumet());
91 
92  // calling regions tTP
93  if( trans->getRegions() != 0) regCnv.transToPers(trans->getRegions(), all);
94 
95  // std::cout<<"OUT source: "<<trans->m_source;
96  // std::cout<<"\tex: "<<trans->m_ex;
97  // std::cout<<"\tey: "<<trans->m_ey;
98  // std::cout<<"\tetSum: "<<trans->m_etSum;
99  // if (trans->m_regions != 0) std::cout<<"\thas Regions"<<std::endl; else std::cout<<"\tNO Regions"<<std::endl;
100 
101  return;
102 }
MissingET::etx
virtual double etx() const
Definition: MissingET.cxx:141
MissingET.h
MissingET::getRegions
virtual const MissingEtRegions * getRegions() const
Definition: MissingET.cxx:164
MissingEtRegionsCnv_p3.h
MissingET::Source
Source
Definition: Reconstruction/MissingETEvent/MissingETEvent/MissingET.h:38
skel.it
it
Definition: skel.GENtoEVGEN.py:396
MissingET::getSource
virtual Source getSource() const
Definition: MissingET.cxx:171
lumiFormat.i
int i
Definition: lumiFormat.py:85
MissingETCnv_p3.h
T_AthenaPoolTPConverter.h
MissingEtRegionsCnv_p3
Definition: MissingEtRegionsCnv_p3.h:21
hist_file_dump.f
f
Definition: hist_file_dump.py:135
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
MissingET
Athena::TPCnvVers::Old Athena::TPCnvVers::Old MissingET
Definition: RecTPCnv.cxx:64
MissingETCnv_p3::persToTrans
virtual void persToTrans(const MissingET_p3 *persObj, MissingET *transObj, MsgStream &msg) const override
Definition: MissingETCnv_p3.cxx:32
MissingET_p3::m_AllTheData
std::vector< float > m_AllTheData
Definition: MissingET_p3.h:25
MissingET_p3
Definition: MissingET_p3.h:18
MissingEtRegionsCnv_p3::persToTrans
virtual void persToTrans(const MissingEtRegions_p3 *persObj, MissingEtRegions *transObj, MsgStream &msg) const override
Definition: MissingEtRegionsCnv_p3.cxx:23
MissingET::ety
virtual double ety() const
Definition: MissingET.cxx:145
MissingEtRegionsCnv_p3::transToPers
virtual void transToPers(const MissingEtRegions *transObj, MissingEtRegions_p3 *persObj, MsgStream &msg) const override
Definition: MissingEtRegionsCnv_p3.cxx:28
MissingEtRegions.h
Cut::all
@ all
Definition: SUSYToolsAlg.cxx:67
MissingETCnv_p3::transToPers
virtual void transToPers(const MissingET *transObj, MissingET_p3 *persObj, MsgStream &msg) const override
Definition: MissingETCnv_p3.cxx:38
MissingET
Definition: Reconstruction/MissingETEvent/MissingETEvent/MissingET.h:23
copySelective.source
string source
Definition: copySelective.py:32
MissingET::sumet
virtual double sumet() const
Definition: MissingET.cxx:149
python.compressB64.c
def c
Definition: compressB64.py:93
pdg_comparison.conv
conv
Definition: pdg_comparison.py:321