1 #ifndef GAUDIALG_GAUDITUPLES_H 2 #define GAUDIALG_GAUDITUPLES_H 1 15 #include "boost/algorithm/string/replace.hpp" 16 #include <boost/multi_index/hashed_index.hpp> 17 #include <boost/multi_index/member.hpp> 18 #include <boost/multi_index/ordered_index.hpp> 19 #include <boost/multi_index_container.hpp> 42 template <
class PBASE>
126 Tuple
nTuple(
const TupleID& ID,
const std::string& title,
const CLID& clid = CLID_ColumnWiseTuple )
const;
158 Tuple evtCol(
const std::string& title,
const CLID& clid = CLID_ColumnWiseTuple )
const;
198 Tuple evtCol(
const TupleID& ID,
const std::string& title,
const CLID& clid = CLID_ColumnWiseTuple )
const;
240 long printTuples()
const;
244 long printEvtCols()
const;
247 bool nTupleExists(
const TupleID& ID )
const;
249 bool evtColExists(
const TupleID& ID )
const;
261 const CLID& clid )
const;
270 const CLID& clid )
const;
276 template <typename U = PBASE, typename = std::enable_if_t<std::is_base_of<GaudiHistoAlg, PBASE>::value, U>>
280 template <typename U = PBASE, typename = std::enable_if_t<std::is_base_of<GaudiHistoTool, PBASE>::value, U>>
282 : PBASE( type, name, parent ) {}
292 return i_gtInitialize();
303 return i_gtFinalize();
316 this->tuplesPrint() )
319 "print N-tuple statistics"};
321 "split long directory names into short pieces (suitable for HBOOK)"};
326 this,
"NTupleDir", boost::algorithm::replace_all_copy( this->
name(),
":",
"_" ),
"subdirectory for N-Tuples"};
329 "general switch to enable/disable Event Tag Collections"};
334 this->evtColsPrint() )
335 this->printEvtCols();
337 "print statistics for Event Tag Collections "};
338 Gaudi::Property<bool> m_splitEvtColDir{
this,
"EvtColSplitDir",
false,
"split long directory names into short pieces"};
342 "Top-level directory for Event Tag Collections"};
344 boost::algorithm::replace_all_copy( this->
name(),
":",
"_" ),
345 "Subdirectory for Event Tag Collections"};
354 template <
typename... Ts>
356 template <
typename... Ts>
358 template <
typename... Ts>
360 template <
typename Obj,
typename Type, Type Obj::*Member>
361 using member = boost::multi_index::member<Obj, Type, Member>;
362 template <
typename T>
363 using tag = boost::multi_index::tag<T>;
364 using nTupleMap = boost::multi_index_container<
373 decltype(
auto ) nTupleByID()
const {
return m_nTupleMap.template get<id_t>(); }
374 decltype(
auto ) nTupleByTitle()
const {
return m_nTupleMap.template get<title_t>(); }
375 decltype(
auto ) nTupleOrdered()
const {
return m_nTupleMap.template get<order_t>(); }
381 decltype(
auto ) evtColByID()
const {
return m_evtColMap.template get<id_t>(); }
382 decltype(
auto ) evtColByTitle()
const {
return m_evtColMap.template get<title_t>(); }
383 decltype(
auto ) evtColOrdered()
const {
return m_evtColMap.template get<order_t>(); }
390 #endif // GAUDIALG_GAUDITUPLES_H
nTupleMap m_evtColMap
the actual storage of event collections by title and ID
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Implementation of property with value of concrete type.
Templated base class providing common 'ntupling' methods.
bool splitEvtColDir() const
get the flag for Event Tag Collection path split (property "EvtColsSplitDir")
const std::string & evtColDir() const
get the Event Tag Collection directory (property "EvtColsDir")
Header file for class TupleObj.
const std::string & nTupleLUN() const
get the logical unit for N-Tuples (property "NTupleLUN")
Tuples::Tuple Tuple
the actual type of the tuple
boost::multi_index::indexed_by< Ts... > indexed_by
int NumericID
type for internal numeric ID
const std::string & evtColTopDir() const
get the top-level Event Tag Collection directory (property "EvtColsTopDir")
const std::string & nTupleTopDir() const
get the top-level N-Tuple directory (property "NTupleTopDir")
bool evtColsPrint() const
print event collections at finalization
GaudiTuples(const std::string &type, const std::string &name, const IInterface *parent)
Tool constructor - SFINAE-ed to insure this constructor is only defined if PBASE derives from AlgTool...
A simple wrapper class over standard Gaudi NTuple::Tuple facility.
GaudiAlg::TupleID TupleID
the actual type of N-tuple ID
boost::multi_index::ordered_unique< Ts... > ordered_unique
TupleID::NumericID nTupleOffSet() const
get the value for N-Tuple offset (property "NTupleOffSet")
This class is used for returning status codes from appropriate routines.
Definition of the basic interface.
GaudiAlg::HistoID HistoID
the actual type for histogram identifier
boost::multi_index::tag< T > tag
GaudiTuples(const std::string &name, ISvcLocator *pSvcLocator)
Algorithm constructor - the SFINAE constraint below ensures that this is constructor is only defined ...
nTupleMap m_nTupleMap
the actual storage of ntuples by title and ID
unsigned int CLID
Class ID definition.
bool tuplesPrint() const
print tuples at finalization
Abstract base class which allows the user to interact with the actual N tuple implementation.
boost::multi_index::member< Obj, Type, Member > member
const std::string & evtColLUN() const
get the logical unit for Event Tag Collections (property "EvtColsLUN")
const std::string & nTupleDir() const
get the N-Tuple directory (property "NTupleDir")
bool produceEvtCols() const
get the flag for Event Tag Collection production (property "EvtColsProduce")
TupleID::NumericID evtColOffSet() const
get the value for Event Tag Collection offset (property "EvtColsOffSet")
bool splitNTupleDir() const
get the flag for N-Tuple path split (property "NTupleSplitDir")
bool produceNTuples() const
get the flag for N-Tuple production (property "NTupleProduce")
std::shared_ptr< Tuples::TupleObj > tuple
boost::multi_index_container< nTupleMapItem, indexed_by< hashed_unique< tag< title_t >, member< nTupleMapItem, std::string,&nTupleMapItem::title >>, hashed_unique< tag< id_t >, member< nTupleMapItem, TupleID,&nTupleMapItem::id >>, ordered_unique< tag< order_t >, member< nTupleMapItem, TupleID,&nTupleMapItem::id >>>> nTupleMap
def nTuple(dirpath, ID, ID2=None, topdir=None, LUN='FILE1')
ID class for Histogram and Ntuples.
Header file for class : Tuple.
boost::multi_index::hashed_unique< Ts... > hashed_unique