| The Gaudi Framework v28r2-patches (bc4ad17a)

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

- File List
- File Members

GaudiTuples.h
Go to the documentation of this file.
1 #ifndef GAUDIALG_GAUDITUPLES_H
2 #define GAUDIALG_GAUDITUPLES_H 1
3 // ============================================================================
4 /* @file GaudiTuples.h
5 *
6 * Header file for class : GaudiTuples
7 *
8 * @author Chris Jones Christopher.Rob.Jones@cern.ch
9 * @author Vanya BELYAEV Ivan.Belyaev@itep.ru
10 * @date 2005-08-08
11 */
12 // ============================================================================
13 // Include files
14 // ============================================================================
15 #include "boost/algorithm/string/replace.hpp"
16 // ============================================================================
17 // GaudiKernel
18 // ============================================================================
19 #include "GaudiKernel/ClassID.h"
20 // ============================================================================
21 // GaudiAlg
22 // ============================================================================
23 #include "GaudiAlg/Maps.h"
24 #include "GaudiAlg/Tuple.h"
25 #include "GaudiAlg/TupleObj.h"
26 #include "GaudiAlg/GaudiHistoTool.h"
27 #include "GaudiAlg/GaudiHistoAlg.h"
28 // ============================================================================
37 // ============================================================================
38 template <class PBASE>
39 class GAUDI_API GaudiTuples : public PBASE
40 {
41 public:
42 // ==========================================================================
44 typedef GaudiAlg::HistoID HistoID;
46 typedef Tuples::Tuple Tuple;
48 typedef GaudiAlg::TupleID TupleID;
50 typedef GaudiAlg::TupleMapTitle TupleMapTitle;
52 typedef GaudiAlg::TupleMapID TupleMapID;
53 // ==========================================================================
54 public:
55 // ==========================================================================
87 Tuple nTuple( const std::string& title, const CLID& clid = CLID_ColumnWiseTuple ) const;
88
127 Tuple nTuple( const TupleID& ID, const std::string& title, const CLID& clid = CLID_ColumnWiseTuple ) const;
128
159 Tuple evtCol( const std::string& title, const CLID& clid = CLID_ColumnWiseTuple ) const;
160
199 Tuple evtCol( const TupleID& ID, const std::string& title, const CLID& clid = CLID_ColumnWiseTuple ) const;
200 // ==========================================================================
201 public: // trivial accessors
202 // ==========================================================================
204 bool produceNTuples() const { return m_produceNTuples; }
206 bool splitNTupleDir() const { return m_splitNTupleDir; }
208 const std::string& nTupleLUN() const { return m_nTupleLUN; }
210 const std::string& nTupleTopDir() const { return m_nTupleTopDir; }
212 const std::string& nTupleDir() const { return m_nTupleDir; }
214 TupleID::NumericID nTupleOffSet() const { return m_nTupleOffSet; }
216 std::string nTuplePath() const;
218 bool produceEvtCols() const { return m_produceEvtCols; }
220 bool splitEvtColDir() const { return m_splitEvtColDir; }
222 const std::string& evtColLUN() const { return m_evtColLUN; }
224 const std::string& evtColTopDir() const { return m_evtColTopDir; }
226 const std::string& evtColDir() const { return m_evtColDir; }
228 TupleID::NumericID evtColOffSet() const { return m_evtColOffSet; }
230 std::string evtColPath() const;
232 bool tuplesPrint() const { return m_tuplesPrint; }
234 bool evtColsPrint() const { return m_evtColsPrint; }
235 // ==========================================================================
236 public:
237 // ==========================================================================
241 long printTuples() const;
245 long printEvtCols() const;
246 // ==========================================================================
247 public:
248 // ==========================================================================
250 bool nTupleExists( const TupleID& ID ) const;
252 bool evtColExists( const TupleID& ID ) const;
253 // ==========================================================================
254 protected:
255 // ==========================================================================
257 const TupleMapTitle& nTupleMapTitle() const { return m_nTupleMapTitle; }
259 const TupleMapTitle& evtColMapTitle() const { return m_evtColMapTitle; }
261 const TupleMapID& nTupleMapID() const { return m_nTupleMapID; }
263 const TupleMapID& evtColMapID() const { return m_evtColMapID; }
264 // ==========================================================================
265 protected:
266 // ==========================================================================
274 virtual Tuples::TupleObj* createNTuple( const std::string& name, NTuple::Tuple* tuple, const CLID& clid ) const;
282 virtual Tuples::TupleObj* createEvtCol( const std::string& name, NTuple::Tuple* tuple, const CLID& clid ) const;
283 // ==========================================================================
284 public:
285 // ==========================================================================
288 template <typename U = PBASE, class = typename std::enable_if<std::is_base_of<GaudiHistoAlg,PBASE>::value,U>::type>
289 GaudiTuples ( const std::string& name,
290 ISvcLocator * pSvcLocator ) : PBASE(name,pSvcLocator)
291 {
292 initGaudiTuplesConstructor();
293 }
296 template <typename U = PBASE, class = typename std::enable_if<std::is_base_of<GaudiHistoTool,PBASE>::value,U>::type >
297 GaudiTuples ( const std::string& type ,
298 const std::string& name ,
299 const IInterface* parent ) : PBASE(type,name,parent)
300 {
301 initGaudiTuplesConstructor();
302 }
304 ~GaudiTuples() override = default;
305 // ==========================================================================
306 protected:
307 // ==========================================================================
311 StatusCode initialize() override
312 #ifdef __ICC
313 {
314 return i_gtInitialize();
315 }
316 StatusCode i_gtInitialize()
317 #endif
318 ;
322 StatusCode finalize() override
323 #ifdef __ICC
324 {
325 return i_gtFinalize();
326 }
327 StatusCode i_gtFinalize()
328 #endif
329 ;
330 // ==========================================================================
331 private:
332 // ==========================================================================
334 inline void initGaudiTuplesConstructor()
335 {
336 m_tuplesPrint.declareUpdateHandler( &GaudiTuples<PBASE>::printNTupleHandler, this );
337 m_evtColsPrint.declareUpdateHandler( &GaudiTuples<PBASE>::printEvtColHandler, this );
338 }
339 // ==========================================================================
340 private:
341 // ==========================================================================
343 void printNTupleHandler( Gaudi::Details::PropertyBase& /* theProp */ ); // "NTuplePrint"
345 void printEvtColHandler( Gaudi::Details::PropertyBase& /* theProp */ ); // "EvtcolsPrint"
346 // ==========================================================================
347 private:
348 // ==========================================================================
349 Gaudi::Property<bool> m_produceNTuples{this, "NTupleProduce", true, "general switch to enable/disable N-tuples"};
350 Gaudi::Property<bool> m_tuplesPrint{this, "NTuplePrint", true, "print N-tuple statistics"};
351 Gaudi::Property<bool> m_splitNTupleDir{this, "NTupleSplitDir", false,
352 "split long directory names into short pieces (suitable for HBOOK)"};
353 Gaudi::Property<TupleID::NumericID> m_nTupleOffSet{this, "NTupleOffSet", 0, "offset for numerical N-tuple ID"};
354 Gaudi::Property<std::string> m_nTupleLUN{this, "NTupleLUN", "FILE1", "Logical File Unit for N-tuples"};
355 Gaudi::Property<std::string> m_nTupleTopDir{this, "NTupleTopDir", "", "top-level directory for N-Tuples"};
356 Gaudi::Property<std::string> m_nTupleDir{
357 this, "NTupleDir", boost::algorithm::replace_all_copy( this->name(), ":", "_" ), "subdirectory for N-Tuples"};
358
359 Gaudi::Property<bool> m_produceEvtCols{this, "EvtColsProduce", false,
360 "general switch to enable/disable Event Tag Collections"};
361 Gaudi::Property<bool> m_evtColsPrint{this, "EvtColsPrint", false, "print statistics for Event Tag Collections "};
362 Gaudi::Property<bool> m_splitEvtColDir{this, "EvtColSplitDir", false, "split long directory names into short pieces"};
363 Gaudi::Property<TupleID::NumericID> m_evtColOffSet{this, "EvtColOffSet", 0, "offset for numerical N-tuple ID"};
364 Gaudi::Property<std::string> m_evtColLUN{this, "EvtColLUN", "EVTCOL", "Logical File Unit for Event Tag Collections"};
365 Gaudi::Property<std::string> m_evtColTopDir{this, "EvtColTopDir", "",
366 "Top-level directory for Event Tag Collections"};
367 Gaudi::Property<std::string> m_evtColDir{this, "EvtColDir",
368 boost::algorithm::replace_all_copy( this->name(), ":", "_" ),
369 "Subdirectory for Event Tag Collections"};
370 // ==========================================================================
372 mutable TupleMapTitle m_nTupleMapTitle;
374 mutable TupleMapID m_nTupleMapID;
375 // ==========================================================================
377 mutable TupleMapTitle m_evtColMapTitle;
379 mutable TupleMapID m_evtColMapID;
380 // ==========================================================================
381 };
382 // ============================================================================
383 // The END
384 // ============================================================================
385 #endif // GAUDIALG_GAUDITUPLES_H
386 // ============================================================================
ClassID.h
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:28
GaudiTuples::m_nTupleMapTitle
TupleMapTitle m_nTupleMapTitle
the actual storage of ntuples by title
Definition: GaudiTuples.h:372
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:314
GaudiTuples
Templated base class providing common &#39;ntupling&#39; methods.
Definition: GaudiTuples.h:39
GaudiTuples::splitEvtColDir
bool splitEvtColDir() const
get the flag for Event Tag Collection path split (property "EvtColsSplitDir")
Definition: GaudiTuples.h:220
GaudiTuples::evtColDir
const std::string & evtColDir() const
get the Event Tag Collection directory (property "EvtColsDir")
Definition: GaudiTuples.h:226
TupleObj.h
Header file for class TupleObj.
GaudiTuples::m_evtColMapTitle
TupleMapTitle m_evtColMapTitle
the actual storage of event collections by title
Definition: GaudiTuples.h:377
GaudiTuples::nTupleLUN
const std::string & nTupleLUN() const
get the logical unit for N-Tuples (property "NTupleLUN")
Definition: GaudiTuples.h:208
GaudiTuples::Tuple
Tuples::Tuple Tuple
the actual type of the tuple
Definition: GaudiTuples.h:46
GaudiHistoTool.h
Header file for class : GaudiHistoTool.
GaudiAlg::ID::NumericID
int NumericID
type for internal numeric ID
Definition: GaudiHistoID.h:49
GaudiTuples::TupleMapTitle
GaudiAlg::TupleMapTitle TupleMapTitle
the actual type of (title) -> (tuple) mappping
Definition: GaudiTuples.h:50
GaudiTuples::evtColTopDir
const std::string & evtColTopDir() const
get the top-level Event Tag Collection directory (property "EvtColsTopDir")
Definition: GaudiTuples.h:224
GaudiTuples::nTupleTopDir
const std::string & nTupleTopDir() const
get the top-level N-Tuple directory (property "NTupleTopDir")
Definition: GaudiTuples.h:210
GaudiTuples::evtColsPrint
bool evtColsPrint() const
print event collections at finalization
Definition: GaudiTuples.h:234
GaudiTuples::GaudiTuples
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...
Definition: GaudiTuples.h:297
std::string
STL class.
GaudiTuples::m_evtColMapID
TupleMapID m_evtColMapID
the actual storage of event collections by ID
Definition: GaudiTuples.h:379
Tuples::Tuple
A simple wrapper class over standard Gaudi NTuple::Tuple facility.
Definition: Tuple.h:116
GaudiTuples::nTupleMapTitle
const TupleMapTitle & nTupleMapTitle() const
access to the all ntuples by title
Definition: GaudiTuples.h:257
GaudiTuples::TupleID
GaudiAlg::TupleID TupleID
the actual type of N-tuple ID
Definition: GaudiTuples.h:48
GaudiTuples::evtColMapTitle
const TupleMapTitle & evtColMapTitle() const
access to the all evet tag collections by title
Definition: GaudiTuples.h:259
Tuples::TupleObj
A simple wrapper class over standard Gaudi NTuple::Tuple facility.
Definition: TupleObj.h:196
GaudiTuples::TupleMapID
GaudiAlg::TupleMapID TupleMapID
the actual type of (Numeric ID) -> (tuple) mappping
Definition: GaudiTuples.h:52
GaudiTuples::nTupleOffSet
TupleID::NumericID nTupleOffSet() const
get the value for N-Tuple offset (property "NTupleOffSet")
Definition: GaudiTuples.h:214
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
IInterface
Definition of the basic interface.
Definition: IInterface.h:234
gaudirun.type
type
Definition: gaudirun.py:125
GaudiTuples::HistoID
GaudiAlg::HistoID HistoID
the actual type for histogram identifier
Definition: GaudiTuples.h:44
Gaudi::Details::PropertyBase
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition: Property.h:32
GaudiTuples::GaudiTuples
GaudiTuples(const std::string &name, ISvcLocator *pSvcLocator)
Algorithm constructor - the SFINAE constraint below ensures that this is constructor is only defined ...
Definition: GaudiTuples.h:289
CLID
unsigned int CLID
Class ID definition.
Definition: ClassID.h:8
GaudiTuples::tuplesPrint
bool tuplesPrint() const
print tuples at finalization
Definition: GaudiTuples.h:232
GaudiPython.GaudiAlgs.nTuple
nTuple
Definition: GaudiAlgs.py:1141
NTuple::Tuple
Abstract base class which allows the user to interact with the actual N tuple implementation.
Definition: NTuple.h:370
GaudiTuples::initGaudiTuplesConstructor
void initGaudiTuplesConstructor()
Constructor initialization and job options.
Definition: GaudiTuples.h:334
Maps.h
GaudiTuples::nTupleMapID
const TupleMapID & nTupleMapID() const
access to the all ntuples by numeric ID
Definition: GaudiTuples.h:261
GaudiTuples::m_nTupleMapID
TupleMapID m_nTupleMapID
the actual storage of ntuples by ID
Definition: GaudiTuples.h:374
GaudiTuples::evtColLUN
const std::string & evtColLUN() const
get the logical unit for Event Tag Collections (property "EvtColsLUN")
Definition: GaudiTuples.h:222
GaudiTuples::nTupleDir
const std::string & nTupleDir() const
get the N-Tuple directory (property "NTupleDir")
Definition: GaudiTuples.h:212
GaudiUtils::HashMap
Common class providing an architecture-independent hash map.
Definition: HashMap.h:77
GaudiHistoAlg.h
GaudiTuples::produceEvtCols
bool produceEvtCols() const
get the flag for Event Tag Collection production (property "EvtColsProduce")
Definition: GaudiTuples.h:218
GaudiTuples::evtColOffSet
TupleID::NumericID evtColOffSet() const
get the value for Event Tag Collection offset (property "EvtColsOffSet")
Definition: GaudiTuples.h:228
GaudiTuples::splitNTupleDir
bool splitNTupleDir() const
get the flag for N-Tuple path split (property "NTupleSplitDir")
Definition: GaudiTuples.h:206
GaudiTuples::produceNTuples
bool produceNTuples() const
get the flag for N-Tuple production (property "NTupleProduce")
Definition: GaudiTuples.h:204
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:107
GaudiAlg::ID
ID class for Histogram and Ntuples.
Definition: GaudiHistoID.h:44
Tuple.h
Header file for class : Tuple.
GaudiTuples::evtColMapID
const TupleMapID & evtColMapID() const
access to the all evet tag collections by numeric ID
Definition: GaudiTuples.h:263