| The Gaudi Framework v29r1 (5cd95fa2)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
Tuples::TupleObj Class Referenceabstract

A simple wrapper class over standard Gaudi NTuple::Tuple facility. More...

`#include <GaudiAlg/TupleObj.h>`

Inheritance diagram for Tuples::TupleObj:
[legend]
Collaboration diagram for Tuples::TupleObj:
[legend]

## Public Types
typedef NTuple::Item< bool > | Bool
| basic type for int items More...
typedef NTuple::Item< char > | Char
| basic type for int items More...
typedef NTuple::Item< unsigned char > | UChar
| basic type for unsigned int items More...
typedef NTuple::Item< short > | Short
| basic type for int items More...
typedef NTuple::Item< unsigned short > | UShort
| basic type for unsigned int items More...
typedef NTuple::Item< int > | Int
| basic type for int items More...
typedef NTuple::Item< unsigned int > | UInt
| basic type for unsigned int items More...
typedef NTuple::Item< long long > | LongLong
| basic type for unsigned long long items More...
typedef NTuple::Item< unsigned long long > | ULongLong
| basic type for unsigned long long items More...
typedef NTuple::Item< float > | Float
| basic type for float items More...
typedef NTuple::Item< double > | Double
| basic type for double items More...
typedef NTuple::Item< IOpaqueAddress * > | Address
| basic type for address items More...
typedef NTuple::Array< float > | FArray
| basic type for array of floats More...
typedef NTuple::Matrix< float > | FMatrix
| basic type for matrix of floats More...
typedef unsigned short | MIndex
typedef std::map< std::string, std::string > | ItemMap

