ATLAS Offline Software
Loading...
Searching...
No Matches
MissingEtCaloCnv_p2.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_p2.cxx
7PURPOSE: Transient/Persisten converter for MissingEtCalo class
8********************************************************************/
9
10// AthenaPoolCnvSvc includes
12
13// MissingETEvent includes
15
16// RecTPCnv includes
19#include <vector>
20#include <bit>
21#include <cstdint>
22
23// MissingET converter
25
26
27void MissingEtCaloCnv_p2::persToTrans( const MissingEtCalo_p2* pers, MissingEtCalo* trans, MsgStream& /* msg */ ) const {
28 std::vector<float>::const_iterator i=pers->m_AllTheData.begin();
29 int size=(int)(*i);++i;
30 trans->setExCaloVec (std::vector<double> (i, i+size)); i+= size;
31 trans->setEyCaloVec (std::vector<double> (i, i+size)); i+= size;
32 trans->setEtSumCaloVec (std::vector<double> (i, i+size)); i+= size;
33 static_assert(sizeof(float) == sizeof(std::uint32_t));
34 for (int w = 0; w < size; ++w) {
35 const auto ncell = std::bit_cast<std::uint32_t>(*i);
36 trans->setNCellCalo(static_cast<MissingEtCalo::CaloIndex>(w), ncell);
37 ++i;
38 }
39 metCnv.persToTrans(trans,i);
40 return;
41}
42
43void MissingEtCaloCnv_p2::transToPers( const MissingEtCalo* trans, MissingEtCalo_p2* pers, MsgStream& /* msg */ ) const {
44 pers->m_AllTheData.push_back((float)trans->exCaloVec().size());
45 std::copy(trans->exCaloVec().begin(), trans->exCaloVec().end(), std::back_inserter(pers->m_AllTheData) );
46 std::copy(trans->eyCaloVec().begin(),trans->eyCaloVec().end(), std::back_inserter(pers->m_AllTheData) );
47 std::copy(trans->etSumCaloVec().begin(),trans->etSumCaloVec().end(), std::back_inserter(pers->m_AllTheData) );
48 static_assert(sizeof(float) == sizeof(std::uint32_t));
49 for (unsigned int w = 0; w < trans->exCaloVec().size(); ++w) {
50 const auto ncell = static_cast<std::uint32_t>(
51 trans->ncellCalo(static_cast<MissingEtCalo::CaloIndex>(w))
52 );
53 pers->m_AllTheData.push_back(std::bit_cast<float>(ncell));
54 }
55 metCnv.transToPers( trans, pers->m_AllTheData );
56
57 return;
58}
static const MissingETCnv_p1 metCnv
size_t size() const
Number of registered mappings.
virtual void transToPers(const MissingEtCalo *transObj, MissingEtCalo_p2 *persObj, MsgStream &msg) const override
virtual void persToTrans(const MissingEtCalo_p2 *persObj, MissingEtCalo *transObj, MsgStream &msg) const override
std::vector< float > m_AllTheData
const std::vector< double > & exCaloVec() const
void setEtSumCaloVec(std::vector< double > &&etSumCaloVec)
void setNCellCalo(CaloIndex aCalo, unsigned int theNCell)
void setEyCaloVec(std::vector< double > &&exCaloVec)
unsigned int ncellCalo(CaloIndex aCalo) const
const std::vector< double > & etSumCaloVec() const
const std::vector< double > & eyCaloVec() const
void setExCaloVec(std::vector< double > &&exCaloVec)