All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Tuples::TupleObj Class Referenceabstract

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

#include <GaudiAlg/TupleObj.h>

Inheritance diagram for Tuples::TupleObj:
Collaboration diagram for Tuples::TupleObj:

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, const float value)
 Set the value for selected tuple column. More...
 
StatusCode column (const std::string &name, const 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, const short value)
 Set the value for selected tuple column. More...
 
StatusCode column (const std::string &name, const short value, const short minv, const short maxv)
 Set the value for selected tuple column. More...
 
StatusCode column (const std::string &name, const unsigned short value)
 Set the value for selected tuple column. More...
 
StatusCode column (const std::string &name, const unsigned short value, const unsigned short minv, const unsigned short maxv)
 Set the value for selected tuple column. More...
 
StatusCode column (const std::string &name, const char value)
 Set the value for selected tuple column. More...
 
StatusCode column (const std::string &name, const char value, const char minv, const char maxv)
 Set the value for selected tuple column. More...
 
StatusCode column (const std::string &name, const unsigned char value)
 Set the value for selected tuple column. More...
 
StatusCode column (const std::string &name, const unsigned char value, const unsigned char minv, const unsigned char maxv)
 Set the value for selected tuple column. More...
 
StatusCode column (const std::string &name, const int value)
 Set the value for selected tuple column. More...
 
StatusCode column (const std::string &name, const int value, const int minv, const int maxv)
 Set the value for selected tuple column. More...
 
StatusCode column (const std::string &name, const unsigned int value)
 Set the value for selected tuple column. More...
 
StatusCode column (const std::string &name, const unsigned int value, const unsigned int minv, const unsigned int maxv)
 Set the value for selected tuple column. More...
 
StatusCode column (const std::string &name, const long value)
 Set the value for the selected tuple column. More...
 
StatusCode column (const std::string &name, const long value, const long minv, const long maxv)
 Set the value for selected tuple column. More...
 
StatusCode column (const std::string &name, const unsigned long value)
 Set the value for selected tuple column. More...
 
StatusCode column (const std::string &name, const unsigned long value, const unsigned long minv, const unsigned long maxv)
 Set the value for selected tuple column. More...
 
StatusCode column (const std::string &name, const long long value)
 Set the value for selected tuple column. More...
 
StatusCode column (const std::string &name, const long long value, const long long minv, const long long maxv)
 Set the value for selected tuple column. More...
 
StatusCode column (const std::string &name, const unsigned long long value)
 Set the value for selected tuple column. More...
 
StatusCode column (const std::string &name, const unsigned long long value, const unsigned long long minv, const unsigned long long maxv)
 Set the value for selected tuple column. More...
 
StatusCode column (const std::string &name, const signed char value)
 Set the value for the selected tuple column. More...
 
