Skip to content
Snippets Groups Projects
Commit dd75a105 authored by Gerhard Raven's avatar Gerhard Raven
Browse files

prefer std integer types with explicit bit counts for packed objects

parent ded19ad4
No related branches found
No related tags found
No related merge requests found
Pipeline #3874381 failed
Showing
with 150 additions and 150 deletions
......@@ -31,8 +31,8 @@ namespace LHCb {
* @date 2017-06-08
*/
struct PackedCaloAdc {
int key{0};
int adc{0};
std::int32_t key{0};
std::int32_t adc{0};
#ifndef __CLING__
template <typename T>
......
......@@ -29,9 +29,9 @@ namespace LHCb {
* @date 2012-03-30
*/
struct PackedCaloClusterEntry {
long long digit{-1};
unsigned int status{0};
short int fraction{0};
std::int64_t digit{-1};
std::uint32_t status{0};
std::int16_t fraction{0};
#ifndef __CLING__
template <typename T>
......@@ -54,16 +54,16 @@ namespace LHCb {
* @date 2012-03-30
*/
struct PackedCaloCluster {
int key{0};
int type{0};
unsigned int seed{0};
int pos_x{0}, pos_y{0}, pos_z{0}, pos_e{0};
int pos_c0{0}, pos_c1{0};
int pos_cov00{0}, pos_cov11{0}, pos_cov22{0};
short int pos_cov10{0}, pos_cov20{0}, pos_cov21{0};
int pos_spread00{0}, pos_spread11{0};
short int pos_spread10{0};
unsigned short int firstEntry{0}, lastEntry{0};
std::int32_t key{0};
std::int32_t type{0};
std::uint32_t seed{0};
std::int32_t pos_x{0}, pos_y{0}, pos_z{0}, pos_e{0};
std::int32_t pos_c0{0}, pos_c1{0};
std::int32_t pos_cov00{0}, pos_cov11{0}, pos_cov22{0};
std::int16_t pos_cov10{0}, pos_cov20{0}, pos_cov21{0};
std::int32_t pos_spread00{0}, pos_spread11{0};
std::int16_t pos_spread10{0};
std::uint16_t firstEntry{0}, lastEntry{0};
#ifndef __CLING__
template <typename T>
......
......@@ -31,8 +31,8 @@ namespace LHCb {
* @date 2017-06-08
*/
struct PackedCaloDigit {
int key{0};
int e{0};
std::int32_t key{0};
std::int32_t e{0};
#ifndef __CLING__
template <typename T>
......
......@@ -30,29 +30,29 @@ namespace LHCb {
* @date 2008-11-10
*/
struct PackedCaloHypo {
int key{0};
int hypothesis{0};
int lh{0};
std::int32_t key{0};
std::int32_t hypothesis{0};
std::int32_t lh{0};
// from CaloPosition
int z{0};
std::int32_t z{0};
// position (3) + 3x3 symmetric covariance matrix
int posX{0}, posY{0}, posE{0};
std::int32_t posX{0}, posY{0}, posE{0};
int cov00{0}, cov11{0}, cov22{0};
short int cov10{0}, cov20{0}, cov21{0};
short int cerr10{0}; // non diagonal terms of the x,y spread matrix.
std::int32_t cov00{0}, cov11{0}, cov22{0};
std::int16_t cov10{0}, cov20{0}, cov21{0};
std::int16_t cerr10{0}; // non diagonal terms of the x,y spread matrix.
// center in x,y + 2x2 symetric covariance matrix
int centX{0};
int centY{0};
int cerr00{0};
int cerr11{0};
unsigned short int firstDigit{0};
unsigned short int lastDigit{0};
unsigned short int firstCluster{0};
unsigned short int lastCluster{0};
unsigned short int firstHypo{0};
unsigned short int lastHypo{0};
std::int32_t centX{0};
std::int32_t centY{0};
std::int32_t cerr00{0};
std::int32_t cerr11{0};
std::uint16_t firstDigit{0};
std::uint16_t lastDigit{0};
std::uint16_t firstCluster{0};
std::uint16_t lastCluster{0};
std::uint16_t firstHypo{0};
std::uint16_t lastHypo{0};
#ifndef __CLING__
template <typename Buf>
......@@ -102,8 +102,8 @@ namespace LHCb {
std::vector<PackedCaloHypo>& data() { return m_vect; }
const std::vector<PackedCaloHypo>& data() const { return m_vect; }
std::vector<long long>& refs() { return m_refs; }
const std::vector<long long>& refs() const { return m_refs; }
std::vector<std::int64_t>& refs() { return m_refs; }
const std::vector<std::int64_t>& refs() const { return m_refs; }
/// Set the packing version
PackedCaloHypos& setPackingVersion( const char ver ) {
......@@ -138,7 +138,7 @@ namespace LHCb {
private:
std::vector<PackedCaloHypo> m_vect;
std::vector<long long> m_refs;
std::vector<std::int64_t> m_refs;
/// Data packing version
char m_packingVersion{0};
......
......@@ -25,13 +25,13 @@ namespace LHCb {
* @date 2012-03-05
*/
struct PackedCluster {
unsigned int id{0};
unsigned int begin{0};
unsigned int end{0};
unsigned int sum{0};
unsigned int sourceID{0};
unsigned int tell1Channel{0};
int spill{0};
std::uint32_t id{0};
std::uint32_t begin{0};
std::uint32_t end{0};
std::uint32_t sum{0};
std::uint32_t sourceID{0};
std::uint32_t tell1Channel{0};
std::int32_t spill{0};
#ifndef __CLING__
template <typename T>
......@@ -84,12 +84,12 @@ namespace LHCb {
addUTCluster( sCl, 0x50000000 ); // need to find the proper key (JC)
}
void addUTCluster( const LHCb::UTCluster* uCl, const unsigned int key );
void addUTCluster( const LHCb::UTCluster* uCl, const std::uint32_t key );
public:
const std::vector<PackedCluster>& clusters() const { return m_clusters; }
const std::vector<int>& strips() const { return m_strips; }
const std::vector<unsigned int>& adcs() const { return m_adcs; }
const std::vector<std::int32_t>& strips() const { return m_strips; }
const std::vector<std::uint32_t>& adcs() const { return m_adcs; }
public:
/// Set the packing version
......@@ -124,8 +124,8 @@ namespace LHCb {
private:
std::vector<PackedCluster> m_clusters;
std::vector<int> m_strips;
std::vector<unsigned int> m_adcs;
std::vector<std::int32_t> m_strips;
std::vector<std::uint32_t> m_adcs;
/** Data packing version
* Note the default packing version here must stay as zero, for compatibility
......
......@@ -73,7 +73,7 @@ namespace LHCb::Hlt::PackedData {
}
/// Return the part ID from the SourceID word
inline unsigned int partID( RawBank const& b ) { return extract<SourceIDMasks::PartID>( b.sourceID() ); }
inline std::uint32_t partID( RawBank const& b ) { return extract<SourceIDMasks::PartID>( b.sourceID() ); }
/// Return the compression from the SourceID word
inline Compression compression( RawBank const& b ) {
return static_cast<Compression>( extract<SourceIDMasks::Compression>( b.sourceID() ) );
......
......@@ -67,7 +67,7 @@ namespace LHCb::Hlt::PackedData {
*/
class ByteBuffer {
public:
using buffer_type = std::vector<uint8_t>;
using buffer_type = std::vector<std::byte>;
/// Return the current position in the buffer.
std::size_t pos() const { return m_pos; }
......@@ -143,11 +143,11 @@ namespace LHCb::Hlt::PackedData {
m_pos += x.size();
}
/// Take requested part of the buffer
LHCb::span<uint8_t const> subspan( size_t offset, size_t size = gsl::dynamic_extent ) const {
LHCb::span<std::byte const> subspan( size_t offset, size_t size = gsl::dynamic_extent ) const {
return LHCb::span{m_buffer}.subspan( offset, size );
}
/// Add sub span of a buffer to a new buffer
void assign( LHCb::span<uint8_t const> data ) {
void assign( LHCb::span<std::byte const> data ) {
m_buffer.assign( data.begin(), data.end() );
m_pos = 0;
}
......@@ -266,7 +266,7 @@ namespace LHCb::Hlt::PackedData {
void clear() { m_buffer.clear(); }
/// Return a reference to the internal buffer.
const std::vector<uint8_t>& buffer() const { return m_buffer.buffer(); }
const std::vector<std::byte>& buffer() const { return m_buffer.buffer(); }
/// Compress the buffer
bool compress( Compression compression, int level, ByteBuffer::buffer_type& output ) const {
return m_buffer.compress( compression, level, output );
......@@ -419,11 +419,11 @@ namespace LHCb::Hlt::PackedData {
}
/// Add a byte buffer of a packed data buffer to another one at a given position
void addBuffer( PackedDataInBuffer const& x, unsigned int p ) {
void addBuffer( PackedDataInBuffer const& x, std::uint32_t p ) {
return m_buffer.assign( x.m_buffer.subspan( p, x.m_buffer.pos() - p ) );
}
/// Add a byte buffer of a packed data buffer to another one at a given position
void addBuffer( ByteBuffer const& x, unsigned int p ) { return m_buffer.assign( x.subspan( p, x.pos() - p ) ); }
void addBuffer( ByteBuffer const& x, std::uint32_t p ) { return m_buffer.assign( x.subspan( p, x.pos() - p ) ); }
/// Load a scalar from a given position and return it.
template <typename T>
T loadAt( std::size_t i ) const {
......
......@@ -40,15 +40,15 @@ namespace LHCb {
static const CLID& classID() { return CLID_PackedDecReport; }
public:
std::vector<unsigned int>& reports() { return m_data; }
const std::vector<unsigned int>& reports() const { return m_data; }
std::vector<std::uint32_t>& reports() { return m_data; }
const std::vector<std::uint32_t>& reports() const { return m_data; }
void setConfiguredTCK( unsigned int value ) { m_configuredTCK = value; }
unsigned int configuredTCK() const { return m_configuredTCK; }
void setConfiguredTCK( std::uint32_t value ) { m_configuredTCK = value; }
std::uint32_t configuredTCK() const { return m_configuredTCK; }
private:
std::vector<unsigned int> m_data;
unsigned int m_configuredTCK{0};
std::vector<std::uint32_t> m_data;
std::uint32_t m_configuredTCK{0};
};
} // namespace LHCb
......@@ -31,18 +31,18 @@ namespace LHCb {
* @date 2013-05-03
*/
struct PackedFlavourTag {
long long key{0}; ///< reference to the original container + key
std::int64_t key{0}; ///< reference to the original container + key
short int decision{0}; ///< The result of the tagging algorithm
short int omega{0}; ///< Wrong tag fraction (predicted)
std::int16_t decision{0}; ///< The result of the tagging algorithm
std::int16_t omega{0}; ///< Wrong tag fraction (predicted)
short int decisionOS{0}; ///< decision of opposite side taggers only
short int omegaOS{0}; ///< Wrong tag fraction (predicted) using opposite side only
std::int16_t decisionOS{0}; ///< decision of opposite side taggers only
std::int16_t omegaOS{0}; ///< Wrong tag fraction (predicted) using opposite side only
long long taggedB{-1}; ///< The B for which this tag has been made
std::int64_t taggedB{-1}; ///< The B for which this tag has been made
// Taggers
unsigned int firstTagger{0}, lastTagger{0};
std::uint32_t firstTagger{0}, lastTagger{0};
#ifndef __CLING__
template <typename T>
......@@ -63,12 +63,12 @@ namespace LHCb {
* @date 2013-05-03
*/
struct PackedTagger {
unsigned short int type{0}; ///< The type of tagger
short int decision{0}; ///< Decision of tagger
short int omega{0}; ///< Wrong tag fraction of tagger
unsigned int firstTagP{0}, lastTagP{0}; ///< Tagging particles
int mvaValue{0}; ///< MVA used for classification
short int charge{0}; ///< Charge used for classification
std::uint16_t type{0}; ///< The type of tagger
std::int16_t decision{0}; ///< Decision of tagger
std::int16_t omega{0}; ///< Wrong tag fraction of tagger
std::uint32_t firstTagP{0}, lastTagP{0}; ///< Tagging particles
std::int32_t mvaValue{0}; ///< MVA used for classification
std::int16_t charge{0}; ///< Charge used for classification
#ifndef __CLING__
template <typename T>
......@@ -113,7 +113,7 @@ namespace LHCb {
typedef std::vector<LHCb::PackedTagger> Taggers;
/// Tagging Particles
typedef std::vector<long long> TaggingParticles;
typedef std::vector<std::int64_t> TaggingParticles;
/// Default Packing Version
[[nodiscard]] static char defaultPackingVersion() { return 1; }
......
......@@ -32,10 +32,10 @@ namespace LHCb {
* @date 2009-10-13
*/
struct PackedMCCaloHit {
int activeE{0};
int sensDetID{0};
char time{0};
long long mcParticle{-1};
int activeE{0};
int sensDetID{0};
char time{0};
std::int64_t mcParticle{-1};
};
constexpr CLID CLID_PackedMCCaloHits = 1526;
......
......@@ -31,13 +31,13 @@ namespace LHCb {
* @date 2009-10-13
*/
struct PackedMCHit {
int sensDetID{0};
int entx{0}, enty{0}, entz{0};
int vtxx{0}, vtxy{0}, vtxz{0};
int energy{0};
int tof{0};
int mp{0};
long long mcParticle{-1};
int sensDetID{0};
int entx{0}, enty{0}, entz{0};
int vtxx{0}, vtxy{0}, vtxz{0};
int energy{0};
int tof{0};
int mp{0};
std::int64_t mcParticle{-1};
};
constexpr CLID CLID_PackedMCHits = 1525;
......
......@@ -23,15 +23,15 @@ namespace LHCb {
* @date 2005-03-18
*/
struct PackedMCParticle {
int key{0};
int px{0};
int py{0};
int pz{0};
float mass{0};
int PID{0};
long long originVertex{-1};
std::vector<long long> endVertices;
unsigned int flags{0};
std::int32_t key{0};
std::int32_t px{0};
std::int32_t py{0};
std::int32_t pz{0};
float mass{0};
std::int32_tint PID{0};
std::int64_t originVertex{-1};
std::vector<std::int64_t> endVertices;
std::uint32_t flags{0};
};
constexpr CLID CLID_PackedMCParticles = 1510;
......
......@@ -31,9 +31,9 @@ namespace LHCb {
* @date 2009-10-13
*/
struct PackedMCRichDigitSummary {
int history{0};
int richSmartID{0};
long long mcParticle{-1};
int history{0};
int richSmartID{0};
std::int64_t mcParticle{-1};
};
constexpr CLID CLID_PackedMCRichDigitSummarys = 1527;
......
......@@ -31,12 +31,12 @@ namespace LHCb {
* @date 2009-10-13
*/
struct PackedMCRichHit {
int x{0}, y{0}, z{0};
int energy{0};
int tof{0};
int sensDetID{0};
int history{0};
long long mcParticle{-1};
int x{0}, y{0}, z{0};
int energy{0};
int tof{0};
int sensDetID{0};
int history{0};
std::int64_t mcParticle{-1};
};
constexpr CLID CLID_PackedMCRichHits = 1521;
......
......@@ -32,17 +32,17 @@ namespace LHCb {
* @date 2009-10-13
*/
struct PackedMCRichOpticalPhoton {
int key{0};
int hpdx{0}, hpdy{0}, hpdz{0};
int pmirx{0}, pmiry{0}, pmirz{0};
int smirx{0}, smiry{0}, smirz{0};
int aerox{0}, aeroy{0}, aeroz{0};
int theta{0}, phi{0};
int emisx{0}, emisy{0}, emisz{0};
int energy{0};
int pmomx{0}, pmomy{0}, pmomz{0};
int hpdqwx{0}, hpdqwy{0}, hpdqwz{0};
long long mcrichhit{-1};
int key{0};
int hpdx{0}, hpdy{0}, hpdz{0};
int pmirx{0}, pmiry{0}, pmirz{0};
int smirx{0}, smiry{0}, smirz{0};
int aerox{0}, aeroy{0}, aeroz{0};
int theta{0}, phi{0};
int emisx{0}, emisy{0}, emisz{0};
int energy{0};
int pmomx{0}, pmomy{0}, pmomz{0};
int hpdqwx{0}, hpdqwy{0}, hpdqwz{0};
std::int64_t mcrichhit{-1};
};
constexpr CLID CLID_PackedMCRichOpticalPhotons = 1522;
......
......@@ -33,13 +33,13 @@ namespace LHCb {
* @date 2009-10-13
*/
struct PackedMCRichSegment {
int key{0};
int history{0};
std::vector<int> trajPx, trajPy, trajPz;
std::vector<int> trajMx, trajMy, trajMz;
long long mcParticle{-1};
long long mcRichTrack{-1};
std::vector<long long> mcPhotons, mcHits;
std::int32_t key{0};
std::int32_t history{0};
std::vector<std::int32_t> trajPx, trajPy, trajPz;
std::vector<std::int32_t> trajMx, trajMy, trajMz;
std::int64_t mcParticle{-1};
std::int64_t mcRichTrack{-1};
std::vector<std::int64_t> mcPhotons, mcHits;
};
constexpr CLID CLID_PackedMCRichSegments = 1523;
......
......@@ -33,9 +33,9 @@ namespace LHCb {
* @date 2009-10-13
*/
struct PackedMCRichTrack {
int key{0};
std::vector<long long> mcSegments;
long long mcParticle{-1};
int key{0};
std::vector<std::int64_t> mcSegments;
std::int64_t mcParticle{-1};
};
constexpr CLID CLID_PackedMCRichTracks = 1524;
......
......@@ -24,14 +24,14 @@ namespace LHCb {
*/
struct PackedMCVertex {
int key{0};
int x{0};
int y{0};
int z{0};
float tof{0};
int type{0};
long long mother{-1};
std::vector<long long> products;
int key{0};
int x{0};
int y{0};
int z{0};
float tof{0};
int type{0};
std::int64_t mother{-1};
std::vector<std::int64_t> products;
};
constexpr CLID CLID_PackedMCVertices = 1511;
......
......@@ -30,18 +30,18 @@ namespace LHCb {
* @date 2009-10-13
*/
struct PackedMuonPID {
int MuonLLMu{0};
int MuonLLBg{0};
int nShared{0};
int status{0};
long long idtrack{-1};
long long mutrack{-1};
long long key{-1};
int chi2Corr{0};
int muonMVA1{0};
int muonMVA2{0};
int muonMVA3{0};
int muonMVA4{0};
std::int32_t MuonLLMu{0};
std::int32_t MuonLLBg{0};
std::int32_t nShared{0};
std::int32_t status{0};
std::int64_t idtrack{-1};
std::int64_t mutrack{-1};
std::int64_t key{-1};
std::int32_t chi2Corr{0};
std::int32_t muonMVA1{0};
std::int32_t muonMVA2{0};
std::int32_t muonMVA3{0};
std::int32_t muonMVA4{0};
#ifndef __CLING__
template <typename Buf>
......
......@@ -35,9 +35,9 @@ namespace LHCb {
*/
struct PackedRelatedInfoMap {
// first and last entry in the info vector
unsigned int first{0}, last{0};
std::uint32_t first{0}, last{0};
// reference
long long reference{-1};
std::int64_t reference{-1};
#ifndef __CLING__
template <typename T>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment