51 std::vector<NTuple::Item<double>>
d;
52 std::vector<NTuple::Item<float>>
f;
53 std::vector<NTuple::Item<int>>
i;
54 std::vector<NTuple::Item<bool>>
b;
55 std::vector<NTuple::Array<double>>
var;
56 std::vector<NTuple::Array<int>>
var2;
57 std::vector<NTuple::Array<float>>
fixed;
58 std::vector<NTuple::Matrix<double>>
mat;
59 std::vector<NTuple::Matrix<float>>
fmat;
72 const int nEach = std::max( 1,
m_nColumns / 9 );
75 auto blk = std::make_unique<Block>();
76 std::string path =
m_dir.value() +
"/t" + std::to_string( t );
77 blk->tuple =
ntupleSvc()->book( path, CLID_ColumnWiseTuple,
"wide tuple " + std::to_string( t ) );
82 blk->d.resize( nEach );
83 blk->f.resize( nEach );
84 blk->i.resize( nEach );
85 blk->b.resize( nEach );
86 blk->var.resize( nEach );
87 blk->var2.resize( nEach );
88 blk->fixed.resize( nEach );
89 blk->mat.resize( nEach );
90 blk->fmat.resize( nEach );
96 for (
int c = 0; c < nEach; ++c ) {
97 const auto s = std::to_string( c );
102 if ( blk->tuple->addIndexedItem(
"var" + s, blk->n, blk->var[c] ).isFailure() )
return StatusCode::FAILURE;
103 if ( blk->tuple->addIndexedItem(
"var2_" + s, blk->m, blk->var2[c] ).isFailure() )
return StatusCode::FAILURE;
104 if ( blk->tuple->addItem(
"fix" + s, 3, blk->fixed[c] ).isFailure() )
return StatusCode::FAILURE;
105 if ( blk->tuple->addIndexedItem(
"mat" + s, blk->n, 2, blk->mat[c] ).isFailure() )
return StatusCode::FAILURE;
106 if ( blk->tuple->addItem(
"fmat" + s, 2, 3, blk->fmat[c] ).isFailure() )
return StatusCode::FAILURE;
108 m_blocks.push_back( std::move( blk ) );
118 for (
size_t t = 0; t <
m_blocks.size(); ++t ) {
121 blk.n = ( e * 3 +
static_cast<int>( t ) ) % (
m_maxArray + 1 );
122 blk.m = ( e * 5 + 2 *
static_cast<int>( t ) ) % (
m_maxArray + 1 );
123 for (
size_t c = 0; c < blk.d.size(); ++c ) {
124 const double v = 1000.0 * t + 10.0 * e + c;
126 blk.f[c] =
static_cast<float>( -v );
127 blk.i[c] =
static_cast<int>( v );
128 blk.b[c] = ( ( e + c ) % 2 ) == 0;
129 for (
int k = 0; k < blk.n; ++k ) {
130 blk.var[c][k] = v + 0.25 * k;
131 blk.mat[c][k][0] = v + 0.5 * k;
132 blk.mat[c][k][1] = v - 0.5 * k;
134 for (
int k = 0; k < blk.m; ++k ) blk.var2[c][k] =
static_cast<int>( v ) - k;
135 for (
int k = 0; k < 3; ++k ) blk.fixed[c][k] =
static_cast<float>( v + k );
136 for (
int k = 0; k < 2; ++k )
137 for (
int l = 0; l < 3; ++l ) blk.fmat[c][k][l] =
static_cast<float>( v + 10 * k + l );
139 if ( blk.tuple->write().isFailure() ) {
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
#define DECLARE_COMPONENT(type)
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Algorithm(std::string name, ISvcLocator *svcloc, std::string version=PACKAGE_VERSION)
Constructor.
StatusCode initialize() override
the default (empty) implementation of IStateful::initialize() method
SmartIF< INTupleSvc > & ntupleSvc() const
The standard N tuple service.
Implementation of property with value of concrete type.
Class acting as a smart pointer holding a N tuple _Item.
Abstract base class which allows the user to interact with the actual N tuple implementation.
This class is used for returning status codes from appropriate routines.
constexpr static const auto SUCCESS
constexpr static const auto FAILURE
Books a configurable grid of column-wise tuples: many trees, many columns, few entries.
std::vector< std::unique_ptr< Block > > m_blocks
Gaudi::Property< int > m_nColumns
Gaudi::Property< std::string > m_dir
Gaudi::Property< int > m_maxArray
StatusCode execute() override
StatusCode initialize() override
Gaudi::Property< int > m_entries
Gaudi::Property< int > m_nTuples
One booked tuple and everything written into it.
std::vector< NTuple::Matrix< double > > mat
std::vector< NTuple::Matrix< float > > fmat
std::vector< NTuple::Array< int > > var2
std::vector< NTuple::Item< double > > d
std::vector< NTuple::Item< int > > i
std::vector< NTuple::Array< double > > var
std::vector< NTuple::Item< bool > > b
std::vector< NTuple::Item< float > > f
std::vector< NTuple::Array< float > > fixed