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]; }
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();
274 tuple5->
farray( {{
"sinar", sinf}, {
"cosar", cosf}, {
"tanar", tanf}},
array.begin(),
array.end(),
"Len2", 100 )
283 Tuple tuple6 =
nTuple(
"six",
"Variable-size matrices" );
286 const size_t num = (size_t)poisson();
289 const size_t nCol = 15;
291 Mtrx mtrx( num,
Row( nCol ) );
293 for (
size_t iRow = 0; iRow < num; ++iRow ) {
294 for (
size_t iCol = 0; iCol < nCol; ++iCol ) { mtrx[iRow][iCol] =
gauss(); }
297 tuple6->
fmatrix(
"mgau", mtrx.begin(), mtrx.end(), nCol,
"Len1", 100 ).
ignore();
301 const size_t num = (size_t)poisson();
304 const size_t nCol = 15;
306 Mtrx mtrx( num,
Row( nCol ) );
308 for (
size_t iRow = 0; iRow < num; ++iRow ) {
309 for (
size_t iCol = 0; iCol < nCol; ++iCol ) { mtrx[iRow][iCol] = expo(); }
322 const size_t num = (size_t)poisson();
328 typedef double ( *fun )( double );
330 Funs funs{sin, cos, tan, sinh, cosh, tanh};
334 funs.begin(), funs.end(),
array.begin(),
array.end(),
"Len3", 100 )
339 const size_t num = (size_t)poisson();
341 const size_t nCol = 15;
343 CLHEP::HepMatrix mtrx( num, nCol );
345 for (
size_t iRow = 0; iRow < num; ++iRow ) {
346 for (
size_t iCol = 0; iCol < nCol; ++iCol ) { mtrx[iRow][iCol] = expo(); }
362 static unsigned long long evtID( 1e14 );
366 Tuple tuple7 =
nTuple(
"typesCW",
"Types Test Column Wise" );
371 tuple7->
column(
"short", (
short)randomRange<char>() ).
ignore();
372 tuple7->
column(
"ushort", (
unsigned short)randomRange<unsigned char>() ).
ignore();
373 tuple7->
column(
"int", (
int)randomRange<char>() ).
ignore();
374 tuple7->
column(
"uint", (
unsigned int)randomRange<unsigned char>() ).
ignore();
375 tuple7->
column(
"long", (
long)randomRange<char>() ).
ignore();
376 tuple7->
column(
"ulong", (
unsigned long)randomRange<unsigned char>() ).
ignore();
377 tuple7->
column(
"longlong", (
long long)randomRange<char>() ).
ignore();
378 tuple7->
column(
"ulonglong", (
unsigned long long)randomRange<unsigned char>() ).
ignore();
380 tuple7->
column(
"uchar", randomRange<unsigned char>() ).
ignore();
386 Tuple tuple8 =
nTuple(
"typesRW",
"Types Test Row Wise", CLID_RowWiseTuple );
391 tuple8->
column(
"short", (
short)randomRange<char>() ).
ignore();
392 tuple8->
column(
"ushort", (
unsigned short)randomRange<unsigned char>() ).
ignore();
393 tuple8->
column(
"int", (
int)randomRange<char>() ).
ignore();
394 tuple8->
column(
"uint", (
unsigned int)randomRange<unsigned char>() ).
ignore();
395 tuple8->
column(
"long", (
long)randomRange<char>() ).
ignore();
396 tuple8->
column(
"ulong", (
unsigned long)randomRange<unsigned char>() ).
ignore();
397 tuple8->
column(
"longlong", (
long long)randomRange<char>() ).
ignore();
398 tuple8->
column(
"ulonglong", (
unsigned long long)randomRange<unsigned char>() ).
ignore();
400 tuple8->
column(
"uchar", randomRange<unsigned char>() ).
ignore();
TupleAlg(const TupleAlg &)=delete
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
T back_inserter(T... args)
EventIDBase max(const EventIDBase &lhs, const EventIDBase &rhs)
Parameters for the flat random number generation within boundaries [minimum, maximum].
StatusCode column(const std::string &name, float value)
Set the value for selected tuple column.
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.
A simple wrapper class over standard Gaudi NTuple::Tuple facility.
EventIDBase min(const EventIDBase &lhs, const EventIDBase &rhs)
StatusCode fmatrix(const std::string &name, const MATRIX &data, size_t rows, const MIndex &cols, const std::string &length, size_t maxv)
Fill N-Tuple with data from variable-size matrix.
StatusCode farray(const std::string &name, ITERATOR1 &&first, ITERATOR2 &&last, const std::string &length, size_t maxv)
Add an indexed array (of type float) to N-tuple.
StatusCode matrix(const std::string &name, const MATRIX &data, const MIndex &rows, const MIndex &cols)
fill N-Tuple with fixed-size matrix
const StatusCode & ignore() const
Allow discarding a StatusCode without warning.
def nTuple(dirpath, ID, ID2=None, topdir=None, LUN='FILE1')
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 array(const std::string &name, DATA first, DATA last)
fill N-Tuple with fixed-size array
StatusCode write()
write a record to NTuple
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.