Go to the documentation of this file.
36 #pragma GCC diagnostic push
37 #pragma GCC diagnostic ignored "-Wnull-dereference"
39 assert( it !=
nullptr );
40 return it->
range().upper();
41 #pragma GCC diagnostic pop
48 TYP low = source->
range().lower();
49 TYP high = source->
range().upper();
50 long hasIdx = source->hasIndex();
51 long ndim = source->ndim();
54 long dim[4], idxLen = 0;
55 long dim1 = 1, dim2 = 1;
57 for (
int i = 0; i < ndim; i++ ) dim[i] = source->dim( i );
61 idxName =
index->name();
62 switch (
index->type() ) {
64 idxLen = upper<unsigned char>(
index );
67 idxLen = upper<unsigned short>(
index );
70 idxLen = upper<unsigned int>(
index );
73 idxLen = upper<unsigned long>(
index );
76 idxLen = upper<char>(
index );
79 idxLen = upper<short>(
index );
82 idxLen = upper<int>(
index );
85 idxLen = upper<long>(
index );
97 dim1 = ( hasIdx ) ? idxLen : dim[0];
101 dim1 = ( hasIdx ) ? idxLen : dim[0];
102 dim2 = ( hasIdx ) ? dim[0] : dim[1];
108 return tuple->
add( it );
157 for (
auto attrib : Parser(
m_output ) ) {
158 switch ( ::
toupper( attrib.tag[0] ) ) {
200 for (
const auto& i : nt->
items() ) {
201 switch ( i->type() ) {
203 status = createItem<unsigned char>(
log, tuple, i, 0 );
206 status = createItem<unsigned short>(
log, tuple, i, 0 );
209 status = createItem<unsigned int>(
log, tuple, i, 0 );
212 status = createItem<unsigned long>(
log, tuple, i, 0 );
215 status = createItem<char>(
log, tuple, i, 0 );
218 status = createItem<short>(
log, tuple, i, 0 );
221 status = createItem<int>(
log, tuple, i, 0 );
224 status = createItem<long>(
log, tuple, i, 0 );
227 status = createItem(
log, tuple, i,
false );
230 status = createItem<float>(
log, tuple, i, 0 );
233 status = createItem<double>(
log, tuple, i, 0 );
236 status = createItem<IOpaqueAddress*>(
log, tuple, i,
nullptr );
239 status = createItem<void*>(
log, tuple, i,
nullptr );
259 if ( clone && src ) {
265 for (
auto i = clone_items.
begin(); i != clone_items.
end(); ++i ) {
270 log <<
"Tuple item " << nam <<
" not present in " << src_id <<
endmsg;
273 if ( itm->
type() != src_itm->
type() ) {
274 log <<
"Tuple item " << nam <<
" are of different types in " << src_id <<
":" << src_itm->
typeName()
278 if ( itm->
ndim() != src_itm->
ndim() ) {
279 log <<
"Tuple item " << nam <<
" have different dimensions in " << src_id <<
":" << src_itm->
ndim() <<
" <-> "
283 for (
int j = 0;
j < itm->
ndim(); ++
j ) {
284 if ( src_itm->
dim(
j ) != itm->
dim(
j ) ) {
285 log <<
"Tuple item " << nam <<
" have different dimensions in " << src_id <<
"[" <<
j
286 <<
"]:" << src_itm->
dim(
j ) <<
" <-> " << clone_id <<
"[" <<
j <<
"]:" << itm->
dim(
j ) <<
endmsg;
291 log <<
"Tuple item " << nam <<
" has different index colums " << src_id <<
":" << src_itm->
hasIndex()
297 log <<
"Tuple item " << nam <<
" has different index colums " << src_id <<
":" << src_itm->
index()
298 <<
" <-> " << clone_id <<
":" << itm->
index() <<
endmsg;
317 size_t k = 0, nentry = 0;
320 for ( k = 0; k < source_items.
size(); ++k ) {
328 INTuple::ItemContainer::const_iterator i;
330 for ( k = 0, i = source_items.
begin(); i != source_items.
end(); ++i, ++k ) {
334 switch ( ( *i )->type() ) {
336 size =
sizeof(
unsigned char );
339 size =
sizeof(
unsigned short );
342 size =
sizeof(
unsigned int );
345 size =
sizeof(
unsigned long );
348 size =
sizeof( char );
351 size =
sizeof( short );
354 size =
sizeof( int );
357 size =
sizeof( long );
360 size =
sizeof( bool );
363 size =
sizeof( float );
366 size =
sizeof( double );
373 size = ::strlen( (
const char*)src_itm->
buffer() ) + 1;
376 *(
void**)out_itm->
buffer() = *(
void**)src_itm->
buffer();
401 log <<
MSG::INFO <<
"End of reading tuple " << input <<
" after " << nentry <<
" entries." <<
endmsg;
414 for (
size_t i = 0; i <
m_inputs.size(); ++i ) {
416 if ( !( 0 == nt ) ) {
429 nt->attachSelector( stmt ).ignore( );
448 for (
const auto& input :
m_inputs ) {
virtual StatusCode book(const NTuple::Tuple *nt)
Book the N-tuple according to the specification.
virtual const ItemRange & range() const =0
Access the range if specified.
StatusCode finalize() override
Finalize.
virtual long type() const =0
Type information of the item.
void toupper(std::string &s)
Gaudi::Property< std::string > m_output
virtual const std::string & index() const =0
Access the index _Item.
constexpr auto size(const T &, Args &&...) noexcept
virtual long length() const =0
Access the buffer length.
std::string m_criteria
Selection criteria (if any)
const std::string & name() const override
The identifying name of the algorithm object.
const std::string & type() const override
The type of the algorithm object.
std::string m_outName
Output tuple name.
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
StatusCode execute() override
Execute procedure.
Alias for backward compatibility.
SmartIF< ISvcLocator > & serviceLocator() const override
The standard service locator.
virtual long ndim() const =0
Dimension.
Gaudi::Property< std::vector< std::string > > m_inputs
virtual const INTupleItem * find(const std::string &name) const =0
Find an item row of the Ntuple (CONST)
SmartIF< INTupleSvc > m_dataSvc
Reference to data provider service.
std::string m_selectorName
Selector factory.
Abstract class describing basic data in an Ntuple.
virtual ItemContainer & items()=0
Access item container.
virtual bool hasIndex() const =0
Is the tuple have an index item?
StatusCode initialize() override
Initialize.
static _Item * create(INTuple *tup, const std::string &name, const std::type_info &info, TYP min, TYP max, TYP def)
Create instance.
StatusCode mergeInputTuples()
Merge all N-tuple entries.
virtual const void * buffer() const =0
Access data buffer (CONST)
std::string m_rootName
Name of the root leaf (obtained at initialize)
virtual std::string typeName() const =0
Proper type name of the object.
virtual StatusCode add(INTupleItem *item)=0
Add an item row to the N tuple.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
static _Matrix * create(INTuple *tup, const std::string &name, const std::type_info &info, const std::string &index, long ncol, long nrow, TYP min, TYP max, TYP def)
Create instance.
virtual long dim(long i) const =0
Access individual dimensions.
virtual StatusCode checkInput(const NTuple::Tuple *clone, const NTuple::Tuple *src)
TYPE * ptr()
Automatic conversion to data type.
constexpr static const auto SUCCESS
TYPE * get() const
Get interface pointer.
A small class used to access easily (and efficiently) data items residing in data stores.
Abstract base class which allows the user to interact with the actual N tuple implementation.
#define DECLARE_COMPONENT(type)
StatusCode service(std::string_view name, T *&psvc, bool createIf=true) const
Access a service by name, creating it if it doesn't already exist.
virtual const std::string & title() const =0
Object title.
virtual const id_type & identifier() const =0
Full identifier (or key)
static _Array * create(INTuple *tup, const std::string &name, const std::type_info &info, const std::string &index, long len, TYP min, TYP max, TYP def)
Create instance.
Gaudi::Property< std::string > m_tupleSvc
Algorithm(std::string name, ISvcLocator *svcloc, std::string version=PACKAGE_VERSION)
Constructor.
virtual const std::string & name() const =0
Access _Item name.
constexpr static const auto FAILURE
StatusCode mergeEntries(const std::string &input)
Merge the entries of a single input tuple into the output.
virtual const CLID & clID() const
Retrieve reference to class definition structure.
Parse attribute strings allowing iteration over the various attributes.
IRegistry * registry() const
Get pointer to Registry.
size_t index(const Gaudi::ParticleProperty *property, const Gaudi::Interfaces::IParticlePropertySvc *service)
helper utility for mapping of Gaudi::ParticleProperty object into non-negative integral sequential id...
StatusCode connect()
Connect input and output N-tuples.