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() ...@@ -51,7 +51,7 @@ int main()
std::cout << sig << std::endl; std::cout << sig << std::endl;
} }
// Testing AveragingCounter wiht buffering // Testing AveragingCounter with buffering
{ {
AveragingCounter<float, atomicity::full> avg2; AveragingCounter<float, atomicity::full> avg2;
{ {
...@@ -72,6 +72,20 @@ int main() ...@@ -72,6 +72,20 @@ int main()
std::cout << bin << std::endl; 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 // Testing StatEntity, the backward compatible counter
{ {
StatEntity se; StatEntity se;
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#=3 Sum=14 Mean= 4.667 +- 1.2472 #=3 Sum=14 Mean= 4.667 +- 1.2472
#=1000 Sum=4.995e+05 Mean= 499.5 #=1000 Sum=4.995e+05 Mean= 499.5
#=5 Sum=2 Eff=|( 40.00000 +- 21.9089 )%| #=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 #=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 #=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 #=3 Sum=14 Mean= 4.667 +- 1.2472 Min/Max= 3.000/6.000
...@@ -768,9 +768,9 @@ namespace Gaudi ...@@ -768,9 +768,9 @@ namespace Gaudi
* @see Gaudi::Accumulators for detailed documentation * @see Gaudi::Accumulators for detailed documentation
*/ */
template <typename Arithmetic = double, atomicity Atomicity = atomicity::full> template <typename Arithmetic = double, atomicity Atomicity = atomicity::full>
struct BinomialCounter : BufferableCounter<bool, Atomicity, BinomialCounter>, struct BinomialCounter : BufferableCounter<Arithmetic, Atomicity, BinomialCounter>,
BinomialAccumulator<Arithmetic, Atomicity> { 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::ostream& print( std::ostream& o, bool tableFormat = false ) const override
{ {
std::string fmt; 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