ATLAS Offline Software
Loading...
Searching...
No Matches
MissingETCnv_p3.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5/********************************************************************
6
7NAME: MissingETCnv_p3.cxx
8PACKAGE: offline/Reconstruction/RecTPCnv
9
10PURPOSE: Transient/Persisten converter for MissingET class
11********************************************************************/
12
13// AthenaPoolCnvSvc includes
15
16// MissingETEvent includes
19
20// RecTPCnv includes
23
24#include <bit>
25#include <utility>
26#include <memory>
27#include <vector>
28
29class MsgStream;
30
31// region converter
33
34
35
36void MissingETCnv_p3::persToTrans( const MissingET_p3* pers, MissingET* trans, MsgStream& /* msg */ ) const {
37 std::vector<float>::const_iterator it=pers->m_AllTheData.begin();
38 persToTrans(trans, it);
39 return;
40}
41
42void MissingETCnv_p3::transToPers( const MissingET* trans, MissingET_p3* pers, MsgStream& /* msg */ ) const {
43 transToPers(trans, pers->m_AllTheData);
44 return;
45}
46
47
48void MissingETCnv_p3::persToTrans( MissingET* trans, std::vector<float>::const_iterator i) const {
49 ++i; // as there is just one it is not used.
50 float fcnv=(*i); ++i;
51 auto icnv = std::bit_cast<unsigned int>(fcnv);
52 MissingET::Source source = static_cast<MissingET::Source>(icnv>>1);
53 double ex = (*i);++i;
54 double ey = (*i);++i;
55 double etSum = (*i);++i;
56 std::unique_ptr<MissingEtRegions> regions;
57 if( icnv & 1) {
58 regions = std::make_unique<MissingEtRegions>();
59 regCnv.persToTrans( regions.get(), i);
60 }
61 *trans = MissingET (source, std::move (regions), ex, ey, etSum);
62 return;
63}
64
65void MissingETCnv_p3::transToPers( const MissingET* trans, std::vector<float> &all ) const {
66
67 all.push_back(3.0); // storing version number
68
69 // folding together m_source and if regions are present
70 unsigned int tmp=static_cast<unsigned int>(trans->getSource());
71 tmp <<= 1;
72 if( trans->getRegions() != 0) tmp|=1;
73
74 union conv{ unsigned int i; float f; } c;
75 c.i=tmp;
76 all.push_back(c.f);
77
78 // simple types
79 all.push_back(trans->etx());
80 all.push_back(trans->ety());
81 all.push_back(trans->sumet());
82
83 // calling regions tTP
84 if( trans->getRegions() != 0) regCnv.transToPers(trans->getRegions(), all);
85
86 return;
87}
static const MissingEtRegionsCnv_p1 regCnv
static const std::vector< std::string > regions
Athena::TPCnvVers::Old Athena::TPCnvVers::Old MissingET
Definition RecTPCnv.cxx:64
virtual void transToPers(const MissingET *transObj, MissingET_p3 *persObj, MsgStream &msg) const override
virtual void persToTrans(const MissingET_p3 *persObj, MissingET *transObj, MsgStream &msg) const override
std::vector< float > m_AllTheData
virtual const MissingEtRegions * getRegions() const
virtual double sumet() const
virtual double etx() const
virtual double ety() const
virtual Source getSource() const