## Public Member Functions
StatusCode | column (const std::string &name, float value)
| Set the value for selected tuple column. More...
StatusCode | column (const std::string &name, double value)
| Set the value for the selected tuple column If the column does not exist, it will be automatically created and appended to the tuple. More...
StatusCode | column (const std::string &name, short value)
| Set the value for selected tuple column. More...
StatusCode | column (const std::string &name, short value, short minv, short maxv)
| Set the value for selected tuple column. More...
StatusCode | column (const std::string &name, unsigned short value)
| Set the value for selected tuple column. More...
StatusCode | column (const std::string &name, unsigned short value, unsigned short minv, unsigned short maxv)
| Set the value for selected tuple column. More...
StatusCode | column (const std::string &name, char value)
| Set the value for selected tuple column. More...
StatusCode | column (const std::string &name, char value, char minv, char maxv)
| Set the value for selected tuple column. More...
StatusCode | column (const std::string &name, unsigned char value)
| Set the value for selected tuple column. More...
StatusCode | column (const std::string &name, unsigned char value, unsigned char minv, unsigned char maxv)
| Set the value for selected tuple column. More...
StatusCode | column (const std::string &name, int value)
| Set the value for selected tuple column. More...
StatusCode | column (const std::string &name, int value, int minv, int maxv)
| Set the value for selected tuple column. More...
StatusCode | column (const std::string &name, unsigned int value)
| Set the value for selected tuple column. More...
StatusCode | column (const std::string &name, unsigned int value, unsigned int minv, unsigned int maxv)
| Set the value for selected tuple column. More...
StatusCode | column (const std::string &name, long value)
| Set the value for the selected tuple column. More...
StatusCode | column (const std::string &name, long value, long minv, long maxv)
| Set the value for selected tuple column. More...
StatusCode | column (const std::string &name, unsigned long value)
| Set the value for selected tuple column. More...
StatusCode | column (const std::string &name, unsigned long value, unsigned long minv, unsigned long maxv)
| Set the value for selected tuple column. More...
StatusCode | column (const std::string &name, long long value)
| Set the value for selected tuple column. More...
StatusCode | column (const std::string &name, long long value, long long minv, long long maxv)
| Set the value for selected tuple column. More...
StatusCode | column (const std::string &name, unsigned long long value)
| Set the value for selected tuple column. More...
StatusCode | column (const std::string &name, unsigned long long value, unsigned long long minv, unsigned long long maxv)
| Set the value for selected tuple column. More...
StatusCode | column (const std::string &name, signed char value)
| Set the value for the selected tuple column. More...
StatusCode | column (const std::string &name, bool value)
| Set the value for selected tuple column. More...
StatusCode | column (const std::string &name, IOpaqueAddress *address)
| Put IOpaqueAddress in POOL-based NTuple. More...
StatusCode | column (IOpaqueAddress *address)
| Put IOpaqueAddress in NTuple. More...
template<typename Value , typename... Args>
StatusCode | columns (Value &&value, Args &&...args)
StatusCode | fill (const char *format...)
| Set the values for several columns simultaneously. More...
template<typename ITERATOR1 , typename ITERATOR2 >
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. More...
template<class DATA >
StatusCode | farray (const std::string &name, const DATA &data, const std::string &length, const size_t maxv)
| Add an indexed array (of type float) to N-tuple. More...
template<class FUNCTION , class ITERATOR >
StatusCode | farray (const std::string &name, const FUNCTION &function, ITERATOR first, ITERATOR last, const std::string &length, size_t maxv)
| Put an indexed array into LoKi-style N-Tuple. More...
template<typename FunIterator , typename DataIterator >
StatusCode | farray_impl (FunIterator first_item, FunIterator last_item, DataIterator first, DataIterator last, const std::string &length, size_t maxv)
| Put arbitrary number of functions from one data array into LoKi-style N-Tuple simultaneously (effective!) More...
template<typename DataIterator , template< typename, typename... > class Container = std::initializer_list, typename NamedFunction = std::pair<std::string, std::function<float( detail::const_ref_t<DataIterator> )>>, typename = std::enable_if_t<!std::is_convertible<Container<NamedFunction>, std::string>::value>>
StatusCode | farray (const Container< NamedFunction > &funs, DataIterator first, DataIterator last, const std::string &length, size_t maxv)
template<typename NamedFunctions , typename DataIterator , typename = std::enable_if_t<!std::is_convertible<NamedFunctions, std::string>::value>>
StatusCode | farray (const NamedFunctions &funs, DataIterator first, DataIterator last, const std::string &length, size_t maxv)
template<class FUNC1 , class FUNC2 , class Iterator >
StatusCode | farray (const std::string &name1, const FUNC1 &func1, const std::string &name2, const FUNC2 &func2, Iterator &&first, Iterator &&last, const std::string &length, size_t maxv)
| Put two functions from one data array into LoKi-style N-Tuple simultaneously (effective!) More...
template<class FUNC1 , class FUNC2 , class FUNC3 , class Iterator >
StatusCode | farray (const std::string &name1, const FUNC1 &func1, const std::string &name2, const FUNC2 &func2, const std::string &name3, const FUNC3 &func3, Iterator &&first, Iterator &&last, const std::string &length, size_t maxv)
| Put three functions from one data array into LoKi-style N-Tuple simultaneously (effective!) More...
template<class FUNC1 , class FUNC2 , class FUNC3 , class FUNC4 , class Iterator >
StatusCode | farray (const std::string &name1, const FUNC1 &func1, const std::string &name2, const FUNC2 &func2, const std::string &name3, const FUNC3 &func3, const std::string &name4, const FUNC4 &func4, Iterator &&first, Iterator &&last, const std::string &length, size_t maxv)
| Put four functions from one data array into LoKi-style N-Tuple simultaneously (effective!) More...
template<class MATRIX >
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. More...
template<class DATA >
StatusCode | fmatrix (const std::string &name, DATA first, DATA last, const MIndex &cols, const std::string &length, size_t maxv)
| Fill N-Tuple with data from variable-size matrix. More...
template<class FUN , class DATA >
StatusCode | fmatrix (const std::string &name, FUN funF, FUN funL, DATA first, DATA last, const std::string &length, size_t maxv)
| fill N-Tuple with matrix of "direct-product" of "data-vector" [first,last) and "function-vector" [funF, funL) More...
template<class DATA >
StatusCode | array (const std::string &name, DATA first, DATA last)
| fill N-Tuple with fixed-size array More...
template<class ARRAY >
StatusCode | array (const std::string &name, const ARRAY &data, const MIndex &length)
| fill N-Tuple with fixed-size array More...
template<class ARRAY >
StatusCode | array (const std::string &name, const ARRAY &data)
| fill N-Tuple with fixed-size array More...
template<class MATRIX >
StatusCode | matrix (const std::string &name, const MATRIX &data, const MIndex &rows, const MIndex &cols)
| fill N-Tuple with fixed-size matrix More...
template<class TYPE >
StatusCode | column (const std::string &name, const ROOT::Math::LorentzVector< TYPE > &v)
| Useful shortcut to put LorentzVector directly into N-Tuple: More...
template<class TYPE , class TAG >
StatusCode | column (const std::string &name, const ROOT::Math::DisplacementVector3D< TYPE, TAG > &v)
| Useful shortcut to put 3D-Vector directly into N-Tuple: More...
template<class TYPE , class TAG >
StatusCode | column (const std::string &name, const ROOT::Math::PositionVector3D< TYPE, TAG > &v)
| Useful shortcut to put 3D-Vector directly into N-Tuple: More...
template<class TYPE , unsigned int D1, unsigned int D2, class REP >
StatusCode | matrix (const std::string &name, const ROOT::Math::SMatrix< TYPE, D1, D2, REP > &mtrx)
| shortcut to put Smatrix into N-tuple: More...
template<class KEY , class VALUE >
StatusCode | fmatrix (const std::string &name, const GaudiUtils::VectorMap< KEY, VALUE > &info, const std::string &length, const size_t maxv=100)
| shortcut to put "ExtraInfo" fields of major into N-Tuple More...
template<class TYPE >
StatusCode | put (const std::string &name, const TYPE *obj)
| The function allows to add almost arbitrary object into N-tuple. More...
StatusCode | write ()
| write a record to NTuple More...
const std::string & | name () const
| get the name More...
const NTuple::Tuple * | tuple () const
| provide the access to underlying Gaudi N-tuple More...
NTuple::Tuple * | tuple ()
| provide the access to underlying Gaudi N-tuple More...
unsigned long | refCount () const
| return the reference counter More...
unsigned long | addRef ()
| add the reference to TupleObj More...
void | release ()
| release the reference to TupleObj if reference counter becomes zero, object will be automatically deleted More...
const CLID & | clid () const
| accessor to the N-Tuple CLID More...
Tuples::Type | type () const
| accessor to the N-Tuple type More...
bool | columnWise () const
| column wise NTuple ? More...
bool | rowWise () const
| row wise NTuple ? More...
bool | evtColType () const
| Event collection ? More...
bool | valid () const
| valid pointer to tuple ? More...
bool | invalid () const
| invalid pointer to tuple ? More...
bool | addItem (std::string name, std::string type)
| add the item name into the list of known items More...
bool | goodItem (const std::string &name) const
| check the uniqueness of the name More...
const ItemMap & | items () const
| get the full list of booked items More...
virtual StatusCode | Error (const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
virtual StatusCode | Warning (const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0

## Protected Member Functions
| TupleObj (std::string name, NTuple::Tuple *tuple, const CLID &clid=CLID_ColumnWiseTuple, const Tuples::Type type=Tuples::NTUPLE)
| Standard constructor. More...
virtual | ~TupleObj ()
| destructor is protected More...

## Private Types
typedef GaudiUtils::HashMap< std::string, std::unique_ptr< Bool > > | Bools
| the actual storage type for short columns More...
typedef GaudiUtils::HashMap< std::string, std::unique_ptr< Char > > | Chars
| the actual storage type for short columns More...
typedef GaudiUtils::HashMap< std::string, std::unique_ptr< UChar > > | UChars
| the actual storage type for unsigned short columns More...
typedef GaudiUtils::HashMap< std::string, std::unique_ptr< Short > > | Shorts
| the actual storage type for short columns More...
typedef GaudiUtils::HashMap< std::string, std::unique_ptr< UShort > > | UShorts
| the actual storage type for unsigned short columns More...
typedef GaudiUtils::HashMap< std::string, std::unique_ptr< Int > > | Ints
| the actual storage type for integer columns More...
typedef GaudiUtils::HashMap< std::string, std::unique_ptr< UInt > > | UInts
| the actual storage type for unsigned integer columns More...
typedef GaudiUtils::HashMap< std::string, std::unique_ptr< LongLong > > | LongLongs
| the actual storage type for longlong columns More...
typedef GaudiUtils::HashMap< std::string, std::unique_ptr< ULongLong > > | ULongLongs
| the actual storage type for ulonglong columns More...
typedef GaudiUtils::HashMap< std::string, std::unique_ptr< Float > > | Floats
| the actual storage type for float columns More...
typedef GaudiUtils::HashMap< std::string, std::unique_ptr< Double > > | Doubles
| the actual storage type for float columns More...
typedef GaudiUtils::HashMap< std::string, std::unique_ptr< Address > > | Addresses
| the actual storage type for address columns More...
typedef GaudiUtils::HashMap< std::string, std::unique_ptr< FArray > > | FArrays
| the actual storage type for array columns More...
typedef GaudiUtils::HashMap< std::string, std::unique_ptr< FMatrix > > | FMatrices
| the actual storage type for matrix columns More...

## Private Member Functions
template<typename Tuple , typename Value , std::size_t... I>
StatusCode | columns_helper (const Value &value, const Tuple &tup, std::index_sequence< I... >)
| Set the values for several columns simultaneously, for the same object Non-existing columns will be automatically created and appended to the ntuple. More...
Int * | ints (const std::string &name, int minv, int maxv)
| get the column More...
FArray * | fArray (const std::string &name, Int *item)
| get the column More...
FArray * | fArray (const std::string &name, const MIndex &rows)
| get the column More...
Address * | addresses (const std::string &name)
| get the column More...
FMatrix * | fMatrix (const std::string &name, Int *item, const MIndex &cols)
| get the column More...
FMatrix * | fMatrix (const std::string &name, const MIndex &rows, const MIndex &cols)
| get the column More...
| TupleObj ()=delete
| delete the default/copy constructor and assignment More...
| TupleObj (const TupleObj &)=delete
TupleObj & | operator= (const TupleObj &)=delete

## Private Attributes
std::string | m_name
| name More...
NTuple::Tuple * | m_tuple
| tuple itself More...
CLID | m_clid
| tuple CLID More...
Tuples::Type | m_type
| tuple 'type' More...
size_t | m_refCount = 0
| reference counter More...
Bools | m_bools
| the actual storage of all 'bool' columns More...
Chars | m_chars
| the actual storage of all 'Int' columns More...
UChars | m_uchars
| the actual storage of all 'unsigned int' columns More...
Shorts | m_shorts
| the actual storage of all 'Int' columns More...
UShorts | m_ushorts
| the actual storage of all 'unsigned int' columns More...
Ints | m_ints
| the actual storage of all 'Int' columns More...
UInts | m_uints
| the actual storage of all 'unsigned int' columns More...
LongLongs | m_longlongs
| the actual storage of all 'longlong' columns More...
ULongLongs | m_ulonglongs
| the actual storage of all 'ulonglong' columns More...
Floats | m_floats
| the actual storage of all 'Float' columns More...
Doubles | m_doubles
| the actual storage of all 'Double' columns More...
Addresses | m_addresses
| the actual storage of all 'Address' columns More...
FArrays | m_farrays
| the actual storage of all 'FArray' columns More...
FArrays | m_arraysf
| the actual storage of all 'FArray' columns (fixed) More...
FMatrices | m_fmatrices
| the actual storage of all 'FArray' columns More...
FMatrices | m_matricesf
| the actual storage of all 'FMatrix' columns (fixed) More...
ItemMap | m_items
| all booked types: More...

## Detailed Description

A simple wrapper class over standard Gaudi NTuple::Tuple facility.

The design and implementation are imported from LoKi package

One should not use lass TupleObj directly. The special handler Tuples::Tuple should be used instead, which is simultaneously 'proxy' an d'smart pointer' for real (and heavy!) TupleObj class.

The main advantages of local ntuples with respect to 'standard' Gaudi NTuples ( NTuple::Tuple ) is their "locality". For 'standard' ntuples one need

1. Define all ntuple columns/items as data members of the algorithm
2. Book the `NTuple::Tuple` object using `INTupleSvc`
3. Add all defined columns/items to the booked ntuple
4. Fill ntuple records

Usually the first step is done in the header file (separate file!) of the algorithm, the second and the third steps are done in `initialize()` method of the algorithm and the fourth step is done somewhere in `execute()` method of the same algorithm. Such approach requires to keep track of the tuple structure through different method and event through different files. And even minor modification of the structure of the ntuple will require the modification of at least 2 methods and 2 files.

The `Tuples::Tuple` wrapper over standard Gaudi `NTuple::Tuple` class solves all above listed problems with "non-local" nature of Gaudi `NTuple::Tuple` objects.

`Tuples::Tuple` object is booked and used 'locally'. One does not need to pre-book the ntuple or its columns/items somewhere in different compilation units or other methods different from the actual point of using the ntuple.

The simplest example of usage Tuples::Tuple object:

Tuple tuple = nTuple( "some more or less unique tuple title ");
for( Loop D0 = loop( "K- pi+", "D0" ) , D0 , ++D0 )
{
tuple -> column ( "mass" , M ( D0 ) / GeV ) ;
tuple -> column ( "pt" , PT ( D0 ) / GeV ) ;
tuple -> column ( "p" , P ( D0 ) / GeV ) ;
tuple -> write () ;
}

One could fill some Tuple variables in one go

Tuple tuple = nTuple( "some more or less unique tuple title ");
for( Loop D0 = loop( "K- pi+", "D0" ) , D0 , ++D0 )
{
tuple -> column ( "mass" , M ( D0 ) / GeV ) ;
tuple -> fill ( "pt , p " , PT ( D0 ) / GeV , P(D0) / GeV ) ;
tuple -> write () ;
}

Even ALL variables could be filled in one go:

Tuple tuple = nTuple( "some more or less unique tuple title ");
for( Loop D0 = loop( "K- pi+", "D0" ) , D0 , ++D0 )
{
tuple -> fill ( "mass pt , p ", M(D0)/GeV,PT(D0)/GeV,P(D0)/GeV ) ;
tuple -> write () ;
}

The 'array-like' columns are also supported ( see methods 'farray')

All these techniques could be easily combined in arbitrary ways

class TupleObj is an abstract class with 3 pure abstract functions Error and Warning , which need to be reimplemented in any 'concrete class. Helper classes TupleObjImp, ErrorHandler and functions createTupleObj and make_handler allows to create concrete objects 'on-flight'

Attention
  `long long` and `unsigned long long` types are not supported. One needs to convert the data into some other representation (e.g. as 2 separate fields, or perform the explicitly cast to `long`)

Author
  Vanya BELYAEV ibely.nosp@m.aev@.nosp@m.physi.nosp@m.cs.s.nosp@m.yr.ed.nosp@m.u

Date
  2004-01-23

Definition at line 199 of file TupleObj.h.

## Member Typedef Documentation

typedef NTuple::Item<IOpaqueAddress*> Tuples::TupleObj::Address

basic type for address items

Definition at line 237 of file TupleObj.h.

typedef GaudiUtils::HashMap<std::string, std::unique_ptr<Address> > Tuples::TupleObj::Addresses
| private

the actual storage type for address columns

Definition at line 2083 of file TupleObj.h.

typedef NTuple::Item<bool> Tuples::TupleObj::Bool

basic type for int items

Definition at line 204 of file TupleObj.h.

typedef GaudiUtils::HashMap<std::string, std::unique_ptr<Bool> > Tuples::TupleObj::Bools
| private

the actual storage type for short columns

Definition at line 2050 of file TupleObj.h.

typedef NTuple::Item<char> Tuples::TupleObj::Char

basic type for int items

Definition at line 207 of file TupleObj.h.

typedef GaudiUtils::HashMap<std::string, std::unique_ptr<Char> > Tuples::TupleObj::Chars
| private

the actual storage type for short columns

Definition at line 2053 of file TupleObj.h.

typedef NTuple::Item<double> Tuples::TupleObj::Double

basic type for double items

Definition at line 234 of file TupleObj.h.

typedef GaudiUtils::HashMap<std::string, std::unique_ptr<Double> > Tuples::TupleObj::Doubles
| private

the actual storage type for float columns

Definition at line 2080 of file TupleObj.h.

typedef NTuple::Array<float> Tuples::TupleObj::FArray

basic type for array of floats

Definition at line 240 of file TupleObj.h.

typedef GaudiUtils::HashMap<std::string, std::unique_ptr<FArray> > Tuples::TupleObj::FArrays
| private

the actual storage type for array columns

Definition at line 2086 of file TupleObj.h.

typedef NTuple::Item<float> Tuples::TupleObj::Float

basic type for float items

Definition at line 231 of file TupleObj.h.

typedef GaudiUtils::HashMap<std::string, std::unique_ptr<Float> > Tuples::TupleObj::Floats
| private

the actual storage type for float columns

Definition at line 2077 of file TupleObj.h.

typedef GaudiUtils::HashMap<std::string, std::unique_ptr<FMatrix> > Tuples::TupleObj::FMatrices
| private

the actual storage type for matrix columns

Definition at line 2089 of file TupleObj.h.

typedef NTuple::Matrix<float> Tuples::TupleObj::FMatrix

basic type for matrix of floats

Definition at line 243 of file TupleObj.h.

typedef NTuple::Item<int> Tuples::TupleObj::Int

basic type for int items

Definition at line 219 of file TupleObj.h.

typedef GaudiUtils::HashMap<std::string, std::unique_ptr<Int> > Tuples::TupleObj::Ints
| private

the actual storage type for integer columns

Definition at line 2065 of file TupleObj.h.

typedef std::map<std::string, std::string> Tuples::TupleObj::ItemMap

Definition at line 249 of file TupleObj.h.

typedef NTuple::Item<long long> Tuples::TupleObj::LongLong

basic type for unsigned long long items

Definition at line 225 of file TupleObj.h.

typedef GaudiUtils::HashMap<std::string, std::unique_ptr<LongLong> > Tuples::TupleObj::LongLongs
| private

the actual storage type for longlong columns

Definition at line 2071 of file TupleObj.h.

typedef unsigned short Tuples::TupleObj::MIndex

Definition at line 246 of file TupleObj.h.

typedef NTuple::Item<short> Tuples::TupleObj::Short

basic type for int items

Definition at line 213 of file TupleObj.h.

typedef GaudiUtils::HashMap<std::string, std::unique_ptr<Short> > Tuples::TupleObj::Shorts
| private

the actual storage type for short columns

Definition at line 2059 of file TupleObj.h.

typedef NTuple::Item<unsigned char> Tuples::TupleObj::UChar

basic type for unsigned int items

Definition at line 210 of file TupleObj.h.

typedef GaudiUtils::HashMap<std::string, std::unique_ptr<UChar> > Tuples::TupleObj::UChars
| private

the actual storage type for unsigned short columns

Definition at line 2056 of file TupleObj.h.

typedef NTuple::Item<unsigned int> Tuples::TupleObj::UInt

basic type for unsigned int items

Definition at line 222 of file TupleObj.h.

typedef GaudiUtils::HashMap<std::string, std::unique_ptr<UInt> > Tuples::TupleObj::UInts
| private

the actual storage type for unsigned integer columns

Definition at line 2068 of file TupleObj.h.

typedef NTuple::Item<unsigned long long> Tuples::TupleObj::ULongLong

basic type for unsigned long long items

Definition at line 228 of file TupleObj.h.

typedef GaudiUtils::HashMap<std::string, std::unique_ptr<ULongLong> > Tuples::TupleObj::ULongLongs
| private

the actual storage type for ulonglong columns

Definition at line 2074 of file TupleObj.h.

typedef NTuple::Item<unsigned short> Tuples::TupleObj::UShort

basic type for unsigned int items

Definition at line 216 of file TupleObj.h.

typedef GaudiUtils::HashMap<std::string, std::unique_ptr<UShort> > Tuples::TupleObj::UShorts
| private

the actual storage type for unsigned short columns

Definition at line 2062 of file TupleObj.h.

## Constructor & Destructor Documentation

Tuples::TupleObj::TupleObj | ( | std::string | name,
|  | NTuple::Tuple * | tuple,
|  | const CLID & | clid = `CLID_ColumnWiseTuple`,
|  | const Tuples::Type | type = `Tuples::NTUPLE`
| ) |  |
| protected

Standard constructor.

See also
  NTuple:Tuple

Parameters

  name | name of the object
  tuple | pointer to standard Gaudi NTuple::Tuple object
  clid | CLID_ColumnWiseTuple or CLID_RowWiseTuple
  type | the type of the tuple

Definition at line 202 of file TupleObj.cpp.

204 : m_name( std::move( name ) ),
205 m_tuple( tuple ),
206 m_clid( clid ),
207 m_type( type )
208 {
209 // make counts
210 Tuples::Local::s_InstanceCounter.increment( m_name );
211 }
Tuples::TupleObj::m_clid
CLID m_clid
tuple CLID
Definition: TupleObj.h:2100
Tuples::TupleObj::m_type
Tuples::Type m_type
tuple &#39;type&#39;
Definition: TupleObj.h:2103
Tuples::TupleObj::m_name
std::string m_name
name
Definition: TupleObj.h:2094
std::move
T move(T...args)
Tuples::TupleObj::m_tuple
NTuple::Tuple * m_tuple
tuple itself
Definition: TupleObj.h:2097
Tuples::TupleObj::type
Tuples::Type type() const
accessor to the N-Tuple type
Definition: TupleObj.h:1976
Tuples::TupleObj::clid
const CLID & clid() const
accessor to the N-Tuple CLID
Definition: TupleObj.h:1973
Tuples::Local::Counter::increment
long increment(const std::string &object)
Definition: TupleObj.cpp:171

Tuples::TupleObj::~TupleObj | ( |  | ) |
| protected virtual

destructor is protected

Definition at line 215 of file TupleObj.cpp.

216 {
217 // make counts
218 Tuples::Local::s_InstanceCounter.decrement( m_name );
219 }
Tuples::Local::Counter::decrement
long decrement(const std::string &object)
Definition: TupleObj.cpp:173
Tuples::TupleObj::m_name
std::string m_name
name
Definition: TupleObj.h:2094

Tuples::TupleObj::TupleObj | ( |  | ) |
| private delete

delete the default/copy constructor and assignment

Tuples::TupleObj::TupleObj | ( | const TupleObj & |  | ) |
| private delete

## Member Function Documentation

bool Tuples::TupleObj::addItem | ( | std::string | name,
|  | std::string | type
| ) |  |
| inline

add the item name into the list of known items

Parameters

  name | the name of the item
  type | the type of the item

Returns
  true if the name is indeed added

Definition at line 2000 of file TupleObj.h.

2001 {
2002 return m_items.emplace( std::move( name ), std::move( type ) ).second;
2003 }
Tuples::TupleObj::m_items
ItemMap m_items
all booked types:
Definition: TupleObj.h:2157
std::move
T move(T...args)
std::map::emplace
T emplace(T...args)

unsigned long Tuples::TupleObj::addRef | ( |  | ) |
| inline

add the reference to TupleObj

Returns
  current reference counter

Definition at line 1964 of file TupleObj.h.

1964 { return ++m_refCount; }
Tuples::TupleObj::m_refCount
size_t m_refCount
reference counter
Definition: TupleObj.h:2106

Address* Tuples::TupleObj::addresses | ( | const std::string & | name | ) |
| private

get the column

template<class DATA >

StatusCode Tuples::TupleObj::array | ( | const std::string & | name,
|  | DATA | first,
|  | DATA | last
| ) |  |
| inline

fill N-Tuple with fixed-size array

SEQUENCE data( 10 ) ;
...
tuple -> array("data" ,
data.begin () ,
data.end () ) ;

Sequence may be of any objects, implicitly convertible into "float"

Parameters

  name | N-Tuple entry name
  first | begin-iterator for data sequence
  last | end-iterator for data sequence

Author
  Vanya BELYAEV Ivan..nosp@m.Bely.nosp@m.aev@l.nosp@m.app..nosp@m.in2p3.nosp@m..fr

Date
  2005-05-01

fill the array

Definition at line 1601 of file TupleObj.h.

1603 {
1604 if ( invalid() ) {
1605 return InvalidTuple;
1606 }
1607 if ( rowWise() ) {
1608 return InvalidOperation;
1609 }
1610
1611 // get the length (fixed!)
1612 auto length = std::distance( first, last );
1613
1614 // get the array itself
1615 FArray* var = fArray( name, length );
1616 if ( !var ) {
1617 return InvalidColumn;
1618 }
1619
1621 std::copy( first, last, std::begin( *var ) );
1622
1623 return StatusCode::SUCCESS;
1624 }
StatusCode::SUCCESS
Definition: StatusCode.h:31
std::copy
T copy(T...args)
std::distance
T distance(T...args)
Tuples::InvalidTuple
Definition: TupleObj.h:97
Tuples::InvalidOperation
Definition: TupleObj.h:99
Tuples::InvalidColumn
Definition: TupleObj.h:98
Tuples::TupleObj::rowWise
bool rowWise() const
row wise NTuple ?
Definition: TupleObj.h:1982
Tuples::TupleObj::fArray
FArray * fArray(const std::string &name, Int *item)
get the column
Definition: TupleObj.cpp:455
std::begin
T begin(T...args)
Tuples::TupleObj::invalid
bool invalid() const
invalid pointer to tuple ?
Definition: TupleObj.h:1991
Tuples::TupleObj::FArray
NTuple::Array< float > FArray
basic type for array of floats
Definition: TupleObj.h:240
template<class ARRAY >

StatusCode Tuples::TupleObj::array | ( | const std::string & | name,
|  | const ARRAY & | data,
|  | const MIndex & | length
| ) |  |
| inline

fill N-Tuple with fixed-size array

"ARRAY" must support indexing operations: e.g it coudl be of type:

- std::vector<TYPE>
- CLHEP::HepVector, ...
- "TYPE"[n]

The content of array should be implicitly convertible to "float"

CLHEP::HepVector vct1(10) ;
...
tuple -> array ( "vct1" , vct1 , 10 ) ;
double vct2[40];
...
tuple -> array ( "vct2" , vct2 , 40 ) ;
long vct3[4];
...
tuple -> array ( "vct3" , vct4 , 4 ) ;
std::vector<long double> vct4(15) ;
...
tuple -> array ( "vct4" , vct4 , 15 ) ;

Parameters

  name | N-Tuple entry name
  data | data sequence
  length | data length (fixed!)

Author
  Vanya BELYAEV Ivan..nosp@m.Bely.nosp@m.aev@l.nosp@m.app..nosp@m.in2p3.nosp@m..fr

Date
  2005-05-01

Definition at line 1665 of file TupleObj.h.

1666 {
1667 using std::begin; // allow data to be eg. CLHEP::HepVector (which does not define HepVector::begin()!,
1668 // in which case ADL prefers CLHEP::begin (yah! at least they (now) use a namespace)
1669 // so one just to insure double* CLHEP::begin(CLHEP::HepVector& v) { return &v[0]; }
1670 // is visible when this function gets instantiated for CLHEP::HepVector...
1671 auto first = begin( data );
1672 return array( name, first, std::next( first, length ) );
1673 }
begin
auto begin(reverse_wrapper< T > &w)
Definition: reverse.h:58
std::next
T next(T...args)
Tuples::TupleObj::array
StatusCode array(const std::string &name, DATA first, DATA last)
fill N-Tuple with fixed-size array
Definition: TupleObj.h:1601
std::begin
T begin(T...args)
template<class ARRAY >

StatusCode Tuples::TupleObj::array | ( | const std::string & | name,
|  | const ARRAY & | data
| ) |  |
| inline

fill N-Tuple with fixed-size array

"ARRAY" is any sequence, which supports ARRAY::begin() and ARRAY::end() protocol, e.g.

- std::vector<TYPE>
- ROOT::Math::SVector<double,15>

The content of array should be implicitly convertible to "float"

typedef std::vector<double> Seq ;
Seq data( 10 ) ;
for ( int i = 0 ; i < 10 ; ++i )
{
data[i] = ... ;
}
tuple -> array( "data" , data ) ;

Parameters

  name | N-Tupel entry name
  data | data sequence

Author
  Vanya BELYAEV Ivan..nosp@m.Bely.nosp@m.aev@l.nosp@m.app..nosp@m.in2p3.nosp@m..fr

Date
  2005-05-01

Definition at line 1706 of file TupleObj.h.

1707 {
1708 using std::begin;
1709 using std::end;
1710 return array( name, begin( data ), end( data ) );
1711 }
std::end
T end(T...args)
begin
auto begin(reverse_wrapper< T > &w)
Definition: reverse.h:58
end
auto end(reverse_wrapper< T > &w)
Definition: reverse.h:64
Tuples::TupleObj::array
StatusCode array(const std::string &name, DATA first, DATA last)
fill N-Tuple with fixed-size array
Definition: TupleObj.h:1601
std::begin
T begin(T...args)

const CLID& Tuples::TupleObj::clid | ( |  | ) | const
| inline

accessor to the N-Tuple CLID

Definition at line 1973 of file TupleObj.h.

1973 { return m_clid; }
Tuples::TupleObj::m_clid
CLID m_clid
tuple CLID
Definition: TupleObj.h:2100

StatusCode Tuples::TupleObj::column | ( | const std::string & | name,
|  | float | value
| ) |  |

Set the value for selected tuple column.

If column does not exist, it will be automatically created and appended to the tuple

//
const float mass = ... ;
tuple->column( "m", mass );
//

Parameters

  name | the name of the column
  value | the value of the variable

Returns
  status code

Definition at line 315 of file TupleObj.cpp.

316 {
317 return column_( this, m_floats, name, value );
318 }
Tuples::TupleObj::m_floats
Floats m_floats
the actual storage of all &#39;Float&#39; columns
Definition: TupleObj.h:2136

StatusCode Tuples::TupleObj::column | ( | const std::string & | name,
|  | double | value
| ) |  |

Set the value for the selected tuple column If the column does not exist, it will be automatically created and appended to the tuple.

//
const double mass = ... ;
tuple->column( "m", mass );
//

Warning
  the value is truncated to float

Parameters

  name | the name of the column
  value | the value of the variable

Returns
  status code

Definition at line 320 of file TupleObj.cpp.

321 {
322 return column_( this, m_doubles, name, value );
323 }
Tuples::TupleObj::m_doubles
Doubles m_doubles
the actual storage of all &#39;Double&#39; columns
Definition: TupleObj.h:2139

StatusCode Tuples::TupleObj::column | ( | const std::string & | name,
|  | short | value
| ) |  |

Set the value for selected tuple column.

If the column does not exist yet, it will be automatically created and appended to the tuple

short number = ... ;
tuple -> column ( "num" , number );

Parameters

  name | the name of the column
  value | the value of the variable

Returns
  status code

Definition at line 346 of file TupleObj.cpp.

347 {
348 return column_( this, m_shorts, name, value );
349 }
Tuples::TupleObj::m_shorts
Shorts m_shorts
the actual storage of all &#39;Int&#39; columns
Definition: TupleObj.h:2118

StatusCode Tuples::TupleObj::column | ( | const std::string & | name,
|  | short | value,
|  | short | minv,
|  | short | maxv
| ) |  |

Set the value for selected tuple column.

If the column does not exist yet, it will be automatically created and appended to the tuple

short number = ... ;
tuple->column( "num", number );

Parameters

  name | name of the column
  value | value of the variable
  minv | minimum value of the variable
  maxv | maximum value of the variable

Returns
  status code

Definition at line 351 of file TupleObj.cpp.

352 {
353 return column_( this, m_shorts, name, value, minv, maxv );
354 }
Tuples::TupleObj::m_shorts
Shorts m_shorts
the actual storage of all &#39;Int&#39; columns
Definition: TupleObj.h:2118

StatusCode Tuples::TupleObj::column | ( | const std::string & | name,
|  | unsigned short | value
| ) |  |

Set the value for selected tuple column.

If the column does not exist yet, it will be automatically created and appended to the tuple

unsigned short number = ... ;
tuple -> column ( "num" , number );

Parameters

  name | the name of the column
  value | the value of the variable

Returns
  status code

Definition at line 356 of file TupleObj.cpp.

357 {
358 return column_( this, m_ushorts, name, value );
359 }
Tuples::TupleObj::m_ushorts
UShorts m_ushorts
the actual storage of all &#39;unsigned int&#39; columns
Definition: TupleObj.h:2121

StatusCode Tuples::TupleObj::column | ( | const std::string & | name,
|  | unsigned short | value,
|  | unsigned short | minv,
|  | unsigned short | maxv
| ) |  |

Set the value for selected tuple column.

If the column does not exist yet, it will be automatically created and appended to the tuple

unsigned short number = ... ;
tuple->column( "num", number );

Parameters

  name | name of the column
  value | value of the variable
  minv | minimum value of the variable
  maxv | maximum value of the variable

Returns
  status code

Definition at line 361 of file TupleObj.cpp.

363 {
364 return column_( this, m_ushorts, name, value, minv, maxv );
365 }
Tuples::TupleObj::m_ushorts
UShorts m_ushorts
the actual storage of all &#39;unsigned int&#39; columns
Definition: TupleObj.h:2121

StatusCode Tuples::TupleObj::column | ( | const std::string & | name,
|  | char | value
| ) |  |

Set the value for selected tuple column.

If the column does not exist yet, it will be automatically created and appended to the tuple

char number = ... ;
tuple -> column ( "num" , number );

Parameters

  name | the name of the column
  value | the value of the variable

Returns
  status code

Definition at line 325 of file TupleObj.cpp.

326 {
327 return column_( this, m_chars, name, value );
328 }
Tuples::TupleObj::m_chars
Chars m_chars
the actual storage of all &#39;Int&#39; columns
Definition: TupleObj.h:2112

StatusCode Tuples::TupleObj::column | ( | const std::string & | name,
|  | char | value,
|  | char | minv,
|  | char | maxv
| ) |  |

Set the value for selected tuple column.

If the column does not exist yet, it will be automatically created and appended to the tuple

char number = ... ;
tuple->column( "num", number );

Parameters

  name | name of the column
  value | value of the variable
  minv | minimum value of the variable
  maxv | maximum value of the variable

Returns
  status code

Definition at line 330 of file TupleObj.cpp.

331 {
332 return column_( this, m_chars, name, value, minv, maxv );
333 }
Tuples::TupleObj::m_chars
Chars m_chars
the actual storage of all &#39;Int&#39; columns
Definition: TupleObj.h:2112

StatusCode Tuples::TupleObj::column | ( | const std::string & | name,
|  | unsigned char | value
| ) |  |

Set the value for selected tuple column.

If the column does not exist yet, it will be automatically created and appended to the tuple

unsigned char number = ... ;
tuple -> column ( "num" , number );

Parameters

  name | the name of the column
  value | the value of the variable

Returns
  status code

Definition at line 335 of file TupleObj.cpp.

336 {
337 return column_( this, m_uchars, name, value );
338 }
Tuples::TupleObj::m_uchars
UChars m_uchars
the actual storage of all &#39;unsigned int&#39; columns
Definition: TupleObj.h:2115

StatusCode Tuples::TupleObj::column | ( | const std::string & | name,
|  | unsigned char | value,
|  | unsigned char | minv,
|  | unsigned char | maxv
| ) |  |

Set the value for selected tuple column.

If the column does not exist yet, it will be automatically created and appended to the tuple

unsigned char number = ... ;
tuple->column( "num", number );

Parameters

  name | name of the column
  value | value of the variable
  minv | minimum value of the variable
  maxv | maximum value of the variable

Returns
  status code

Definition at line 340 of file TupleObj.cpp.

342 {
343 return column_( this, m_uchars, name, value, minv, maxv );
344 }
Tuples::TupleObj::m_uchars
UChars m_uchars
the actual storage of all &#39;unsigned int&#39; columns
Definition: TupleObj.h:2115

StatusCode Tuples::TupleObj::column | ( | const std::string & | name,
|  | int | value
| ) |  |

Set the value for selected tuple column.

If the column does not exist yet, it will be automatically created and appended to the tuple

int number = ... ;
tuple->column("num", number );

Parameters

  name | name of the column
  value | value of the variable

Returns
  status code

Definition at line 367 of file TupleObj.cpp.

368 {
369 return column_( this, m_ints, name, value );
370 }
Tuples::TupleObj::m_ints
Ints m_ints
the actual storage of all &#39;Int&#39; columns
Definition: TupleObj.h:2124

StatusCode Tuples::TupleObj::column | ( | const std::string & | name,
|  | int | value,
|  | int | minv,
|  | int | maxv
| ) |  |

Set the value for selected tuple column.

If the column does not exist yet, it will be automatically created and appended to the tuple

int number = ... ;
tuple->column( "num", number );

Parameters

  name | name of the column
  value | value of the variable
  minv | minimum value of the variable
  maxv | maximum value of the variable

Returns
  status code

Definition at line 372 of file TupleObj.cpp.

373 {
374 return column_( this, m_ints, name, value, minv, maxv );
375 }
Tuples::TupleObj::m_ints
Ints m_ints
the actual storage of all &#39;Int&#39; columns
Definition: TupleObj.h:2124

StatusCode Tuples::TupleObj::column | ( | const std::string & | name,
|  | unsigned int | value
| ) |  |

Set the value for selected tuple column.

If the column does not exist yet, it will be automatically created and appended to the tuple

unsigned int number = ... ;
tuple->column("num", number );

Parameters

  name | name of the column
  value | value of the variable

Returns
  status code

Definition at line 382 of file TupleObj.cpp.

383 {
384 return column_( this, m_uints, name, value );
385 }
Tuples::TupleObj::m_uints
UInts m_uints
the actual storage of all &#39;unsigned int&#39; columns
Definition: TupleObj.h:2127

StatusCode Tuples::TupleObj::column | ( | const std::string & | name,
|  | unsigned int | value,
|  | unsigned int | minv,
|  | unsigned int | maxv
| ) |  |

Set the value for selected tuple column.

If the column does not exist yet, it will be automatically created and appended to the tuple

unsigned int number = ... ;
tuple->column("num", number );

Parameters

  name | name of the column
  value | value of the variable
  minv | minimum value of the variable
  maxv | maximum value of the variable

Returns
  status code

Definition at line 387 of file TupleObj.cpp.

388 {
389 return column_( this, m_uints, name, value, minv, maxv );
390 }
Tuples::TupleObj::m_uints
UInts m_uints
the actual storage of all &#39;unsigned int&#39; columns
Definition: TupleObj.h:2127

StatusCode Tuples::TupleObj::column | ( | const std::string & | name,
|  | long | value
| ) |  |

Set the value for the selected tuple column.

If the column does not exist yet, it will be automatically created and appended to the tuple

long number = ... ;
tuple -> column ( "num", number );

Warning
  the value could be truncated to int

Parameters

  name | the name of the column
  value | the value of the variable

Returns
  status code

Definition at line 392 of file TupleObj.cpp.

393 {
394 Warning( "'long' has different sizes on 32/64 bit systems. Casting '" + name + "' to 'long long'",
395 StatusCode::SUCCESS )
396 .ignore();
397 return column( name, static_cast<long long>( value ) );
398 }
StatusCode::SUCCESS
Definition: StatusCode.h:31
Tuples::TupleObj::column
StatusCode column(const std::string &name, float value)
Set the value for selected tuple column.
Definition: TupleObj.cpp:315
Tuples::TupleObj::Warning
virtual StatusCode Warning(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
StatusCode::ignore
void ignore() const
Definition: StatusCode.h:109

StatusCode Tuples::TupleObj::column | ( | const std::string & | name,
|  | long | value,
|  | long | minv,
|  | long | maxv
| ) |  |

Set the value for selected tuple column.

If the column does not exist yet, it will be automatically created and appended to the tuple

long number = ... ;
tuple->column("num", number );

Parameters

  name | name of the column
  value | value of the variable
  minv | minimum value of the variable
  maxv | maximum value of the variable

Returns
  status code

Definition at line 400 of file TupleObj.cpp.

401 {
402 Warning( "'long' has different sizes on 32/64 bit systems. Casting '" + name + "' to 'long long'",
403 StatusCode::SUCCESS )
404 .ignore();
405 return column( name, static_cast<long long>( value ), static_cast<long long>( minv ),
406 static_cast<long long>( maxv ) );
407 }
StatusCode::SUCCESS
Definition: StatusCode.h:31
Tuples::TupleObj::column
StatusCode column(const std::string &name, float value)
Set the value for selected tuple column.
Definition: TupleObj.cpp:315
Tuples::TupleObj::Warning
virtual StatusCode Warning(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
StatusCode::ignore
void ignore() const
Definition: StatusCode.h:109

StatusCode Tuples::TupleObj::column | ( | const std::string & | name,
|  | unsigned long | value
| ) |  |

Set the value for selected tuple column.

If the column does not exist yet, it will be automatically created and appended to the tuple

unsigned long number = ... ;
tuple -> column ( "num" , number );

Warning
  the value could be truncated to int

Parameters

  name | the name of the column
  value | the value of the variable

Returns
  status code

Definition at line 409 of file TupleObj.cpp.

410 {
411 Warning( "'unsigned long' has different sizes on 32/64 bit systems. Casting '" + name + "' to 'unsigned long long'",
412 StatusCode::SUCCESS )
413 .ignore();
414 return column( name, static_cast<unsigned long long>( value ) );
415 }
StatusCode::SUCCESS
Definition: StatusCode.h:31
Tuples::TupleObj::column
StatusCode column(const std::string &name, float value)
Set the value for selected tuple column.
Definition: TupleObj.cpp:315
Tuples::TupleObj::Warning
virtual StatusCode Warning(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
StatusCode::ignore
void ignore() const
Definition: StatusCode.h:109

StatusCode Tuples::TupleObj::column | ( | const std::string & | name,
|  | unsigned long | value,
|  | unsigned long | minv,
|  | unsigned long | maxv
| ) |  |

Set the value for selected tuple column.

If the column does not exist yet, it will be automatically created and appended to the tuple

unsigned long number = ... ;
tuple->column( "num", number );

Parameters

  name | name of the column
  value | value of the variable
  minv | minimum value of the variable
  maxv | maximum value of the variable

Returns
  status code

Definition at line 417 of file TupleObj.cpp.

419 {
420 Warning( "'unsigned long' has different sizes on 32/64 bit systems. Casting '" + name + "' to 'unsigned long long'",
421 StatusCode::SUCCESS )
422 .ignore();
423 return column( name, static_cast<unsigned long long>( value ), static_cast<unsigned long long>( minv ),
424 static_cast<unsigned long long>( maxv ) );
425 }
StatusCode::SUCCESS
Definition: StatusCode.h:31
Tuples::TupleObj::column
StatusCode column(const std::string &name, float value)
Set the value for selected tuple column.
Definition: TupleObj.cpp:315
Tuples::TupleObj::Warning
virtual StatusCode Warning(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
StatusCode::ignore
void ignore() const
Definition: StatusCode.h:109

StatusCode Tuples::TupleObj::column | ( | const std::string & | name,
|  | long long | value
| ) |  |

Set the value for selected tuple column.

If the column does not exist yet, it will be automatically created and appended to the tuple

long long number = ... ;
tuple->column( "num", number );

Parameters

  name | name of the column
  value | value of the variable

Returns
  status code

Definition at line 427 of file TupleObj.cpp.

428 {
429 return column_( this, m_longlongs, name, value );
430 }
Tuples::TupleObj::m_longlongs
LongLongs m_longlongs
the actual storage of all &#39;longlong&#39; columns
Definition: TupleObj.h:2130

StatusCode Tuples::TupleObj::column | ( | const std::string & | name,
|  | long long | value,
|  | long long | minv,
|  | long long | maxv
| ) |  |

Set the value for selected tuple column.

If the column does not exist yet, it will be automatically created and appended to the tuple

long long number = ... ;
tuple->column( "num", number );

Parameters

  name | name of the column
  value | value of the variable
  minv | minimum value of the variable
  maxv | maximum value of the variable

Returns
  status code

Definition at line 432 of file TupleObj.cpp.

433 {
434 return column_( this, m_longlongs, name, value, minv, maxv );
435 }
Tuples::TupleObj::m_longlongs
LongLongs m_longlongs
the actual storage of all &#39;longlong&#39; columns
Definition: TupleObj.h:2130

StatusCode Tuples::TupleObj::column | ( | const std::string & | name,
|  | unsigned long long | value
| ) |  |

Set the value for selected tuple column.

If the column does not exist yet, it will be automatically created and appended to the tuple

unsigned long long number = ... ;
tuple->column( "num", number );

Parameters

  name | name of the column
  value | value of the variable

Returns
  status code

Definition at line 437 of file TupleObj.cpp.

438 {
439 return column_( this, m_ulonglongs, name, value );
440 }
Tuples::TupleObj::m_ulonglongs
ULongLongs m_ulonglongs
the actual storage of all &#39;ulonglong&#39; columns
Definition: TupleObj.h:2133

StatusCode Tuples::TupleObj::column | ( | const std::string & | name,
|  | unsigned long long | value,
|  | unsigned long long | minv,
|  | unsigned long long | maxv
| ) |  |

Set the value for selected tuple column.

If the column does not exist yet, it will be automatically created and appended to the tuple

unsigned long long number = ... ;
tuple->column( "num", number );

Parameters

  name | name of the column
  value | value of the variable
  minv | minimum value of the variable
  maxv | maximum value of the variable

Returns
  status code

Definition at line 442 of file TupleObj.cpp.

444 {
445 return column_( this, m_ulonglongs, name, value, minv, maxv );
446 }
Tuples::TupleObj::m_ulonglongs
ULongLongs m_ulonglongs
the actual storage of all &#39;ulonglong&#39; columns
Definition: TupleObj.h:2133

StatusCode Tuples::TupleObj::column | ( | const std::string & | name,
|  | signed char | value
| ) |  |
| inline

Set the value for the selected tuple column.

If the column does not exist yet, it will be automatically created and appended to the tuple

signed char number = ... ;
tuple->column("num", number );

Parameters

  name | the name of the column
  value | the value of tve variable

Returns
  status code

Definition at line 707 of file TupleObj.h.

708 {
709 return column( name, value, std::numeric_limits<signed char>::min(), std::numeric_limits<signed char>::max() );
710 }
Tuples::TupleObj::column
StatusCode column(const std::string &name, float value)
Set the value for selected tuple column.
Definition: TupleObj.cpp:315
std::numeric_limits

StatusCode Tuples::TupleObj::column | ( | const std::string & | name,
|  | bool | value
| ) |  |

Set the value for selected tuple column.

If the column does not exist yet, it will be automatically create and appended to the tuple

tuple->column( "empty" , v.empty() );

Parameters

  name | the name of the column
  value | the value of the variable

Returns
  status code

Definition at line 448 of file TupleObj.cpp.

449 {
450 return column_( this, m_bools, name, value );
451 }
Tuples::TupleObj::m_bools
Bools m_bools
the actual storage of all &#39;bool&#39; columns
Definition: TupleObj.h:2109

StatusCode Tuples::TupleObj::column | ( | const std::string & | name,
|  | IOpaqueAddress * | address
| ) |  |

Put IOpaqueAddress in POOL-based NTuple.

If the column does not exist, it will be automatically created and appended to the tuple.

IOpaqueAddress* address = ... ;
tuple->column( "Address", address );

Warning
  It has sense only for Event tag collection N-Tuples

Parameters

  name | name of the column ("Address" is a recommended convention!)
  address | IOpaqueAddress

Returns
  status code

Definition at line 298 of file TupleObj.cpp.

299 {
300 if ( !evtColType() ) {
301 return InvalidOperation;
302 }
303 if ( !address ) {
304 return Error( "column('" + name + "') IOpaqueAddress* is NULL!", InvalidObject );
305 }
306 return column_( this, m_addresses, name, address );
307 }
Tuples::TupleObj::evtColType
bool evtColType() const
Event collection ?
Definition: TupleObj.h:1985
Tuples::InvalidOperation
Definition: TupleObj.h:99
Tuples::TupleObj::m_addresses
Addresses m_addresses
the actual storage of all &#39;Address&#39; columns
Definition: TupleObj.h:2142
Tuples::TupleObj::Error
virtual StatusCode Error(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
Tuples::InvalidObject
Definition: TupleObj.h:100

StatusCode Tuples::TupleObj::column | ( | IOpaqueAddress * | address | ) |

Put IOpaqueAddress in NTuple.

If the column does not exist, it will be automatically created and appended to the tuple. The column name is set to be `"Address"`

IOpaqueAddress* address = ... ;
tuple->column ( address );

Warning
  It has sense only for Event tag collection N-Tuples

Parameters

  address | IOpaqueAddress

Returns
  status code

Definition at line 312 of file TupleObj.cpp.

312 { return column( "Address", address ); }
Tuples::TupleObj::column
StatusCode column(const std::string &name, float value)
Set the value for selected tuple column.
Definition: TupleObj.cpp:315
template<class TYPE >

StatusCode Tuples::TupleObj::column | ( | const std::string & | name,
|  | const ROOT::Math::LorentzVector< TYPE > & | v
| ) |  |
| inline

Useful shortcut to put LorentzVector directly into N-Tuple:

const LHCb::Particle* B = ...
Tuple tuple = nTuple("My N-Tuple") ;
// put 4-vector of B-candidate into N-tuple:
tuple -> column ("B" , B->momentum() ) ;

Author
  Vanya BELYAEV ibely.nosp@m.aev@.nosp@m.physi.nosp@m.cs.s.nosp@m.yr.ed.nosp@m.u

Date
  2006-11-26

Definition at line 1807 of file TupleObj.h.

1808 {
1809 return columns( v, std::make_pair( name + "E", &ROOT::Math::LorentzVector<TYPE>::E ),
1810 std::make_pair( name + "X", &ROOT::Math::LorentzVector<TYPE>::Px ),
1811 std::make_pair( name + "Y", &ROOT::Math::LorentzVector<TYPE>::Py ),
1812 std::make_pair( name + "Z", &ROOT::Math::LorentzVector<TYPE>::Pz ) );
1813 }
std::make_pair
T make_pair(T...args)
Tuples::TupleObj::columns
StatusCode columns(Value &&value, Args &&...args)
Definition: TupleObj.h:808
template<class TYPE , class TAG >

StatusCode Tuples::TupleObj::column | ( | const std::string & | name,
|  | const ROOT::Math::DisplacementVector3D< TYPE, TAG > & | v
| ) |  |
| inline

Useful shortcut to put 3D-Vector directly into N-Tuple:

const LHCb::Vertex* V = ...
Tuple tuple = nTuple("My N-Tuple") ;
// put vertex position into N-tuple:
tuple -> column ("B" , B->position() ) ;

Author
  Vanya BELYAEV ibely.nosp@m.aev@.nosp@m.physi.nosp@m.cs.s.nosp@m.yr.ed.nosp@m.u

Date
  2006-11-26

Definition at line 1832 of file TupleObj.h.

1833 {
1834 return this->columns( v, std::make_pair( name + "X", &ROOT::Math::DisplacementVector3D<TYPE, TAG>::X ),
1835 std::make_pair( name + "Y", &ROOT::Math::DisplacementVector3D<TYPE, TAG>::Y ),
1836 std::make_pair( name + "Z", &ROOT::Math::DisplacementVector3D<TYPE, TAG>::Z ) );
1837 }
std::make_pair
T make_pair(T...args)
ROOT::Math::DisplacementVector3D
Definition: IMagneticFieldSvc.h:20
Tuples::TupleObj::columns
StatusCode columns(Value &&value, Args &&...args)
Definition: TupleObj.h:808
template<class TYPE , class TAG >

StatusCode Tuples::TupleObj::column | ( | const std::string & | name,
|  | const ROOT::Math::PositionVector3D< TYPE, TAG > & | v
| ) |  |
| inline

Useful shortcut to put 3D-Vector directly into N-Tuple:

const LHCb::Vertex* V = ...
Tuple tuple = nTuple("My N-Tuple") ;
// put vertex position into N-tuple:
tuple -> column ("B" , B->position() ) ;

Author
  Vanya BELYAEV ibely.nosp@m.aev@.nosp@m.physi.nosp@m.cs.s.nosp@m.yr.ed.nosp@m.u

Date
  2006-11-26

Definition at line 1856 of file TupleObj.h.

1857 {
1858 return this->columns( v, std::make_pair( name + "X", &ROOT::Math::PositionVector3D<TYPE, TAG>::X ),
1859 std::make_pair( name + "Y", &ROOT::Math::PositionVector3D<TYPE, TAG>::Y ),
1860 std::make_pair( name + "Z", &ROOT::Math::PositionVector3D<TYPE, TAG>::Z ) );
1861 }
ROOT::Math::PositionVector3D
Definition: IMagneticFieldSvc.h:17
std::make_pair
T make_pair(T...args)
Tuples::TupleObj::columns
StatusCode columns(Value &&value, Args &&...args)
Definition: TupleObj.h:808
template<typename Value , typename... Args>

StatusCode Tuples::TupleObj::columns | ( | Value && | value,
|  | Args &&... | args
| ) |  |
| inline

Definition at line 808 of file TupleObj.h.

809 {
810 return columns_helper( std::forward<Value>( value ), std::forward_as_tuple( std::forward<Args>( args )... ),
811 std::index_sequence_for<Args...>{} );
812 }
std::forward_as_tuple
T forward_as_tuple(T...args)
gaudirun.args
args
Definition: gaudirun.py:244
Tuples::TupleObj::columns_helper
StatusCode columns_helper(const Value &value, const Tuple &tup, std::index_sequence< I... >)
Set the values for several columns simultaneously, for the same object Non-existing columns will be a...
Definition: TupleObj.h:792
template<typename Tuple , typename Value , std::size_t... I>

StatusCode Tuples::TupleObj::columns_helper | ( | const Value & | value,
|  | const Tuple & | tup,
|  | std::index_sequence< I... > |
| ) |  |
| inline private

Set the values for several columns simultaneously, for the same object Non-existing columns will be automatically created and appended to the ntuple.

Gaudi::XYZPoint p;
tuple->columns( p, std::make_pair( "X", &Gaudi::XYZPoint::X),
std::make_pair( "Y", &Gaudi::XYZPoint::Y),
std::make_pair( "Z", &Gaudi::XYZPoint::Z) );

Warning
  the type of column is set (implicitly) by the type returned by the 'callable' for that column, i.e. in the above the return type of eg. `Gaudi::XYZPoint::X()`

Author
  Gerhard Raven

Definition at line 792 of file TupleObj.h.

793 {
794 auto scs = std::initializer_list<StatusCode>{
795 this->column( std::get<I>( tup ).first, Gaudi::invoke( std::get<I>( tup ).second, value ) )...};
796 auto is_ok = []( const StatusCode& sc ) -> bool { return sc; };
797 auto i = std::find_if_not( begin( scs ), end( scs ), is_ok );
798 if ( i != end( scs ) ) {
799 // avoid unchecked StatusCodes...
800 std::for_each( std::next( i ), end( scs ), is_ok );
801 return *i;
802 }
803 return StatusCode::SUCCESS;
804 }
StatusCode::SUCCESS
Definition: StatusCode.h:31
Tuples::TupleObj::column
StatusCode column(const std::string &name, float value)
Set the value for selected tuple column.
Definition: TupleObj.cpp:315
begin
auto begin(reverse_wrapper< T > &w)
Definition: reverse.h:58
Gaudi::Units::second
constexpr double second
Definition: SystemOfUnits.h:123
std::next
T next(T...args)
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
end
auto end(reverse_wrapper< T > &w)
Definition: reverse.h:64
std::find_if_not
T find_if_not(T...args)
Gaudi::invoke
auto invoke(F &&f, ArgTypes &&...args) noexcept(noexcept(detail2::INVOKE(std::forward< F >(f), std::forward< ArgTypes >(args)...))) -> decltype(detail2::INVOKE(std::forward< F >(f), std::forward< ArgTypes >(args)...))
Definition: invoke.h:85
std::for_each
T for_each(T...args)
std::initializer_list

bool Tuples::TupleObj::columnWise | ( |  | ) | const
| inline

column wise NTuple ?

Definition at line 1979 of file TupleObj.h.

1979 { return CLID_ColumnWiseTuple == clid(); }
Tuples::TupleObj::clid
const CLID & clid() const
accessor to the N-Tuple CLID
Definition: TupleObj.h:1973

virtual StatusCode Tuples::TupleObj::Error | ( | const std::string & | msg,
|  | const StatusCode | sc = `StatusCode::FAILURE`
| ) |  | const
| pure virtual

Implemented in Tuples::detail::TupleObjImp< HANDLER1, HANDLER2 >.

bool Tuples::TupleObj::evtColType | ( |  | ) | const
| inline

Event collection ?

Definition at line 1985 of file TupleObj.h.

1985 { return Tuples::EVTCOL == type(); }
Tuples::EVTCOL
Definition: TupleObj.h:86
Tuples::TupleObj::type
Tuples::Type type() const
accessor to the N-Tuple type
Definition: TupleObj.h:1976
template<typename ITERATOR1 , typename ITERATOR2 >

StatusCode Tuples::TupleObj::farray | ( | const std::string & | name,
|  | ITERATOR1 && | first,
|  | ITERATOR2 && | last,
|  | const std::string & | length,
|  | size_t | maxv
| ) |  |
| inline

Add an indexed array (of type float) to N-tuple.

The method is not VERY efficient since it copies the data.

std::vector<double> values = ... ;
tuple->farray( "Values" , // item name
values.begin () , // begin of sequence
values.end () , // end of sequence
"Length" , // name of "length" item
10000 ) ;

The name of "length" item can be reused for several arrays. The last assignement "wins"

std::vector<double> val1 = ... ;
std::vector<double> val2 = ... ;
tuple->farray( "Val1" , // item name
val1.begin () , // begin of sequence
val1.end () , // end of sequence
"Length" , // name of "length" item
10000 ) ; // maximal length
tuple->farray( "Val2" , // item name
val2.begin () , // begin of sequence
val2.end () , // end of sequence
"Length" , // name of "length" item
10000 ) ; // maximal length

Any sequence `[first:last[` of objects which can be converted to type `float` can be used as input data, e.g. `std::vector<double>`, `std::vector<float>`, plain C-array, or whatever else

Parameters

  name | name of N-tuple item
  first | begin of data sequence
  last | end of data sequence
  length | name of "length" item
  maxv | maximal length of array

Definition at line 892 of file TupleObj.h.

894 {
895 return farray( name, detail::to_float, std::forward<ITERATOR1>( first ), std::forward<ITERATOR2>( last ), length,
896 maxv );
897 }
Tuples::TupleObj::farray
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.
Definition: TupleObj.h:892
template<class DATA >

StatusCode Tuples::TupleObj::farray | ( | const std::string & | name,
|  | const DATA & | data,
|  | const std::string & | length,
|  | const size_t | maxv
| ) |  |
| inline

Add an indexed array (of type float) to N-tuple.

it is just a small adaptor for the previous method

std::vector<double> values = ... ;
tuple->farray( "Values" , // item name
values , // sequence
"Length" , // name of "length" item
10000 ) ;

The name of "length" item can be reused for several arrays. The last assignment "wins"

std::vector<double> val1 = ... ;
std::vector<double> val2 = ... ;
tuple->farray( "Val1" , // item name
val1 , // begin of sequence
"Length" , // name of "length" item
10000 ) ; // maximal length
tuple->farray( "Val2" , // item name
val2 , // begin of sequence
"Length" , // name of "length" item
10000 ) ; // maximal length

Any sequence which provides `begin()` and `end()` methods can be used.

Parameters

  name | name of N-tuple item
  data | data sequence
  length | name of "length" item
  maxv | maximal length of array

Definition at line 942 of file TupleObj.h.

943 {
944 return farray( name, std::begin( data ), std::end( data ), length, maxv );
945 }
std::end
T end(T...args)
Tuples::TupleObj::farray
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.
Definition: TupleObj.h:892
std::begin
T begin(T...args)
template<class FUNCTION , class ITERATOR >

StatusCode Tuples::TupleObj::farray | ( | const std::string & | name,
|  | const FUNCTION & | function,
|  | ITERATOR | first,
|  | ITERATOR | last,
|  | const std::string & | length,
|  | size_t | maxv
| ) |  |
| inline

Put an indexed array into LoKi-style N-Tuple.

std::vector<double> data = ... ;
Tuple tuple = ntuple( "My Ntuple" );
tuple->farray( "data" , // data item name
sqrt , // "function" to be applied
data.begin () , // begin of data sequence
data.end () , // end of data sequence
"length" , // name of "length" tuple item
10000 ) ; // maximal array length

Since the method is templated, one can use arbitrary combinations of "sequences" and "functions", e.g. one can directly manipulate with complex objects. The only one thing is required - the result of `FUNCTION(*DATA)` formal operation MUST be convertible to type `float`

// some container of particles.
ParticleVector particles = ... ;
Tuple tuple = ntuple( "My Ntuple" );
// put the transverse momentum of all particles into N-Tuple
tuple->farray( "pt" , // data item name
PT , // function object
particles.begin () , // begin of data sequence
particles.end () , // end of data sequence
"num" , // name of "length" tuple item
10000 ) ; // maximal array length
// create the appropriate function object
Fun fun = Q / P ;
// put Q/P of all particles into N-Tuple
tuple->farray( "qp" , // data item name
fun , // function object
particles.begin () , // begin of data sequence
particles.end () , // end of data sequence
"num" , // name of "length" tuple item
10000 ) ; // maximal array length

Parameters

  name | tuple item name
  function | function to be applied
  first | begin of data sequence
  last | end of data sequence
  length | name of "length" tuple name
  maxv | maximal length of the array

Returns
  status code

Definition at line 1010 of file TupleObj.h.

1012 {
1013 if ( invalid() ) {
1014 return InvalidTuple;
1015 }
1016 if ( rowWise() ) {
1017 return InvalidOperation;
1018 }
1019
1020 // adjust the length
1021 if ( std::distance( first, last ) > static_cast<std::ptrdiff_t>( maxv ) ) {
1022 Warning( "farray('" + name + "'): array is overflow, skip extra entries" );
1023 last = std::next( first, maxv );
1024 }
1025
1026 // get the length item
1027 Int* len = ints( length, 0, maxv );
1028 if ( !len ) {
1029 return InvalidColumn;
1030 }
1031
1032 // adjust the length
1033 *len = std::distance( first, last );
1034
1035 // get the array itself
1036 FArray* var = fArray( name, len );
1037 if ( !var ) {
1038 return InvalidColumn;
1039 }
1040
1041 // fill the array
1042 std::transform( first, last, std::begin( *var ), std::cref( function ) );
1043
1044 return StatusCode::SUCCESS;
1045 }
Tuples::TupleObj::ints
Int * ints(const std::string &name, int minv, int maxv)
get the column
Definition: TupleObj.cpp:377
StatusCode::SUCCESS
Definition: StatusCode.h:31
std::distance
T distance(T...args)
Tuples::InvalidTuple
Definition: TupleObj.h:97
Tuples::InvalidOperation
Definition: TupleObj.h:99
Tuples::TupleObj::Warning
virtual StatusCode Warning(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
std::next
T next(T...args)
Tuples::InvalidColumn
Definition: TupleObj.h:98
Tuples::TupleObj::rowWise
bool rowWise() const
row wise NTuple ?
Definition: TupleObj.h:1982
Tuples::TupleObj::fArray
FArray * fArray(const std::string &name, Int *item)
get the column
Definition: TupleObj.cpp:455
std::cref
T cref(T...args)
std::begin
T begin(T...args)
Tuples::TupleObj::Int
NTuple::Item< int > Int
basic type for int items
Definition: TupleObj.h:219
Tuples::TupleObj::invalid
bool invalid() const
invalid pointer to tuple ?
Definition: TupleObj.h:1991
std::transform
T transform(T...args)
Tuples::TupleObj::FArray
NTuple::Array< float > FArray
basic type for array of floats
Definition: TupleObj.h:240
template<typename DataIterator , template< typename, typename... > class Container = std::initializer_list, typename NamedFunction = std::pair<std::string, std::function<float( detail::const_ref_t<DataIterator> )>>, typename = std::enable_if_t<!std::is_convertible<Container<NamedFunction>, std::string>::value>>

StatusCode Tuples::TupleObj::farray | ( | const Container< NamedFunction > & | funs,
|  | DataIterator | first,
|  | DataIterator | last,
|  | const std::string & | length,
|  | size_t | maxv
| ) |  |
| inline

Definition at line 1124 of file TupleObj.h.

1126 {
1127 return farray_impl( funs.begin(), funs.end(), std::forward<DataIterator>( first ),
1128 std::forward<DataIterator>( last ), length, maxv );
1129 }
Tuples::TupleObj::farray_impl
StatusCode farray_impl(FunIterator first_item, FunIterator last_item, DataIterator first, DataIterator last, const std::string &length, size_t maxv)
Put arbitrary number of functions from one data array into LoKi-style N-Tuple simultaneously (effecti...
Definition: TupleObj.h:1075
template<typename NamedFunctions , typename DataIterator , typename = std::enable_if_t<!std::is_convertible<NamedFunctions, std::string>::value>>

StatusCode Tuples::TupleObj::farray | ( | const NamedFunctions & | funs,
|  | DataIterator | first,
|  | DataIterator | last,
|  | const std::string & | length,
|  | size_t | maxv
| ) |  |
| inline

Definition at line 1133 of file TupleObj.h.

1135 {
1136 return farray_impl( funs.begin(), funs.end(), std::forward<DataIterator>( first ),
1137 std::forward<DataIterator>( last ), length, maxv );
1138 }
Tuples::TupleObj::farray_impl
StatusCode farray_impl(FunIterator first_item, FunIterator last_item, DataIterator first, DataIterator last, const std::string &length, size_t maxv)
Put arbitrary number of functions from one data array into LoKi-style N-Tuple simultaneously (effecti...
Definition: TupleObj.h:1075
template<class FUNC1 , class FUNC2 , class Iterator >

StatusCode Tuples::TupleObj::farray | ( | const std::string & | name1,
|  | const FUNC1 & | func1,
|  | const std::string & | name2,
|  | const FUNC2 & | func2,
|  | Iterator && | first,
|  | Iterator && | last,
|  | const std::string & | length,
|  | size_t | maxv
| ) |  |
| inline

Put two functions from one data array into LoKi-style N-Tuple simultaneously (effective!)

std::vector<double> data = ... ;
Tuple tuple = ntuple( "My Ntuple" );
tuple->farray( "square_root" , // the first data item name
sqrt , // "func1" to be used
"sinus" , // the second data item name
sin , // "func2" to be used
data.begin () , // begin of data sequence
data.end () , // end of data sequence
"length" , // name of "length" tuple item
10000 ) ; // maximal array length

Parameters

  name1 | the first tuple item name
  func1 | the first function to be applied
  name2 | the second tuple item name
  func2 | the second function to be applied
  first | begin of data sequence
  last | end of data sequence
  length | name of "length" tuple name
  maxv | maximal length of the array

Returns
  status code

Definition at line 1172 of file TupleObj.h.

1174 {
1175 return farray( {{name1, std::cref( func1 )}, {name2, std::cref( func2 )}}, std::forward<Iterator>( first ),
1176 std::forward<Iterator>( last ), length, maxv );
1177 }
Tuples::TupleObj::farray
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.
Definition: TupleObj.h:892
std::cref
T cref(T...args)
template<class FUNC1 , class FUNC2 , class FUNC3 , class Iterator >

StatusCode Tuples::TupleObj::farray | ( | const std::string & | name1,
|  | const FUNC1 & | func1,
|  | const std::string & | name2,
|  | const FUNC2 & | func2,
|  | const std::string & | name3,
|  | const FUNC3 & | func3,
|  | Iterator && | first,
|  | Iterator && | last,
|  | const std::string & | length,
|  | size_t | maxv
| ) |  |
| inline

Put three functions from one data array into LoKi-style N-Tuple simultaneously (effective!)

std::vector<double> data = ... ;
Tuple tuple = ntuple( "My Ntuple" );
tuple->farray( "square_root" , // the first data item name
sqrt , // "func1" to be used
"sinus" , // the second data item name
sin , // "func2" to be used
"tan" , // the third data item name
tan , // "func3" to be used
data.begin () , // begin of data sequence
data.end () , // end of data sequence
"length" , // name of "length" tuple item
10000 ) ; // maximal array length

Parameters

  name1 | the first tuple item name
  func1 | the first function to be applied
  name2 | the second tuple item name
  func2 | the second function to be applied
  name3 | the third tuple item name
  func3 | the third function to be applied
  first | begin of data sequence
  last | end of data sequence
  length | name of "length" tuple name
  maxv | maximal length of the array

Returns
  status code

Definition at line 1216 of file TupleObj.h.

1219 {
1220 return farray( {{name1, std::cref( func1 )}, {name2, std::cref( func2 )}, {name3, std::cref( func3 )}},
1221 std::forward<Iterator>( first ), std::forward<Iterator>( last ), length, maxv );
1222 }
Tuples::TupleObj::farray
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.
Definition: TupleObj.h:892
std::cref
T cref(T...args)
template<class FUNC1 , class FUNC2 , class FUNC3 , class FUNC4 , class Iterator >

StatusCode Tuples::TupleObj::farray | ( | const std::string & | name1,
|  | const FUNC1 & | func1,
|  | const std::string & | name2,
|  | const FUNC2 & | func2,
|  | const std::string & | name3,
|  | const FUNC3 & | func3,
|  | const std::string & | name4,
|  | const FUNC4 & | func4,
|  | Iterator && | first,
|  | Iterator && | last,
|  | const std::string & | length,
|  | size_t | maxv
| ) |  |
| inline

Put four functions from one data array into LoKi-style N-Tuple simultaneously (effective!)

std::vector<double> data = ... ;
Tuple tuple = ntuple( "My Ntuple" );
tuple->farray( "square_root" , // the first data item name
sqrt , // "func1" to be used
"sinus" , // the second data item name
sin , // "func2" to be used
"tan" , // the third data item name
tan , // "func3" to be used
"tanh" , //
tanh , //
data.begin () , // begin of data sequence
data.end () , // end of data sequence
"length" , // name of "length" tuple item
10000 ) ; // maximal array length

Parameters

  name1 | the first tuple item name
  func1 | the first function to be applied
  name2 | the second tuple item name
  func2 | the second function to be applied
  name3 | the third tuple item name
  func3 | the third function to be applied
  name4 | the fourth tuple item name
  func4 | the fourth function to be applied
  first | begin of data sequence
  last | end of data sequence
  length | name of "length" tuple name
  maxv | maximal length of the array

Returns
  status code

Definition at line 1264 of file TupleObj.h.

1267 {
1268 return farray( {{name1, std::cref( func1 )},
1269 {name2, std::cref( func2 )},
1270 {name3, std::cref( func3 )},
1271 {name4, std::cref( func4 )}},
1272 std::forward<Iterator>( first ), std::forward<Iterator>( last ), length, maxv );
1273 }
Tuples::TupleObj::farray
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.
Definition: TupleObj.h:892
std::cref
T cref(T...args)

Tuples::TupleObj::FArray * Tuples::TupleObj::fArray | ( | const std::string & | name,
|  | Int * | item
| ) |  |
| private

get the column

Definition at line 455 of file TupleObj.cpp.

456 {
457 // existing array ?
458 auto found = m_farrays.find( name );
459 if ( m_farrays.end() != found ) {
460 return found->second.get();
461 }
462 return create_( this, m_farrays, name,
463 [&]( const std::string& n, FArray& i ) { return this->tuple()->addIndexedItem( n, *length, i ); } );
464 }
Tuples::TupleObj::tuple
const NTuple::Tuple * tuple() const
provide the access to underlying Gaudi N-tuple
Definition: TupleObj.h:1949
Tuples::TupleObj::m_farrays
FArrays m_farrays
the actual storage of all &#39;FArray&#39; columns
Definition: TupleObj.h:2145
NTuple::Tuple::addIndexedItem
StatusCode addIndexedItem(const std::string &name, Item< INDEX > &index, Array< TYPE > &array, const RANGE low, const RANGE high)
Add an indexed Array of data to a column wise N tuple with a range.
Definition: NTuple.h:736
std::string
STL class.
GaudiPluginService.cpluginsvc.n
n
Definition: cpluginsvc.py:228
GaudiUtils::Map::end
iterator end()
Definition: Map.h:134
GaudiUtils::Map::find
iterator find(const key_type &key)
Definition: Map.h:151
Tuples::TupleObj::FArray
NTuple::Array< float > FArray
basic type for array of floats
Definition: TupleObj.h:240

Tuples::TupleObj::FArray * Tuples::TupleObj::fArray | ( | const std::string & | name,
|  | const MIndex & | rows
| ) |  |
| private

get the column

Definition at line 468 of file TupleObj.cpp.

469 {
470 // existing array ?
471 auto found = m_arraysf.find( name );
472 if ( m_arraysf.end() != found ) {
473 return found->second.get();
474 }
475 return create_( this, m_arraysf, name,
476 [&]( const std::string& n, FArray& i ) { return this->tuple()->addItem( n, rows, i ); } );
477 }
Tuples::TupleObj::tuple
const NTuple::Tuple * tuple() const
provide the access to underlying Gaudi N-tuple
Definition: TupleObj.h:1949
Tuples::TupleObj::m_arraysf
FArrays m_arraysf
the actual storage of all &#39;FArray&#39; columns (fixed)
Definition: TupleObj.h:2148
std::string
STL class.
GaudiPluginService.cpluginsvc.n
n
Definition: cpluginsvc.py:228
GaudiUtils::Map::end
iterator end()
Definition: Map.h:134
GaudiUtils::Map::find
iterator find(const key_type &key)
Definition: Map.h:151
NTuple::Tuple::addItem
StatusCode addItem(const std::string &name, Item< TYPE > &itm)
Add a scalar data item a N tuple.
Definition: NTuple.h:572
Tuples::TupleObj::FArray
NTuple::Array< float > FArray
basic type for array of floats
Definition: TupleObj.h:240
template<typename FunIterator , typename DataIterator >

StatusCode Tuples::TupleObj::farray_impl | ( | FunIterator | first_item,
|  | FunIterator | last_item,
|  | DataIterator | first,
|  | DataIterator | last,
|  | const std::string & | length,
|  | size_t | maxv
| ) |  |
| inline

Put arbitrary number of functions from one data array into LoKi-style N-Tuple simultaneously (effective!)

std::vector<double> data = ... ;
Tuple tuple = ntuple( "My Ntuple" );
tuple->farray( { { "sqrt", sqrt }, // name of 1st column, and function to use for it
{ "sinus", sin } }, // name of the 2nd column, and corresponding function
data.begin () , // begin of data sequence
data.end () , // end of data sequence
"length" , // name of "length" tuple item
10000 ) ; // maximal array length

Parameters

  items | vector of pairs { name, callable }
  first | begin of data sequence
  last | end of data sequence
  length | name of "length" tuple name
  maxv | maximal length of the array

Returns
  status code

Definition at line 1075 of file TupleObj.h.

1077 {
1078 if ( invalid() ) return InvalidTuple;
1079 if ( rowWise() ) return InvalidOperation;
1080
1081 // adjust the length
1082 if ( std::distance( first, last ) > static_cast<std::ptrdiff_t>( maxv ) ) {
1083 using GaudiUtils::details::ostream_joiner;
1084 std::ostringstream os;
1085 ostream_joiner( os, first_item, last_item, ",",
1086 []( std::ostream& os, const auto& i ) -> std::ostream& { return os << i.first; } );
1087 Warning( "farray('" + os.str() + "'): array overflow, skipping extra entries" ).ignore();
1088 last = std::next( first, maxv );
1089 }
1090
1091 // get the length item
1092 Int* len = ints( length, 0, maxv );
1093 if ( !len ) {
1094 return InvalidColumn;
1095 }
1096
1097 // adjust the length
1098 *len = std::distance( first, last );
1099
1100 // get the arrays themselves
1101 std::vector<FArray*> vars;
1102 vars.reserve( std::distance( first_item, last_item ) );
1103 std::transform( first_item, last_item, std::back_inserter( vars ),
1104 [&]( const auto& item ) { return this->fArray( item.first, len ); } );
1105 if ( std::any_of( vars.begin(), vars.end(), []( const FArray* f ) { return !f; } ) ) {
1106 return InvalidColumn;
1107 }
1108
1109 // fill the array
1110 for ( size_t index = 0; first != last; ++first, ++index ) {
1111 auto item = first_item;
1112 for ( auto& var : vars ) {
1113 ( *var )[index] = ( item++ )->second( *first );
1114 }
1115 }
1116
1117 return StatusCode::SUCCESS;
1118 }
Tuples::TupleObj::ints
Int * ints(const std::string &name, int minv, int maxv)
get the column
Definition: TupleObj.cpp:377
StatusCode::SUCCESS
Definition: StatusCode.h:31
std::distance
T distance(T...args)
Tuples::InvalidTuple
Definition: TupleObj.h:97
std::vector::end
T end(T...args)
Tuples::InvalidOperation
Definition: TupleObj.h:99
Gaudi::Units::second
constexpr double second
Definition: SystemOfUnits.h:123
Tuples::TupleObj::Warning
virtual StatusCode Warning(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
std::next
T next(T...args)
std::ostringstream
STL class.
Tuples::InvalidColumn
Definition: TupleObj.h:98
Tuples::TupleObj::rowWise
bool rowWise() const
row wise NTuple ?
Definition: TupleObj.h:1982
GaudiUtils::details::ostream_joiner
Stream & ostream_joiner(Stream &os, Iterator first, Iterator last, Separator sep, OutputElement output=OutputElement{})
Definition: SerializeSTL.h:40
Tuples::TupleObj::fArray
FArray * fArray(const std::string &name, Int *item)
get the column
Definition: TupleObj.cpp:455
std::vector
STL class.
std::vector::begin
T begin(T...args)
std::back_inserter
T back_inserter(T...args)
std::any_of
T any_of(T...args)
Tuples::TupleObj::Int
NTuple::Item< int > Int
basic type for int items
Definition: TupleObj.h:219
Tuples::TupleObj::invalid
bool invalid() const
invalid pointer to tuple ?
Definition: TupleObj.h:1991
std::transform
T transform(T...args)
Tuples::TupleObj::FArray
NTuple::Array< float > FArray
basic type for array of floats
Definition: TupleObj.h:240
std::ostream
STL class.
std::vector::reserve
T reserve(T...args)

StatusCode Tuples::TupleObj::fill | ( | const char * | format... | ) |

Set the values for several columns simultaneously.

Number of columns is arbitrary, but it should not be less than number of blank or comma separated tags in `format` string. Non-existing columns will be automatically created and appended to the ntuple.

double r1 , r2 , r3 , r4 , mass , length ;
tuple->fill( "var1 var2, radius rad4 mass len" ,
r1, r2, r3, r4, mass, length);

Warning
  ALL columns are assumed to be of type `double`

Parameters

  format | blank-separated list of variables, followed by variable number of arguments.

Attention
  All variables are assumed to be `double` numbers

Author
  Vanya Belyaev Ivan..nosp@m.Bely.nosp@m.aev@i.nosp@m.tep..nosp@m.ru

Date
  2002-10-30

decode arguments

Definition at line 269 of file TupleObj.cpp.

270 {
271 // check the underlying tuple
272 if ( invalid() ) {
273 return InvalidTuple;
274 }
275 // decode format string into tokens
276 auto tokens = tokenize( format, " ,;" );
278 va_list valist;
279 va_start( valist, format );
280 // loop over all tokens
281 StatusCode status = StatusCode::SUCCESS;
282 for ( auto token = tokens.cbegin(); tokens.cend() != token && status.isSuccess(); ++token ) {
283 double val = va_arg( valist, double );
284 status = column( *token, val );
285 if ( status.isFailure() ) {
286 Error( "fill(): Can not add column '" + *token + "' " );
287 }
288 }
289 // mandatory !!!
290 va_end( valist );
291 //
292 return status;
293 }
StatusCode::SUCCESS
Definition: StatusCode.h:31
format
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
Definition: MsgStream.cpp:120
Tuples::InvalidTuple
Definition: TupleObj.h:97
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
Tuples::TupleObj::column
StatusCode column(const std::string &name, float value)
Set the value for selected tuple column.
Definition: TupleObj.cpp:315
StatusCode::isFailure
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
Tuples::TupleObj::Error
virtual StatusCode Error(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
Tuples::TupleObj::invalid
bool invalid() const
invalid pointer to tuple ?
Definition: TupleObj.h:1991
va_list
template<class MATRIX >

StatusCode Tuples::TupleObj::fmatrix | ( | const std::string & | name,
|  | const MATRIX & | data,
|  | size_t | rows,
|  | const MIndex & | cols,
|  | const std::string & | length,
|  | size_t | maxv
| ) |  |
| inline

Fill N-Tuple with data from variable-size matrix.

"Matrix" could be of any type, which supports data[iRow][iCol] indexing, e.g.

- std::vector<std::vector<TYPE> >
- CLHEP::HepMatrix, etc...

typedef std::vector<double> Row ;
typedef std::vector<Row> Mtrx ;
// number of columns (fixed!)
const size_t numCols = 5 ;
// maximal number of rows
const size_t maxRows = 300 ;
// number of rows (variable)
size_t numRows = .... ;
...
tuple -> fMatrix ( "mtrx" , // "column" name
mtrx , // matrix
numRows , // number of rows (variable!)
numCols , // number of columns (fixed)
"Length" , // name for "length" column
maxRows ) ; // maximal number of columns
CLHEP::HepMatrix mtrx = ... ;
...
tuple -> fMatrix ( "mtrx" , // "column" name
mtrx , // matrix
mtrx.num_row() , // number of rows (variable!)
mtrx.num_col() , // number of columns (fixed)
"Length" , // name for "length" column
maxRows ) ; // maximal number of columns

Parameters

  name | entry name in N-Tuple
  data | matrix itself
  rows | number of rows of matrix (variable)
  cols | number of columns of matrix (fixed)
  length | entry name in NTuple for number of matrix column
  maxv | maximal number of rows in matrix

Author
  Vanya BELYAEV Ivan..nosp@m.Bely.nosp@m.aev@l.nosp@m.app..nosp@m.in2p3.nosp@m..fr

Date
  2005-05-01

fill the matrix

Definition at line 1328 of file TupleObj.h.

1330 {
1331 if ( invalid() ) {
1332 return InvalidTuple;
1333 }
1334 if ( rowWise() ) {
1335 return InvalidOperation;
1336 }
1337
1338 // adjust the length
1339 if ( rows >= maxv ) {
1340 Warning( "fmatrix('" + name + "'): matrix is overflow, skip extra items" ).ignore();
1341 rows = ( 0 < maxv ) ? ( maxv - 1 ) : 0;
1342 }
1343
1344 // get the length item
1345 Int* len = ints( length, 0, maxv );
1346 if ( !len ) {
1347 return InvalidColumn;
1348 }
1349
1350 // adjust the length item
1351 *len = rows;
1352
1353 // get the array itself
1354 FMatrix* var = fMatrix( name, len, cols );
1355 if ( !var ) {
1356 return InvalidColumn;
1357 }
1358
1360 for ( size_t iCol = 0; iCol < cols; ++iCol ) {
1361 for ( MIndex iRow = 0; iRow < rows; ++iRow ) {
1362 ( *var )[iRow][iCol] = data[iRow][iCol];
1363 }
1364 }
1365
1366 return StatusCode::SUCCESS;
1367 }
Tuples::TupleObj::ints
Int * ints(const std::string &name, int minv, int maxv)
get the column
Definition: TupleObj.cpp:377
StatusCode::SUCCESS
Definition: StatusCode.h:31
Tuples::InvalidTuple
Definition: TupleObj.h:97
Tuples::TupleObj::MIndex
unsigned short MIndex
Definition: TupleObj.h:246
Tuples::InvalidOperation
Definition: TupleObj.h:99
Tuples::TupleObj::Warning
virtual StatusCode Warning(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
Tuples::TupleObj::FMatrix
NTuple::Matrix< float > FMatrix
basic type for matrix of floats
Definition: TupleObj.h:243
Tuples::InvalidColumn
Definition: TupleObj.h:98
Tuples::TupleObj::rowWise
bool rowWise() const
row wise NTuple ?
Definition: TupleObj.h:1982
Tuples::TupleObj::Int
NTuple::Item< int > Int
basic type for int items
Definition: TupleObj.h:219
Tuples::TupleObj::fMatrix
FMatrix * fMatrix(const std::string &name, Int *item, const MIndex &cols)
get the column
Definition: TupleObj.cpp:481
Tuples::TupleObj::invalid
bool invalid() const
invalid pointer to tuple ?
Definition: TupleObj.h:1991
StatusCode::ignore
void ignore() const
Definition: StatusCode.h:109
template<class DATA >

StatusCode Tuples::TupleObj::fmatrix | ( | const std::string & | name,
|  | DATA | first,
|  | DATA | last,
|  | const MIndex & | cols,
|  | const std::string & | length,
|  | size_t | maxv
| ) |  |
| inline

Fill N-Tuple with data from variable-size matrix.

"Matrix" could be of any type, which supports iteration from the first column to the last column and for each iterating column supports the indexing: (*first)[iCol]

typedef std::vector<double> Row ;
typedef std::vector<Row> Mtrx ;
// number of rows (fixed!)
const size_t numRows = 5 ;
// maximal number of columns
const size_t maxCols = 300 ;
// number of columns (variable)
size_t numCols = .... ;
...
tuple -> fMatrix ( "mtrx" , // entry name
mtrx.begin() , // first row of matrix
mtrx.end () , // last row of matrix
numCols , // number of columns (fixed!)
"Length" , // name for "length" column
maxRows ) ; // maximal number of rows

Parameters

  name | entry name in N-Tuple
  first | iterator for the first row of matrix
  last | iterator for the last row of matrix
  cols | number of columns for matrix (fixed!)
  length | entry name in NTuple for number of matrix column
  maxv | maximal number of rows in matrix

Author
  Vanya BELYAEV Ivan..nosp@m.Bely.nosp@m.aev@l.nosp@m.app..nosp@m.in2p3.nosp@m..fr

Date
  2005-05-01

fill the matrix

Definition at line 1406 of file TupleObj.h.

1408 {
1409 if ( invalid() ) {
1410 return InvalidTuple;
1411 }
1412 if ( rowWise() ) {
1413 return InvalidOperation;
1414 }
1415
1416 // adjust the length
1417 if ( first + maxv < last ) {
1418 Warning( "fmatrix('" + name + "'): matrix is overflow, skip extra items" ).ignore();
1419 last = first + maxv;
1420 }
1421
1422 // get the length item
1423 Int* len = ints( length, 0, maxv );
1424 if ( !len ) {
1425 return InvalidColumn;
1426 }
1427
1428 // adjust the length item
1429 *len = last - first;
1430
1431 // get the array itself
1432 FMatrix* var = fMatrix( name, len, cols );
1433 if ( !var ) {
1434 return InvalidColumn;
1435 }
1436
1438 size_t iRow = 0;
1439 for ( ; first != last; ++first ) {
1440 //
1441 for ( MIndex iCol = 0; iCol < cols; ++iCol ) {
1442 ( *var )[iRow][iCol] = (float)( ( *first )[iCol] );
1443 }
1444 //
1445 ++iRow;
1446 }
1447
1448 return StatusCode::SUCCESS;
1449 }
Tuples::TupleObj::ints
Int * ints(const std::string &name, int minv, int maxv)
get the column
Definition: TupleObj.cpp:377
StatusCode::SUCCESS
Definition: StatusCode.h:31
Tuples::InvalidTuple
Definition: TupleObj.h:97
Tuples::TupleObj::MIndex
unsigned short MIndex
Definition: TupleObj.h:246
Tuples::InvalidOperation
Definition: TupleObj.h:99
Tuples::TupleObj::Warning
virtual StatusCode Warning(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
Tuples::TupleObj::FMatrix
NTuple::Matrix< float > FMatrix
basic type for matrix of floats
Definition: TupleObj.h:243
Tuples::InvalidColumn
Definition: TupleObj.h:98
Tuples::TupleObj::rowWise
bool rowWise() const
row wise NTuple ?
Definition: TupleObj.h:1982
Tuples::TupleObj::Int
NTuple::Item< int > Int
basic type for int items
Definition: TupleObj.h:219
Tuples::TupleObj::fMatrix
FMatrix * fMatrix(const std::string &name, Int *item, const MIndex &cols)
get the column
Definition: TupleObj.cpp:481
Tuples::TupleObj::invalid
bool invalid() const
invalid pointer to tuple ?
Definition: TupleObj.h:1991
StatusCode::ignore
void ignore() const
Definition: StatusCode.h:109
template<class FUN , class DATA >

StatusCode Tuples::TupleObj::fmatrix | ( | const std::string & | name,
|  | FUN | funF,
|  | FUN | funL,
|  | DATA | first,
|  | DATA | last,
|  | const std::string & | length,
|  | size_t | maxv
| ) |  |
| inline

fill N-Tuple with matrix of "direct-product" of "data-vector" [first,last) and "function-vector" [funF, funL)

The elements of effective matrix are:

mtrx[iCol][iRow] = (*(funF+iRow))( *(first+iCol) )

Attention
  The length of data-vector is variable, while the length of "function" vector is fixed!

typedef std::vector<double> Array ;
Array array = ... ;
typedef double (*fun)( double ) ;
typedef std::vector<fun> Funs ;
Funs funs ;
funs.push_back( sin ) ;
funs.push_back( cos ) ;
funs.push_back( tan ) ;
funs.push_back( sinh ) ;
funs.push_back( cosh ) ;
funs.push_back( tanh ) ;
tuple->fmatrix ( "mtrx" , // N-Tuple entry name
funs.begin () , // begin of "function-vector"
funs.end () , // end of "function-vector"
array.begin () , // begin of "data-vector"
array.end () , // end of "data-vector"
"Length" ,
100 ) ;

This method is very convenient e.g. for using within LoKi:

typedef std::vector<Fun> VctFun ;
// sequence of Particles
Range particles = .... ;
// vector of functions:
VctFun funs ;
funs.push_back( E / GeV ) ;
funs.push_back( PX / GeV ) ;
funs.push_back( PY / GeV ) ;
funs.push_back( PZ / GeV ) ;
funs.push_back( PT / GeV ) ;
funs.push_back( M / GeV ) ;
funs.push_back( ID ) ;
// fill N-Tuple with information about each particle
tuple -> fmatrix ( "vars" ,
funs.begin () ,
funs.end () ,
particles.begin () ,
particles.end () ,
"nParts" ,
200 ) ;

Parameters

  name | entry name in N-Tuple
  funF | "begin"-iterator for vector of functions
  funL | "end"-iterator for vector of functions
  first | "begin"-iterator for vector of data
  last | "end"-iterator for vector of data
  length | entry name in NTuple for number of matrix column
  maxv | maximal number of rows in matrix

Author
  Vanya BELYAEV Ivan..nosp@m.Bely.nosp@m.aev@l.nosp@m.app..nosp@m.in2p3.nosp@m..fr

Date
  2005-05-01

fill the matrix

Definition at line 1530 of file TupleObj.h.

1532 {
1533 if ( invalid() ) {
1534 return InvalidTuple;
1535 }
1536 if ( rowWise() ) {
1537 return InvalidOperation;
1538 }
1539
1540 // adjust the length
1541 if ( std::distance( first, last ) > static_cast<std::ptrdiff_t>( maxv ) ) {
1542 Warning( "fmatrix('" + name + "'): matrix is overflow, skip extra items" ).ignore();
1543 last = std::next( first, maxv );
1544 }
1545
1546 // get the length item
1547 Int* len = ints( length, 0, maxv );
1548 if ( !len ) {
1549 return InvalidColumn;
1550 }
1551
1552 // adjust the length item
1553 *len = std::distance( first, last );
1554
1555 // get the array itself
1556 auto cols = std::distance( funF, funL );
1557 FMatrix* var = fMatrix( name, len, cols );
1558 if ( !var ) {
1559 return InvalidColumn;
1560 }
1561
1563 size_t iRow = 0;
1564 for ( ; first != last; ++first ) {
1565 //
1566 for ( FUN fun = funF; fun < funL; ++fun ) {
1567 ( *var )[iRow][fun - funF] = ( *fun )( *first );
1568 }
1569 //
1570 ++iRow;
1571 }
1572
1573 return StatusCode::SUCCESS;
1574 }
Tuples::TupleObj::ints
Int * ints(const std::string &name, int minv, int maxv)
get the column
Definition: TupleObj.cpp:377
StatusCode::SUCCESS
Definition: StatusCode.h:31
std::distance
T distance(T...args)
Tuples::InvalidTuple
Definition: TupleObj.h:97
Tuples::InvalidOperation
Definition: TupleObj.h:99
Tuples::TupleObj::Warning
virtual StatusCode Warning(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
std::next
T next(T...args)
Tuples::TupleObj::FMatrix
NTuple::Matrix< float > FMatrix
basic type for matrix of floats
Definition: TupleObj.h:243
Tuples::InvalidColumn
Definition: TupleObj.h:98
Tuples::TupleObj::rowWise
bool rowWise() const
row wise NTuple ?
Definition: TupleObj.h:1982
fun
double fun(const std::vector< double > &x)
Definition: PFuncTest.cpp:26
Tuples::TupleObj::Int
NTuple::Item< int > Int
basic type for int items
Definition: TupleObj.h:219
Tuples::TupleObj::fMatrix
FMatrix * fMatrix(const std::string &name, Int *item, const MIndex &cols)
get the column
Definition: TupleObj.cpp:481
Tuples::TupleObj::invalid
bool invalid() const
invalid pointer to tuple ?
Definition: TupleObj.h:1991
StatusCode::ignore
void ignore() const
Definition: StatusCode.h:109
template<class KEY , class VALUE >

StatusCode Tuples::TupleObj::fmatrix | ( | const std::string & | name,
|  | const GaudiUtils::VectorMap< KEY, VALUE > & | info,
|  | const std::string & | length,
|  | const size_t | maxv = `100`
| ) |  |
| inline

shortcut to put "ExtraInfo" fields of major into N-Tuple

const LHCb::Particle* B = ...
Tuple tuple = nTuple("My N-Tuple") ;
// put the vector into N-Tuple:
tuple -> fmatrix ( "Info" , B->extraInfo() , "nInfo" , 100 ) ;

Author
  Vanya BELYAEV ibely.nosp@m.aev@.nosp@m.physi.nosp@m.cs.s.nosp@m.yr.ed.nosp@m.u

Date
  2006-11-26

Definition at line 1915 of file TupleObj.h.

1917 {
1918 using Info = std::pair<KEY, VALUE>;
1919 static const std::array<std::function<float( const Info& )>, 2> fns = {
1920 {[]( const Info& i ) { return i.first; }, []( const Info& i ) { return i.second; }}};
1921 return fmatrix( name, std::begin( fns ), std::end( fns ), std::begin( info ), std::end( info ), length, maxv );
1922 }
std::end
T end(T...args)
Tuples::TupleObj::fmatrix
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.
Definition: TupleObj.h:1328
std::pair
std::begin
T begin(T...args)
std::array
STL class.

Tuples::TupleObj::FMatrix * Tuples::TupleObj::fMatrix | ( | const std::string & | name,
|  | Int * | item,
|  | const MIndex & | cols
| ) |  |
| private

get the column

Definition at line 481 of file TupleObj.cpp.

483 {
484 // existing array ?
485 auto found = m_fmatrices.find( name );
486 if ( m_fmatrices.end() != found ) {
487 return found->second.get();
488 }
489 return create_( this, m_fmatrices, name, [&]( const std::string& n, FMatrix& i ) {
490 return this->tuple()->addIndexedItem( n, *length, cols, i );
491 } );
492 }
Tuples::TupleObj::m_fmatrices
FMatrices m_fmatrices
the actual storage of all &#39;FArray&#39; columns
Definition: TupleObj.h:2151
Tuples::TupleObj::tuple
const NTuple::Tuple * tuple() const
provide the access to underlying Gaudi N-tuple
Definition: TupleObj.h:1949
NTuple::Tuple::addIndexedItem
StatusCode addIndexedItem(const std::string &name, Item< INDEX > &index, Array< TYPE > &array, const RANGE low, const RANGE high)
Add an indexed Array of data to a column wise N tuple with a range.
Definition: NTuple.h:736
std::string
STL class.
GaudiPluginService.cpluginsvc.n
n
Definition: cpluginsvc.py:228
GaudiUtils::Map::end
iterator end()
Definition: Map.h:134
Tuples::TupleObj::FMatrix
NTuple::Matrix< float > FMatrix
basic type for matrix of floats
Definition: TupleObj.h:243
GaudiUtils::Map::find
iterator find(const key_type &key)
Definition: Map.h:151

Tuples::TupleObj::FMatrix * Tuples::TupleObj::fMatrix | ( | const std::string & | name,
|  | const MIndex & | rows,
|  | const MIndex & | cols
| ) |  |
| private

get the column

Definition at line 496 of file TupleObj.cpp.

498 {
499 // existing array ?
500 auto found = m_matricesf.find( name );
501 if ( m_matricesf.end() != found ) {
502 return found->second.get();
503 }
504 return create_( this, m_matricesf, name,
505 [&]( const std::string& n, FMatrix& i ) { return this->tuple()->addItem( n, rows, cols, i ); } );
506 }
Tuples::TupleObj::tuple
const NTuple::Tuple * tuple() const
provide the access to underlying Gaudi N-tuple
Definition: TupleObj.h:1949
Tuples::TupleObj::m_matricesf
FMatrices m_matricesf
the actual storage of all &#39;FMatrix&#39; columns (fixed)
Definition: TupleObj.h:2154
std::string
STL class.
GaudiPluginService.cpluginsvc.n
n
Definition: cpluginsvc.py:228
GaudiUtils::Map::end
iterator end()
Definition: Map.h:134
Tuples::TupleObj::FMatrix
NTuple::Matrix< float > FMatrix
basic type for matrix of floats
Definition: TupleObj.h:243
GaudiUtils::Map::find
iterator find(const key_type &key)
Definition: Map.h:151
NTuple::Tuple::addItem
StatusCode addItem(const std::string &name, Item< TYPE > &itm)
Add a scalar data item a N tuple.
Definition: NTuple.h:572

bool Tuples::TupleObj::goodItem | ( | const std::string & | name | ) | const
| inline

check the uniqueness of the name

Parameters

  name | the name of the item

Returns
  true if the name is indeed unique

Definition at line 2009 of file TupleObj.h.

2009 { return m_items.end() == m_items.find( name ); }
std::map::end
T end(T...args)
Tuples::TupleObj::m_items
ItemMap m_items
all booked types:
Definition: TupleObj.h:2157
std::map::find
T find(T...args)

Tuples::TupleObj::Int * Tuples::TupleObj::ints | ( | const std::string & | name,
|  | int | minv,
|  | int | maxv
| ) |  |
| private

get the column

Definition at line 377 of file TupleObj.cpp.

378 {
379 return find_or_create( this, name, m_ints, minv, maxv );
380 }
Tuples::TupleObj::m_ints
Ints m_ints
the actual storage of all &#39;Int&#39; columns
Definition: TupleObj.h:2124

bool Tuples::TupleObj::invalid | ( |  | ) | const
| inline

invalid pointer to tuple ?

Definition at line 1991 of file TupleObj.h.

1991 { return !valid(); }
Tuples::TupleObj::valid
bool valid() const
valid pointer to tuple ?
Definition: TupleObj.h:1988

const ItemMap& Tuples::TupleObj::items | ( |  | ) | const
| inline

get the full list of booked items

Definition at line 2012 of file TupleObj.h.

2012 { return m_items; }
Tuples::TupleObj::m_items
ItemMap m_items
all booked types:
Definition: TupleObj.h:2157
template<class MATRIX >

StatusCode Tuples::TupleObj::matrix | ( | const std::string & | name,
|  | const MATRIX & | data,
|  | const MIndex & | rows,
|  | const MIndex & | cols
| ) |  |
| inline

fill N-Tuple with fixed-size matrix

"MATRIX" must support indexing operations: data[iRow][iCol]

e.g it could be of type:

- std::vector<std::vector<TYPE> >
- CLHEP::HepMatrix , CLHEP::GenMatrix, etc ...
- "TYPE"[n][m]

The content of MATRIX should be implicitly convertible to "float"

CLHEP::HepMatrix mtrx1(3,20) ;
...
tuple -> matrix ( "m1" ,
mtrx1 ,
mtrx1.num_row() ,
mtrx1.num_col() ) ;
typedef std::vector<double> Row ;
typedef std:vector<Row> Mtrx ;
Mtrx mtrx2( 3 , Row(10) ) ;
...
tuple -> matrix ( "m2" ,
mtrx2 ,
3 ,
10 ) ;
float mtrx3[3][10] ;
...
tuple -> matrix ( "m3" ,
mtrx3 ,
3 ,
10 ) ;

Parameters

  name | N-Tuple entry name
  data | data source (matrix)
  cols | number of columns
  rows | number of rows

Author
  Vanya BELYAEV Ivan..nosp@m.Bely.nosp@m.aev@l.nosp@m.app..nosp@m.in2p3.nosp@m..fr

Date
  2005-05-01

fill the matrix

Definition at line 1764 of file TupleObj.h.

1765 {
1766 if ( invalid() ) {
1767 return InvalidTuple;
1768 }
1769 if ( rowWise() ) {
1770 return InvalidOperation;
1771 }
1772
1773 // get the matrix itself
1774 FMatrix* var = fMatrix( name, rows, cols );
1775 if ( !var ) {
1776 return InvalidColumn;
1777 }
1778
1780 for ( size_t iCol = 0; iCol < cols; ++iCol ) {
1781 for ( size_t iRow = 0; iRow < rows; ++iRow ) {
1782 ( *var )[iRow][iCol] = data[iRow][iCol];
1783 }
1784 };
1785 return StatusCode::SUCCESS;
1786 }
StatusCode::SUCCESS
Definition: StatusCode.h:31
Tuples::InvalidTuple
Definition: TupleObj.h:97
Tuples::InvalidOperation
Definition: TupleObj.h:99
Tuples::TupleObj::FMatrix
NTuple::Matrix< float > FMatrix
basic type for matrix of floats
Definition: TupleObj.h:243
Tuples::InvalidColumn
Definition: TupleObj.h:98
Tuples::TupleObj::rowWise
bool rowWise() const
row wise NTuple ?
Definition: TupleObj.h:1982
Tuples::TupleObj::fMatrix
FMatrix * fMatrix(const std::string &name, Int *item, const MIndex &cols)
get the column
Definition: TupleObj.cpp:481
Tuples::TupleObj::invalid
bool invalid() const
invalid pointer to tuple ?
Definition: TupleObj.h:1991
template<class TYPE , unsigned int D1, unsigned int D2, class REP >

StatusCode Tuples::TupleObj::matrix | ( | const std::string & | name,
|  | const ROOT::Math::SMatrix< TYPE, D1, D2, REP > & | mtrx
| ) |  |
| inline

shortcut to put Smatrix into N-tuple:

Author
  Vanya BELYAEV ibely.nosp@m.aev@.nosp@m.physi.nosp@m.cs.s.nosp@m.yr.ed.nosp@m.u

Date
  2006-11-26

fill the matrix

Definition at line 1872 of file TupleObj.h.

1873 {
1874 if ( invalid() ) {
1875 return InvalidTuple;
1876 }
1877 if ( rowWise() ) {
1878 return InvalidOperation;
1879 }
1880
1881 // get the matrix itself
1882 FMatrix* var = fMatrix( name, (MIndex)D1, (MIndex)D2 );
1883 if ( !var ) {
1884 return InvalidColumn;
1885 }
1886
1888 for ( size_t iCol = 0; iCol < D2; ++iCol ) {
1889 for ( size_t iRow = 0; iRow < D1; ++iRow ) {
1890 ( *var )[iRow][iCol] = mtrx( iRow, iCol );
1891 }
1892 };
1893
1894 return StatusCode::SUCCESS;
1895 }
StatusCode::SUCCESS
Definition: StatusCode.h:31
Tuples::InvalidTuple
Definition: TupleObj.h:97
Tuples::TupleObj::MIndex
unsigned short MIndex
Definition: TupleObj.h:246
Tuples::InvalidOperation
Definition: TupleObj.h:99
Tuples::TupleObj::FMatrix
NTuple::Matrix< float > FMatrix
basic type for matrix of floats
Definition: TupleObj.h:243
Tuples::InvalidColumn
Definition: TupleObj.h:98
Tuples::TupleObj::rowWise
bool rowWise() const
row wise NTuple ?
Definition: TupleObj.h:1982
Tuples::TupleObj::fMatrix
FMatrix * fMatrix(const std::string &name, Int *item, const MIndex &cols)
get the column
Definition: TupleObj.cpp:481
Tuples::TupleObj::invalid
bool invalid() const
invalid pointer to tuple ?
Definition: TupleObj.h:1991

const std::string& Tuples::TupleObj::name | ( |  | ) | const
| inline

get the name

Definition at line 1944 of file TupleObj.h.

1944 { return m_name; }
Tuples::TupleObj::m_name
std::string m_name
name
Definition: TupleObj.h:2094

TupleObj& Tuples::TupleObj::operator= | ( | const TupleObj & |  | ) |
| private delete

template<class TYPE >

StatusCode Tuples::TupleObj::put | ( | const std::string & | name,
|  | const TYPE * | obj
| ) |  |
| inline

The function allows to add almost arbitrary object into N-tuple.

Attention
  it requires POOL persistency

Parameters

  name | column name
  obj | pointer to the object

Author
  Vanya BELYAEV ibely.nosp@m.aev@.nosp@m.physi.nosp@m.cs.s.nosp@m.yr.ed.nosp@m.u

Date
  2007-04-08

Definition at line 121 of file TuplePut.h.

122 {
123 if ( invalid() ) {
124 return InvalidTuple;
125 } // RETURN
126 if ( !evtColType() ) {
127 return InvalidOperation;
128 } // RETURN
129
130 // static block: The type description & the flag
131 static bool s_fail = false; // STATIC
132 static TClass* s_type = nullptr; // STATIC
133 // check the status
134 if ( s_fail ) {
135 return InvalidItem;
136 } // RETURN
137 else if ( !s_type ) {
138 s_type = TClass::GetClass( typeid( TYPE ) );
139 if ( !s_type ) {
140 s_fail = true;
141 return Error( " put('" + name + "'," + System::typeinfoName( typeid( TYPE ) ) + ") :Invalid ROOT Type",
142 InvalidItem ); // RETURN
143 }
144 }
145 // the local storage of items
146 static Tuples::ItemStore<TYPE*> s_map;
147 // get the variable by name:
148 auto item = s_map.getItem( name, this );
149 if ( !item ) {
150 return Error( " put('" + name + "'): invalid item detected", InvalidItem );
151 }
152 // assign the item!
153 ( *item ) = const_cast<TYPE*>( obj ); // THATS ALL!!
154 //
155 return StatusCode::SUCCESS; // RETURN
156 }
StatusCode::SUCCESS
Definition: StatusCode.h:31
Tuples::TupleObj::evtColType
bool evtColType() const
Event collection ?
Definition: TupleObj.h:1985
Tuples::InvalidTuple
Definition: TupleObj.h:97
System::typeinfoName
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:329
Tuples::InvalidItem
Definition: TupleObj.h:101
Tuples::InvalidOperation
Definition: TupleObj.h:99
Tuples::TupleObj::Error
virtual StatusCode Error(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
Tuples::TupleObj::invalid
bool invalid() const
invalid pointer to tuple ?
Definition: TupleObj.h:1991
Tuples::ItemStore
Simple class, which represents the local storage of N-tuple items of the given type.
Definition: TuplePut.h:38
Tuples::ItemStore::getItem
NTuple::Item< VALUE > * getItem(const std::string &key, Tuples::TupleObj *tuple)
the only one method:
Definition: TuplePut.h:51

unsigned long Tuples::TupleObj::refCount | ( |  | ) | const
| inline

return the reference counter

Returns
  current reference counter

Definition at line 1959 of file TupleObj.h.

1959 { return m_refCount; }
Tuples::TupleObj::m_refCount
size_t m_refCount
reference counter
Definition: TupleObj.h:2106

void Tuples::TupleObj::release | ( |  | ) |

release the reference to TupleObj if reference counter becomes zero, object will be automatically deleted

Definition at line 225 of file TupleObj.cpp.

226 {
227 // decrease the reference counter
228 if ( refCount() > 0 ) {
229 --m_refCount;
230 }
231 // check references -- delete if needed
232 if ( 0 == refCount() ) delete this;
233 }
Tuples::TupleObj::m_refCount
size_t m_refCount
reference counter
Definition: TupleObj.h:2106
Tuples::TupleObj::refCount
unsigned long refCount() const
return the reference counter
Definition: TupleObj.h:1959

bool Tuples::TupleObj::rowWise | ( |  | ) | const
| inline

row wise NTuple ?

Definition at line 1982 of file TupleObj.h.

1982 { return CLID_RowWiseTuple == clid(); }
Tuples::TupleObj::clid
const CLID & clid() const
accessor to the N-Tuple CLID
Definition: TupleObj.h:1973

const NTuple::Tuple* Tuples::TupleObj::tuple | ( |  | ) | const
| inline

provide the access to underlying Gaudi N-tuple

Returns
  pointer to Gaudi N-tuple object

Definition at line 1949 of file TupleObj.h.

1949 { return m_tuple; }
Tuples::TupleObj::m_tuple
NTuple::Tuple * m_tuple
tuple itself
Definition: TupleObj.h:2097

NTuple::Tuple* Tuples::TupleObj::tuple | ( |  | ) |
| inline

provide the access to underlying Gaudi N-tuple

Returns
  pointer to Gaudi N-tuple object

Definition at line 1954 of file TupleObj.h.

1954 { return m_tuple; }
Tuples::TupleObj::m_tuple
NTuple::Tuple * m_tuple
tuple itself
Definition: TupleObj.h:2097

Tuples::Type Tuples::TupleObj::type | ( |  | ) | const
| inline

accessor to the N-Tuple type

Definition at line 1976 of file TupleObj.h.

1976 { return m_type; }
Tuples::TupleObj::m_type
Tuples::Type m_type
tuple &#39;type&#39;
Definition: TupleObj.h:2103

bool Tuples::TupleObj::valid | ( |  | ) | const
| inline

valid pointer to tuple ?

Definition at line 1988 of file TupleObj.h.

1988 { return 0 != tuple(); }
Tuples::TupleObj::tuple
const NTuple::Tuple * tuple() const
provide the access to underlying Gaudi N-tuple
Definition: TupleObj.h:1949

virtual StatusCode Tuples::TupleObj::Warning | ( | const std::string & | msg,
|  | const StatusCode | sc = `StatusCode::FAILURE`
| ) |  | const
| pure virtual

Implemented in Tuples::detail::TupleObjImp< HANDLER1, HANDLER2 >.

StatusCode Tuples::TupleObj::write | ( |  | ) |

write a record to NTuple

Returns
  status code

Definition at line 237 of file TupleObj.cpp.

238 {
239 if ( invalid() ) {
240 return InvalidTuple;
241 }
242 return tuple()->write();
243 }
INTuple::write
virtual StatusCode write()=0
Write record of the NTuple (Shortcut of writeRecord)
Tuples::TupleObj::tuple
const NTuple::Tuple * tuple() const
provide the access to underlying Gaudi N-tuple
Definition: TupleObj.h:1949
Tuples::InvalidTuple
Definition: TupleObj.h:97
Tuples::TupleObj::invalid
bool invalid() const
invalid pointer to tuple ?
Definition: TupleObj.h:1991

## Member Data Documentation

Addresses Tuples::TupleObj::m_addresses
| mutable private

the actual storage of all 'Address' columns

Definition at line 2142 of file TupleObj.h.

FArrays Tuples::TupleObj::m_arraysf
| mutable private

the actual storage of all 'FArray' columns (fixed)

Definition at line 2148 of file TupleObj.h.

Bools Tuples::TupleObj::m_bools
| mutable private

the actual storage of all 'bool' columns

Definition at line 2109 of file TupleObj.h.

Chars Tuples::TupleObj::m_chars
| mutable private

the actual storage of all 'Int' columns

Definition at line 2112 of file TupleObj.h.

CLID Tuples::TupleObj::m_clid
| private

tuple CLID

Definition at line 2100 of file TupleObj.h.

Doubles Tuples::TupleObj::m_doubles
| mutable private

the actual storage of all 'Double' columns

Definition at line 2139 of file TupleObj.h.

FArrays Tuples::TupleObj::m_farrays
| mutable private

the actual storage of all 'FArray' columns

Definition at line 2145 of file TupleObj.h.

Floats Tuples::TupleObj::m_floats
| mutable private

the actual storage of all 'Float' columns

Definition at line 2136 of file TupleObj.h.

FMatrices Tuples::TupleObj::m_fmatrices
| mutable private

the actual storage of all 'FArray' columns

Definition at line 2151 of file TupleObj.h.

Ints Tuples::TupleObj::m_ints
| mutable private

the actual storage of all 'Int' columns

Definition at line 2124 of file TupleObj.h.

ItemMap Tuples::TupleObj::m_items
| private

all booked types:

Definition at line 2157 of file TupleObj.h.

LongLongs Tuples::TupleObj::m_longlongs
| mutable private

the actual storage of all 'longlong' columns

Definition at line 2130 of file TupleObj.h.

FMatrices Tuples::TupleObj::m_matricesf
| mutable private

the actual storage of all 'FMatrix' columns (fixed)

Definition at line 2154 of file TupleObj.h.

std::string Tuples::TupleObj::m_name
| private

name

Definition at line 2094 of file TupleObj.h.

size_t Tuples::TupleObj::m_refCount = 0
| private

reference counter

Definition at line 2106 of file TupleObj.h.

Shorts Tuples::TupleObj::m_shorts
| mutable private

the actual storage of all 'Int' columns

Definition at line 2118 of file TupleObj.h.

NTuple::Tuple* Tuples::TupleObj::m_tuple
| private

tuple itself

Definition at line 2097 of file TupleObj.h.

Tuples::Type Tuples::TupleObj::m_type
| private

tuple 'type'

Definition at line 2103 of file TupleObj.h.

UChars Tuples::TupleObj::m_uchars
| mutable private

the actual storage of all 'unsigned int' columns

Definition at line 2115 of file TupleObj.h.

UInts Tuples::TupleObj::m_uints
| mutable private

the actual storage of all 'unsigned int' columns

Definition at line 2127 of file TupleObj.h.

ULongLongs Tuples::TupleObj::m_ulonglongs
| mutable private

the actual storage of all 'ulonglong' columns

Definition at line 2133 of file TupleObj.h.

UShorts Tuples::TupleObj::m_ushorts
| mutable private

the actual storage of all 'unsigned int' columns

Definition at line 2121 of file TupleObj.h.

The documentation for this class was generated from the following files:

- GaudiAlg/GaudiAlg/TupleObj.h
- GaudiAlg/GaudiAlg/TuplePut.h
- GaudiAlg/src/lib/TupleObj.cpp