ATLAS Offline Software
Loading...
Searching...
No Matches
MissingEtCaloCnv_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/********************************************************************
6NAME: MissingEtCaloCnv_p3.cxx
7PURPOSE: Transient/Persisten converter for MissingEtCalo class
8********************************************************************/
9
10// AthenaPoolCnvSvc includes
12
13// MissingETEvent includes
16
17// RecTPCnv includes
20#include <bit>
21#include <cstdint>
22
23// MissingET converter
25
26
27void MissingEtCaloCnv_p3::persToTrans( const MissingEtCalo_p3* pers, MissingEtCalo* trans, MsgStream& /* msg */ ) const {
28 std::vector<float>::const_iterator i=pers->m_allTheData.begin();
29 //float version;
30 //version = (*i);
31 ++i; // as there is just one it is not used.
32 static_assert(sizeof(float) == sizeof(std::uint32_t));
33 int size= static_cast<int>(*i); ++i;
34 for (int vi=0;vi<size;++vi){
35 auto ci = static_cast<MissingEtCalo::CaloIndex>(vi);
36 trans->setExCalo(ci, *i); ++i;
37 trans->setEyCalo(ci, *i); ++i;
38 trans->setEtSumCalo(ci, *i); ++i;
39 trans->setNCellCalo(ci, std::bit_cast<std::uint32_t>(*i));
40 ++i;
41 }
42 if ( i != pers->m_allTheData.end()) {
43 metCnv.persToTrans(trans, i);
44 }
45
46return;
47}
48
49void MissingEtCaloCnv_p3::transToPers( const MissingEtCalo* trans, MissingEtCalo_p3* pers, MsgStream& /* msg */ )const {
50 static_assert(sizeof(float) == sizeof(std::uint32_t));
51 pers->m_allTheData.push_back(3.0); // storing version number
52 pers->m_allTheData.reserve(MissingEtCalo::Size * 4 + 1);
53 pers->m_allTheData.push_back(MissingEtCalo::Size);
54 for (int vi=0;vi<MissingEtCalo::Size;++vi){
55 auto ci = static_cast<MissingEtCalo::CaloIndex>(vi);
56 pers->m_allTheData.push_back(trans->exCalo(ci));
57 pers->m_allTheData.push_back(trans->eyCalo(ci));
58 pers->m_allTheData.push_back(trans->etSumCalo(ci));
59 pers->m_allTheData.push_back(std::bit_cast<float>(trans->ncellCalo(ci)));
60 }
61 if( trans->getSource() >= 0 && trans->getSource() < 1000 )
62 metCnv.transToPers( trans, pers->m_allTheData );
63 return;
64}
static const MissingETCnv_p1 metCnv
size_t size() const
Number of registered mappings.
virtual void persToTrans(const MissingEtCalo_p3 *persObj, MissingEtCalo *transObj, MsgStream &msg) const override
virtual void transToPers(const MissingEtCalo *transObj, MissingEtCalo_p3 *persObj, MsgStream &msg) const override
std::vector< float > m_allTheData
TH1F * trans(TH1F *h, bool t=false)