The Gaudi Framework  v38r1p1 (ae26267b)
Tuples::detail::TupleObjImp< HANDLER1, HANDLER2 > Class Template Reference

#include </builds/gaudi/Gaudi/GaudiAlg/include/GaudiAlg/TupleDetail.h>

Inheritance diagram for Tuples::detail::TupleObjImp< HANDLER1, HANDLER2 >:
Collaboration diagram for Tuples::detail::TupleObjImp< HANDLER1, HANDLER2 >:

Public Member Functions

 TupleObjImp (HANDLER1 handler1, HANDLER2 handler2, const std::string &name, NTuple::Tuple *tuple, const CLID &clid=CLID_ColumnWiseTuple, const Tuples::Type type=Tuples::NTUPLE)
 constructor More...
 
StatusCode Error (const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const override
 
StatusCode Warning (const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const override
 
- Public Member Functions inherited from Tuples::TupleObj
virtual ~TupleObj ()
 
StatusCode column (std::string_view name, float value)
 Set the value for selected tuple column. More...
 
StatusCode column (std::string_view name, double value)
 Set the value for the selected tuple column If the column does not exist, it will be automatically created and appended to the tuple. More...
 
StatusCode column (std::string_view name, short value)
 Set the value for selected tuple column. More...
 
StatusCode column (std::string_view name, short value, short minv, short maxv)
 Set the value for selected tuple column. More...
 
StatusCode column (std::string_view name, unsigned short value)
 Set the value for selected tuple column. More...
 
StatusCode column (std::string_view name, unsigned short value, unsigned short minv, unsigned short maxv)
 Set the value for selected tuple column. More...
 
StatusCode column (std::string_view name, char value)
 Set the value for selected tuple column. More...
 
StatusCode column (std::string_view name, char value, char minv, char maxv)
 Set the value for selected tuple column. More...
 
StatusCode column (std::string_view name, unsigned char value)
 Set the value for selected tuple column. More...
 
StatusCode column (std::string_view name, unsigned char value, unsigned char minv, unsigned char maxv)
 Set the value for selected tuple column. More...
 
StatusCode column (std::string_view name, int value)
 Set the value for selected tuple column. More...
 
StatusCode column (std::string_view name, int value, int minv, int maxv)
 Set the value for selected tuple column. More...
 
StatusCode column (std::string_view name, unsigned int value)
 Set the value for selected tuple column. More...
 
StatusCode column (std::string_view name, unsigned int value, unsigned int minv, unsigned int maxv)
 Set the value for selected tuple column. More...
 
StatusCode column (std::string_view name, long value)
 Set the value for the selected tuple column. More...
 
StatusCode column (std::string_view name, long value, long minv, long maxv)
 Set the value for selected tuple column. More...
 
StatusCode column (std::string_view name, unsigned long value)
 Set the value for selected tuple column. More...
 
StatusCode column (std::string_view name, unsigned long value, unsigned long minv, unsigned long maxv)
 Set the value for selected tuple column. More...
 
StatusCode column (std::string_view name, long long value)
 Set the value for selected tuple column. More...
 
StatusCode column (std::string_view name, long long value, long long minv, long long maxv)
 Set the value for selected tuple column. More...
 
StatusCode column (std::string_view name, unsigned long long value)
 Set the value for selected tuple column. More...
 
StatusCode column (std::string_view name, unsigned long long value, unsigned long long minv, unsigned long long maxv)
 Set the value for selected tuple column. More...
 
StatusCode column (std::string_view name, signed char value)
 Set the value for the selected tuple column. More...
 
StatusCode column (std::string_view name, bool value)
 Set the value for selected tuple column. More...
 
StatusCode column (std::string_view name, IOpaqueAddress *address)
 Put IOpaqueAddress in POOL-based NTuple. More...
 
StatusCode column (IOpaqueAddress *address)
 Put IOpaqueAddress in NTuple. More...
 
template<typename Value , typename... Args>
StatusCode columns (Value &&value, Args &&... args)
 Set the values for several columns simultaneously, for the same object Non-existing columns will be automatically created and appended to the ntuple. More...
 
template<typename Arg , typename... Args>
StatusCode fill (std::string_view fmt, Arg arg, Args... args)
 Set the values for several columns simultaneously. More...
 
template<typename ITERATOR1 , typename ITERATOR2 >
StatusCode farray (std::string_view name, ITERATOR1 &&first, ITERATOR2 &&last, std::string_view length, size_t maxv)
 Add an indexed array (of type float) to N-tuple. More...
 
template<class DATA >
StatusCode farray (std::string_view name, const DATA &data, std::string_view length, const size_t maxv)
 Add an indexed array (of type float) to N-tuple. More...
 
template<class FUNCTION , class ITERATOR >
StatusCode farray (std::string_view name, const FUNCTION &function, ITERATOR first, ITERATOR last, std::string_view length, size_t maxv)
 Put an indexed array into LoKi-style N-Tuple. More...
 
template<typename FunIterator , typename DataIterator >
StatusCode farray_impl (FunIterator first_item, FunIterator last_item, DataIterator first, DataIterator last, std::string_view length, size_t maxv)
 Put arbitrary number of functions from one data array into LoKi-style N-Tuple simultaneously (effective!) More...
 
template<typename DataIterator , template< typename, typename... > class Container = std::initializer_list, typename NamedFunction = std::pair<std::string_view, std::function<float( detail::const_ref_t<DataIterator> )>, typename = std::enable_if_t<!std::is_convertible_v<Container<NamedFunction>, std::string_view>>>
StatusCode farray (const Container< NamedFunction > &funs, DataIterator first, DataIterator last, std::string_view length, size_t maxv)
 
template<typename NamedFunctions , typename DataIterator , typename = std::enable_if_t<!std::is_convertible_v<NamedFunctions, std::string_view>>>
StatusCode farray (const NamedFunctions &funs, DataIterator first, DataIterator last, std::string_view length, size_t maxv)
 
template<class FUNC1 , class FUNC2 , class Iterator >
StatusCode farray (std::string_view name1, const FUNC1 &func1, std::string_view name2, const FUNC2 &func2, Iterator &&first, Iterator &&last, std::string_view length, size_t maxv)
 Put two functions from one data array into LoKi-style N-Tuple simultaneously (effective!) More...
 
template<class FUNC1 , class FUNC2 , class FUNC3 , class Iterator >
StatusCode farray (std::string_view name1, const FUNC1 &func1, std::string_view name2, const FUNC2 &func2, std::string_view name3, const FUNC3 &func3, Iterator &&first, Iterator &&last, std::string_view length, size_t maxv)
 Put three functions from one data array into LoKi-style N-Tuple simultaneously (effective!) More...
 
template<class FUNC1 , class FUNC2 , class FUNC3 , class FUNC4 , class Iterator >
StatusCode farray (std::string_view name1, const FUNC1 &func1, std::string_view name2, const FUNC2 &func2, std::string_view name3, const FUNC3 &func3, std::string_view name4, const FUNC4 &func4, Iterator &&first, Iterator &&last, std::string_view length, size_t maxv)
 Put four functions from one data array into LoKi-style N-Tuple simultaneously (effective!) More...
 
template<class MATRIX >
StatusCode fmatrix (std::string_view name, const MATRIX &data, size_t rows, const MIndex &cols, std::string_view length, size_t maxv)
 Fill N-Tuple with data from variable-size matrix. More...
 
template<class DATA >
StatusCode fmatrix (std::string_view name, DATA first, DATA last, const MIndex &cols, std::string_view length, size_t maxv)
 Fill N-Tuple with data from variable-size matrix. More...
 
template<class FUN , class DATA >
StatusCode fmatrix (std::string_view name, FUN funF, FUN funL, DATA first, DATA last, std::string_view length, size_t maxv)
 fill N-Tuple with matrix of "direct-product" of "data-vector" [first,last) and "function-vector" [funF, funL) More...
 
template<class DATA >
StatusCode array (std::string_view name, DATA first, DATA last)
 fill N-Tuple with fixed-size array More...
 
template<class ARRAY >
StatusCode array (std::string_view name, const ARRAY &data, const MIndex &length)
 fill N-Tuple with fixed-size array More...
 
template<class ARRAY >
StatusCode array (std::string_view name, const ARRAY &data)
 fill N-Tuple with fixed-size array More...
 
template<class MATRIX >
StatusCode matrix (std::string_view name, const MATRIX &data, const MIndex &rows, const MIndex &cols)
 fill N-Tuple with fixed-size matrix More...
 
template<class TYPE >
StatusCode column (std::string_view name, const ROOT::Math::LorentzVector< TYPE > &v)
 Useful shortcut to put LorentzVector directly into N-Tuple: More...
 
template<class TYPE , class TAG >
StatusCode column (std::string_view 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 (std::string_view name, const ROOT::Math::PositionVector3D< TYPE, TAG > &v)
 Useful shortcut to put 3D-Vector directly into N-Tuple: More...
 
template<class TYPE , unsigned int D1, unsigned int D2, class REP >
StatusCode matrix (std::string_view 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 (std::string_view name, const GaudiUtils::VectorMap< KEY, VALUE > &info, std::string_view length, const size_t maxv=100)
 shortcut to put "ExtraInfo" fields of major into N-Tuple More...
 
template<class TYPE >
StatusCode put (std::string_view 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::stringname () const
 get the name More...
 
const NTuple::Tupletuple () const
 provide the access to underlying Gaudi N-tuple More...
 
NTuple::Tupletuple ()
 provide the access to underlying Gaudi N-tuple 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 (std::string name, std::string type)
 add the item name into the list of known items More...
 
bool goodItem (std::string_view name) const
 check the uniqueness of the name More...
 
const ItemMapitems () const
 get the full list of booked items More...
 

Private Attributes

HANDLER1 m_handler1
 
HANDLER2 m_handler2
 

Additional Inherited Members

- Public Types inherited from Tuples::TupleObj
using Bool = NTuple::Item< bool >
 basics type for various items More...
 
using Char = NTuple::Item< char >
 
using UChar = NTuple::Item< unsigned char >
 
using Short = NTuple::Item< short >
 
using UShort = NTuple::Item< unsigned short >
 
using Int = NTuple::Item< int >
 
using UInt = NTuple::Item< unsigned int >
 
using LongLong = NTuple::Item< long long >
 
using ULongLong = NTuple::Item< unsigned long long >
 
using Float = NTuple::Item< float >
 
using Double = NTuple::Item< double >
 
using Address = NTuple::Item< IOpaqueAddress * >
 
using FArray = NTuple::Array< float >
 
using FMatrix = NTuple::Matrix< float >
 
typedef unsigned short MIndex
 
typedef std::map< std::string, std::string, std::less<> > ItemMap
 
- Protected Member Functions inherited from Tuples::TupleObj
 TupleObj (std::string name, NTuple::Tuple *tuple, const CLID &clid=CLID_ColumnWiseTuple, const Tuples::Type type=Tuples::NTUPLE)
 Standard constructor. More...
 

Detailed Description

template<class HANDLER1, class HANDLER2>
class Tuples::detail::TupleObjImp< HANDLER1, HANDLER2 >

The simplest concrete implementation of class TupleObj with 3 arbitrary error handlers Any types (classes, functions, etc.) which supports the semantics

HANDLER obj = .. ;
StatusCode obj( msg , sc )

can be used as error handler, e.g.

void print_error ( const std::string& msg , StatusCode sc )
{ std::cout <<
"Error" << msg << " code " << sc.getCode() << std::endl ; }
void print_warning ( const std::string& msg , StatusCode sc )
{ std::cout <<
"Warning" << msg << " code " << sc.getCode() << std::endl ; }
void print_print ( const std::string& msg , StatusCode sc )
{ std::cout << msg << " code " << sc.getCode() << std::endl ; }
TupleObj* obj =
createTupleObj( print_errror ,
print_warning ,
print_print ,
" my tuple " , ntuple ) ;

Templated helper functions allow to avoid heavy semantics of dealing with explicit type

Few concrete error handlers for dealing with classes, which supports member functions Error and Warning ( e.g. class GaudiAlgorithm or class GaudiTool ) are provided

Author
Vanya BELYAEV Ivan..nosp@m.Bely.nosp@m.aev@i.nosp@m.tep..nosp@m.ru
Date
2004-1-24

Definition at line 86 of file TupleDetail.h.

Constructor & Destructor Documentation

◆ TupleObjImp()

template<class HANDLER1 , class HANDLER2 >
Tuples::detail::TupleObjImp< HANDLER1, HANDLER2 >::TupleObjImp ( HANDLER1  handler1,
HANDLER2  handler2,
const std::string name,
NTuple::Tuple tuple,
const CLID clid = CLID_ColumnWiseTuple,
const Tuples::Type  type = Tuples::NTUPLE 
)
inline

constructor

Parameters
handler1error handler
handler2warning handler
nameName of the NTuple
tupleNTuple itself
clidNTuple CLID
typeNTuple type

Definition at line 96 of file TupleDetail.h.

98  : TupleObj( name, tuple, clid, type ), m_handler1( handler1 ), m_handler2( handler2 ) {}

Member Function Documentation

◆ Error()

template<class HANDLER1 , class HANDLER2 >
StatusCode Tuples::detail::TupleObjImp< HANDLER1, HANDLER2 >::Error ( const std::string msg,
const StatusCode  sc = StatusCode::FAILURE 
) const
inlineoverridevirtual

Implements Tuples::TupleObj.

Definition at line 101 of file TupleDetail.h.

101  {
102  return m_handler1( name() + " " + msg, sc );
103  }

◆ Warning()

template<class HANDLER1 , class HANDLER2 >
StatusCode Tuples::detail::TupleObjImp< HANDLER1, HANDLER2 >::Warning ( const std::string msg,
const StatusCode  sc = StatusCode::FAILURE 
) const
inlineoverridevirtual

Implements Tuples::TupleObj.

Definition at line 105 of file TupleDetail.h.

105  {
106  return m_handler2( name() + " " + msg, sc );
107  }

Member Data Documentation

◆ m_handler1

template<class HANDLER1 , class HANDLER2 >
HANDLER1 Tuples::detail::TupleObjImp< HANDLER1, HANDLER2 >::m_handler1
private

Definition at line 110 of file TupleDetail.h.

◆ m_handler2

template<class HANDLER1 , class HANDLER2 >
HANDLER2 Tuples::detail::TupleObjImp< HANDLER1, HANDLER2 >::m_handler2
private

Definition at line 111 of file TupleDetail.h.


The documentation for this class was generated from the following file:
std::string
STL class.
Tuples::TupleObj::type
Tuples::Type type() const
accessor to the N-Tuple type
Definition: TupleObj.h:1873
Tuples::TupleObj::tuple
const NTuple::Tuple * tuple() const
provide the access to underlying Gaudi N-tuple
Definition: TupleObj.h:1862
Tuples::TupleObj::TupleObj
TupleObj(std::string name, NTuple::Tuple *tuple, const CLID &clid=CLID_ColumnWiseTuple, const Tuples::Type type=Tuples::NTUPLE)
Standard constructor.
Definition: TupleObj.cpp:229
GaudiMP.FdsRegistry.msg
msg
Definition: FdsRegistry.py:19
StatusCode
Definition: StatusCode.h:65
std::cout
Tuples::TupleObj::clid
const CLID & clid() const
accessor to the N-Tuple CLID
Definition: TupleObj.h:1870
GaudiAlg.TupleUtils.ntuple
def ntuple
Definition: TupleUtils.py:160
std::endl
T endl(T... args)
NTuple::Tuple
Abstract base class which allows the user to interact with the actual N tuple implementation.
Definition: NTuple.h:387
Tuples::detail::createTupleObj
auto createTupleObj(HANDLER1 handler1, HANDLER2 handler2, const std::string &name, NTuple::Tuple *tuple, const CLID &clid=CLID_ColumnWiseTuple, const Tuples::Type type=Tuples::NTUPLE)
Templated helper functions allow to avoid heavy semantics of dealing with explicit type of class Tupl...
Definition: TupleDetail.h:143
StatusCode::getCode
code_t getCode() const
Retrieve value.
Definition: StatusCode.h:136
Tuples::detail::TupleObjImp::m_handler1
HANDLER1 m_handler1
Definition: TupleDetail.h:110
Tuples::detail::TupleObjImp::m_handler2
HANDLER2 m_handler2
Definition: TupleDetail.h:111
Tuples::TupleObj::name
const std::string & name() const
get the name
Definition: TupleObj.h:1857