Loading [MathJax]/extensions/tex2jax.js
Go to the documentation of this file.
22 #include "CLHEP/Matrix/Matrix.h"
23 #include "CLHEP/Matrix/Vector.h"
38 using namespace CLHEP;
45 double*
begin( CLHEP::HepVector&
v ) {
return &
v[0]; }
46 const double*
begin(
const CLHEP::HepVector&
v ) {
return &
v[0]; }
64 using GaudiTupleAlg::GaudiTupleAlg;
71 Assert( randSvc() != 0,
"Random Service is not available!" );
115 Tuple tuple1 =
nTuple( 1,
"Trivial Row-Wise Tuple", CLID_RowWiseTuple );
128 tuple1->
column(
"pois2", (
int)poisson(), 0, 14 ).
ignore();
129 tuple1->
column(
"bino2", (
int)binom(), 0, 14 ).
ignore();
140 Tuple tuple2 =
nTuple(
"two",
"Column-Wise Tuple" );
153 tuple2->
column(
"pois2", (
int)poisson(), 0, 10 ).
ignore();
154 tuple2->
column(
"bino2", (
int)binom(), 0, 10 ).
ignore();
165 Tuple tuple3 =
nTuple( 3,
"Fixed-size arrays/vectors" );
168 const size_t nCol = 50;
170 for (
size_t i = 0; i < nCol; ++i ) {
array[i] = (float)flat(); }
178 const size_t nCol = 62;
180 for (
size_t i = 0; i <
array.size(); ++i ) {
array[i] = expo(); }
187 const size_t nCol = 42;
189 for (
size_t i = 0; i < nCol; ++i ) {
array[i] =
gauss(); }
196 const size_t nCol = 42;
197 CLHEP::HepVector
array( nCol );
198 for (
size_t i = 0; i < nCol; ++i ) {
array[i] =
gauss(); }
210 Tuple tuple4 =
nTuple(
"subdir/four",
"Fixed-size matrices" );
214 const size_t nRow = 15;
215 const size_t nCol = 5;
217 double mtrx[nRow][nCol];
219 for (
size_t iRow = 0; iRow < nRow; ++iRow ) {
220 for (
size_t iCol = 0; iCol < nCol; ++iCol ) { mtrx[iRow][iCol] =
gauss(); }
231 const size_t nRow = 26;
232 const size_t nCol = 4;
234 Mtrx mtrx( nRow,
Row( nCol ) );
236 for (
size_t iRow = 0; iRow < nRow; ++iRow ) {
237 for (
size_t iCol = 0; iCol < nCol; ++iCol ) { mtrx[iRow][iCol] = flat(); }
245 const size_t nRow = 13;
246 const size_t nCol = 3;
247 CLHEP::HepMatrix mtrx( nRow, nCol );
248 for (
int iCol = 0; iCol < mtrx.num_col(); ++iCol ) {
249 for (
int iRow = 0; iRow < mtrx.num_row(); ++iRow ) { mtrx[iRow][iCol] = expo(); }
252 tuple4->
matrix(
"mexpo", mtrx, mtrx.num_row(), mtrx.num_col() ).
ignore();
260 Tuple tuple5 =
nTuple( 5,
"Variable-size arrays/vectors" );
263 const size_t num = (size_t)poisson();
270 const size_t num = (size_t)poisson();
275 ->
farray( { {
"sinar", sinf }, {
"cosar", cosf }, {
"tanar", tanf } },
array.begin(),
array.end(),
"Len2", 100 )
284 Tuple tuple6 =
nTuple(
"six",
"Variable-size matrices" );
287 const size_t num = (size_t)poisson();
290 const size_t nCol = 15;
292 Mtrx mtrx( num,
Row( nCol ) );
294 for (
size_t iRow = 0; iRow < num; ++iRow ) {
295 for (
size_t iCol = 0; iCol < nCol; ++iCol ) { mtrx[iRow][iCol] =
gauss(); }
298 tuple6->
fmatrix(
"mgau", mtrx.begin(), mtrx.end(), nCol,
"Len1", 100 ).
ignore();
302 const size_t num = (size_t)poisson();
305 const size_t nCol = 15;
307 Mtrx mtrx( num,
Row( nCol ) );
309 for (
size_t iRow = 0; iRow < num; ++iRow ) {
310 for (
size_t iCol = 0; iCol < nCol; ++iCol ) { mtrx[iRow][iCol] = expo(); }
323 const size_t num = (size_t)poisson();
329 typedef double ( *fun )( double );
331 Funs funs{ sin, cos, tan, sinh, cosh, tanh };
335 funs.begin(), funs.end(),
array.begin(),
array.end(),
"Len3", 100 )
340 const size_t num = (size_t)poisson();
342 const size_t nCol = 15;
344 CLHEP::HepMatrix mtrx( num, nCol );
346 for (
size_t iRow = 0; iRow < num; ++iRow ) {
347 for (
size_t iCol = 0; iCol < nCol; ++iCol ) { mtrx[iRow][iCol] = expo(); }
363 static unsigned long long evtID( 1e14 );
367 Tuple tuple7 =
nTuple(
"typesCW",
"Types Test Column Wise" );
372 tuple7->
column(
"short", (
short)randomRange<char>() ).
ignore();
373 tuple7->
column(
"ushort", (
unsigned short)randomRange<unsigned char>() ).
ignore();
374 tuple7->
column(
"int", (
int)randomRange<char>() ).
ignore();
375 tuple7->
column(
"uint", (
unsigned int)randomRange<unsigned char>() ).
ignore();
376 tuple7->
column(
"long", (
long)randomRange<char>() ).
ignore();
377 tuple7->
column(
"ulong", (
unsigned long)randomRange<unsigned char>() ).
ignore();
378 tuple7->
column(
"longlong", (
long long)randomRange<char>() ).
ignore();
379 tuple7->
column(
"ulonglong", (
unsigned long long)randomRange<unsigned char>() ).
ignore();
381 tuple7->
column(
"uchar", randomRange<unsigned char>() ).
ignore();
387 Tuple tuple8 =
nTuple(
"typesRW",
"Types Test Row Wise", CLID_RowWiseTuple );
392 tuple8->
column(
"short", (
short)randomRange<char>() ).
ignore();
393 tuple8->
column(
"ushort", (
unsigned short)randomRange<unsigned char>() ).
ignore();
394 tuple8->
column(
"int", (
int)randomRange<char>() ).
ignore();
395 tuple8->
column(
"uint", (
unsigned int)randomRange<unsigned char>() ).
ignore();
396 tuple8->
column(
"long", (
long)randomRange<char>() ).
ignore();
397 tuple8->
column(
"ulong", (
unsigned long)randomRange<unsigned char>() ).
ignore();
398 tuple8->
column(
"longlong", (
long long)randomRange<char>() ).
ignore();
399 tuple8->
column(
"ulonglong", (
unsigned long long)randomRange<unsigned char>() ).
ignore();
401 tuple8->
column(
"uchar", randomRange<unsigned char>() ).
ignore();
TupleAlg(const TupleAlg &)=delete
def nTuple(dirpath, ID, ID2=None, topdir=None, LUN="FILE1")
StatusCode execute() override
the only one essential method
KeyedObjectManager< array > Array
Forward declaration of specialized redirection array object manager.
StatusCode initialize() override
initialize the algorithm
StatusCode column(std::string_view name, float value)
Set the value for selected tuple column.
StatusCode matrix(std::string_view name, const MATRIX &data, const MIndex &rows, const MIndex &cols)
fill N-Tuple with fixed-size matrix
T back_inserter(T... args)
EventIDBase max(const EventIDBase &lhs, const EventIDBase &rhs)
StatusCode array(std::string_view name, DATA first, DATA last)
fill N-Tuple with fixed-size array
Parameters for the flat random number generation within boundaries [minimum, maximum].
Parameters for the Gauss random number generation.
Random number accessor This small class encapsulates the use of the random number generator.
double * begin(CLHEP::HepVector &v)
Parameters for the BreitWigner distributed random number generation.
StatusCode fmatrix(std::string_view name, const MATRIX &data, size_t rows, const MIndex &cols, std::string_view length, size_t maxv)
Fill N-Tuple with data from variable-size matrix.
A simple wrapper class over standard Gaudi NTuple::Tuple facility.
EventIDBase min(const EventIDBase &lhs, const EventIDBase &rhs)
const StatusCode & ignore() const
Allow discarding a StatusCode without warning.
constexpr static const auto SUCCESS
struct GAUDI_API array
Parametrisation class for redirection array - like implementation.
#define DECLARE_COMPONENT(type)
TupleAlg & operator=(const TupleAlg &)=delete
StatusCode write()
write a record to NTuple
StatusCode farray(std::string_view name, ITERATOR1 &&first, ITERATOR2 &&last, std::string_view length, size_t maxv)
Add an indexed array (of type float) to N-tuple.
Parameters for the Gauss random number generation.
Parameters for the Poisson distributed random number generation with a given mean.
StatusCode initialize() override
standard initialization method
Parameters for the Binomial distributed random number generation.