ATLAS Offline Software
Loading...
Searching...
No Matches
LArRawChannelCnv_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
8#include <cstdint>
9// LArRawChannelCnv_p2, used for T/P separation
10// author G.Unal
11
12namespace {
13
14 constexpr uint32_t qualityMask = 0x0000ffffu;
15 constexpr uint32_t provenanceMask = 0x3fff0000u;
16 constexpr uint32_t gainMask = 0xc0000000u;
17
19 packQualityProvenance(const uint16_t quality, const uint16_t provenance) {
20 return static_cast<uint32_t>(quality) |
21 ((static_cast<uint32_t>(provenance) << 16) & provenanceMask);
22 }
23
25 unpackQuality(const uint32_t packed) {
26 return static_cast<uint16_t>(packed & qualityMask);
27 }
28
30 unpackProvenance(const uint32_t packed) {
31 return static_cast<uint16_t>((packed & provenanceMask) >> 16);
32 }
33
34}
35
36void
38 LArRawChannel_p2* pers,
39 MsgStream& /*log*/) const
40{
42 pers->m_energy = trans->energy();
43 pers->m_time = trans->time();
44
45 const uint32_t qualityProvenance =
46 packQualityProvenance(trans->quality(), trans->provenance());
47
48 const uint32_t gain =
49 static_cast<uint32_t>(trans->gain() & 0x3) << 30;
50
51 pers->m_qualityandgain = static_cast<int>(qualityProvenance | gain);
52}
53
54void
56 LArRawChannel* trans,
57 MsgStream& /*log*/) const
58{
59 const uint32_t qualityAndGain =
60 static_cast<uint32_t>(pers->m_qualityandgain);
61
62 *trans = LArRawChannel{
64 pers->m_energy,
65 pers->m_time,
66 unpackQuality(qualityAndGain),
67 unpackProvenance(qualityAndGain),
68 static_cast<CaloGain::CaloGain>((qualityAndGain & gainMask) >> 30)
69 };
70}
value_type get_compact() const
Get the compact id.
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
virtual void transToPers(const LArRawChannel *trans, LArRawChannel_p2 *pers, MsgStream &log) const override
virtual void persToTrans(const LArRawChannel_p2 *pers, LArRawChannel *trans, MsgStream &log) const override
persistent class for LArRawChannel, version p2.
unsigned int m_channelID
unsigned int m_qualityandgain
Liquid Argon ROD output object base class.
uint16_t provenance() const
HWIdentifier identify() const
CaloGain::CaloGain gain() const
int time() const
uint16_t quality() const
int energy() const
H5::CompType packed(H5::CompType in)
setWord1 uint16_t
setEventNumber uint32_t