StatusCode column (const std::string &name, const 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...
 
StatusCode fill (const char *format...)
 Set the values for several columns simultaneously. More...
 
template<class DATA >
StatusCode farray (const std::string &name, DATA first, DATA last, const std::string &length, const 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 DATA >
StatusCode farray (const std::string &name, const FUNCTION &function, DATA first, DATA last, const std::string &length, const size_t maxv)
 Put an indexed array into LoKi-style N-Tuple. More...
 
template<class FUNC1 , class FUNC2 , class DATA >
StatusCode farray (const std::string &name1, const FUNC1 &func1, const std::string &name2, const FUNC2 &func2, DATA first, DATA last, const std::string &length, const 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 DATA >
StatusCode farray (const std::string &name1, const FUNC1 &func1, const std::string &name2, const FUNC2 &func2, const std::string &name3, const FUNC3 &func3, DATA first, DATA last, const std::string &length, const 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 DATA >
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, DATA first, DATA last, const std::string &length, const 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, const 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, const 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, const 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 DIM>
StatusCode array (const std::string &name, const ROOT::Math::SVector< TYPE, DIM > &vect)
 shortcut to put SVector 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...
 
NTuple::Tupletuple () const
 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 CLIDclid () 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 (const std::string &name, const 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 ItemMapitems () 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 (const 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, Bool * > 
Bools
 the actual storage type for short columns More...
 
typedef GaudiUtils::HashMap
< std::string, Char * > 
Chars
 the actual storage type for short columns More...
 
typedef GaudiUtils::HashMap
< std::string, UChar * > 
UChars
 the actual storage type for unsigned short columns More...
 
typedef GaudiUtils::HashMap
< std::string, Short * > 
Shorts
 the actual storage type for short columns More...
 
typedef GaudiUtils::HashMap
< std::string, UShort * > 
UShorts
 the actual storage type for unsigned short columns More...
 
typedef GaudiUtils::HashMap
< std::string, Int * > 
Ints
 the actual storage type for integer columns More...
 
typedef GaudiUtils::HashMap
< std::string, UInt * > 
UInts
 the actual storage type for unsigned integer columns More...
 
typedef GaudiUtils::HashMap
< std::string, LongLong * > 
LongLongs
 the actual storage type for longlong columns More...
 
typedef GaudiUtils::HashMap
< std::string, ULongLong * > 
ULongLongs
 the actual storage type for ulonglong columns More...
 
typedef GaudiUtils::HashMap
< std::string, Float * > 
Floats
 the actual storage type for float columns More...
 
typedef GaudiUtils::HashMap
< std::string, Double * > 
Doubles
 the actual storage type for float columns More...
 
typedef GaudiUtils::HashMap
< std::string, Address * > 
Addresses
 the actual storage type for address columns More...
 
typedef GaudiUtils::HashMap
< std::string, FArray * > 
FArrays
 the actual storage type for array columns More...
 
typedef GaudiUtils::HashMap
< std::string, FMatrix * > 
FMatrices
 the actual storage type for matrix columns More...
 

Private Member Functions

Boolbools (const std::string &name)
 get the column More...
 
Floatfloats (const std::string &name)
 get the column More...
 
Doubledoubles (const std::string &name)
 get the column More...
 
Charchars (const std::string &name)
 get the column More...
 
Charchars (const std::string &name, const char minv, const char maxv)
 get the column More...
 
UCharuchars (const std::string &name)
 get the column More...
 
UCharuchars (const std::string &name, const unsigned char minv, const unsigned char maxv)
 get the column More...
 
Shortshorts (const std::string &name)
 get the column More...
 
Shortshorts (const std::string &name, const short minv, const short maxv)
 get the column More...
 
UShortushorts (const std::string &name)
 get the column More...
 
UShortushorts (const std::string &name, const unsigned short minv, const unsigned short maxv)
 get the column More...
 
Intints (const std::string &name)
 get the column More...
 
Intints (const std::string &name, const int minv, const int maxv)
 get the column More...
 
UIntuints (const std::string &name)
 get the column More...
 
UIntuints (const std::string &name, const unsigned int minv, const unsigned int maxv)
 get the column More...
 
LongLonglonglongs (const std::string &name)
 get the column More...
 
LongLonglonglongs (const std::string &name, const long long minv, const long long maxv)
 get the column More...
 
ULongLongulonglongs (const std::string &name)
 get the column More...
 
ULongLongulonglongs (const std::string &name, const unsigned long long minv, const unsigned long long maxv)
 get the column More...
 
FArrayfArray (const std::string &name, Int *item)
 get the column More...
 
FArrayfArray (const std::string &name, const MIndex &rows)
 get the column More...
 
Addressaddresses (const std::string &name)
 get the column More...
 
FMatrixfMatrix (const std::string &name, Int *item, const MIndex &cols)
 get the column More...
 
FMatrixfMatrix (const std::string &name, const MIndex &rows, const MIndex &cols)
 get the column More...
 
 TupleObj ()
 the default constructor is disabled More...
 
 TupleObj (const TupleObj &)
 copy constructor is disabled More...
 
TupleObjoperator= (const TupleObj &)
 assignment is disabled More...
 

Private Attributes

std::string m_name
 name More...
 
NTuple::Tuplem_tuple
 tuple itself More...
 
CLID m_clid
 tuple CLID More...
 
Tuples::Type m_type
 tuple 'type' More...
 
size_t m_refCount
 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 180 of file TupleObj.h.

Member Typedef Documentation

basic type for address items

Definition at line 218 of file TupleObj.h.

the actual storage type for address columns

Definition at line 2301 of file TupleObj.h.

basic type for int items

Definition at line 185 of file TupleObj.h.

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

the actual storage type for short columns

Definition at line 2268 of file TupleObj.h.

basic type for int items

Definition at line 188 of file TupleObj.h.

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

the actual storage type for short columns

Definition at line 2271 of file TupleObj.h.

basic type for double items

Definition at line 215 of file TupleObj.h.

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

the actual storage type for float columns

Definition at line 2298 of file TupleObj.h.

basic type for array of floats

Definition at line 221 of file TupleObj.h.

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

the actual storage type for array columns

Definition at line 2304 of file TupleObj.h.

basic type for float items

Definition at line 212 of file TupleObj.h.

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

the actual storage type for float columns

Definition at line 2295 of file TupleObj.h.

the actual storage type for matrix columns

Definition at line 2307 of file TupleObj.h.

basic type for matrix of floats

Definition at line 224 of file TupleObj.h.

basic type for int items

Definition at line 200 of file TupleObj.h.

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

the actual storage type for integer columns

Definition at line 2283 of file TupleObj.h.

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

Definition at line 230 of file TupleObj.h.

basic type for unsigned long long items

Definition at line 206 of file TupleObj.h.

the actual storage type for longlong columns

Definition at line 2289 of file TupleObj.h.

typedef unsigned short Tuples::TupleObj::MIndex

Definition at line 227 of file TupleObj.h.

basic type for int items

Definition at line 194 of file TupleObj.h.

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

the actual storage type for short columns

Definition at line 2277 of file TupleObj.h.

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

basic type for unsigned int items

Definition at line 191 of file TupleObj.h.

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

the actual storage type for unsigned short columns

Definition at line 2274 of file TupleObj.h.

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

basic type for unsigned int items

Definition at line 203 of file TupleObj.h.

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

the actual storage type for unsigned integer columns

Definition at line 2286 of file TupleObj.h.

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

basic type for unsigned long long items

Definition at line 209 of file TupleObj.h.

the actual storage type for ulonglong columns

Definition at line 2292 of file TupleObj.h.

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

basic type for unsigned int items

Definition at line 197 of file TupleObj.h.

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

the actual storage type for unsigned short columns

Definition at line 2280 of file TupleObj.h.

Constructor & Destructor Documentation

Tuples::TupleObj::TupleObj ( const 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
namename of the object
tuplepointer to standard Gaudi NTuple::Tuple object
clidCLID_ColumnWiseTuple or CLID_RowWiseTuple
typethe type of the tuple

Definition at line 84 of file TupleObj.cpp.

89  : m_name ( name )
90  , m_tuple ( tuple )
91  , m_clid ( clid )
92  , m_type ( type )
93 // for error handling
94  , m_refCount ( 0 )
95 // columns
96  , m_bools ()
97  , m_chars ()
98  , m_uchars ()
99  , m_shorts ()
100  , m_ushorts ()
101  , m_ints ()
102  , m_uints ()
103  , m_longlongs ()
104  , m_ulonglongs()
105  , m_floats ()
106  , m_doubles ()
107  , m_addresses ()
108  , m_farrays ()
109  , m_arraysf ()
110  , m_fmatrices ()
111  , m_matricesf ()
112 //
113  , m_items ()
114 {
115  // make counts
116  Tuples::Local::s_InstanceCounter.increment ( m_name ) ;
117 }
UShorts m_ushorts
the actual storage of all 'unsigned int' columns
Definition: TupleObj.h:2339
FMatrices m_fmatrices
the actual storage of all 'FArray' columns
Definition: TupleObj.h:2369
CLID m_clid
tuple CLID
Definition: TupleObj.h:2318
Doubles m_doubles
the actual storage of all 'Double' columns
Definition: TupleObj.h:2357
Tuples::Type m_type
tuple 'type'
Definition: TupleObj.h:2321
FMatrices m_matricesf
the actual storage of all 'FMatrix' columns (fixed)
Definition: TupleObj.h:2372
Floats m_floats
the actual storage of all 'Float' columns
Definition: TupleObj.h:2354
FArrays m_farrays
the actual storage of all 'FArray' columns
Definition: TupleObj.h:2363
size_t m_refCount
reference counter
Definition: TupleObj.h:2324
std::string m_name
name
Definition: TupleObj.h:2312
FArrays m_arraysf
the actual storage of all 'FArray' columns (fixed)
Definition: TupleObj.h:2366
Bools m_bools
the actual storage of all 'bool' columns
Definition: TupleObj.h:2327
Chars m_chars
the actual storage of all 'Int' columns
Definition: TupleObj.h:2330
ULongLongs m_ulonglongs
the actual storage of all 'ulonglong' columns
Definition: TupleObj.h:2351
UInts m_uints
the actual storage of all 'unsigned int' columns
Definition: TupleObj.h:2345
ItemMap m_items
all booked types:
Definition: TupleObj.h:2375
Ints m_ints
the actual storage of all 'Int' columns
Definition: TupleObj.h:2342
LongLongs m_longlongs
the actual storage of all 'longlong' columns
Definition: TupleObj.h:2348
Addresses m_addresses
the actual storage of all 'Address' columns
Definition: TupleObj.h:2360
NTuple::Tuple * m_tuple
tuple itself
Definition: TupleObj.h:2315
Tuples::Type type() const
accessor to the N-Tuple type
Definition: TupleObj.h:2110
Shorts m_shorts
the actual storage of all 'Int' columns
Definition: TupleObj.h:2336
const CLID & clid() const
accessor to the N-Tuple CLID
Definition: TupleObj.h:2107
const std::string & name() const
get the name
Definition: TupleObj.h:2083
long increment(const std::string &object)
Definition: TupleObj.cpp:48
UChars m_uchars
the actual storage of all 'unsigned int' columns
Definition: TupleObj.h:2333
Tuples::TupleObj::~TupleObj ( )
protectedvirtual

destructor is protected

Definition at line 121 of file TupleObj.cpp.

122 {
123  {// delete 'bool' columns
124  for( Bools::iterator it = m_bools.begin() ;
125  m_bools.end() != it ; ++it )
126  { if( 0 != it->second ) { delete it->second ; } }
127  m_bools.clear() ;
128  }
129  {// delete 'char' columns
130  for( Chars::iterator it = m_chars.begin() ;
131  m_chars.end() != it ; ++it )
132  { if( 0 != it->second ) { delete it->second ; } }
133  m_chars.clear() ;
134  }
135  {// delete 'unsigned char' columns
136  for( UChars::iterator it = m_uchars.begin() ;
137  m_uchars.end() != it ; ++it )
138  { if( 0 != it->second ) { delete it->second ; } }
139  m_uchars.clear() ;
140  }
141  {// delete 'short' columns
142  for( Shorts::iterator it = m_shorts.begin() ;
143  m_shorts.end() != it ; ++it )
144  { if( 0 != it->second ) { delete it->second ; } }
145  m_shorts.clear() ;
146  }
147  {// delete 'unsigned short' columns
148  for( UShorts::iterator it = m_ushorts.begin() ;
149  m_ushorts.end() != it ; ++it )
150  { if( 0 != it->second ) { delete it->second ; } }
151  m_ushorts.clear() ;
152  }
153  {// delete 'int' columns
154  for( Ints::iterator it = m_ints.begin() ;
155  m_ints.end() != it ; ++it )
156  { if( 0 != it->second ) { delete it->second ; } }
157  m_ints.clear() ;
158  }
159  {// delete 'unsigned int' columns
160  for( UInts::iterator it = m_uints.begin() ;
161  m_uints.end() != it ; ++it )
162  { if( 0 != it->second ) { delete it->second ; } }
163  m_uints.clear() ;
164  }
165  {// delete 'longlong' columns
167  m_longlongs.end() != it ; ++it )
168  { if( 0 != it->second ) { delete it->second ; } }
169  m_longlongs.clear() ;
170  }
171  {// delete 'ulonglong' columns
173  m_ulonglongs.end() != it ; ++it )
174  { if( 0 != it->second ) { delete it->second ; } }
175  m_ulonglongs.clear() ;
176  }
177  {// delete 'float' columns
178  for( Floats::iterator it = m_floats.begin() ;
179  m_floats.end() != it ; ++it )
180  { if( 0 != it->second ) { delete it->second ; } }
181  m_floats.clear() ;
182  }
183  {// delete 'double' columns
184  for( Doubles::iterator it = m_doubles.begin() ;
185  m_doubles.end() != it ; ++it )
186  { if( 0 != it->second ) { delete it->second ; } }
187  m_doubles.clear() ;
188  }
189  {// delete 'fArray' columns
190  for( FArrays::iterator it = m_farrays.begin() ;
191  m_farrays.end() != it ; ++it )
192  { if( 0 != it->second ) { delete it->second ; } }
193  m_farrays.clear() ;
194  }
195  {// delete 'fArray' columns
196  for( FArrays::iterator it = m_arraysf.begin() ;
197  m_arraysf.end() != it ; ++it )
198  { if( 0 != it->second ) { delete it->second ; } }
199  m_arraysf.clear() ;
200  }
201  { // destroy and clean all "addresses"
203  m_addresses.end() != it ; ++it )
204  { if( 0 != it->second ) { delete it->second ; } }
205  m_addresses.clear();
206  }
207  { // destroy and clean all "matrices"
209  m_fmatrices.end() != it ; ++it )
210  { if( 0 != it->second ) { delete it->second ; } }
211  m_fmatrices.clear();
212  }
213  { // destroy and clean all "matrices" (fixed)
215  m_matricesf.end() != it ; ++it )
216  { if( 0 != it->second ) { delete it->second ; } }
217  m_matricesf.clear();
218  }
219 
220  // make counts
221  Tuples::Local::s_InstanceCounter.decrement ( m_name ) ;
222 }
UShorts m_ushorts
the actual storage of all 'unsigned int' columns
Definition: TupleObj.h:2339
FMatrices m_fmatrices
the actual storage of all 'FArray' columns
Definition: TupleObj.h:2369
long decrement(const std::string &object)
Definition: TupleObj.cpp:50
Doubles m_doubles
the actual storage of all 'Double' columns
Definition: TupleObj.h:2357
FMatrices m_matricesf
the actual storage of all 'FMatrix' columns (fixed)
Definition: TupleObj.h:2372
Floats m_floats
the actual storage of all 'Float' columns
Definition: TupleObj.h:2354
FArrays m_farrays
the actual storage of all 'FArray' columns
Definition: TupleObj.h:2363
std::string m_name
name
Definition: TupleObj.h:2312
FArrays m_arraysf
the actual storage of all 'FArray' columns (fixed)
Definition: TupleObj.h:2366
Bools m_bools
the actual storage of all 'bool' columns
Definition: TupleObj.h:2327
Chars m_chars
the actual storage of all 'Int' columns
Definition: TupleObj.h:2330
ULongLongs m_ulonglongs
the actual storage of all 'ulonglong' columns
Definition: TupleObj.h:2351
iterator end()
Definition: Map.h:131
UInts m_uints
the actual storage of all 'unsigned int' columns
Definition: TupleObj.h:2345
Ints m_ints
the actual storage of all 'Int' columns
Definition: TupleObj.h:2342
LongLongs m_longlongs
the actual storage of all 'longlong' columns
Definition: TupleObj.h:2348
iterator begin()
Definition: Map.h:130
Addresses m_addresses
the actual storage of all 'Address' columns
Definition: TupleObj.h:2360
void clear()
Definition: Map.h:176
Shorts m_shorts
the actual storage of all 'Int' columns
Definition: TupleObj.h:2336
UChars m_uchars
the actual storage of all 'unsigned int' columns
Definition: TupleObj.h:2333
Tuples::TupleObj::TupleObj ( )
private

the default constructor is disabled

Tuples::TupleObj::TupleObj ( const TupleObj )
private

copy constructor is disabled

Member Function Documentation

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

add the item name into the list of known items

Parameters
namethe name of the item
typethe type of the item
Returns
true if the name is indeed added

Definition at line 2134 of file TupleObj.h.

2136  { return m_items.insert ( std::make_pair ( name , type ) ).second ; }
ItemMap m_items
all booked types:
Definition: TupleObj.h:2375
Tuples::Type type() const
accessor to the N-Tuple type
Definition: TupleObj.h:2110
const std::string & name() const
get the name
Definition: TupleObj.h:2083
unsigned long Tuples::TupleObj::addRef ( )
inline

add the reference to TupleObj

Returns
current reference counter

Definition at line 2098 of file TupleObj.h.

2098 { return ++m_refCount ; }
size_t m_refCount
reference counter
Definition: TupleObj.h:2324
Tuples::TupleObj::Address * Tuples::TupleObj::addresses ( const std::string &  name)
private

get the column

Definition at line 887 of file TupleObj.cpp.

888 {
890  if( m_addresses.end() != found ) { return found->second ; }
891  Address* item = new Address() ;
892  m_addresses[ name ] = item ;
893  const StatusCode sc = tuple()->addItem( name , *item );
894  if( sc.isFailure() )
895  { Error ( "addresses ('" + name + "'): item is not added", sc ) ; }
896  if ( !addItem ( name , "IOpaqueAddress*" ) )
897  { Error ( "addresses ('" + name + "'): item is not unique" ) ; }
898  return item ;
899 }
NTuple::Item< IOpaqueAddress * > Address
basic type for address items
Definition: TupleObj.h:218
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:72
NTuple::Tuple * tuple() const
provide the access to underlying Gaudi N-tuple
Definition: TupleObj.h:2088
iterator end()
Definition: Map.h:131
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
iterator find(const key_type &key)
Definition: Map.h:148
virtual StatusCode Error(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
Addresses m_addresses
the actual storage of all 'Address' columns
Definition: TupleObj.h:2360
bool addItem(const std::string &name, const std::string &type)
add the item name into the list of known items
Definition: TupleObj.h:2134
tuple item
print s1,s2
Definition: ana.py:146
StatusCode addItem(const std::string &name, Item< TYPE > &itm)
Add a scalar data item a N tuple.
Definition: NTuple.h:551
const std::string & name() const
get the name
Definition: TupleObj.h:2083
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
nameN-Tuple entry name
firstbegin-iterator for data sequence
lastend-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 1659 of file TupleObj.h.

1663  {
1664  if ( invalid () ) { return InvalidTuple ; }
1665  if ( rowWise () ) { return InvalidOperation ; }
1666 
1667  // get the length (fixed!)
1668  const size_t length = last - first ;
1669 
1670  // get the array itself
1671  FArray* var = fArray ( name , length ) ;
1672  if ( 0 == var ) { return InvalidColumn ; }
1673 
1675  size_t iCol = 0 ;
1676  for ( ; first != last ; ++first )
1677  { (*var)[ iCol ] = (float)(*first) ; ++iCol ; }
1678 
1679  return StatusCode::SUCCESS ;
1680  }
bool rowWise() const
row wise NTuple ?
Definition: TupleObj.h:2116
FArray * fArray(const std::string &name, Int *item)
get the column
Definition: TupleObj.cpp:904
bool invalid() const
invalid pointer to tuple ?
Definition: TupleObj.h:2125
NTuple::Array< float > FArray
basic type for array of floats
Definition: TupleObj.h:221
const std::string & name() const
get the name
Definition: TupleObj.h:2083
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
nameN-Tuple entry name
datadata sequence
lengthdata 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

fill the array

Definition at line 1721 of file TupleObj.h.

1724  {
1725  if ( invalid () ) { return InvalidTuple ; }
1726  if ( rowWise () ) { return InvalidOperation ; }
1727 
1728  // get the array itself
1729  FArray* var = fArray ( name , length ) ;
1730  if ( 0 == var ) { return InvalidColumn ; }
1731 
1733  for ( size_t index = 0 ; index < length ; ++index )
1734  { (*var)[ index ] = (float) data[index] ; }
1735 
1736  return StatusCode::SUCCESS ;
1737  }
bool rowWise() const
row wise NTuple ?
Definition: TupleObj.h:2116
FArray * fArray(const std::string &name, Int *item)
get the column
Definition: TupleObj.cpp:904
bool invalid() const
invalid pointer to tuple ?
Definition: TupleObj.h:2125
NTuple::Array< float > FArray
basic type for array of floats
Definition: TupleObj.h:221
const std::string & name() const
get the name
Definition: TupleObj.h:2083
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>

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
nameN-Tupel entry name
datadata 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 1769 of file TupleObj.h.

1771  { return array ( name , data.begin() , data.end() ) ; }
StatusCode array(const std::string &name, DATA first, DATA last)
fill N-Tuple with fixed-size array
Definition: TupleObj.h:1659
const std::string & name() const
get the name
Definition: TupleObj.h:2083
template<class TYPE , unsigned int DIM>
StatusCode Tuples::TupleObj::array ( const std::string &  name,
const ROOT::Math::SVector< TYPE, DIM > &  vect 
)
inline

shortcut to put SVector into N-tuple:

ROOT::Math::SVector<double,15> vct = ... ;
Tuple tuple = nTuple("My N-Tuple") ;
// put the vector into N-Tuple:
tuple -> array ( "v" , vct ) ;
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 1963 of file TupleObj.h.

1965  {
1966  return this->array( name , vect.begin() , vect.end() ) ;
1967  }
StatusCode array(const std::string &name, DATA first, DATA last)
fill N-Tuple with fixed-size array
Definition: TupleObj.h:1659
const std::string & name() const
get the name
Definition: TupleObj.h:2083
Tuples::TupleObj::Bool * Tuples::TupleObj::bools ( const std::string &  name)
private

get the column

Definition at line 616 of file TupleObj.cpp.

617 {
618  Bools::iterator found = m_bools.find( name ) ;
619  if( m_bools.end() != found ) { return found->second ; }
620  Bool* item = new Bool() ;
621  m_bools[ name ] = item ;
622  StatusCode sc = tuple()->addItem( name , *item );
623  if( sc.isFailure() )
624  { Error ( "bools ('" + name + "'): item is not added", sc ) ; }
625  if ( !addItem ( name , "I" ) )
626  { Error ( "bools ('" + name + "'): item is not unique" ) ; }
627  return item ;
628 }
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:72
Bools m_bools
the actual storage of all 'bool' columns
Definition: TupleObj.h:2327
NTuple::Tuple * tuple() const
provide the access to underlying Gaudi N-tuple
Definition: TupleObj.h:2088
iterator end()
Definition: Map.h:131
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
iterator find(const key_type &key)
Definition: Map.h:148
NTuple::Item< bool > Bool
basic type for int items
Definition: TupleObj.h:185
virtual StatusCode Error(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
bool addItem(const std::string &name, const std::string &type)
add the item name into the list of known items
Definition: TupleObj.h:2134
tuple item
print s1,s2
Definition: ana.py:146
StatusCode addItem(const std::string &name, Item< TYPE > &itm)
Add a scalar data item a N tuple.
Definition: NTuple.h:551
const std::string & name() const
get the name
Definition: TupleObj.h:2083
Tuples::TupleObj::Char * Tuples::TupleObj::chars ( const std::string &  name)
private

get the column

Definition at line 631 of file TupleObj.cpp.

632 {
633  Chars::iterator found = m_chars.find( name ) ;
634  if( m_chars.end() != found ) { return found->second ; }
635  Char* item = new Char() ;
636  m_chars[ name ] = item ;
637  StatusCode sc = tuple()->addItem( name , *item );
638  if( sc.isFailure() )
639  { Error ( "chars ('" + name + "'): item is not added", sc ) ; }
640  if ( !addItem ( name , "I" ) )
641  { Error ( "chars ('" + name + "'): item is not unique" ) ; }
642  return item ;
643 }
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:72
NTuple::Tuple * tuple() const
provide the access to underlying Gaudi N-tuple
Definition: TupleObj.h:2088
Chars m_chars
the actual storage of all 'Int' columns
Definition: TupleObj.h:2330
iterator end()
Definition: Map.h:131
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
iterator find(const key_type &key)
Definition: Map.h:148
virtual StatusCode Error(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
bool addItem(const std::string &name, const std::string &type)
add the item name into the list of known items
Definition: TupleObj.h:2134
NTuple::Item< char > Char
basic type for int items
Definition: TupleObj.h:188
tuple item
print s1,s2
Definition: ana.py:146
StatusCode addItem(const std::string &name, Item< TYPE > &itm)
Add a scalar data item a N tuple.
Definition: NTuple.h:551
const std::string & name() const
get the name
Definition: TupleObj.h:2083
Tuples::TupleObj::Char * Tuples::TupleObj::chars ( const std::string &  name,
const char  minv,
const char  maxv 
)
private

get the column

Definition at line 646 of file TupleObj.cpp.

649 {
650  Chars::iterator found = m_chars.find( name ) ;
651  if( m_chars.end() != found ) { return found->second ; }
652  Char* item = new Char() ;
653  m_chars[ name ] = item ;
654  const StatusCode sc = tuple()->addItem( name , *item , minv , maxv );
655  if( sc.isFailure() )
656  { Error ( "chars ('" + name + "'): item is not added", sc ) ; }
657  if ( !addItem ( name , "I" ) )
658  { Error ( "chars ('" + name + "'): item is not unique" ) ; }
659  return item ;
660 }
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:72
NTuple::Tuple * tuple() const
provide the access to underlying Gaudi N-tuple
Definition: TupleObj.h:2088
Chars m_chars
the actual storage of all 'Int' columns
Definition: TupleObj.h:2330
iterator end()
Definition: Map.h:131
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
iterator find(const key_type &key)
Definition: Map.h:148
virtual StatusCode Error(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
bool addItem(const std::string &name, const std::string &type)
add the item name into the list of known items
Definition: TupleObj.h:2134
NTuple::Item< char > Char
basic type for int items
Definition: TupleObj.h:188
tuple item
print s1,s2
Definition: ana.py:146
StatusCode addItem(const std::string &name, Item< TYPE > &itm)
Add a scalar data item a N tuple.
Definition: NTuple.h:551
const std::string & name() const
get the name
Definition: TupleObj.h:2083
const CLID& Tuples::TupleObj::clid ( ) const
inline

accessor to the N-Tuple CLID

Definition at line 2107 of file TupleObj.h.

2107 { return m_clid ; }
CLID m_clid
tuple CLID
Definition: TupleObj.h:2318
StatusCode Tuples::TupleObj::column ( const std::string &  name,
const 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
namethe name of the column
valuethe value of the variable
Returns
status code

Definition at line 337 of file TupleObj.cpp.

339 {
340  if ( invalid() ) { return InvalidTuple ; }
341  Float* item = floats ( name ) ;
342  if ( !item ) { return InvalidColumn ; }
343  *item = value ;
344  return StatusCode::SUCCESS ;
345 }
Float * floats(const std::string &name)
get the column
Definition: TupleObj.cpp:586
NTuple::Item< float > Float
basic type for float items
Definition: TupleObj.h:212
tuple item
print s1,s2
Definition: ana.py:146
bool invalid() const
invalid pointer to tuple ?
Definition: TupleObj.h:2125
const std::string & name() const
get the name
Definition: TupleObj.h:2083
StatusCode Tuples::TupleObj::column ( const std::string &  name,
const 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
namethe name of the column
valuethe value of the variable
Returns
status code

Definition at line 347 of file TupleObj.cpp.

349 {
350  if ( invalid() ) { return InvalidTuple ; }
351  Double * item = doubles ( name ) ;
352  if ( !item ) { return InvalidColumn ; }
353  *item = value ;
354  return StatusCode::SUCCESS ;
355 }
NTuple::Item< double > Double
basic type for double items
Definition: TupleObj.h:215
tuple item
print s1,s2
Definition: ana.py:146
bool invalid() const
invalid pointer to tuple ?
Definition: TupleObj.h:2125
Double * doubles(const std::string &name)
get the column
Definition: TupleObj.cpp:601
const std::string & name() const
get the name
Definition: TupleObj.h:2083
StatusCode Tuples::TupleObj::column ( const std::string &  name,
const 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
namethe name of the column
valuethe value of the variable
Returns
status code

Definition at line 401 of file TupleObj.cpp.

403 {
404  if ( invalid() ) { return InvalidTuple ; }
405  Short* item = shorts( name ) ;
406  if ( !item ) { return InvalidColumn ; }
407  *item = value ;
408  return StatusCode::SUCCESS ;
409 }
NTuple::Item< short > Short
basic type for int items
Definition: TupleObj.h:194
Short * shorts(const std::string &name)
get the column
Definition: TupleObj.cpp:695
tuple item
print s1,s2
Definition: ana.py:146
bool invalid() const
invalid pointer to tuple ?
Definition: TupleObj.h:2125
const std::string & name() const
get the name
Definition: TupleObj.h:2083
StatusCode Tuples::TupleObj::column ( const std::string &  name,
const short  value,
const short  minv,
const 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
namename of the column
valuevalue of the variable
minvminimum value of the variable
maxvmaximum value of the variable
Returns
status code

Definition at line 411 of file TupleObj.cpp.

415 {
416  if ( invalid() ) { return InvalidTuple ; }
417  Short* item = shorts ( name , minv , maxv ) ;
418  if ( !item ) { return InvalidColumn ; }
419  *item = value ;
420  return StatusCode::SUCCESS ;
421 }
NTuple::Item< short > Short
basic type for int items
Definition: TupleObj.h:194
Short * shorts(const std::string &name)
get the column
Definition: TupleObj.cpp:695
tuple item
print s1,s2
Definition: ana.py:146
bool invalid() const
invalid pointer to tuple ?
Definition: TupleObj.h:2125
const std::string & name() const
get the name
Definition: TupleObj.h:2083
StatusCode Tuples::TupleObj::column ( const std::string &  name,
const 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
namethe name of the column
valuethe value of the variable
Returns
status code

Definition at line 423 of file TupleObj.cpp.

425 {
426  if ( invalid() ) { return InvalidTuple ; }
427  UShort* item = ushorts( name ) ;
428  if ( !item ) { return InvalidColumn ; }
429  *item = value ;
430  return StatusCode::SUCCESS ;
431 }
UShort * ushorts(const std::string &name)
get the column
Definition: TupleObj.cpp:727
NTuple::Item< unsigned short > UShort
basic type for unsigned int items
Definition: TupleObj.h:197
tuple item
print s1,s2
Definition: ana.py:146
bool invalid() const
invalid pointer to tuple ?
Definition: TupleObj.h:2125
const std::string & name() const
get the name
Definition: TupleObj.h:2083
StatusCode Tuples::TupleObj::column ( const std::string &  name,
const unsigned short  value,
const unsigned short  minv,
const 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
namename of the column
valuevalue of the variable
minvminimum value of the variable
maxvmaximum value of the variable
Returns
status code

Definition at line 433 of file TupleObj.cpp.

437 {
438  if ( invalid() ) { return InvalidTuple ; }
439  UShort* item = ushorts ( name , minv , maxv ) ;
440  if ( !item ) { return InvalidColumn ; }
441  *item = value ;
442  return StatusCode::SUCCESS ;
443 }
UShort * ushorts(const std::string &name)
get the column
Definition: TupleObj.cpp:727
NTuple::Item< unsigned short > UShort
basic type for unsigned int items
Definition: TupleObj.h:197
tuple item
print s1,s2
Definition: ana.py:146
bool invalid() const
invalid pointer to tuple ?
Definition: TupleObj.h:2125
const std::string & name() const
get the name
Definition: TupleObj.h:2083
StatusCode Tuples::TupleObj::column ( const std::string &  name,
const 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
namethe name of the column
valuethe value of the variable
Returns
status code

Definition at line 357 of file TupleObj.cpp.

359 {
360  if ( invalid() ) { return InvalidTuple ; }
361  Char* item = chars( name ) ;
362  if ( !item ) { return InvalidColumn ; }
363  *item = value ;
364  return StatusCode::SUCCESS ;
365 }
Char * chars(const std::string &name)
get the column
Definition: TupleObj.cpp:631
NTuple::Item< char > Char
basic type for int items
Definition: TupleObj.h:188
tuple item
print s1,s2
Definition: ana.py:146
bool invalid() const
invalid pointer to tuple ?
Definition: TupleObj.h:2125
const std::string & name() const
get the name
Definition: TupleObj.h:2083
StatusCode Tuples::TupleObj::column ( const std::string &  name,
const char  value,
const char  minv,
const 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
namename of the column
valuevalue of the variable
minvminimum value of the variable
maxvmaximum value of the variable
Returns
status code

Definition at line 367 of file TupleObj.cpp.

371 {
372  if ( invalid() ) { return InvalidTuple ; }
373  Char* item = chars ( name , minv , maxv ) ;
374  if ( !item ) { return InvalidColumn ; }
375  *item = value ;
376  return StatusCode::SUCCESS ;
377 }
Char * chars(const std::string &name)
get the column
Definition: TupleObj.cpp:631
NTuple::Item< char > Char
basic type for int items
Definition: TupleObj.h:188
tuple item
print s1,s2
Definition: ana.py:146
bool invalid() const
invalid pointer to tuple ?
Definition: TupleObj.h:2125
const std::string & name() const
get the name
Definition: TupleObj.h:2083
StatusCode Tuples::TupleObj::column ( const std::string &  name,
const 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
namethe name of the column
valuethe value of the variable
Returns
status code

Definition at line 379 of file TupleObj.cpp.

381 {
382  if ( invalid() ) { return InvalidTuple ; }
383  UChar* item = uchars( name ) ;
384  if ( !item ) { return InvalidColumn ; }
385  *item = value ;
386  return StatusCode::SUCCESS ;
387 }
UChar * uchars(const std::string &name)
get the column
Definition: TupleObj.cpp:663
NTuple::Item< unsigned char > UChar
basic type for unsigned int items
Definition: TupleObj.h:191
tuple item
print s1,s2
Definition: ana.py:146
bool invalid() const
invalid pointer to tuple ?
Definition: TupleObj.h:2125
const std::string & name() const
get the name
Definition: TupleObj.h:2083
StatusCode Tuples::TupleObj::column ( const std::string &  name,
const unsigned char  value,
const unsigned char  minv,
const 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
namename of the column
valuevalue of the variable
minvminimum value of the variable
maxvmaximum value of the variable
Returns
status code

Definition at line 389 of file TupleObj.cpp.

393 {
394  if ( invalid() ) { return InvalidTuple ; }
395  UChar* item = uchars ( name , minv , maxv ) ;
396  if ( !item ) { return InvalidColumn ; }
397  *item = value ;
398  return StatusCode::SUCCESS ;
399 }
UChar * uchars(const std::string &name)
get the column
Definition: TupleObj.cpp:663
NTuple::Item< unsigned char > UChar
basic type for unsigned int items
Definition: TupleObj.h:191
tuple item
print s1,s2
Definition: ana.py:146
bool invalid() const
invalid pointer to tuple ?
Definition: TupleObj.h:2125
const std::string & name() const
get the name
Definition: TupleObj.h:2083
StatusCode Tuples::TupleObj::column ( const std::string &  name,
const 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
namename of the column
valuevalue of the variable
Returns
status code

Definition at line 445 of file TupleObj.cpp.

447 {
448  if ( invalid() ) { return InvalidTuple ; }
449  Int* item = ints( name ) ;
450  if ( !item ) { return InvalidColumn ; }
451  *item = value ;
452  return StatusCode::SUCCESS ;
453 }
NTuple::Item< int > Int
basic type for int items
Definition: TupleObj.h:200
tuple item
print s1,s2
Definition: ana.py:146
bool invalid() const
invalid pointer to tuple ?
Definition: TupleObj.h:2125
Int * ints(const std::string &name)
get the column
Definition: TupleObj.cpp:759
const std::string & name() const
get the name
Definition: TupleObj.h:2083
StatusCode Tuples::TupleObj::column ( const std::string &  name,
const int  value,
const int  minv,
const 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
namename of the column
valuevalue of the variable
minvminimum value of the variable
maxvmaximum value of the variable
Returns
status code

Definition at line 455 of file TupleObj.cpp.

459 {
460  if ( invalid() ) { return InvalidTuple ; }
461  Int* item = ints ( name , minv , maxv ) ;
462  if ( !item ) { return InvalidColumn ; }
463  *item = value ;
464  return StatusCode::SUCCESS ;
465 }
NTuple::Item< int > Int
basic type for int items
Definition: TupleObj.h:200
tuple item
print s1,s2
Definition: ana.py:146
bool invalid() const
invalid pointer to tuple ?
Definition: TupleObj.h:2125
Int * ints(const std::string &name)
get the column
Definition: TupleObj.cpp:759
const std::string & name() const
get the name
Definition: TupleObj.h:2083
StatusCode Tuples::TupleObj::column ( const std::string &  name,
const 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
namename of the column
valuevalue of the variable
Returns
status code

Definition at line 467 of file TupleObj.cpp.

469 {
470  if ( invalid() ) { return InvalidTuple ; }
471  UInt* item = uints( name ) ;
472  if ( !item ) { return InvalidColumn ; }
473  *item = value ;
474  return StatusCode::SUCCESS ;
475 }
UInt * uints(const std::string &name)
get the column
Definition: TupleObj.cpp:791
tuple item
print s1,s2
Definition: ana.py:146
bool invalid() const
invalid pointer to tuple ?
Definition: TupleObj.h:2125
const std::string & name() const
get the name
Definition: TupleObj.h:2083
NTuple::Item< unsigned int > UInt
basic type for unsigned int items
Definition: TupleObj.h:203
StatusCode Tuples::TupleObj::column ( const std::string &  name,
const unsigned int  value,
const unsigned int  minv,
const 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
namename of the column
valuevalue of the variable
minvminimum value of the variable
maxvmaximum value of the variable
Returns
status code

Definition at line 477 of file TupleObj.cpp.

481 {
482  if ( invalid() ) { return InvalidTuple ; }
483  UInt* item = uints ( name , minv , maxv ) ;
484  if ( !item ) { return InvalidColumn ; }
485  *item = value ;
486  return StatusCode::SUCCESS ;
487 }
UInt * uints(const std::string &name)
get the column
Definition: TupleObj.cpp:791
tuple item
print s1,s2
Definition: ana.py:146
bool invalid() const
invalid pointer to tuple ?
Definition: TupleObj.h:2125
const std::string & name() const
get the name
Definition: TupleObj.h:2083
NTuple::Item< unsigned int > UInt
basic type for unsigned int items
Definition: TupleObj.h:203
StatusCode Tuples::TupleObj::column ( const std::string &  name,
const 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
namethe name of the column
valuethe value of the variable
Returns
status code

Definition at line 489 of file TupleObj.cpp.

491 {
492  Warning( "'long' has different sizes on 32/64 bit systems. Casting '" +
493  name + "' to 'long long'", StatusCode::SUCCESS ).ignore();
494  return column( name, (long long)value );
495 }
virtual StatusCode Warning(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
StatusCode column(const std::string &name, const float value)
Set the value for selected tuple column.
Definition: TupleObj.cpp:337
void ignore() const
Definition: StatusCode.h:94
const std::string & name() const
get the name
Definition: TupleObj.h:2083
StatusCode Tuples::TupleObj::column ( const std::string &  name,
const long  value,
const long  minv,
const 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
namename of the column
valuevalue of the variable
minvminimum value of the variable
maxvmaximum value of the variable
Returns
status code

Definition at line 497 of file TupleObj.cpp.

501 {
502  Warning( "'long' has different sizes on 32/64 bit systems. Casting '" +
503  name + "' to 'long long'", StatusCode::SUCCESS ).ignore();
504  return column( name,
505  (long long)value,
506  (long long)minv,
507  (long long)maxv );
508 }
virtual StatusCode Warning(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
StatusCode column(const std::string &name, const float value)
Set the value for selected tuple column.
Definition: TupleObj.cpp:337
void ignore() const
Definition: StatusCode.h:94
const std::string & name() const
get the name
Definition: TupleObj.h:2083
StatusCode Tuples::TupleObj::column ( const std::string &  name,
const 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
namethe name of the column
valuethe value of the variable
Returns
status code

Definition at line 510 of file TupleObj.cpp.

512 {
513  Warning( "'unsigned long' has different sizes on 32/64 bit systems. Casting '" +
514  name + "' to 'unsigned long long'", StatusCode::SUCCESS ).ignore();
515  return column( name, (unsigned long long)value );
516 }
virtual StatusCode Warning(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
StatusCode column(const std::string &name, const float value)
Set the value for selected tuple column.
Definition: TupleObj.cpp:337
void ignore() const
Definition: StatusCode.h:94
const std::string & name() const
get the name
Definition: TupleObj.h:2083
StatusCode Tuples::TupleObj::column ( const std::string &  name,
const unsigned long  value,
const unsigned long  minv,
const 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
namename of the column
valuevalue of the variable
minvminimum value of the variable
maxvmaximum value of the variable
Returns
status code

Definition at line 518 of file TupleObj.cpp.

522 {
523  Warning( "'unsigned long' has different sizes on 32/64 bit systems. Casting '" +
524  name + "' to 'unsigned long long'", StatusCode::SUCCESS ).ignore();
525  return column( name,
526  (unsigned long long)value,
527  (unsigned long long)minv,
528  (unsigned long long)maxv );
529 }
virtual StatusCode Warning(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
StatusCode column(const std::string &name, const float value)
Set the value for selected tuple column.
Definition: TupleObj.cpp:337
void ignore() const
Definition: StatusCode.h:94
const std::string & name() const
get the name
Definition: TupleObj.h:2083
StatusCode Tuples::TupleObj::column ( const std::string &  name,
const 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
namename of the column
valuevalue of the variable
Returns
status code

Definition at line 531 of file TupleObj.cpp.

533 {
534  if ( invalid() ) { return InvalidTuple ; }
535  LongLong* item = longlongs( name ) ;
536  if ( !item ) { return InvalidColumn ; }
537  *item = value ;
538  return StatusCode::SUCCESS ;
539 }
NTuple::Item< long long > LongLong
basic type for unsigned long long items
Definition: TupleObj.h:206
tuple item
print s1,s2
Definition: ana.py:146
bool invalid() const
invalid pointer to tuple ?
Definition: TupleObj.h:2125
const std::string & name() const
get the name
Definition: TupleObj.h:2083
LongLong * longlongs(const std::string &name)
get the column
Definition: TupleObj.cpp:823
StatusCode Tuples::TupleObj::column ( const std::string &  name,
const long long  value,
const long long  minv,
const 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
namename of the column
valuevalue of the variable
minvminimum value of the variable
maxvmaximum value of the variable
Returns
status code

Definition at line 541 of file TupleObj.cpp.

545 {
546  if ( invalid() ) { return InvalidTuple ; }
547  LongLong* item = longlongs ( name , minv , maxv ) ;
548  if ( !item ) { return InvalidColumn ; }
549  *item = value ;
550  return StatusCode::SUCCESS ;
551 }
NTuple::Item< long long > LongLong
basic type for unsigned long long items
Definition: TupleObj.h:206
tuple item
print s1,s2
Definition: ana.py:146
bool invalid() const
invalid pointer to tuple ?
Definition: TupleObj.h:2125
const std::string & name() const
get the name
Definition: TupleObj.h:2083
LongLong * longlongs(const std::string &name)
get the column
Definition: TupleObj.cpp:823
StatusCode Tuples::TupleObj::column ( const std::string &  name,
const 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
namename of the column
valuevalue of the variable
Returns
status code

Definition at line 553 of file TupleObj.cpp.

555 {
556  if ( invalid() ) { return InvalidTuple ; }
557  ULongLong* item = ulonglongs( name ) ;
558  if ( !item ) { return InvalidColumn ; }
559  *item = value ;
560  return StatusCode::SUCCESS ;
561 }
NTuple::Item< unsigned long long > ULongLong
basic type for unsigned long long items
Definition: TupleObj.h:209
ULongLong * ulonglongs(const std::string &name)
get the column
Definition: TupleObj.cpp:855
tuple item
print s1,s2
Definition: ana.py:146
bool invalid() const
invalid pointer to tuple ?
Definition: TupleObj.h:2125
const std::string & name() const
get the name
Definition: TupleObj.h:2083
StatusCode Tuples::TupleObj::column ( const std::string &  name,
const unsigned long long  value,
const unsigned long long  minv,
const 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
namename of the column
valuevalue of the variable
minvminimum value of the variable
maxvmaximum value of the variable
Returns
status code

Definition at line 563 of file TupleObj.cpp.

567 {
568  if ( invalid() ) { return InvalidTuple ; }
569  ULongLong* item = ulonglongs ( name , minv , maxv ) ;
570  if ( !item ) { return InvalidColumn ; }
571  *item = value ;
572  return StatusCode::SUCCESS ;
573 }
NTuple::Item< unsigned long long > ULongLong
basic type for unsigned long long items
Definition: TupleObj.h:209
ULongLong * ulonglongs(const std::string &name)
get the column
Definition: TupleObj.cpp:855
tuple item
print s1,s2
Definition: ana.py:146
bool invalid() const
invalid pointer to tuple ?
Definition: TupleObj.h:2125
const std::string & name() const
get the name
Definition: TupleObj.h:2083
StatusCode Tuples::TupleObj::column ( const std::string &  name,
const 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
namethe name of the column
valuethe value of tve variable
Returns
status code

Definition at line 732 of file TupleObj.h.

734  {
735  return column
736  ( name ,
737  value ,
739  std::numeric_limits<signed char>::max() ) ;
740  }
StatusCode column(const std::string &name, const float value)
Set the value for selected tuple column.
Definition: TupleObj.cpp:337
#define min(a, b)
const std::string & name() const
get the name
Definition: TupleObj.h:2083
StatusCode Tuples::TupleObj::column ( const std::string &  name,
const 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
namethe name of the column
valuethe value of the variable
Returns
status code

Definition at line 575 of file TupleObj.cpp.

577 {
578  if ( invalid() ) { return InvalidTuple ; }
579  Bool* item = bools( name ) ;
580  if ( !item ) { return InvalidColumn ; }
581  *item = value ;
582  return StatusCode::SUCCESS ;
583 }
Bool * bools(const std::string &name)
get the column
Definition: TupleObj.cpp:616
NTuple::Item< bool > Bool
basic type for int items
Definition: TupleObj.h:185
tuple item
print s1,s2
Definition: ana.py:146
bool invalid() const
invalid pointer to tuple ?
Definition: TupleObj.h:2125
const std::string & name() const
get the name
Definition: TupleObj.h:2083
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
namename of the column ("Address" is a recommended convention!)
addressIOpaqueAddress
Returns
status code

Definition at line 313 of file TupleObj.cpp.

315 {
316  if ( invalid () ) { return InvalidTuple ; }
317  if ( !evtColType () ) { return InvalidOperation ; }
318  if ( 0 == address )
319  { return Error ( "column('" + name +
320  "') IOpaqueAddress* is NULL!" , InvalidObject ) ; }
321  Address* item = addresses( name );
322  if ( 0 == item ) { return InvalidItem ; }
323  *item = address ;
324  return StatusCode::SUCCESS ;
325 }
Address * addresses(const std::string &name)
get the column
Definition: TupleObj.cpp:887
bool evtColType() const
Event collection ?
Definition: TupleObj.h:2119
NTuple::Item< IOpaqueAddress * > Address
basic type for address items
Definition: TupleObj.h:218
virtual StatusCode Error(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
tuple item
print s1,s2
Definition: ana.py:146
bool invalid() const
invalid pointer to tuple ?
Definition: TupleObj.h:2125
const std::string & name() const
get the name
Definition: TupleObj.h:2083
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
addressIOpaqueAddress
Returns
status code

Definition at line 331 of file TupleObj.cpp.

332 {
333  return column ( "Address" , address ) ;
334 }
StatusCode column(const std::string &name, const float value)
Set the value for selected tuple column.
Definition: TupleObj.cpp:337
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 1865 of file TupleObj.h.

1867  {
1868  if ( invalid() ) { return InvalidTuple ; }
1869  // fill all separate columns:
1870  StatusCode sc1 = this -> column ( name + "E" , v.E () ) ;
1871  StatusCode sc2 = this -> column ( name + "X" , v.Px () ) ;
1872  StatusCode sc3 = this -> column ( name + "Y" , v.Py () ) ;
1873  StatusCode sc4 = this -> column ( name + "Z" , v.Pz () ) ;
1874  return
1875  sc1.isFailure () ? sc1 :
1876  sc2.isFailure () ? sc2 :
1877  sc3.isFailure () ? sc3 :
1878  sc4.isFailure () ? sc4 : StatusCode(StatusCode::SUCCESS) ;
1879  }
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:72
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
StatusCode column(const std::string &name, const float value)
Set the value for selected tuple column.
Definition: TupleObj.cpp:337
bool invalid() const
invalid pointer to tuple ?
Definition: TupleObj.h:2125
const std::string & name() const
get the name
Definition: TupleObj.h:2083
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

fill separate columns

Definition at line 1899 of file TupleObj.h.

1901  {
1902  if ( invalid() ) { return InvalidTuple ; }
1904  StatusCode sc1 = this -> column ( name + "X" , v.X () ) ;
1905  StatusCode sc2 = this -> column ( name + "Y" , v.Y () ) ;
1906  StatusCode sc3 = this -> column ( name + "Z" , v.Z () ) ;
1907  return
1908  sc1.isFailure () ? sc1 :
1909  sc2.isFailure () ? sc2 :
1910  sc3.isFailure () ? sc3 : StatusCode(StatusCode::SUCCESS) ;
1911  }
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:72
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
StatusCode column(const std::string &name, const float value)
Set the value for selected tuple column.
Definition: TupleObj.cpp:337
bool invalid() const
invalid pointer to tuple ?
Definition: TupleObj.h:2125
const std::string & name() const
get the name
Definition: TupleObj.h:2083
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

fill separate columns

Definition at line 1931 of file TupleObj.h.

1933  {
1934  if ( invalid() ) { return InvalidTuple ; }
1936  StatusCode sc1 = this -> column ( name + "X" , v.X () ) ;
1937  StatusCode sc2 = this -> column ( name + "Y" , v.Y () ) ;
1938  StatusCode sc3 = this -> column ( name + "Z" , v.Z () ) ;
1939  return
1940  sc1.isFailure () ? sc1 :
1941  sc2.isFailure () ? sc2 :
1942  sc3.isFailure () ? sc3 : StatusCode(StatusCode::SUCCESS) ;
1943  }
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:72
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
StatusCode column(const std::string &name, const float value)
Set the value for selected tuple column.
Definition: TupleObj.cpp:337
bool invalid() const
invalid pointer to tuple ?
Definition: TupleObj.h:2125
const std::string & name() const
get the name
Definition: TupleObj.h:2083
bool Tuples::TupleObj::columnWise ( ) const
inline

column wise NTuple ?

Definition at line 2113 of file TupleObj.h.

2113 { return CLID_ColumnWiseTuple == clid() ; }
const CLID & clid() const
accessor to the N-Tuple CLID
Definition: TupleObj.h:2107
Tuples::TupleObj::Double * Tuples::TupleObj::doubles ( const std::string &  name)
private

get the column

Definition at line 601 of file TupleObj.cpp.

602 {
603  Doubles::iterator found = m_doubles.find( name ) ;
604  if ( m_doubles.end() != found ) { return found->second ; }
605  Double* item = new Double() ;
606  m_doubles[ name ] = item ;
607  const StatusCode sc = tuple()->addItem( name , *item );
608  if ( sc.isFailure() )
609  { Error ( "doubles ('" + name + "'): item is not added", sc ) ; }
610  if ( !addItem ( name , "D" ) )
611  { Error ( "doubles ('" + name + "'): item is not unique" ) ; }
612  return item ;
613 }
Doubles m_doubles
the actual storage of all 'Double' columns
Definition: TupleObj.h:2357
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:72
NTuple::Tuple * tuple() const
provide the access to underlying Gaudi N-tuple
Definition: TupleObj.h:2088
iterator end()
Definition: Map.h:131
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
iterator find(const key_type &key)
Definition: Map.h:148
NTuple::Item< double > Double
basic type for double items
Definition: TupleObj.h:215
virtual StatusCode Error(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
bool addItem(const std::string &name, const std::string &type)
add the item name into the list of known items
Definition: TupleObj.h:2134
tuple item
print s1,s2
Definition: ana.py:146
StatusCode addItem(const std::string &name, Item< TYPE > &itm)
Add a scalar data item a N tuple.
Definition: NTuple.h:551
const std::string & name() const
get the name
Definition: TupleObj.h:2083
virtual StatusCode Tuples::TupleObj::Error ( const std::string &  msg,
const StatusCode  sc = StatusCode::FAILURE 
) const
pure virtual
bool Tuples::TupleObj::evtColType ( ) const
inline

Event collection ?

Definition at line 2119 of file TupleObj.h.

2119 { return Tuples::EVTCOL == type() ; }
Tuples::Type type() const
accessor to the N-Tuple type
Definition: TupleObj.h:2110
template<class DATA >
StatusCode Tuples::TupleObj::farray ( const std::string &  name,
DATA  first,
DATA  last,
const std::string &  length,
const 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
namename of N-tuple item
firstbegin of data sequence
lastend of data sequence
lengthname of "length" item
maxvmaximal length of array

fill the array

Definition at line 880 of file TupleObj.h.

885  {
886  if ( invalid () ) { return InvalidTuple ; }
887  if ( rowWise () ) { return InvalidOperation ; }
888 
889  // adjust the length
890  if( first + maxv < last )
891  {
892  Warning( "farray('"+name+"'): array is overflow, skip extra items") ;
893  last = first + maxv ;
894  }
895 
896  // get the length item
897  Int* len = ints( length , 0 , maxv ) ;
898  if( 0 == len ) { return InvalidColumn; }
899 
900  // adjust the length item
901  *len = last - first ;
902 
903  // get the array itself
904  FArray* var = fArray ( name , len ) ;
905  if( 0 == var ) { return InvalidColumn ; }
906 
908  size_t index = 0 ;
909  for( ; first != last ; ++first )
910  { (*var)[ index ] = (float)(*first) ; ++index ; }
911 
912  return StatusCode::SUCCESS ;
913  }
virtual StatusCode Warning(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
bool rowWise() const
row wise NTuple ?
Definition: TupleObj.h:2116
FArray * fArray(const std::string &name, Int *item)
get the column
Definition: TupleObj.cpp:904
NTuple::Item< int > Int
basic type for int items
Definition: TupleObj.h:200
bool invalid() const
invalid pointer to tuple ?
Definition: TupleObj.h:2125
Int * ints(const std::string &name)
get the column
Definition: TupleObj.cpp:759
NTuple::Array< float > FArray
basic type for array of floats
Definition: TupleObj.h:221
const std::string & name() const
get the name
Definition: TupleObj.h:2083
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
namename of N-tuple item
datadata sequence
lengthname of "length" item
maxvmaximal length of array

Definition at line 958 of file TupleObj.h.

962  { return farray ( name , data.begin() , data.end() , length , maxv ) ; }
const std::string & name() const
get the name
Definition: TupleObj.h:2083
StatusCode farray(const std::string &name, DATA first, DATA last, const std::string &length, const size_t maxv)
Add an indexed array (of type float) to N-tuple.
Definition: TupleObj.h:880
template<class FUNCTION , class DATA >
StatusCode Tuples::TupleObj::farray ( const std::string &  name,
const FUNCTION &  function,
DATA  first,
DATA  last,
const std::string &  length,
const 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
nametuple item name
functionfunction to be applied
firstbegin of data sequence
lastend of data sequence
lengthname of "length" tuple name
maxvmaximal length of the array
Returns
status code

Definition at line 1027 of file TupleObj.h.

1033  {
1034  if ( invalid () ) { return InvalidTuple ; }
1035  if ( rowWise () ) { return InvalidOperation ; }
1036 
1037  // adjust the length
1038  if( first + maxv < last )
1039  {
1040  Warning("farray('"
1041  + name + "'): array is overflow, skip extra entries") ;
1042  last = first + maxv ;
1043  }
1044 
1045  // get the length item
1046  Int* len = ints( length , 0 , maxv ) ;
1047  if( 0 == len ) { return InvalidColumn ; }
1048 
1049  // adjust the length
1050  *len = last - first ;
1051 
1052  // get the array itself
1053  FArray* var = fArray ( name , len ) ;
1054  if( 0 == var ) { return InvalidColumn ; }
1055 
1056  // fill the array
1057  size_t index = 0 ;
1058  for( ; first != last ; ++first )
1059  { (*var)[ index ] = function( *first ) ; ++index ; }
1060 
1061  return StatusCode::SUCCESS ;
1062  }
virtual StatusCode Warning(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
bool rowWise() const
row wise NTuple ?
Definition: TupleObj.h:2116
FArray * fArray(const std::string &name, Int *item)
get the column
Definition: TupleObj.cpp:904
NTuple::Item< int > Int
basic type for int items
Definition: TupleObj.h:200
bool invalid() const
invalid pointer to tuple ?
Definition: TupleObj.h:2125
Int * ints(const std::string &name)
get the column
Definition: TupleObj.cpp:759
NTuple::Array< float > FArray
basic type for array of floats
Definition: TupleObj.h:221
const std::string & name() const
get the name
Definition: TupleObj.h:2083
template<class FUNC1 , class FUNC2 , class DATA >
StatusCode Tuples::TupleObj::farray ( const std::string &  name1,
const FUNC1 &  func1,
const std::string &  name2,
const FUNC2 &  func2,
DATA  first,
DATA  last,
const std::string &  length,
const 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( "sqr" , // 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
name1the first tuple item name
func1the first function to be applied
name2the second tuple item name
func2the second function to be applied
firstbegin of data sequence
lastend of data sequence
lengthname of "length" tuple name
maxvmaximal length of the array
Returns
status code

Definition at line 1096 of file TupleObj.h.

1104  {
1105  if ( invalid () ) { return InvalidTuple ; }
1106  if ( rowWise () ) { return InvalidOperation ; }
1107 
1108  // adjust the lenfth
1109  if( first + maxv < last )
1110  {
1111  Warning("farray('"
1112  + name1 + ","
1113  + name2 + "'): array is overflow, skip extra entries").ignore() ;
1114  Warning("farray('"+name1+"'): array is overflow, skip extra items").ignore() ;
1115  last = first + maxv ;
1116  }
1117 
1118  // get the length item
1119  Int* len = ints ( length , 0 , maxv ) ;
1120  if ( 0 == len ) { return InvalidColumn ; }
1121 
1122  // adjust the length
1123  *len = last - first ;
1124 
1125  // get the array itself
1126  FArray* var1 = fArray ( name1 , len ) ;
1127  if ( 0 == var1 ) { return InvalidColumn ; }
1128 
1129  // get the array itself
1130  FArray* var2 = fArray ( name2 , len ) ;
1131  if ( 0 == var2 ) { return InvalidColumn ; }
1132 
1133  // fill the array
1134  size_t index = 0 ;
1135  for( ; first != last ; ++first )
1136  {
1137  ( *var1 ) [ index ] = func1 ( *first ) ;
1138  ( *var2 ) [ index ] = func2 ( *first ) ;
1139  ++index ;
1140  }
1141 
1142  return StatusCode::SUCCESS ;
1143  }
virtual StatusCode Warning(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
bool rowWise() const
row wise NTuple ?
Definition: TupleObj.h:2116
FArray * fArray(const std::string &name, Int *item)
get the column
Definition: TupleObj.cpp:904
NTuple::Item< int > Int
basic type for int items
Definition: TupleObj.h:200
bool invalid() const
invalid pointer to tuple ?
Definition: TupleObj.h:2125
Int * ints(const std::string &name)
get the column
Definition: TupleObj.cpp:759
NTuple::Array< float > FArray
basic type for array of floats
Definition: TupleObj.h:221
void ignore() const
Definition: StatusCode.h:94
template<class FUNC1 , class FUNC2 , class FUNC3 , class DATA >
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,
DATA  first,
DATA  last,
const std::string &  length,
const 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( "sqr" , // 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
name1the first tuple item name
func1the first function to be applied
name2the second tuple item name
func2the second function to be applied
name3the third tuple item name
func3the third function to be applied
firstbegin of data sequence
lastend of data sequence
lengthname of "length" tuple name
maxvmaximal length of the array
Returns
status code

Definition at line 1182 of file TupleObj.h.

1192  {
1193  if ( invalid () ) { return InvalidTuple ; }
1194  if ( rowWise () ) { return InvalidOperation ; }
1195 
1196  // adjust the length
1197  if( first + maxv < last )
1198  {
1199  Warning("farray('"
1200  + name1 + ","
1201  + name2 + ","
1202  + name3 + "'): array is overflow, skip extra entries").ignore() ;
1203  last = first + maxv ;
1204  }
1205 
1206  // get the length item
1207  Int* len = ints ( length , 0 , maxv ) ;
1208  if( 0 == len ) { return InvalidColumn ; }
1209 
1210  // adjust the length
1211  *len = last - first ;
1212 
1213  // get the array itself
1214  FArray* var1 = fArray ( name1 , len ) ;
1215  if( 0 == var1 ) { return InvalidColumn ; }
1216 
1217  // get the array itself
1218  FArray* var2 = fArray ( name2 , len ) ;
1219  if( 0 == var2 ) { return InvalidColumn ; }
1220 
1221  // get the array itself
1222  FArray* var3 = fArray ( name3 , len ) ;
1223  if( 0 == var3 ) { return InvalidColumn ; }
1224 
1225  // fill the array
1226  size_t index = 0 ;
1227  for( ; first != last ; ++first )
1228  {
1229  ( *var1 ) [ index ] = (float)func1 ( *first ) ;
1230  ( *var2 ) [ index ] = (float)func2 ( *first ) ;
1231  ( *var3 ) [ index ] = (float)func3 ( *first ) ;
1232  ++index ;
1233  }
1234  return StatusCode::SUCCESS ;
1235  }
virtual StatusCode Warning(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
bool rowWise() const
row wise NTuple ?
Definition: TupleObj.h:2116
FArray * fArray(const std::string &name, Int *item)
get the column
Definition: TupleObj.cpp:904
NTuple::Item< int > Int
basic type for int items
Definition: TupleObj.h:200
bool invalid() const
invalid pointer to tuple ?
Definition: TupleObj.h:2125
Int * ints(const std::string &name)
get the column
Definition: TupleObj.cpp:759
NTuple::Array< float > FArray
basic type for array of floats
Definition: TupleObj.h:221
void ignore() const
Definition: StatusCode.h:94
template<class FUNC1 , class FUNC2 , class FUNC3 , class FUNC4 , class DATA >
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,
DATA  first,
DATA  last,
const std::string &  length,
const 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( "sqr" , // 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
name1the first tuple item name
func1the first function to be applied
name2the second tuple item name
func2the second function to be applied
name3the third tuple item name
func3the third function to be applied
name4the fourth tuple item name
func4the fourth function to be applied
firstbegin of data sequence
lastend of data sequence
lengthname of "length" tuple name
maxvmaximal length of the array
Returns
status code

Definition at line 1277 of file TupleObj.h.

1289  {
1290  if ( invalid () ) { return InvalidTuple ; }
1291  if ( rowWise () ) { return InvalidOperation ; }
1292 
1293  // adjust the length
1294  if( first + maxv < last )
1295  {
1296  Warning("farray('"
1297  + name1 + ","
1298  + name2 + ","
1299  + name3 + ","
1300  + name4 + "'): array is overflow, skip extra entries").ignore() ;
1301  last = first + maxv ;
1302  }
1303 
1304  // get the length item
1305  Int* len = ints ( length , 0 , maxv ) ;
1306  if( 0 == len ) { return InvalidColumn ; }
1307 
1308  // adjust the length
1309  *len = last - first ;
1310 
1311  // get the array itself
1312  FArray* var1 = fArray ( name1 , len ) ;
1313  if( 0 == var1 ) { return InvalidColumn ; }
1314 
1315  // get the array itself
1316  FArray* var2 = fArray ( name2 , len ) ;
1317  if( 0 == var2 ) { return InvalidColumn ; }
1318 
1319  // get the array itself
1320  FArray* var3 = fArray ( name3 , len ) ;
1321  if( 0 == var3 ) { return InvalidColumn ; }
1322 
1323  // get the array itself
1324  FArray* var4 = fArray ( name4 , len ) ;
1325  if( 0 == var4 ) { return InvalidColumn ; }
1326 
1327  // fill the array
1328  size_t index = 0 ;
1329  for( ; first != last ; ++first )
1330  {
1331  ( *var1 ) [ index ] = static_cast<float> ( func1 ( *first ) );
1332  ( *var2 ) [ index ] = static_cast<float> ( func2 ( *first ) );
1333  ( *var3 ) [ index ] = static_cast<float> ( func3 ( *first ) );
1334  ( *var4 ) [ index ] = static_cast<float> ( func4 ( *first ) );
1335  ++index ;
1336  }
1337 
1338  return StatusCode::SUCCESS ;
1339  }
virtual StatusCode Warning(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
bool rowWise() const
row wise NTuple ?
Definition: TupleObj.h:2116
FArray * fArray(const std::string &name, Int *item)
get the column
Definition: TupleObj.cpp:904
NTuple::Item< int > Int
basic type for int items
Definition: TupleObj.h:200
bool invalid() const
invalid pointer to tuple ?
Definition: TupleObj.h:2125
Int * ints(const std::string &name)
get the column
Definition: TupleObj.cpp:759
NTuple::Array< float > FArray
basic type for array of floats
Definition: TupleObj.h:221
void ignore() const
Definition: StatusCode.h:94
Tuples::TupleObj::FArray * Tuples::TupleObj::fArray ( const std::string &  name,
Int item 
)
private

get the column

Definition at line 904 of file TupleObj.cpp.

906 {
907  // existing array ?
908  FArrays::iterator found = m_farrays.find( name ) ;
909  if( m_farrays.end() != found ) { return found->second ; }
910  // create new array
911  FArray* array = new FArray () ;
912  m_farrays[ name] = array ;
913  const StatusCode sc = tuple() -> addIndexedItem( name , *length , *array) ;
914  if( sc.isFailure() )
915  { Error ( "farray ('" + name + "'): item is not added", sc ) ; }
916  if ( !addItem ( name , "FArray" ) )
917  { Error ( "farray ('" + name + "'): item is not unique" ) ; }
918  return array ;
919 }
FArrays m_farrays
the actual storage of all 'FArray' columns
Definition: TupleObj.h:2363
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:72
NTuple::Tuple * tuple() const
provide the access to underlying Gaudi N-tuple
Definition: TupleObj.h:2088
iterator end()
Definition: Map.h:131
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
iterator find(const key_type &key)
Definition: Map.h:148
virtual StatusCode Error(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
StatusCode array(const std::string &name, DATA first, DATA last)
fill N-Tuple with fixed-size array
Definition: TupleObj.h:1659
bool addItem(const std::string &name, const std::string &type)
add the item name into the list of known items
Definition: TupleObj.h:2134
NTuple::Array< float > FArray
basic type for array of floats
Definition: TupleObj.h:221
const std::string & name() const
get the name
Definition: TupleObj.h:2083
Tuples::TupleObj::FArray * Tuples::TupleObj::fArray ( const std::string &  name,
const MIndex rows 
)
private

get the column

Definition at line 924 of file TupleObj.cpp.

926 {
927  // existing array ?
928  FArrays::iterator found = m_arraysf.find( name ) ;
929  if( m_arraysf.end() != found ) { return found->second ; }
930  // create new array
931  FArray* array = new FArray () ;
932  m_arraysf[ name] = array ;
933  const StatusCode sc = tuple() -> addItem ( name , rows , *array) ;
934  if( sc.isFailure() )
935  { Error ( "array ('" + name + "'): item is not added", sc ) ; }
936  if ( !addItem ( name , "FArray" ) )
937  { Error ( "array ('" + name + "'): item is not unique" ) ; }
938  return array ;
939 }
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:72
FArrays m_arraysf
the actual storage of all 'FArray' columns (fixed)
Definition: TupleObj.h:2366
NTuple::Tuple * tuple() const
provide the access to underlying Gaudi N-tuple
Definition: TupleObj.h:2088
iterator end()
Definition: Map.h:131
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
iterator find(const key_type &key)
Definition: Map.h:148
virtual StatusCode Error(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
StatusCode array(const std::string &name, DATA first, DATA last)
fill N-Tuple with fixed-size array
Definition: TupleObj.h:1659
bool addItem(const std::string &name, const std::string &type)
add the item name into the list of known items
Definition: TupleObj.h:2134
NTuple::Array< float > FArray
basic type for array of floats
Definition: TupleObj.h:221
const std::string & name() const
get the name
Definition: TupleObj.h:2083
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
formatblank-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 282 of file TupleObj.cpp.

283 {
284  // check the underlying tuple
285  if ( invalid() ) { return InvalidTuple ; }
286  // decode format string into tokens
287  Tokens tokens ;
288  tokenize( format , tokens , " ,;" );
289  if ( tokens.empty() ) { return StatusCode::SUCCESS ; }
291  va_list valist ;
292  va_start( valist , format ) ;
293  // loop over all tokens
295  for( Tokens::const_iterator token = tokens.begin() ;
296  tokens.end() != token && status.isSuccess() ; ++token )
297  {
298  const double val = va_arg( valist , double );
299  status = column( *token , val );
300  if( status.isFailure() )
301  { Error ( "fill(): Can not add column '" + *token + "' " ) ; }
302  }
303  // mandatory !!!
304  va_end( valist );
305  //
306  return status ;
307 }
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
Definition: MsgStream.cpp:133
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:62
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:72
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
StatusCode column(const std::string &name, const float value)
Set the value for selected tuple column.
Definition: TupleObj.cpp:337
virtual StatusCode Error(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
bool invalid() const
invalid pointer to tuple ?
Definition: TupleObj.h:2125
Tuples::TupleObj::Float * Tuples::TupleObj::floats ( const std::string &  name)
private

get the column

Definition at line 586 of file TupleObj.cpp.

587 {
588  Floats::iterator found = m_floats.find( name ) ;
589  if ( m_floats.end() != found ) { return found->second ; }
590  Float* item = new Float() ;
591  m_floats[ name ] = item ;
592  const StatusCode sc = tuple()->addItem( name , *item );
593  if ( sc.isFailure() )
594  { Error ( "floats ('" + name + "'): item is not added", sc ) ; }
595  if ( !addItem ( name , "F" ) )
596  { Error ( "floats ('" + name + "'): item is not unique" ) ; }
597  return item ;
598 }
NTuple::Item< float > Float
basic type for float items
Definition: TupleObj.h:212
Floats m_floats
the actual storage of all 'Float' columns
Definition: TupleObj.h:2354
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:72
NTuple::Tuple * tuple() const
provide the access to underlying Gaudi N-tuple
Definition: TupleObj.h:2088
iterator end()
Definition: Map.h:131
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
iterator find(const key_type &key)
Definition: Map.h:148
virtual StatusCode Error(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
bool addItem(const std::string &name, const std::string &type)
add the item name into the list of known items
Definition: TupleObj.h:2134
tuple item
print s1,s2
Definition: ana.py:146
StatusCode addItem(const std::string &name, Item< TYPE > &itm)
Add a scalar data item a N tuple.
Definition: NTuple.h:551
const std::string & name() const
get the name
Definition: TupleObj.h:2083
template<class MATRIX >
StatusCode Tuples::TupleObj::fmatrix ( const std::string &  name,
const MATRIX &  data,
size_t  rows,
const MIndex cols,
const std::string &  length,
const 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
nameentry name in N-Tuple
datamatrix itself
rowsnumber of rows of matrix (variable)
colsnumber of columns of matrix (fixed)
lengthentry name in NTuple for number of matrix column
maxvmaximal 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 1394 of file TupleObj.h.

1400  {
1401  if ( invalid () ) { return InvalidTuple ; }
1402  if ( rowWise () ) { return InvalidOperation ; }
1403 
1404  // adjust the length
1405  if ( rows >= maxv )
1406  {
1407  Warning ( "fmatrix('"+name+"'): matrix is overflow, skip extra items").ignore() ;
1408  rows = ( 0 < maxv ) ? ( maxv - 1 ) : 0 ;
1409  }
1410 
1411  // get the length item
1412  Int* len = ints( length , 0 , maxv ) ;
1413  if ( 0 == len ) { return InvalidColumn; }
1414 
1415  // adjust the length item
1416  *len = rows ;
1417 
1418  // get the array itself
1419  FMatrix* var = fMatrix ( name , len , cols ) ;
1420  if ( 0 == var ) { return InvalidColumn ; }
1421 
1423  for ( size_t iCol = 0 ; iCol < cols ; ++iCol )
1424  {
1425  for ( MIndex iRow = 0 ; iRow < rows ; ++iRow )
1426  { (*var)[ iRow ] [ iCol ] = (float)(data[ iRow ][ iCol ]) ; }
1427  }
1428 
1429  return StatusCode::SUCCESS ;
1430  }
unsigned short MIndex
Definition: TupleObj.h:227
virtual StatusCode Warning(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
NTuple::Matrix< float > FMatrix
basic type for matrix of floats
Definition: TupleObj.h:224
bool rowWise() const
row wise NTuple ?
Definition: TupleObj.h:2116
NTuple::Item< int > Int
basic type for int items
Definition: TupleObj.h:200
FMatrix * fMatrix(const std::string &name, Int *item, const MIndex &cols)
get the column
Definition: TupleObj.cpp:945
bool invalid() const
invalid pointer to tuple ?
Definition: TupleObj.h:2125
Int * ints(const std::string &name)
get the column
Definition: TupleObj.cpp:759
void ignore() const
Definition: StatusCode.h:94
const std::string & name() const
get the name
Definition: TupleObj.h:2083
template<class DATA >
StatusCode Tuples::TupleObj::fmatrix ( const std::string &  name,
DATA  first,
DATA  last,
const MIndex cols,
const std::string &  length,
const 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
nameentry name in N-Tuple
firstiterator for the first row of matrix
lastiterator for the last row of matrix
colsnumber of columns for matrix (fixed!)
lengthentry name in NTuple for number of matrix column
maxvmaximal 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 1469 of file TupleObj.h.

1475  {
1476  if ( invalid () ) { return InvalidTuple ; }
1477  if ( rowWise () ) { return InvalidOperation ; }
1478 
1479  // adjust the length
1480  if ( first + maxv < last )
1481  {
1482  Warning("fmatrix('"+name+"'): matrix is overflow, skip extra items").ignore() ;
1483  last = first + maxv ;
1484  }
1485 
1486  // get the length item
1487  Int* len = ints( length , 0 , maxv ) ;
1488  if ( 0 == len ) { return InvalidColumn; }
1489 
1490  // adjust the length item
1491  *len = last - first ;
1492 
1493  // get the array itself
1494  FMatrix* var = fMatrix ( name , len , cols ) ;
1495  if ( 0 == var ) { return InvalidColumn ; }
1496 
1498  size_t iRow = 0 ;
1499  for ( ; first != last ; ++first )
1500  {
1501  //
1502  for ( MIndex iCol = 0 ; iCol < cols ; ++iCol )
1503  { (*var)[ iRow ] [ iCol ] = (float)((*first)[ iCol ]) ; }
1504  //
1505  ++iRow ;
1506  }
1507 
1508  return StatusCode::SUCCESS ;
1509  }
unsigned short MIndex
Definition: TupleObj.h:227
virtual StatusCode Warning(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
NTuple::Matrix< float > FMatrix
basic type for matrix of floats
Definition: TupleObj.h:224
bool rowWise() const
row wise NTuple ?
Definition: TupleObj.h:2116
NTuple::Item< int > Int
basic type for int items
Definition: TupleObj.h:200
FMatrix * fMatrix(const std::string &name, Int *item, const MIndex &cols)
get the column
Definition: TupleObj.cpp:945
bool invalid() const
invalid pointer to tuple ?
Definition: TupleObj.h:2125
Int * ints(const std::string &name)
get the column
Definition: TupleObj.cpp:759
void ignore() const
Definition: StatusCode.h:94
const std::string & name() const
get the name
Definition: TupleObj.h:2083
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,
const 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
nameentry 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
lengthentry name in NTuple for number of matrix column
maxvmaximal 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 1590 of file TupleObj.h.

1597  {
1598  if ( invalid () ) { return InvalidTuple ; }
1599  if ( rowWise () ) { return InvalidOperation ; }
1600 
1601  // adjust the length
1602  if ( first + maxv < last )
1603  {
1604  Warning("fmatrix('"+name+"'): matrix is overflow, skip extra items").ignore() ;
1605  last = first + maxv ;
1606  }
1607 
1608  // get the length item
1609  Int* len = ints( length , 0 , maxv ) ;
1610  if ( 0 == len ) { return InvalidColumn; }
1611 
1612  // adjust the length item
1613  *len = last - first ;
1614 
1615  // get the array itself
1616  const size_t cols = funL - funF ;
1617  FMatrix* var = fMatrix ( name , len , cols ) ;
1618  if ( 0 == var ) { return InvalidColumn ; }
1619 
1621  size_t iRow = 0 ;
1622  for ( ; first != last ; ++first )
1623  {
1624  //
1625  for ( FUN fun = funF ; fun < funL ; ++fun )
1626  { (*var)[ iRow ] [ fun - funF ] = (float)((*fun) ( *first )) ; }
1627  //
1628  ++iRow;
1629  }
1630 
1631  return StatusCode::SUCCESS ;
1632  }
virtual StatusCode Warning(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
NTuple::Matrix< float > FMatrix
basic type for matrix of floats
Definition: TupleObj.h:224
bool rowWise() const
row wise NTuple ?
Definition: TupleObj.h:2116
double fun(const std::vector< double > &x)
Definition: PFuncTest.cpp:27
NTuple::Item< int > Int
basic type for int items
Definition: TupleObj.h:200
FMatrix * fMatrix(const std::string &name, Int *item, const MIndex &cols)
get the column
Definition: TupleObj.cpp:945
bool invalid() const
invalid pointer to tuple ?
Definition: TupleObj.h:2125
Int * ints(const std::string &name)
get the column
Definition: TupleObj.cpp:759
void ignore() const
Definition: StatusCode.h:94
const std::string & name() const
get the name
Definition: TupleObj.h:2083
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

fill the matrix

Definition at line 2018 of file TupleObj.h.

2022  {
2023 
2024  if ( invalid () ) { return InvalidTuple ; }
2025  if ( rowWise () ) { return InvalidOperation ; }
2026 
2027  typename GaudiUtils::VectorMap<KEY,VALUE>::const_iterator begin = info.begin () ;
2029 
2030  // adjust the length
2031  if ( maxv < info.size() )
2032  {
2033  Warning("fmatrix('"+name+"'): matrix is overflow, skip extra items") ;
2034  end = begin + maxv ;
2035  } ;
2036 
2037  // get the length item
2038  Int* len = ints( length , 0 , maxv ) ;
2039  if ( 0 == len ) { return InvalidColumn; }
2040 
2041  // adjust the length item
2042  *len = end - begin ;
2043 
2044  // get the array itself
2045  FMatrix* var = fMatrix ( name , len , 2 ) ;
2046  if ( 0 == var ) { return InvalidColumn ; }
2047 
2049  size_t iRow = 0 ;
2050  for ( ; begin != end ; ++begin)
2051  {
2052  //
2053  (*var)[iRow][0] = (float) begin->first ;
2054  (*var)[iRow][1] = (float) begin->second ;
2055  //
2056  ++iRow ;
2057  } ;
2058 
2059  return StatusCode::SUCCESS ;
2060  }
virtual StatusCode Warning(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
iterator end() const
"end" iterator for sequential access (const-only version!)
Definition: VectorMap.h:200
NTuple::Matrix< float > FMatrix
basic type for matrix of floats
Definition: TupleObj.h:224
iterator begin() const
"begin" iterator for sequential access (const-only version!)
Definition: VectorMap.h:198
bool rowWise() const
row wise NTuple ?
Definition: TupleObj.h:2116
tuple end
Definition: IOTest.py:101
_vector::const_iterator const_iterator
visible const_iterator (exported)
Definition: VectorMap.h:151
NTuple::Item< int > Int
basic type for int items
Definition: TupleObj.h:200
FMatrix * fMatrix(const std::string &name, Int *item, const MIndex &cols)
get the column
Definition: TupleObj.cpp:945
bool invalid() const
invalid pointer to tuple ?
Definition: TupleObj.h:2125
Int * ints(const std::string &name)
get the column
Definition: TupleObj.cpp:759
const std::string & name() const
get the name
Definition: TupleObj.h:2083
size_type size() const
number of elements
Definition: VectorMap.h:495
Tuples::TupleObj::FMatrix * Tuples::TupleObj::fMatrix ( const std::string &  name,
Int item,
const MIndex cols 
)
private

get the column

Definition at line 945 of file TupleObj.cpp.

948 {
949  // existing array ?
951  if( m_fmatrices.end() != found ) { return found->second ; }
952  // create new array
953  FMatrix* matrix = new FMatrix () ;
954  m_fmatrices[ name] = matrix ;
955  const StatusCode sc =
956  tuple() -> addIndexedItem( name , *length , cols , *matrix ) ;
957  if( sc.isFailure() )
958  { Error ( "fmatrix ('" + name + "'): item is not added", sc ) ; }
959  if ( !addItem ( name , "FMatrix" ) )
960  { Error ( "fmatrix ('" + name + "'): item is not unique" ) ; }
961  return matrix ;
962 }
FMatrices m_fmatrices
the actual storage of all 'FArray' columns
Definition: TupleObj.h:2369
StatusCode matrix(const std::string &name, const MATRIX &data, const MIndex &rows, const MIndex &cols)
fill N-Tuple with fixed-size matrix
Definition: TupleObj.h:1824
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:72
NTuple::Tuple * tuple() const
provide the access to underlying Gaudi N-tuple
Definition: TupleObj.h:2088
iterator end()
Definition: Map.h:131
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
NTuple::Matrix< float > FMatrix
basic type for matrix of floats
Definition: TupleObj.h:224
iterator find(const key_type &key)
Definition: Map.h:148
virtual StatusCode Error(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
bool addItem(const std::string &name, const std::string &type)
add the item name into the list of known items
Definition: TupleObj.h:2134
const std::string & name() const
get the name
Definition: TupleObj.h:2083
Tuples::TupleObj::FMatrix * Tuples::TupleObj::fMatrix ( const std::string &  name,
const MIndex rows,
const MIndex cols 
)
private

get the column

Definition at line 968 of file TupleObj.cpp.

971 {
972  // existing array ?
974  if( m_matricesf.end() != found ) { return found->second ; }
975  // create new array
976  FMatrix* matrix = new FMatrix () ;
977  m_matricesf[ name] = matrix ;
978  const StatusCode sc =
979  tuple() -> addItem( name , rows , cols , *matrix ) ;
980  if( sc.isFailure() )
981  { Error ( "matrix ('" + name + "'): item is not added", sc ) ; }
982  if ( !addItem ( name , "FMatrix" ) )
983  { Error ( "matrix ('" + name + "'): item is not unique" ) ; }
984  return matrix ;
985 }
StatusCode matrix(const std::string &name, const MATRIX &data, const MIndex &rows, const MIndex &cols)
fill N-Tuple with fixed-size matrix
Definition: TupleObj.h:1824
FMatrices m_matricesf
the actual storage of all 'FMatrix' columns (fixed)
Definition: TupleObj.h:2372
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:72
NTuple::Tuple * tuple() const
provide the access to underlying Gaudi N-tuple
Definition: TupleObj.h:2088
iterator end()
Definition: Map.h:131
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
NTuple::Matrix< float > FMatrix
basic type for matrix of floats
Definition: TupleObj.h:224
iterator find(const key_type &key)
Definition: Map.h:148
virtual StatusCode Error(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
bool addItem(const std::string &name, const std::string &type)
add the item name into the list of known items
Definition: TupleObj.h:2134
const std::string & name() const
get the name
Definition: TupleObj.h:2083
bool Tuples::TupleObj::goodItem ( const std::string &  name) const
inline

check the uniqueness of the name

Parameters
namethe name of the item
Returns
true if the name is indeed unique

Definition at line 2142 of file TupleObj.h.

2143  { return m_items.end() == m_items.find ( name ) ; }
ItemMap m_items
all booked types:
Definition: TupleObj.h:2375
const std::string & name() const
get the name
Definition: TupleObj.h:2083
Tuples::TupleObj::Int * Tuples::TupleObj::ints ( const std::string &  name)
private

get the column

Definition at line 759 of file TupleObj.cpp.

760 {
761  Ints::iterator found = m_ints.find( name ) ;
762  if( m_ints.end() != found ) { return found->second ; }
763  Int* item = new Int() ;
764  m_ints[ name ] = item ;
765  StatusCode sc = tuple()->addItem( name , *item );
766  if( sc.isFailure() )
767  { Error ( "ints ('" + name + "'): item is not added", sc ) ; }
768  if ( !addItem ( name , "I" ) )
769  { Error ( "ints ('" + name + "'): item is not unique" ) ; }
770  return item ;
771 }
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:72
NTuple::Tuple * tuple() const
provide the access to underlying Gaudi N-tuple
Definition: TupleObj.h:2088
iterator end()
Definition: Map.h:131
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
iterator find(const key_type &key)
Definition: Map.h:148
Ints m_ints
the actual storage of all 'Int' columns
Definition: TupleObj.h:2342
virtual StatusCode Error(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
bool addItem(const std::string &name, const std::string &type)
add the item name into the list of known items
Definition: TupleObj.h:2134
map_type::iterator iterator
Definition: Map.h:98
NTuple::Item< int > Int
basic type for int items
Definition: TupleObj.h:200
tuple item
print s1,s2
Definition: ana.py:146
StatusCode addItem(const std::string &name, Item< TYPE > &itm)
Add a scalar data item a N tuple.
Definition: NTuple.h:551
const std::string & name() const
get the name
Definition: TupleObj.h:2083
Tuples::TupleObj::Int * Tuples::TupleObj::ints ( const std::string &  name,
const int  minv,
const int  maxv 
)
private

get the column

Definition at line 774 of file TupleObj.cpp.

777 {
778  Ints::iterator found = m_ints.find( name ) ;
779  if( m_ints.end() != found ) { return found->second ; }
780  Int* item = new Int() ;
781  m_ints[ name ] = item ;
782  const StatusCode sc = tuple()->addItem( name , *item , minv , maxv );
783  if( sc.isFailure() )
784  { Error ( "ints ('" + name + "'): item is not added", sc ) ; }
785  if ( !addItem ( name , "I" ) )
786  { Error ( "ints ('" + name + "'): item is not unique" ) ; }
787  return item ;
788 }
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:72
NTuple::Tuple * tuple() const
provide the access to underlying Gaudi N-tuple
Definition: TupleObj.h:2088
iterator end()
Definition: Map.h:131
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
iterator find(const key_type &key)
Definition: Map.h:148
Ints m_ints
the actual storage of all 'Int' columns
Definition: TupleObj.h:2342
virtual StatusCode Error(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
bool addItem(const std::string &name, const std::string &type)
add the item name into the list of known items
Definition: TupleObj.h:2134
map_type::iterator iterator
Definition: Map.h:98
NTuple::Item< int > Int
basic type for int items
Definition: TupleObj.h:200
tuple item
print s1,s2
Definition: ana.py:146
StatusCode addItem(const std::string &name, Item< TYPE > &itm)
Add a scalar data item a N tuple.
Definition: NTuple.h:551
const std::string & name() const
get the name
Definition: TupleObj.h:2083
bool Tuples::TupleObj::invalid ( ) const
inline

invalid pointer to tuple ?

Definition at line 2125 of file TupleObj.h.

2125 { return ! valid() ; }
bool valid() const
valid pointer to tuple ?
Definition: TupleObj.h:2122
const ItemMap& Tuples::TupleObj::items ( ) const
inline

get the full list of booked items

Definition at line 2146 of file TupleObj.h.

2146 { return m_items ; }
ItemMap m_items
all booked types:
Definition: TupleObj.h:2375
Tuples::TupleObj::LongLong * Tuples::TupleObj::longlongs ( const std::string &  name)
private

get the column

Definition at line 823 of file TupleObj.cpp.

824 {
826  if( m_longlongs.end() != found ) { return found->second ; }
827  LongLong* item = new LongLong() ;
828  m_longlongs[ name ] = item ;
829  StatusCode sc = tuple()->addItem( name , *item );
830  if( sc.isFailure() )
831  { Error ( "ints ('" + name + "'): item is not added", sc ) ; }
832  if ( !addItem ( name , "ULL" ) )
833  { Error ( "ints ('" + name + "'): item is not unique" ) ; }
834  return item ;
835 }
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:72
NTuple::Tuple * tuple() const
provide the access to underlying Gaudi N-tuple
Definition: TupleObj.h:2088
iterator end()
Definition: Map.h:131
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
iterator find(const key_type &key)
Definition: Map.h:148
virtual StatusCode Error(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
LongLongs m_longlongs
the actual storage of all 'longlong' columns
Definition: TupleObj.h:2348
NTuple::Item< long long > LongLong
basic type for unsigned long long items
Definition: TupleObj.h:206
bool addItem(const std::string &name, const std::string &type)
add the item name into the list of known items
Definition: TupleObj.h:2134
tuple item
print s1,s2
Definition: ana.py:146
StatusCode addItem(const std::string &name, Item< TYPE > &itm)
Add a scalar data item a N tuple.
Definition: NTuple.h:551
const std::string & name() const
get the name
Definition: TupleObj.h:2083
Tuples::TupleObj::LongLong * Tuples::TupleObj::longlongs ( const std::string &  name,
const long long  minv,
const long long  maxv 
)
private

get the column

Definition at line 838 of file TupleObj.cpp.

841 {
843  if( m_longlongs.end() != found ) { return found->second ; }
844  LongLong* item = new LongLong() ;
845  m_longlongs[ name ] = item ;
846  const StatusCode sc = tuple()->addItem( name , *item , minv , maxv );
847  if( sc.isFailure() )
848  { Error ( "longlongs ('" + name + "'): item is not added", sc ) ; }
849  if ( !addItem ( name , "ULL" ) )
850  { Error ( "longlongs ('" + name + "'): item is not unique" ) ; }
851  return item ;
852 }
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:72
NTuple::Tuple * tuple() const
provide the access to underlying Gaudi N-tuple
Definition: TupleObj.h:2088
iterator end()
Definition: Map.h:131
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
iterator find(const key_type &key)
Definition: Map.h:148
virtual StatusCode Error(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
LongLongs m_longlongs
the actual storage of all 'longlong' columns
Definition: TupleObj.h:2348
NTuple::Item< long long > LongLong
basic type for unsigned long long items
Definition: TupleObj.h:206
bool addItem(const std::string &name, const std::string &type)
add the item name into the list of known items
Definition: TupleObj.h:2134
tuple item
print s1,s2
Definition: ana.py:146
StatusCode addItem(const std::string &name, Item< TYPE > &itm)
Add a scalar data item a N tuple.
Definition: NTuple.h:551
const std::string & name() const
get the name
Definition: TupleObj.h:2083
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
nameN-Tuple entry name
datadata source (matrix)
colsnumber of columns
rowsnumber 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 1824 of file TupleObj.h.

1828  {
1829  if ( invalid () ) { return InvalidTuple ; }
1830  if ( rowWise () ) { return InvalidOperation ; }
1831 
1832  // get the matrix itself
1833  FMatrix* var = fMatrix ( name , rows , cols ) ;
1834  if ( 0 == var ) { return InvalidColumn ; }
1835 
1837  for ( size_t iCol = 0 ; iCol < cols ; ++iCol )
1838  {
1839  for ( size_t iRow = 0 ; iRow < rows ; ++iRow )
1840  { (*var)[iRow][iCol] = (float)(data[iRow][iCol]) ; }
1841  };
1842  return StatusCode::SUCCESS ;
1843  }
NTuple::Matrix< float > FMatrix
basic type for matrix of floats
Definition: TupleObj.h:224
bool rowWise() const
row wise NTuple ?
Definition: TupleObj.h:2116
FMatrix * fMatrix(const std::string &name, Int *item, const MIndex &cols)
get the column
Definition: TupleObj.cpp:945
bool invalid() const
invalid pointer to tuple ?
Definition: TupleObj.h:2125
const std::string & name() const
get the name
Definition: TupleObj.h:2083
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 1979 of file TupleObj.h.

1981  {
1982  if ( invalid () ) { return InvalidTuple ; }
1983  if ( rowWise () ) { return InvalidOperation ; }
1984 
1985  // get the matrix itself
1986  FMatrix* var = fMatrix ( name , (MIndex)D1 , (MIndex)D2 ) ;
1987  if ( 0 == var ) { return InvalidColumn ; }
1988 
1990  for ( size_t iCol = 0 ; iCol < D2 ; ++iCol )
1991  {
1992  for ( size_t iRow = 0 ; iRow < D1 ; ++iRow )
1993  { (*var)[iRow][iCol] = (float) mtrx(iRow,iCol) ; }
1994  };
1995 
1996  return StatusCode::SUCCESS ;
1997  }
unsigned short MIndex
Definition: TupleObj.h:227
NTuple::Matrix< float > FMatrix
basic type for matrix of floats
Definition: TupleObj.h:224
bool rowWise() const
row wise NTuple ?
Definition: TupleObj.h:2116
FMatrix * fMatrix(const std::string &name, Int *item, const MIndex &cols)
get the column
Definition: TupleObj.cpp:945
bool invalid() const
invalid pointer to tuple ?
Definition: TupleObj.h:2125
const std::string & name() const
get the name
Definition: TupleObj.h:2083
const std::string& Tuples::TupleObj::name ( ) const
inline

get the name

Definition at line 2083 of file TupleObj.h.

2083 { return m_name ; }
std::string m_name
name
Definition: TupleObj.h:2312
TupleObj& Tuples::TupleObj::operator= ( const TupleObj )
private

assignment is disabled

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
namecolumn name
objpointer 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 127 of file TuplePut.h.

128 {
129  if ( invalid () ) { return InvalidTuple ; } // RETURN
130  if ( !evtColType () ) { return InvalidOperation ; } // RETURN
131 
132  // static block: The type description & the flag
133  static bool s_fail = false ; // STATIC
134  static TClass* s_type = 0 ; // STATIC
135  // check the status
136  if ( s_fail ) { return InvalidItem ; } // RETURN
137  else if ( !s_type )
138  {
139  s_type = TClass::GetClass(typeid(TYPE));
140  if ( !s_type )
141  {
142  s_fail = true ;
143  return Error ( " put('"+name+"'," + System::typeinfoName(typeid(TYPE)) +
144  ") :Invalid ROOT Type", InvalidItem ) ; // RETURN
145  }
146  }
147  // the local storage of items
148  static Tuples::ItemStore<TYPE*> s_map ;
149  // get the variable by name:
150  NTuple::Item<TYPE*>* item = s_map.getItem ( name , this ) ;
151  if ( 0 == item )
152  { return Error ( " put('" + name + "'): invalid item detected", InvalidItem ) ; }
153  // assign the item!
154  (*item) = const_cast<TYPE*> ( obj ) ; // THATS ALL!!
155  //
156  return StatusCode::SUCCESS ; // RETURN
157 }
bool evtColType() const
Event collection ?
Definition: TupleObj.h:2119
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:298
virtual StatusCode Error(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
tuple item
print s1,s2
Definition: ana.py:146
bool invalid() const
invalid pointer to tuple ?
Definition: TupleObj.h:2125
Simple class, which represents the local storage of N-tuple items of the given type.
Definition: TuplePut.h:38
Class acting as a smart pointer holding a N tuple _Item.
Definition: NTuple.h:43
NTuple::Item< VALUE > * getItem(const std::string &key, Tuples::TupleObj *tuple)
the only one method:
Definition: TuplePut.h:56
const std::string & name() const
get the name
Definition: TupleObj.h:2083
unsigned long Tuples::TupleObj::refCount ( ) const
inline

return the reference counter

Returns
current reference counter

Definition at line 2093 of file TupleObj.h.

2093 { return m_refCount ; }
size_t m_refCount
reference counter
Definition: TupleObj.h:2324
void Tuples::TupleObj::release ( )

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

Definition at line 228 of file TupleObj.cpp.

229 {
230  // decrease the reference counter
231  if( 0 < refCount() ) { --m_refCount; }
232  // check references
233  if( 0 != refCount() ) { return; }
234  // delete the object
235  delete this ;
236 }
size_t m_refCount
reference counter
Definition: TupleObj.h:2324
unsigned long refCount() const
return the reference counter
Definition: TupleObj.h:2093
bool Tuples::TupleObj::rowWise ( ) const
inline

row wise NTuple ?

Definition at line 2116 of file TupleObj.h.

2116 { return CLID_RowWiseTuple == clid() ; }
const CLID & clid() const
accessor to the N-Tuple CLID
Definition: TupleObj.h:2107
Tuples::TupleObj::Short * Tuples::TupleObj::shorts ( const std::string &  name)
private

get the column

Definition at line 695 of file TupleObj.cpp.

696 {
697  Shorts::iterator found = m_shorts.find( name ) ;
698  if( m_shorts.end() != found ) { return found->second ; }
699  Short* item = new Short() ;
700  m_shorts[ name ] = item ;
701  StatusCode sc = tuple()->addItem( name , *item );
702  if( sc.isFailure() )
703  { Error ( "shorts ('" + name + "'): item is not added", sc ) ; }
704  if ( !addItem ( name , "I" ) )
705  { Error ( "shorts ('" + name + "'): item is not unique" ) ; }
706  return item ;
707 }
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:72
NTuple::Tuple * tuple() const
provide the access to underlying Gaudi N-tuple
Definition: TupleObj.h:2088
NTuple::Item< short > Short
basic type for int items
Definition: TupleObj.h:194
iterator end()
Definition: Map.h:131
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
iterator find(const key_type &key)
Definition: Map.h:148
virtual StatusCode Error(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
bool addItem(const std::string &name, const std::string &type)
add the item name into the list of known items
Definition: TupleObj.h:2134
tuple item
print s1,s2
Definition: ana.py:146
StatusCode addItem(const std::string &name, Item< TYPE > &itm)
Add a scalar data item a N tuple.
Definition: NTuple.h:551
Shorts m_shorts
the actual storage of all 'Int' columns
Definition: TupleObj.h:2336
const std::string & name() const
get the name
Definition: TupleObj.h:2083
Tuples::TupleObj::Short * Tuples::TupleObj::shorts ( const std::string &  name,
const short  minv,
const short  maxv 
)
private

get the column

Definition at line 710 of file TupleObj.cpp.

713 {
714  Shorts::iterator found = m_shorts.find( name ) ;
715  if( m_shorts.end() != found ) { return found->second ; }
716  Short* item = new Short() ;
717  m_shorts[ name ] = item ;
718  const StatusCode sc = tuple()->addItem( name , *item , minv , maxv );
719  if( sc.isFailure() )
720  { Error ( "shorts ('" + name + "'): item is not added", sc ) ; }
721  if ( !addItem ( name , "I" ) )
722  { Error ( "shorts ('" + name + "'): item is not unique" ) ; }
723  return item ;
724 }
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:72
NTuple::Tuple * tuple() const
provide the access to underlying Gaudi N-tuple
Definition: TupleObj.h:2088
NTuple::Item< short > Short
basic type for int items
Definition: TupleObj.h:194
iterator end()
Definition: Map.h:131
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
iterator find(const key_type &key)
Definition: Map.h:148
virtual StatusCode Error(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
bool addItem(const std::string &name, const std::string &type)
add the item name into the list of known items
Definition: TupleObj.h:2134
tuple item
print s1,s2
Definition: ana.py:146
StatusCode addItem(const std::string &name, Item< TYPE > &itm)
Add a scalar data item a N tuple.
Definition: NTuple.h:551
Shorts m_shorts
the actual storage of all 'Int' columns
Definition: TupleObj.h:2336
const std::string & name() const
get the name
Definition: TupleObj.h:2083
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 2088 of file TupleObj.h.

2088 { return m_tuple ; }
NTuple::Tuple * m_tuple
tuple itself
Definition: TupleObj.h:2315
Tuples::Type Tuples::TupleObj::type ( ) const
inline

accessor to the N-Tuple type

Definition at line 2110 of file TupleObj.h.

2110 { return m_type ; }
Tuples::Type m_type
tuple 'type'
Definition: TupleObj.h:2321
Tuples::TupleObj::UChar * Tuples::TupleObj::uchars ( const std::string &  name)
private

get the column

Definition at line 663 of file TupleObj.cpp.

664 {
665  UChars::iterator found = m_uchars.find( name ) ;
666  if( m_uchars.end() != found ) { return found->second ; }
667  UChar* item = new UChar() ;
668  m_uchars[ name ] = item ;
669  StatusCode sc = tuple()->addItem( name , *item );
670  if( sc.isFailure() )
671  { Error ( "uchars ('" + name + "'): item is not added", sc ) ; }
672  if ( !addItem ( name , "I" ) )
673  { Error ( "uchars ('" + name + "'): item is not unique" ) ; }
674  return item ;
675 }
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:72
NTuple::Item< unsigned char > UChar
basic type for unsigned int items
Definition: TupleObj.h:191
NTuple::Tuple * tuple() const
provide the access to underlying Gaudi N-tuple
Definition: TupleObj.h:2088
iterator end()
Definition: Map.h:131
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
iterator find(const key_type &key)
Definition: Map.h:148
virtual StatusCode Error(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
bool addItem(const std::string &name, const std::string &type)
add the item name into the list of known items
Definition: TupleObj.h:2134
tuple item
print s1,s2
Definition: ana.py:146
StatusCode addItem(const std::string &name, Item< TYPE > &itm)
Add a scalar data item a N tuple.
Definition: NTuple.h:551
const std::string & name() const
get the name
Definition: TupleObj.h:2083
UChars m_uchars
the actual storage of all 'unsigned int' columns
Definition: TupleObj.h:2333
Tuples::TupleObj::UChar * Tuples::TupleObj::uchars ( const std::string &  name,
const unsigned char  minv,
const unsigned char  maxv 
)
private

get the column

Definition at line 678 of file TupleObj.cpp.

681 {
682  UChars::iterator found = m_uchars.find( name ) ;
683  if( m_uchars.end() != found ) { return found->second ; }
684  UChar* item = new UChar() ;
685  m_uchars[ name ] = item ;
686  const StatusCode sc = tuple()->addItem( name , *item , minv , maxv );
687  if( sc.isFailure() )
688  { Error ( "uchars ('" + name + "'): item is not added", sc ) ; }
689  if ( !addItem ( name , "I" ) )
690  { Error ( "uchars ('" + name + "'): item is not unique" ) ; }
691  return item ;
692 }
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:72
NTuple::Item< unsigned char > UChar
basic type for unsigned int items
Definition: TupleObj.h:191
NTuple::Tuple * tuple() const
provide the access to underlying Gaudi N-tuple
Definition: TupleObj.h:2088
iterator end()
Definition: Map.h:131
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
iterator find(const key_type &key)
Definition: Map.h:148
virtual StatusCode Error(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
bool addItem(const std::string &name, const std::string &type)
add the item name into the list of known items
Definition: TupleObj.h:2134
tuple item
print s1,s2
Definition: ana.py:146
StatusCode addItem(const std::string &name, Item< TYPE > &itm)
Add a scalar data item a N tuple.
Definition: NTuple.h:551
const std::string & name() const
get the name
Definition: TupleObj.h:2083
UChars m_uchars
the actual storage of all 'unsigned int' columns
Definition: TupleObj.h:2333
Tuples::TupleObj::UInt * Tuples::TupleObj::uints ( const std::string &  name)
private

get the column

Definition at line 791 of file TupleObj.cpp.

792 {
793  UInts::iterator found = m_uints.find( name ) ;
794  if( m_uints.end() != found ) { return found->second ; }
795  UInt* item = new UInt() ;
796  m_uints[ name ] = item ;
797  StatusCode sc = tuple()->addItem( name , *item );
798  if( sc.isFailure() )
799  { Error ( "uints ('" + name + "'): item is not added", sc ) ; }
800  if ( !addItem ( name , "I" ) )
801  { Error ( "uints ('" + name + "'): item is not unique" ) ; }
802  return item ;
803 }
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:72
NTuple::Tuple * tuple() const
provide the access to underlying Gaudi N-tuple
Definition: TupleObj.h:2088
iterator end()
Definition: Map.h:131
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
UInts m_uints
the actual storage of all 'unsigned int' columns
Definition: TupleObj.h:2345
iterator find(const key_type &key)
Definition: Map.h:148
virtual StatusCode Error(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
bool addItem(const std::string &name, const std::string &type)
add the item name into the list of known items
Definition: TupleObj.h:2134
tuple item
print s1,s2
Definition: ana.py:146
StatusCode addItem(const std::string &name, Item< TYPE > &itm)
Add a scalar data item a N tuple.
Definition: NTuple.h:551
const std::string & name() const
get the name
Definition: TupleObj.h:2083
NTuple::Item< unsigned int > UInt
basic type for unsigned int items
Definition: TupleObj.h:203
Tuples::TupleObj::UInt * Tuples::TupleObj::uints ( const std::string &  name,
const unsigned int  minv,
const unsigned int  maxv 
)
private

get the column

Definition at line 806 of file TupleObj.cpp.

809 {
810  UInts::iterator found = m_uints.find( name ) ;
811  if( m_uints.end() != found ) { return found->second ; }
812  UInt* item = new UInt() ;
813  m_uints[ name ] = item ;
814  const StatusCode sc = tuple()->addItem( name , *item , minv , maxv );
815  if( sc.isFailure() )
816  { Error ( "uints ('" + name + "'): item is not added", sc ) ; }
817  if ( !addItem ( name , "I" ) )
818  { Error ( "uints ('" + name + "'): item is not unique" ) ; }
819  return item ;
820 }
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:72
NTuple::Tuple * tuple() const
provide the access to underlying Gaudi N-tuple
Definition: TupleObj.h:2088
iterator end()
Definition: Map.h:131
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
UInts m_uints
the actual storage of all 'unsigned int' columns
Definition: TupleObj.h:2345
iterator find(const key_type &key)
Definition: Map.h:148
virtual StatusCode Error(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
bool addItem(const std::string &name, const std::string &type)
add the item name into the list of known items
Definition: TupleObj.h:2134
tuple item
print s1,s2
Definition: ana.py:146
StatusCode addItem(const std::string &name, Item< TYPE > &itm)
Add a scalar data item a N tuple.
Definition: NTuple.h:551
const std::string & name() const
get the name
Definition: TupleObj.h:2083
NTuple::Item< unsigned int > UInt
basic type for unsigned int items
Definition: TupleObj.h:203
Tuples::TupleObj::ULongLong * Tuples::TupleObj::ulonglongs ( const std::string &  name)
private

get the column

Definition at line 855 of file TupleObj.cpp.

856 {
858  if( m_ulonglongs.end() != found ) { return found->second ; }
859  ULongLong* item = new ULongLong() ;
860  m_ulonglongs[ name ] = item ;
861  StatusCode sc = tuple()->addItem( name , *item );
862  if( sc.isFailure() )
863  { Error ( "ulonglongs ('" + name + "'): item is not added", sc ) ; }
864  if ( !addItem ( name , "ULL" ) )
865  { Error ( "ulonglongs ('" + name + "'): item is not unique" ) ; }
866  return item ;
867 }
NTuple::Item< unsigned long long > ULongLong
basic type for unsigned long long items
Definition: TupleObj.h:209
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:72
NTuple::Tuple * tuple() const
provide the access to underlying Gaudi N-tuple
Definition: TupleObj.h:2088
ULongLongs m_ulonglongs
the actual storage of all 'ulonglong' columns
Definition: TupleObj.h:2351
iterator end()
Definition: Map.h:131
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
iterator find(const key_type &key)
Definition: Map.h:148
virtual StatusCode Error(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
bool addItem(const std::string &name, const std::string &type)
add the item name into the list of known items
Definition: TupleObj.h:2134
tuple item
print s1,s2
Definition: ana.py:146
StatusCode addItem(const std::string &name, Item< TYPE > &itm)
Add a scalar data item a N tuple.
Definition: NTuple.h:551
const std::string & name() const
get the name
Definition: TupleObj.h:2083
Tuples::TupleObj::ULongLong * Tuples::TupleObj::ulonglongs ( const std::string &  name,
const unsigned long long  minv,
const unsigned long long  maxv 
)
private

get the column

Definition at line 870 of file TupleObj.cpp.

873 {
875  if( m_ulonglongs.end() != found ) { return found->second ; }
876  ULongLong* item = new ULongLong() ;
877  m_ulonglongs[ name ] = item ;
878  const StatusCode sc = tuple()->addItem( name , *item , minv , maxv );
879  if( sc.isFailure() )
880  { Error ( "ulonglongs ('" + name + "'): item is not added", sc ) ; }
881  if ( !addItem ( name , "ULL" ) )
882  { Error ( "ulonglongs ('" + name + "'): item is not unique" ) ; }
883  return item ;
884 }
NTuple::Item< unsigned long long > ULongLong
basic type for unsigned long long items
Definition: TupleObj.h:209
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:72
NTuple::Tuple * tuple() const
provide the access to underlying Gaudi N-tuple
Definition: TupleObj.h:2088
ULongLongs m_ulonglongs
the actual storage of all 'ulonglong' columns
Definition: TupleObj.h:2351
iterator end()
Definition: Map.h:131
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
iterator find(const key_type &key)
Definition: Map.h:148
virtual StatusCode Error(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
bool addItem(const std::string &name, const std::string &type)
add the item name into the list of known items
Definition: TupleObj.h:2134
tuple item
print s1,s2
Definition: ana.py:146
StatusCode addItem(const std::string &name, Item< TYPE > &itm)
Add a scalar data item a N tuple.
Definition: NTuple.h:551
const std::string & name() const
get the name
Definition: TupleObj.h:2083
Tuples::TupleObj::UShort * Tuples::TupleObj::ushorts ( const std::string &  name)
private

get the column

Definition at line 727 of file TupleObj.cpp.

728 {
729  UShorts::iterator found = m_ushorts.find( name ) ;
730  if( m_ushorts.end() != found ) { return found->second ; }
731  UShort* item = new UShort() ;
732  m_ushorts[ name ] = item ;
733  StatusCode sc = tuple()->addItem( name , *item );
734  if( sc.isFailure() )
735  { Error ( "ushorts ('" + name + "'): item is not added", sc ) ; }
736  if ( !addItem ( name , "I" ) )
737  { Error ( "ushorts ('" + name + "'): item is not unique" ) ; }
738  return item ;
739 }
UShorts m_ushorts
the actual storage of all 'unsigned int' columns
Definition: TupleObj.h:2339
NTuple::Item< unsigned short > UShort
basic type for unsigned int items
Definition: TupleObj.h:197
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:72
NTuple::Tuple * tuple() const
provide the access to underlying Gaudi N-tuple
Definition: TupleObj.h:2088
iterator end()
Definition: Map.h:131
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
iterator find(const key_type &key)
Definition: Map.h:148
virtual StatusCode Error(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
bool addItem(const std::string &name, const std::string &type)
add the item name into the list of known items
Definition: TupleObj.h:2134
tuple item
print s1,s2
Definition: ana.py:146
StatusCode addItem(const std::string &name, Item< TYPE > &itm)
Add a scalar data item a N tuple.
Definition: NTuple.h:551
const std::string & name() const
get the name
Definition: TupleObj.h:2083
Tuples::TupleObj::UShort * Tuples::TupleObj::ushorts ( const std::string &  name,
const unsigned short  minv,
const unsigned short  maxv 
)
private

get the column

Definition at line 742 of file TupleObj.cpp.

745 {
746  UShorts::iterator found = m_ushorts.find( name ) ;
747  if( m_ushorts.end() != found ) { return found->second ; }
748  UShort* item = new UShort() ;
749  m_ushorts[ name ] = item ;
750  const StatusCode sc = tuple()->addItem( name , *item , minv , maxv );
751  if( sc.isFailure() )
752  { Error ( "ushorts ('" + name + "'): item is not added", sc ) ; }
753  if ( !addItem ( name , "I" ) )
754  { Error ( "ushorts ('" + name + "'): item is not unique" ) ; }
755  return item ;
756 }
UShorts m_ushorts
the actual storage of all 'unsigned int' columns
Definition: TupleObj.h:2339
NTuple::Item< unsigned short > UShort
basic type for unsigned int items
Definition: TupleObj.h:197
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:72
NTuple::Tuple * tuple() const
provide the access to underlying Gaudi N-tuple
Definition: TupleObj.h:2088
iterator end()
Definition: Map.h:131
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
iterator find(const key_type &key)
Definition: Map.h:148
virtual StatusCode Error(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
bool addItem(const std::string &name, const std::string &type)
add the item name into the list of known items
Definition: TupleObj.h:2134
tuple item
print s1,s2
Definition: ana.py:146
StatusCode addItem(const std::string &name, Item< TYPE > &itm)
Add a scalar data item a N tuple.
Definition: NTuple.h:551
const std::string & name() const
get the name
Definition: TupleObj.h:2083
bool Tuples::TupleObj::valid ( ) const
inline

valid pointer to tuple ?

Definition at line 2122 of file TupleObj.h.

2122 { return 0 != tuple() ; }
NTuple::Tuple * tuple() const
provide the access to underlying Gaudi N-tuple
Definition: TupleObj.h:2088
virtual StatusCode Tuples::TupleObj::Warning ( const std::string &  msg,
const StatusCode  sc = StatusCode::FAILURE 
) const
pure virtual
StatusCode Tuples::TupleObj::write ( )

write a record to NTuple

Returns
status code

Definition at line 240 of file TupleObj.cpp.

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

Member Data Documentation

Addresses Tuples::TupleObj::m_addresses
mutableprivate

the actual storage of all 'Address' columns

Definition at line 2360 of file TupleObj.h.

FArrays Tuples::TupleObj::m_arraysf
mutableprivate

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

Definition at line 2366 of file TupleObj.h.

Bools Tuples::TupleObj::m_bools
mutableprivate

the actual storage of all 'bool' columns

Definition at line 2327 of file TupleObj.h.

Chars Tuples::TupleObj::m_chars
mutableprivate

the actual storage of all 'Int' columns

Definition at line 2330 of file TupleObj.h.

CLID Tuples::TupleObj::m_clid
private

tuple CLID

Definition at line 2318 of file TupleObj.h.

Doubles Tuples::TupleObj::m_doubles
mutableprivate

the actual storage of all 'Double' columns

Definition at line 2357 of file TupleObj.h.

FArrays Tuples::TupleObj::m_farrays
mutableprivate

the actual storage of all 'FArray' columns

Definition at line 2363 of file TupleObj.h.

Floats Tuples::TupleObj::m_floats
mutableprivate

the actual storage of all 'Float' columns

Definition at line 2354 of file TupleObj.h.

FMatrices Tuples::TupleObj::m_fmatrices
mutableprivate

the actual storage of all 'FArray' columns

Definition at line 2369 of file TupleObj.h.

Ints Tuples::TupleObj::m_ints
mutableprivate

the actual storage of all 'Int' columns

Definition at line 2342 of file TupleObj.h.

ItemMap Tuples::TupleObj::m_items
private

all booked types:

Definition at line 2375 of file TupleObj.h.

LongLongs Tuples::TupleObj::m_longlongs
mutableprivate

the actual storage of all 'longlong' columns

Definition at line 2348 of file TupleObj.h.

FMatrices Tuples::TupleObj::m_matricesf
mutableprivate

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

Definition at line 2372 of file TupleObj.h.

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

name

Definition at line 2312 of file TupleObj.h.

size_t Tuples::TupleObj::m_refCount
private

reference counter

Definition at line 2324 of file TupleObj.h.

Shorts Tuples::TupleObj::m_shorts
mutableprivate

the actual storage of all 'Int' columns

Definition at line 2336 of file TupleObj.h.

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

tuple itself

Definition at line 2315 of file TupleObj.h.

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

tuple 'type'

Definition at line 2321 of file TupleObj.h.

UChars Tuples::TupleObj::m_uchars
mutableprivate

the actual storage of all 'unsigned int' columns

Definition at line 2333 of file TupleObj.h.

UInts Tuples::TupleObj::m_uints
mutableprivate

the actual storage of all 'unsigned int' columns

Definition at line 2345 of file TupleObj.h.

ULongLongs Tuples::TupleObj::m_ulonglongs
mutableprivate

the actual storage of all 'ulonglong' columns

Definition at line 2351 of file TupleObj.h.

UShorts Tuples::TupleObj::m_ushorts
mutableprivate

the actual storage of all 'unsigned int' columns

Definition at line 2339 of file TupleObj.h.


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