17 #include "../../../GaudiKernel/tests/src/LogHistogram.h"
26 template <
typename Arithmetic, Gaudi::Accumulators::atomicity Atomicity>
36 auto randSvc = service<IRndmGenSvc>(
"RndmGenSvc",
true );
38 error() <<
"Unable to create Random generator" <<
endmsg;
43 for (
unsigned int iH = 0; iH <
m_nHistos; ++iH ) {
45 title <<
"Histogram Number " << iH;
53 for (
unsigned int iT = 0; iT <
m_nTracks; ++iT ) {
83 return Base::initialize().
andThen( [&] { m_custom_gauss_noinit.createHistogram( *
this ); } );
93 const double gauss( Gauss() );
94 const double gauss2( Gauss() );
95 const double flat( Flat() );
96 const double gauss3( Gauss3() );
100 ++m_gaussAbsName[
gauss];
101 ++m_gaussVflat[{ flat,
gauss }];
102 ++m_gaussVflatVgauss[{ flat,
gauss, gauss2 }];
103 ++m_gauss_noato[
gauss];
104 ++m_gaussVflat_noato[{ flat,
gauss }];
105 ++m_gaussVflatVgauss_noato[{ flat,
gauss, gauss2 }];
106 ++m_gauss_int[(int)
gauss];
107 ++m_gaussVflat_int[{ (int)flat, (
int)
gauss }];
108 ++m_gaussVflatVgauss_int[{ (int)flat, (
int)
gauss, (int)gauss2 }];
111 m_gauss_w[
gauss] += .5;
112 m_gaussVflat_w[{ flat,
gauss }] += .5;
113 m_gaussVflatVgauss_w[{ flat,
gauss, gauss2 }] += .5;
116 auto gauss_buf = m_gauss_buf.buffer();
117 auto gaussVflat_buf = m_gaussVflat_buf.buffer();
118 auto gaussVflatVgauss_buf = m_gaussVflatVgauss_buf.buffer();
119 for (
unsigned int i = 0; i < 10; i++ ) {
121 ++gaussVflat_buf[{ flat,
gauss }];
122 ++gaussVflatVgauss_buf[{ flat,
gauss, gauss2 }];
126 m_prof_gauss[
gauss] += gauss3;
127 m_prof_gaussVflat[{ flat,
gauss }] += gauss3;
128 m_prof_gaussVflatVgauss[{ flat,
gauss, gauss2 }] += gauss3;
129 m_prof_gauss_noato[
gauss] += gauss3;
130 m_prof_gaussVflat_noato[{ flat,
gauss }] += gauss3;
131 m_prof_gaussVflatVgauss_noato[{ flat,
gauss, gauss2 }] += gauss3;
132 m_prof_gauss_int[(int)
gauss] += (
int)gauss3;
133 m_prof_gaussVflat_int[{ (int)flat, (
int)
gauss }] += (int)gauss3;
134 m_prof_gaussVflatVgauss_int[{ (int)flat, (
int)
gauss, (int)gauss2 }] += (int)gauss3;
137 m_prof_gauss_w[
gauss] += { gauss3, .5 };
138 m_prof_gaussVflat_w[{ flat,
gauss }] += { gauss3, .5 };
139 m_prof_gaussVflatVgauss_w[{ flat,
gauss, gauss2 }] += { gauss3, .5 };
142 auto prof_gauss_buf = m_prof_gauss_buf.buffer();
143 auto prof_gaussVflat_buf = m_prof_gaussVflat_buf.buffer();
144 auto prof_gaussVflatVgauss_buf = m_prof_gaussVflatVgauss_buf.buffer();
145 for (
unsigned int i = 0; i < 10; i++ ) {
146 prof_gauss_buf[
gauss] += gauss3;
147 prof_gaussVflat_buf[{ flat,
gauss }] += gauss3;
148 prof_gaussVflatVgauss_buf[{ flat,
gauss, gauss2 }] += gauss3;
152 m_log_gauss[
gauss]++;
153 m_log_gaussVflat[{ flat,
gauss }]++;
156 ++m_custom_gauss_noprop[
gauss];
157 ++m_custom_gauss[
gauss];
158 ++m_custom_gaussVflat[{ flat,
gauss }];
159 ++m_custom_gaussVflatVgauss[{ flat,
gauss, gauss2 }];
160 m_custom_gauss_w[
gauss] += .5;
161 m_custom_gaussVflat_w[{ flat,
gauss }] += .5;
162 m_custom_gaussVflatVgauss_w[{ flat,
gauss, gauss2 }] += .5;
163 m_custom_prof_gauss[
gauss] += gauss3;
164 m_custom_prof_gaussVflat[{ flat,
gauss }] += gauss3;
165 m_custom_prof_gaussVflatVgauss[{ flat,
gauss, gauss2 }] += gauss3;
166 m_custom_prof_gauss_w[
gauss] += { gauss3, .5 };
167 m_custom_prof_gaussVflat_w[{ flat,
gauss }] += { gauss3, .5 };
168 m_custom_prof_gaussVflatVgauss_w[{ flat,
gauss, gauss2 }] += { gauss3, .5 };
169 ++m_custom_gauss_noinit[
gauss];
171 if ( m_nCalls.nEntries() == 0 ) always() <<
"Filling Histograms...... Please be patient !" <<
endmsg;
183 this,
"Empty1D",
"Empty 1D histogram", { 100, -5, 5,
"X" } };
185 this,
"Empty2D",
"Empty 2D histogram", { { 50, -5, 5,
"X" }, { 50, -5, 5,
"Y" } } };
187 this,
"Empty3D",
"Empty 3D histogram", { { 10, -5, 5,
"X" }, { 10, -5, 5,
"Y" }, { 10, -5, 5,
"Z" } } };
191 this,
"Gauss",
"Gaussian mean=0, sigma=1, atomic", { 100, -5, 5,
"X" } };
193 this,
"GaussFlat",
"Gaussian V Flat, atomic", { { 50, -5, 5,
"X" }, { 50, -5, 5,
"Y" } } };
197 "Gaussian V Flat V Gaussian, atomic",
198 { { 10, -5, 5,
"X" }, { 10, -5, 5,
"Y" }, { 10, -5, 5,
"Z" } } };
202 this,
"GaussNA",
"Gaussian mean=0, sigma=1, non atomic", { 100, -5, 5 } };
204 this,
"GaussFlatNA",
"Gaussian V Flat, non atomic", { { 50, -5, 5 }, { 50, -5, 5 } } };
208 "Gaussian V Flat V Gaussian, non atomic",
209 { { 10, -5, 5 }, { 10, -5, 5 }, { 10, -5, 5 } } };
213 this,
"GaussInt",
"Gaussian mean=0, sigma=1, integer values", { 10, -5, 5 } };
215 this,
"GaussFlatInt",
"Gaussian V Flat, integer values", { { 10, -5, 5 }, { 10, -5, 5 } } };
217 m_gaussVflatVgauss_int{
this,
219 "Gaussian V Flat V Gaussian, interger values",
220 { { 10, -5, 5 }, { 10, -5, 5 }, { 10, -5, 5 } } };
224 this,
"GaussW",
"Gaussian mean=0, sigma=1, weighted", { 100, -5, 5 } };
226 this,
"GaussFlatW",
"Gaussian V Flat, weighted", { { 50, -5, 5 }, { 50, -5, 5 } } };
230 "Gaussian V Flat V Gaussian, weighted",
231 { { 10, -5, 5 }, { 10, -5, 5 }, { 10, -5, 5 } } };
235 this,
"GaussBuf",
"Gaussian mean=0, sigma=1, buffered", { 100, -5, 5 } };
237 this,
"GaussFlatBuf",
"Gaussian V Flat, buffered", { { 50, -5, 5 }, { 50, -5, 5 } } };
241 "Gaussian V Flat V Gaussian, buffered",
242 { { 10, -5, 5 }, { 10, -5, 5 }, { 10, -5, 5 } } };
248 this,
"ProfGauss",
"Profile, Gaussian mean=0, sigma=1, atomic", { 100, -5, 5 } };
250 this,
"ProfGaussFlat",
"Profile, Gaussian V Flat, atomic", { { 50, -5, 5 }, { 50, -5, 5 } } };
253 "ProfGaussFlatGauss",
254 "Profile, Gaussian V Flat V Gaussian, atomic",
255 { { 10, -5, 5 }, { 10, -5, 5 }, { 10, -5, 5 } } };
259 this,
"ProfGaussNA",
"Profile, Gaussian mean=0, sigma=1, non atomic", { 100, -5, 5 } };
261 m_prof_gaussVflat_noato{
262 this,
"ProfGaussFlatNA",
"Profile, Gaussian V Flat, non atomic", { { 50, -5, 5 }, { 50, -5, 5 } } };
264 m_prof_gaussVflatVgauss_noato{
this,
265 "ProfGaussFlatGaussNA",
266 "Profile, Gaussian V Flat V Gaussian, non atomic",
267 { { 10, -5, 5 }, { 10, -5, 5 }, { 10, -5, 5 } } };
272 this,
"ProfGaussInt",
"Profile, Gaussian mean=0, sigma=1, integer values", { 10, -5, 5 } };
274 m_prof_gaussVflat_int{
this,
276 "Profile, Gaussian V Flat, integer values",
277 { { 10, -5, 5 }, { 10, -5, 5 } } };
279 m_prof_gaussVflatVgauss_int{
this,
280 "ProfGaussFlatGaussInt",
281 "Profile, Gaussian V Flat V Gaussian, interger values",
282 { { 10, -5, 5 }, { 10, -5, 5 }, { 10, -5, 5 } } };
286 this,
"ProfGaussW",
"Profile, Gaussian mean=0, sigma=1, weighted", { 100, -5, 5 } };
288 this,
"ProfGaussFlatW",
"Profile, Gaussian V Flat, weighted", { { 50, -5, 5 }, { 50, -5, 5 } } };
291 "ProfGaussFlatGaussW",
292 "Profile, Gaussian V Flat V Gaussian, weighted",
293 { { 10, -5, 5 }, { 10, -5, 5 }, { 10, -5, 5 } } };
297 this,
"ProfGaussBuf",
"Profile, Gaussian mean=0, sigma=1, buffered", { 100, -5, 5 } };
299 this,
"ProfGaussFlatBuf",
"Profile, Gaussian V Flat, buffered", { { 50, -5, 5 }, { 50, -5, 5 } } };
302 "ProfGaussFlatGaussBuf",
303 "Profile, Gaussian V Flat V Gaussian, buffered",
304 { { 10, -5, 5 }, { 10, -5, 5 }, { 10, -5, 5 } } };
307 mutable Accumulators::LogHistogram<1> m_log_gauss{
this,
"LogGauss",
"Log, Gaussian", { 5, 0, 2 } };
308 mutable Accumulators::LogHistogram<2, Accumulators::atomicity::full, float> m_log_gaussVflat{
309 this,
"LogGaussFlat",
"LogLog, Gaussian V Flat", { { 5, 0, 2 }, { 5, 0, 2 } } };
313 this,
"/TopDir/SubDir/Gauss",
"Gaussian mean=0, sigma=1, atomic", { 100, -5, 5,
"X" } };
317 this,
"CustomGaussNoProp",
"Gaussian mean=0, sigma=1, atomic", { 100, -5, 5,
"X" } };
329 "CustomProfGaussFlatGauss" };
333 "CustomProfGaussFlatW" };
335 this,
"CustomProfGaussFlatGaussW" };
354 const double gauss( Gauss() );
355 const double gauss2( Gauss() );
356 const double flat( Flat() );
360 ++m_gaussVflat[{ flat,
gauss }];
361 ++m_gaussVflatVgauss[{ flat,
gauss, gauss2 }];
364 auto gauss_buf = m_gauss_buf.buffer();
365 auto gaussVflat_buf = m_gaussVflat_buf.buffer();
366 auto gaussVflatVgauss_buf = m_gaussVflatVgauss_buf.buffer();
367 for (
unsigned int i = 0; i < 10; i++ ) {
369 ++gaussVflat_buf[{ flat,
gauss }];
370 ++gaussVflatVgauss_buf[{ flat,
gauss, gauss2 }];
374 ++m_custom_gauss[
gauss];
375 ++m_custom_gaussVflat[{ flat,
gauss }];
376 ++m_custom_gaussVflatVgauss[{ flat,
gauss, gauss2 }];
378 if ( m_nCalls.nEntries() == 0 ) always() <<
"Filling Histograms...... Please be patient !" <<
endmsg;
390 this,
"Gauss",
"Gaussian mean=0, sigma=1, atomic", { 100, -5, 5,
"X" } };
392 this,
"GaussFlat",
"Gaussian V Flat, atomic", { { 50, -5, 5,
"X" }, { 50, -5, 5,
"Y" } } };
396 "Gaussian V Flat V Gaussian, atomic",
397 { { 10, -5, 5,
"X" }, { 10, -5, 5,
"Y" }, { 10, -5, 5,
"Z" } } };
401 this,
"GaussBuf",
"Gaussian mean=0, sigma=1, buffered", { 100, -5, 5 } };
403 this,
"GaussFlatBuf",
"Gaussian V Flat, buffered", { { 50, -5, 5 }, { 50, -5, 5 } } };
407 "Gaussian V Flat V Gaussian, buffered",
408 { { 10, -5, 5 }, { 10, -5, 5 }, { 10, -5, 5 } } };
412 "Gaussian mean=0, sigma=1, atomic" };
414 "Gaussian V Flat, atomic" };
416 "Gaussian V Flat V Gaussian, atomic" };