16#define BOOST_TEST_MODULE Utility test
17#define BOOST_TEST_MAIN
18#define BOOST_TEST_DYN_LINK
28#include <boost/test/unit_test.hpp>
29#include <boost/mp11.hpp>
40using buffer_types = boost::mp11::mp_list<uint8_t, uint16_t, uint32_t, uint64_t>;
41using source_types = boost::mp11::mp_list<uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t>;
43using test_types = boost::mp11::mp_product<boost::mp11::mp_list, source_types, buffer_types>;
56 std::vector<buffer_type> serializationBuffer(bufferSize, 0);
57 auto begin = serializationBuffer.data();
61 for (
auto iter =
end; iter != begin + serializationBuffer.size(); ++iter) {
67 BOOST_CHECK_EQUAL(srcRenormedHistogram.getIncompressibleSymbolFrequency(), restoredRenormedHistogram.getIncompressibleSymbolFrequency());
68 BOOST_CHECK_EQUAL(srcRenormedHistogram.getOffset(), restoredRenormedHistogram.getOffset());
69 BOOST_CHECK_EQUAL(srcRenormedHistogram.getNumSamples(), restoredRenormedHistogram.getNumSamples());
74 BOOST_CHECK_EQUAL_COLLECTIONS(srcSymbolTable.
begin(), srcSymbolTable.
end(), restoredSymbolTable.
begin(), restoredSymbolTable.
end());
89 std::vector<buffer_type> serializationBuffer(256, 0);
90 auto begin = serializationBuffer.data();
94 for (
auto iter =
end; iter != begin + serializationBuffer.size(); ++iter) {
100 BOOST_CHECK_EQUAL(srcRenormedHistogram.getIncompressibleSymbolFrequency(), restoredRenormedHistogram.getIncompressibleSymbolFrequency());
101 BOOST_CHECK_EQUAL(srcRenormedHistogram.getOffset(), restoredRenormedHistogram.getOffset());
102 BOOST_CHECK_EQUAL(srcRenormedHistogram.getNumSamples(), restoredRenormedHistogram.getNumSamples());
106 BOOST_CHECK_EQUAL_COLLECTIONS(srcSymbolTable.
begin(), srcSymbolTable.
end(), restoredSymbolTable.
begin(), restoredSymbolTable.
end());
109template <
typename source_T>
115 if (mSourceMessage.empty()) {
118 const size_t draws = (
max -
min) + 1;
119 const double probability = 0.5;
120 std::binomial_distribution<int64_t> dist(draws, probability);
121 mSourceMessage.resize(messageSize);
122 std::generate(mSourceMessage.begin(), mSourceMessage.end(), [&dist, &mt,
min]() ->
source_T { return static_cast<int64_t>(dist(mt)) + min; });
128 inline constexpr auto&
get() const noexcept {
return mSourceMessage; };
133 std::vector<source_T> mSourceMessage{};
141 template <
typename T>
144 if constexpr (std::is_same_v<uint8_t, T>) {
145 return sourceMessage8u.get();
146 }
else if constexpr (std::is_same_v<int8_t, T>) {
147 return sourceMessage8.
get();
148 }
else if constexpr (std::is_same_v<uint16_t, T>) {
149 return sourceMessage16u.
get();
150 }
else if constexpr (std::is_same_v<int16_t, T>) {
151 return sourceMessage16.
get();
152 }
else if constexpr (std::is_same_v<uint32_t, T>) {
153 return sourceMessage32u.get();
154 }
else if constexpr (std::is_same_v<int32_t, T>) {
155 return sourceMessage32.
get();
157 throw Exception{
"unsupported source type"};
162 inline static constexpr size_t MessageSize = utils::pow2(10);
186 std::vector<buffer_type> serializationBuffer(bufferSize, 0);
187 auto begin = serializationBuffer.data();
191 for (
auto iter =
end; iter != begin + serializationBuffer.size(); ++iter) {
197 BOOST_CHECK_EQUAL(srcRenormedHistogram.getIncompressibleSymbolFrequency(), restoredRenormedHistogram.getIncompressibleSymbolFrequency());
198 BOOST_CHECK_EQUAL(srcRenormedHistogram.getNumSamples(), restoredRenormedHistogram.getNumSamples());
204 BOOST_CHECK_EQUAL_COLLECTIONS(srcSymbolTable.
begin(), srcSymbolTable.
end(), restoredSymbolTable.
begin(), restoredSymbolTable.
end());
221 std::vector<buffer_type> serializationBuffer(bufferSize, 0);
222 auto begin = serializationBuffer.data();
226 for (
auto iter =
end; iter != begin + serializationBuffer.size(); ++iter) {
232 BOOST_CHECK_EQUAL(srcRenormedHistogram.getIncompressibleSymbolFrequency(), restoredRenormedHistogram.getIncompressibleSymbolFrequency());
233 BOOST_CHECK_EQUAL(srcRenormedHistogram.getNumSamples(), restoredRenormedHistogram.getNumSamples());
238 BOOST_CHECK_EQUAL_COLLECTIONS(srcSymbolTable.
begin(), srcSymbolTable.
end(), restoredSymbolTable.
begin(), restoredSymbolTable.
end());
259 std::vector<buffer_type> serializationBuffer(bufferSize, 0);
260 auto begin = serializationBuffer.data();
264 for (
auto iter =
end; iter != begin + serializationBuffer.size(); ++iter) {
270 BOOST_CHECK_EQUAL(srcRenormedHistogram.getIncompressibleSymbolFrequency(), restoredRenormedHistogram.getIncompressibleSymbolFrequency());
271 BOOST_CHECK_EQUAL(srcRenormedHistogram.getNumSamples(), restoredRenormedHistogram.getNumSamples());
277 BOOST_CHECK_EQUAL_COLLECTIONS(srcSymbolTable.
begin(), srcSymbolTable.
end(), restoredSymbolTable.
begin(), restoredSymbolTable.
end());
296 std::vector<buffer_type> serializationBuffer(bufferSize, 0);
297 auto begin = serializationBuffer.data();
301 for (
auto iter =
end; iter != begin + serializationBuffer.size(); ++iter) {
307 BOOST_CHECK_EQUAL(srcRenormedHistogram.getIncompressibleSymbolFrequency(), restoredRenormedHistogram.getIncompressibleSymbolFrequency());
308 BOOST_CHECK_EQUAL(srcRenormedHistogram.getNumSamples(), restoredRenormedHistogram.getNumSamples());
313 BOOST_CHECK_EQUAL_COLLECTIONS(srcCrossCheckSymbolTable.begin(), srcCrossCheckSymbolTable.end(), restoredSymbolTable.
begin(), restoredSymbolTable.
end());
332 std::vector<buffer_type> serializationBuffer(bufferSize, 0);
333 auto begin = serializationBuffer.data();
337 for (
auto iter =
end; iter != begin + serializationBuffer.size(); ++iter) {
343 BOOST_CHECK_EQUAL(srcRenormedHistogram.getIncompressibleSymbolFrequency(), restoredRenormedHistogram.getIncompressibleSymbolFrequency());
344 BOOST_CHECK_EQUAL(srcRenormedHistogram.getNumSamples(), restoredRenormedHistogram.getNumSamples());
350 BOOST_CHECK_EQUAL_COLLECTIONS(srcSymbolTable.
begin(), srcSymbolTable.
end(), restoredSymbolTable.
begin(), restoredSymbolTable.
end());
369 std::vector<buffer_type> serializationBuffer(bufferSize, 0);
370 auto begin = serializationBuffer.data();
374 for (
auto iter =
end; iter != begin + serializationBuffer.size(); ++iter) {
380 BOOST_CHECK_EQUAL(srcRenormedHistogram.getIncompressibleSymbolFrequency(), restoredRenormedHistogram.getIncompressibleSymbolFrequency());
381 BOOST_CHECK_EQUAL(srcRenormedHistogram.getNumSamples(), restoredRenormedHistogram.getNumSamples());
386 BOOST_CHECK_EQUAL_COLLECTIONS(srcCrossCheckSymbolTable.begin(), srcCrossCheckSymbolTable.end(), restoredSymbolTable.
begin(), restoredSymbolTable.
end());
configStandalone Reconstruction rec_tpc multiplier for the combined cluster track error during track following area in cm for the search of for z only used if decrease removal by when above this local occupancy rowx Shift of TPC revert cluster flag edge bit distance to edge exceeds this ZOffset for secondary multiple of radius max P of electron K BB bands crossing max P of electron p BB bands crossing max P of electron d BB bands crossing max P of electron t BB bands crossing min accepted dEdxMaxTPC of the track Additive extra cluster error for Y2 if edge flag set Additive extra cluster error for Y2 if single set Additive extra cluster error for Y2 if or single set Additive extra cluster error for Z2 if or single set Extra errors to add to track when crossing depending on addErrorsCECrossing Inner portion of y range in sector that is not used in searching for extrapolated track candidates factor2YS for track merging factor2K for track merging Margin in cm of Y position when rejecting edge clusters based on uncorrected track Y Max fraction of shared clusters for tracklet Except pad from cluster finding if total number of charges in a fragment is above this Except pad from cluster finding if number of consecutive charges in a fragment is above this Threshold where a timebin is considered disabling the noisy pad check for that pad Treat signal above this minimum as saturated Smoothing factor for the exponential Highly Ionising Particle tail filter Number of timebins to use for the averaging Add additional custom track errors when crossing relative as fraction of Do N fit passes in final fit of< 0:reject at max -n hits") AddOptionRTC(rejectIFCLowRadiusCluster, uint8_t, 1, "", 0, "Reject clusters that get the IFC mask error during refit") AddOptionRTC(dEdxTruncLow, uint8_t, 2, "", 0, "Low truncation threshold, fraction of 128") AddOptionRTC(dEdxTruncHigh, uint8_t, 77, "", 0, "High truncation threshold, fraction of 128") AddOptionRTC(extrapolationTracking, int8_t, 1, "", 0, "Enable Extrapolation Tracking(prolong tracks to adjacent sectors to find short segments)") AddOptionRTC(disableRefitAttachment, uint8_t, 0, "", 0, "Bitmask to disable certain attachment steps during refit(1:attachment, 2:propagation, 4:loop following, 8:mirroring)") AddOptionRTC(rejectionStrategy, uint8_t, o2::gpu::GPUSettings::RejectionStrategyA, "", 0, "Enable rejection of TPC clusters for compression(0=no, 1=strategy A, 2=strategy B)") AddOptionRTC(mergeLoopersAfterburner, uint8_t, 1, "", 0, "Run afterburner for additional looper merging") AddOptionRTC(compressionTypeMask, uint8_t, o2::gpu::GPUSettings::CompressionFull, "", 0, "TPC Compression mode bits(1=truncate charge/width LSB, 2=differences, 4=track-model)") AddOptionRTC(compressionSortOrder, uint8_t, o2::gpu::GPUSettings::SortTime, "", 0, "Sort order of TPC compression(0=time, 1=pad, 2=Z-time-pad, 3=Z-pad-time, 4=no sorting(use incoming order))") AddOptionRTC(sigBitsCharge, uint8_t, 4, "", 0, "Number of significant bits for TPC cluster charge in compression mode 1") AddOptionRTC(sigBitsWidth, uint8_t, 3, "", 0, "Number of significant bits for TPC cluster width in compression mode 1") AddOptionRTC(dropLoopers, uint8_t, 0, "", 0, "Drop looping tracks starting from second loop") AddOptionRTC(mergerInterpolateErrors, uint8_t, 1, "", 0, "Use interpolation instead of extrapolation for chi2 based cluster rejection") AddOptionRTC(mergerInterpolateRejectAlsoOnCurrentPosition, uint8_t, 1, "", 0, "When using mergerInterpolateErrors, reject based on chi2 twice computed with interpolated and current track position starting from NDF > mergerNonInterpolateRejectMinNDF Merge tracks accross the central electrode Enable PID response Add sub threshold clusters in TPC dEdx computation OR mask of TPC flags that will reject the cluster in alternative dEdx Reject edge clusters based on uncorrected track Y during track fit Increase decrease removal by when on this number of pads from the edge h configStandalone Reconstruction rec_trd Max chi2 for TRD tracklets to be matched to a track Chi2 cut for strict matching mode Number of sigmas for ITS TPC track time error estimate Addition to search road around track prolongation along Y in cm Optimal tracklet rphi resolution in maximum chi2 per attached tracklet for TRD tracks take into account the full likelihood of the slope including exponential tails Tracks with less attached tracklets are discarded after the tracking Post trigger Pile up integration time in BCs fits all iterations but the last one in projections Use material lookup table for TPC refit Apply workarounds to avoid cyclic merge should not be needed tpc dyn configStandalone Processing proc_rtc Replace constant variables static by constexpr expressions Compile RTC in deterministic with NO_FAST_MATH flags and GPUCA_DETERMINISTIC_MODE define Use RTC to optimize GPU code h configStandalone Processing proc_rtctech Use a file lock to serialize access to the cache folder int32_t
Contains statistical information for one source symbol, required for encoding/decoding.
constexpr size_t MessageSize
Class for time synchronization of RawReader instances.
SourceMessageProxy()=default
const auto & getMessage() const noexcept
constexpr source_T getMin() const noexcept
constexpr auto & get() const noexcept
constexpr source_T getMax() const noexcept
SourceMessage(size_t messageSize, source_T max=std::numeric_limits< source_T >::max(), source_T min=std::numeric_limits< source_T >::min())
size_t getCompressedDictionarySize(double_t safetyFactor=2) const
const_iterator begin() const noexcept
const_iterator end() const noexcept
source_type getOffset() const noexcept
static factory classes for building histograms, encoders and decoders.
GLsizei GLenum const void GLuint GLsizei GLfloat * metrics
GLuint GLsizei const GLchar * message
public interface for building and renorming histograms from source data.
dest_IT compressRenormedDictionary(const container_T &container, dest_IT dstBufferBegin)
RenormedDenseHistogram< source_T > readRenormedDictionary(buffer_IT begin, buffer_IT end, source_T min, source_T max, size_t renormingPrecision)
decltype(auto) renorm(histogram_T histogram, size_t newPrecision, RenormingPolicy renormingPolicy=RenormingPolicy::Auto, size_t lowProbabilityCutoffBits=0)
public interface for serializing histograms (dictionaries) to JSON or compressed binary.
static decltype(auto) fromSamples(source_IT begin, source_IT end)
static decltype(auto) fromSamples(source_IT begin, source_IT end, typename std::iterator_traits< source_IT >::value_type min, typename std::iterator_traits< source_IT >::value_type max)
boost::mp11::mp_list< uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t > source_types
BOOST_CHECK_EQUAL(triggersD.size(), triggers.size())
boost::mp11::mp_list< int8_t, int16_t, int32_t, int64_t > buffer_types
boost::mp11::mp_product< boost::mp11::mp_list, source_types, buffer_types > test_types
boost::mp11::mp_list< uint32_t, int32_t > adaptiveSource_types
adaptiveTest_types sparseTest_types
const SourceMessageProxy MessageProxy
boost::mp11::mp_product< boost::mp11::mp_list, source_types, buffer_types > adaptiveTest_types
BOOST_AUTO_TEST_CASE_TEMPLATE(testSerializeDeserializeEmptyHistogram, T, test_types)