Commit 2da8d13c authored by Sebastien Ponce's avatar Sebastien Ponce
Browse files

Fixed bug in BinomialCounter when using buffer

Credits to @jonrob for the discovery
I've added some lines to the unit test so that the problem can now be
identified in the nightlies, should it come back
parent 867547b9
......@@ -51,7 +51,7 @@ int main()
std::cout << sig << std::endl;
}
// Testing AveragingCounter wiht buffering
// Testing AveragingCounter with buffering
{
AveragingCounter<float, atomicity::full> avg2;
{
......@@ -72,6 +72,20 @@ int main()
std::cout << bin << std::endl;
}
// Testing Binomialcounter with buffers
{
BinomialCounter<> bin;
{
auto bufBin = bin.buffer();
bufBin += false;
bufBin += true;
bufBin += true;
bufBin += false;
bufBin += false;
}
std::cout << bin << std::endl;
}
// Testing StatEntity, the backward compatible counter
{
StatEntity se;
......
......@@ -5,6 +5,7 @@
#=3 Sum=14 Mean= 4.667 +- 1.2472
#=1000 Sum=4.995e+05 Mean= 499.5
#=5 Sum=2 Eff=|( 40.00000 +- 21.9089 )%|
#=5 Sum=2 Eff=|( 40.00000 +- 21.9089 )%|
#=3 Sum=14 Mean= 4.667 +- 1.2472 Min/Max= 3.000/6.000
#=5 Sum=2 Mean= 0.4000 +- 0.48990 Min/Max= 0.000/1.000
#=3 Sum=14 Mean= 4.667 +- 1.2472 Min/Max= 3.000/6.000
......@@ -768,9 +768,9 @@ namespace Gaudi
* @see Gaudi::Accumulators for detailed documentation
*/
template <typename Arithmetic = double, atomicity Atomicity = atomicity::full>
struct BinomialCounter : BufferableCounter<bool, Atomicity, BinomialCounter>,
struct BinomialCounter : BufferableCounter<Arithmetic, Atomicity, BinomialCounter>,
BinomialAccumulator<Arithmetic, Atomicity> {
using BufferableCounter<bool, Atomicity, BinomialCounter>::BufferableCounter;
using BufferableCounter<Arithmetic, Atomicity, BinomialCounter>::BufferableCounter;
std::ostream& print( std::ostream& o, bool tableFormat = false ) const override
{
std::string fmt;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment