Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • rrabadan/LHCb
  • talin/LHCb
  • imjelde/LHCb
  • mstahl/LHCb
  • padeken/LHCb
  • mimazure/LHCb
  • roiser/LHCb
  • conrad/LHCb
  • kklimasz/LHCb
  • rcurrie/LHCb
  • wkrzemie/LHCb
  • fkeizer/LHCb
  • valassi/LHCb
  • hschrein/LHCb
  • anstahll/LHCb
  • jonrob/LHCb
  • graven/LHCb
  • clemenci/LHCb
  • chaen/LHCb
  • sstahl/LHCb
  • lhcb/LHCb
21 results
Show changes
Commits on Source (6)
Showing with 47 additions and 56 deletions
......@@ -15,6 +15,7 @@
#include "Event/RawBank.h"
#include "Event/RawBankReadoutStatus.h"
#include "Gaudi/Accumulators.h"
#include "Kernel/STLExtensions.h"
#include "LHCbAlgs/Transformer.h"
#include "boost/container/small_vector.hpp"
#include <Gaudi/Accumulators/Histogram.h>
......@@ -75,13 +76,13 @@ namespace {
}
template <typename T, auto N>
constexpr auto pop( gsl::span<T, N>& v, bool isLittleEndian = true ) {
constexpr auto pop( LHCb::span<T, N>& v, bool isLittleEndian = true ) {
auto first = v[0];
v = v.template subspan<1>();
return isLittleEndian ? first : __builtin_bswap32( first );
}
template <typename T, auto N>
constexpr void advance( gsl::span<T, N>& v, int s ) {
constexpr void advance( LHCb::span<T, N>& v, int s ) {
v = v.subspan( s );
}
......
......@@ -13,4 +13,7 @@
<argument name="program"><text>scripts/TupleEx1.py</text></argument>
<argument name="use_temp_dir"><enumeral>true</enumeral></argument>
<argument name="reference"><text>refs/TupleEx1.pyref</text></argument>
<argument name="unsupported_platforms"><set>
<text>.*clang*</text>
</set></argument>
</extension>
......@@ -178,7 +178,7 @@ namespace LHCb {
case LHCbID::channelIDtype::VP: {
const auto vpid = id.vpID();
const auto station = vpid.station();
if ( vpid.sidepos() == 0 ) {
if ( vpid.sidepos() == LHCb::Detector::VPChannelID::Side::A ) {
advance( m_veloA[station] );
} else {
advance( m_veloC[station] );
......
......@@ -16,7 +16,7 @@
#include <boost/container/small_vector.hpp>
#include <gsl/span>
#include "Kernel/STLExtensions.h"
#include <cstddef>
#include <numeric>
......@@ -67,7 +67,7 @@ namespace LHCb::Arena {
std::byte* m_current_end{nullptr};
/// All memory blocks owned by this arena.
boost::container::small_vector<gsl::span<std::byte>, 1> m_all_blocks;
boost::container::small_vector<LHCb::span<std::byte>, 1> m_all_blocks;
/// Approximate factor by which each block is larger than its predecessor.
static constexpr std::size_t growth_factor = 2;
......
......@@ -71,7 +71,7 @@ namespace LHCb {
namespace cxx {
// FIXME: C++20: replace with std::bind_front
#ifndef __cpp_lib_bind_front
template <typename F, typename... BoundArgs>
auto bind_front( F&& f, BoundArgs&&... boundArgs ) {
return [f = std::forward<F>( f ),
......@@ -80,10 +80,13 @@ namespace LHCb {
f, std::tuple_cat( boundArgs, std::forward_as_tuple( std::forward<decltype( args )>( args )... ) ) );
};
}
#else
using std::bind_front;
#endif
} // namespace cxx
// FIXME/TODO: C++20: replace with std::span
// FIXME/TODO: C++20: replace with std::span -- note: C++20 does not have a `make_span`...
using gsl::make_span;
using gsl::span;
......@@ -117,11 +120,14 @@ namespace LHCb {
template <typename Iterator, typename = std::enable_if_t<details_se::isContiguous<Iterator>()>>
auto make_span( Iterator firstElem, Iterator lastElem ) {
#ifdef __cpp_lib_to_address
return make_span( std::to_address( firstElem ), std::distance( firstElem, lastElem ) );
#else
// avoid forming a reference to *firstElem, as [firstElem,lastElem) may be an empty range,
// in which case *firstElem would be an invalid expression, and eg. std::addressof(*firstElem)
// would imply UB.
// C++20 FIXME: use std::to_address(firstElem)
return make_span( firstElem.operator->(), std::distance( firstElem, lastElem ) );
#endif
}
namespace range {
......
......@@ -16,26 +16,8 @@
#include "Kernel/STLExtensions.h"
#ifdef NDEBUG
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wunused-parameter"
# define GSL_UNENFORCED_ON_CONTRACT_VIOLATION
#endif
// drop bounds checking in non-debug mode in a way which (also) works with MS-GSL3
#include "gsl/gsl_assert"
#ifdef NDEBUG
# undef GSL_CONTRACT_CHECK
# define GSL_CONTRACT_CHECK( type, cond ) GSL_ASSUME( cond )
#endif
#include "gsl/span"
#ifdef NDEBUG
# pragma GCC diagnostic pop
#endif
namespace LHCb::Math {
using gsl::span;
namespace detail {
inline auto to_span( double& target ) { return span<double, 1>{&target, 1}; }
......
......@@ -13,13 +13,12 @@
#include <utility>
#include "GaudiKernel/System.h"
#include "Kernel/STLExtensions.h"
#include "LHCbMath/Similarity.h"
#include <Vc/Vc>
namespace LHCb::Math::detail {
using gsl::span;
namespace {
//----------------------------------------------------------------------
......
......@@ -21,7 +21,10 @@ namespace Muon::DAQ {
using LongType = std::uint64_t;
/// DAQ short type definition
using ShortType = std::uint32_t;
using ByteType = uint8_t;
using ShortType = std::uint32_t;
using ByteType = uint8_t;
constexpr unsigned int MaxHitsInFrame = 48;
constexpr unsigned int MaxTDCsInFrame = 12;
constexpr unsigned int MaxHitBytes = MaxHitsInFrame / 8;
constexpr unsigned int MaxTDCBytes = MaxTDCsInFrame / 2;
} // namespace Muon::DAQ
......@@ -12,6 +12,7 @@
#include "Event/RawBank.h"
#include "Event/RawEvent.h"
#include "Kernel/STLExtensions.h"
#include "MuonDAQ/MuonDAQDefinitions.h"
#include "MuonDet/DeMuonDetector.h"
#include "MuonDet/MuonNamespace.h"
......@@ -44,9 +45,10 @@ namespace LHCb::MuonUpgrade::DAQ {
bool double_error = false;
};
std::optional<LinkFrameInfo> splitMuonLinkFrame( ByteType control_register, gsl::span<const ByteType> allFrame,
ByteType HitsMap[6], ByteType TDCMap[6],
unsigned int& TDCMap_ByteLength ) {
std::optional<LinkFrameInfo> splitMuonLinkFrame( ByteType control_register, LHCb::span<const ByteType> allFrame,
LHCb::span<ByteType, MaxHitBytes> HitsMap,
LHCb::span<ByteType, MaxTDCBytes> TDCMap,
unsigned int& TDCMap_ByteLength ) {
// allframe is single fiber data the length is written inside but it cannot be longer than 13
// first interpret the setting used in Tell40
LinkFrameInfo out_info;
......@@ -85,23 +87,24 @@ namespace LHCb::MuonUpgrade::DAQ {
// now copy the in in output --- byte aligned
// TDCMap[6];
if ( EDAC_info_stored == 0 ) {
for ( unsigned int i = 0; i < 6; i++ ) {
for ( unsigned int i = 0; i < MaxHitBytes; i++ ) {
HitsMap[i] = ( ( range_link_HitsMap[i] << 4 ) & 0xF0 ) | ( ( range_link_HitsMap[i + 1] >> 4 ) & 0x0F );
}
} else {
for ( unsigned int i = 0; i < 6; i++ ) { HitsMap[i] = range_link_HitsMap[i]; }
for ( unsigned int i = 0; i < MaxHitBytes; i++ ) { HitsMap[i] = range_link_HitsMap[i]; }
}
// now TDC part
if ( EDAC_info_stored == 0 ) {
for ( unsigned int i = 0; i < TDCMap_length - 1; i++ ) {
TDCMap[i] = ( ( range_link_TDC[i] & 0x0F ) << 4 ) | ( ( range_link_TDC[i + 1] & 0xF0 ) >> 4 );
}
TDCMap[TDCMap_length - 1] = ( ( range_link_TDC[TDCMap_length - 1] & 0x0F ) << 4 );
// in the [TDCMap_length==7 only first half of the last byte can contain a TDC so skip following line in that case
if ( TDCMap_length <= MaxTDCBytes )
TDCMap[TDCMap_length - 1] = ( ( range_link_TDC[TDCMap_length - 1] & 0x0F ) << 4 );
} else {
for ( unsigned int i = 0; i < TDCMap_length; i++ ) { TDCMap[i] = range_link_TDC[i]; }
}
TDCMap_ByteLength = TDCMap_length;
if ( EDAC_info_stored > 0 ) return out_info;
return {};
}
......
......@@ -534,7 +534,6 @@ namespace LHCb::MuonUpgrade::DAQ {
}
}
}
// move pointer to where real hits start
link_start_pointer = ( bt == 1 ) ? link_start_pointer + 3 : link_start_pointer;
current_pointer = link_start_pointer;
......@@ -591,14 +590,11 @@ namespace LHCb::MuonUpgrade::DAQ {
if ( msgLevel( MSG::DEBUG ) ) debug() << " new link " << std::bitset<8>( curr_byte ) << endmsg;
if ( size_of_link > 1 ) {
bool TDCPadded = true;
auto allFrame = range_data.subspan( link_start_pointer, size_of_link );
ByteType HitsMap[6] = {};
ByteType TDCMap[6] = {};
// remember in the nearfuture to move to
// std::array<ByteType,6> HitsMap ={};
// std::array<ByteType,6> TDCMap = {};
unsigned int TDCMap_ByteLength = 0;
bool TDCPadded = true;
auto allFrame = range_data.subspan( link_start_pointer, size_of_link );
std::array<ByteType, MaxHitBytes> HitsMap = {};
std::array<ByteType, MaxTDCBytes> TDCMap = {};
unsigned int TDCMap_ByteLength = 0;
// it return byte aligned hitsmap and TDC. The returned value spot if edac counters are in data, it affects
// TDC length
auto link_info = splitMuonLinkFrame( control_register, allFrame, HitsMap, TDCMap, TDCMap_ByteLength );
......@@ -606,7 +602,6 @@ namespace LHCb::MuonUpgrade::DAQ {
debug() << "Link decoded with EDAC info stored" << endmsg;
if ( ( link_info )->EDAC_stored ) TDCPadded = false;
}
if ( msgLevel( MSG::DEBUG ) ) {
debug() << "print after new frame access mode " << size_of_link << " " << TDCPadded << " ";
for ( unsigned int rt = 0; rt < size_of_link; rt++ ) {
......@@ -614,16 +609,15 @@ namespace LHCb::MuonUpgrade::DAQ {
debug() << std::bitset<8>( allFrame[rt] );
}
debug() << endmsg;
debug() << "print HitsMap "
<< " ";
debug() << "print HitsMap ";
for ( unsigned int rt = 0; rt < 6; rt++ ) { debug() << std::bitset<8>( HitsMap[rt] ); }
debug() << endmsg;
debug() << "print TDCsMap "
<< " ";
for ( unsigned int rt = 0; rt < TDCMap_ByteLength; rt++ ) { debug() << std::bitset<8>( TDCMap[rt] ); }
debug() << "print TDCsMap ";
for ( unsigned int rt = 0; rt < std::min( TDCMap_ByteLength, MaxTDCBytes ); rt++ ) {
debug() << std::bitset<8>( TDCMap[rt] );
}
debug() << endmsg;
}
// now true decoding of hits map and TDC
unsigned int pos_in_link = 0;
unsigned int nSynch_hits_number = 0;
......
......@@ -33,7 +33,7 @@ void MuonSynchFrame::getFullSynchFrame( unsigned int frame[8] ) {
if ( m_hitmap[i + 32] ) { frame[1] |= 1UL << i; }
}
// now TDC
for ( int i = 0; i < 48; i++ ) {
for ( unsigned int i = 0; i < Muon::DAQ::MaxHitsInFrame; i++ ) {
unsigned int nframe = ( i * 4 ) / 32;
unsigned int shift = ( i * 4 ) % 32;
......@@ -49,7 +49,7 @@ ShortType MuonSynchFrame::getSynchFrame( unsigned int frame[3], bool edac ) {
unsigned int nframe = 0;
unsigned int shift = 0;
if ( edac ) max_hits = 10;
for ( int i = 0; i < 48; i++ ) {
for ( unsigned int i = 0; i < Muon::DAQ::MaxHitsInFrame; i++ ) {
if ( m_hitmap[i] ) {
if ( i < 32 ) {
frame[0] |= 1UL << ( 31 - i );
......