1 #ifndef GAUDIALG_TUPLEPUT_H 2 #define GAUDIALG_TUPLEPUT_H 1 37 template <
class VALUE>
57 return ifound->second.get();
65 tuple->
Error(
"ItemStore::getItem('" + key +
"') item name is not unique" ).
ignore();
71 tuple->
Error(
"ItemStore::getItem('" + key +
"') invalid NTuple::Tuple*" ).
ignore();
77 if ( !stored.second ) {
78 tuple->
Warning(
"ItemStore::getItem('" + key +
"') item already exists, new one not inserted!" ).
ignore();
81 auto& item = stored.first->second;
85 tuple->
Error(
"ItemStore::getItem('" + key +
"') cannot addItem", sc ).
ignore();
91 tuple->
Warning(
"ItemStore::getItem('" + key +
"') the item not unique " ).
ignore();
120 template <
class TYPE>
126 if ( !evtColType() ) {
131 static bool s_fail =
false;
132 static TClass* s_type =
nullptr;
137 else if ( !s_type ) {
138 s_type = TClass::GetClass(
typeid( TYPE ) );
141 return Error(
" put('" + name +
"'," +
System::typeinfoName(
typeid( TYPE ) ) +
") :Invalid ROOT Type",
148 auto item = s_map.
getItem( name,
this );
150 return Error(
" put('" + name +
"'): invalid item detected",
InvalidItem );
153 ( *item ) =
const_cast<TYPE*
>( obj );
162 #endif // GAUDIALG_TUPLEPUT_H
const NTuple::Tuple * tuple() const
provide the access to underlying Gaudi N-tuple
bool goodItem(const std::string &name) const
check the uniqueness of the name
Header file for class TupleObj.
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
ItemStore()=default
constructor : create empty map
GaudiUtils::HashMap< std::string, std::unique_ptr< NTuple::Item< VALUE > > > Store
bool isFailure() const
Test for a status code of FAILURE.
virtual StatusCode Warning(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
bool addItem(std::string name, std::string type)
add the item name into the list of known items
A simple wrapper class over standard Gaudi NTuple::Tuple facility.
This class is used for returning status codes from appropriate routines.
Store m_map
the underlying map
iterator find(const key_type &key)
std::pair< iterator, bool > emplace(Args &&...args)
Abstract base class which allows the user to interact with the actual N tuple implementation.
iterator erase(const_iterator pos)
virtual StatusCode Error(const std::string &msg, const StatusCode sc=StatusCode::FAILURE) const =0
ItemStore & operator=(const ItemStore &)=delete
Common class providing an architecture-independent hash map.
StatusCode addItem(const std::string &name, Item< TYPE > &itm)
Add a scalar data item a N tuple.
Simple class, which represents the local storage of N-tuple items of the given type.
StatusCode put(const std::string &name, const TYPE *obj)
The function allows to add almost arbitrary object into N-tuple.
NTuple::Item< VALUE > * getItem(const std::string &key, Tuples::TupleObj *tuple)
the only one method:
General namespace for Tuple properties.