All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GaudiTuples.h
Go to the documentation of this file.
1 // $Id: GaudiTuples.h,v 1.7 2008/10/27 19:22:20 marcocle Exp $
2 // ============================================================================
3 #ifndef GAUDIALG_GAUDITUPLES_H
4 #define GAUDIALG_GAUDITUPLES_H 1
5 // ============================================================================
6 /* @file GaudiTuples.h
7  *
8  * Header file for class : GaudiTuples
9  *
10  * @author Chris Jones Christopher.Rob.Jones@cern.ch
11  * @author Vanya BELYAEV Ivan.Belyaev@itep.ru
12  * @date 2005-08-08
13  */
14 // ============================================================================
15 // Include files
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 // ============================================================================
35 // ============================================================================
36 template <class PBASE>
37 class GAUDI_API GaudiTuples: public PBASE
38 {
39 public:
40  // ==========================================================================
44  typedef Tuples::Tuple Tuple ;
51  // ==========================================================================
52 public:
53  // ==========================================================================
85  Tuple nTuple ( const std::string& title ,
86  const CLID& clid = CLID_ColumnWiseTuple ) const ;
87 
126  Tuple nTuple ( const TupleID& ID ,
127  const std::string& title ,
128  const CLID& clid = CLID_ColumnWiseTuple ) const ;
129 
160  Tuple evtCol ( const std::string& title ,
161  const CLID& clid = CLID_ColumnWiseTuple ) const ;
162 
201  Tuple evtCol ( const TupleID& ID ,
202  const std::string& title ,
203  const CLID& clid = CLID_ColumnWiseTuple ) const ;
204  // ==========================================================================
205 public: // trivial accessors
206  // ==========================================================================
208  bool produceNTuples () const { return m_produceNTuples ; }
210  bool splitNTupleDir () const { return m_splitNTupleDir ; }
212  const std::string& nTupleLUN () const { return m_nTupleLUN ; }
214  const std::string& nTupleTopDir () const { return m_nTupleTopDir ; }
216  const std::string& nTupleDir () const { return m_nTupleDir ; }
218  TupleID::NumericID nTupleOffSet () const { return m_nTupleOffSet ; }
220  std::string nTuplePath () const;
222  bool produceEvtCols () const { return m_produceEvtCols ; }
224  bool splitEvtColDir () const { return m_splitEvtColDir ; }
226  const std::string& evtColLUN () const { return m_evtColLUN ; }
228  const std::string& evtColTopDir () const { return m_evtColTopDir ; }
230  const std::string& evtColDir () const { return m_evtColDir ; }
232  TupleID::NumericID evtColOffSet () const { return m_evtColOffSet ; }
234  std::string evtColPath () const;
236  bool tuplesPrint () const { return m_tuplesPrint ; }
238  bool evtColsPrint () const { return m_evtColsPrint ; }
239  // ==========================================================================
240 public :
241  // ==========================================================================
245  long printTuples () const ;
249  long printEvtCols () const ;
250  // ==========================================================================
251 public :
252  // ==========================================================================
254  bool nTupleExists ( const TupleID& ID ) const;
256  bool evtColExists ( const TupleID& ID ) const;
257  // ==========================================================================
258 protected:
259  // ==========================================================================
261  const TupleMapTitle& nTupleMapTitle () const { return m_nTupleMapTitle ; }
263  const TupleMapTitle& evtColMapTitle () const { return m_evtColMapTitle ; }
265  const TupleMapID& nTupleMapID () const { return m_nTupleMapID ; }
267  const TupleMapID& evtColMapID () const { return m_evtColMapID ; }
268  // ==========================================================================
269 protected:
270  // ==========================================================================
278  virtual Tuples::TupleObj*
279  createNTuple ( const std::string& name ,
280  NTuple::Tuple* tuple ,
281  const CLID& clid ) const ;
289  virtual Tuples::TupleObj*
290  createEvtCol ( const std::string& name ,
291  NTuple::Tuple* tuple ,
292  const CLID& clid ) const ;
293  // ==========================================================================
294 public:
295  // ==========================================================================
297  GaudiTuples ( const std::string & name,
298  ISvcLocator * pSvcLocator );
300  GaudiTuples ( const std::string& type ,
301  const std::string& name ,
302  const IInterface* parent );
304  virtual ~GaudiTuples();
305  // ==========================================================================
306 protected:
307  // ==========================================================================
311  virtual StatusCode initialize()
312 #ifdef __ICC
313  { return i_gtInitialize(); }
314  StatusCode i_gtInitialize()
315 #endif
316  ;
320  virtual StatusCode finalize()
321 #ifdef __ICC
322  { return i_gtFinalize(); }
323  StatusCode i_gtFinalize()
324 #endif
325  ;
326  // ==========================================================================
327 private:
328  // ==========================================================================
331  {
332  m_produceNTuples = true ; // Switch ON/OFF ntuple production
333  m_splitNTupleDir = false ; // for HBOOK it is better to use 'true'
334  m_nTupleLUN = "FILE1" ; // logical unit for ntuples
335  m_nTupleTopDir = "" ; // top level ntuple directory
336  m_nTupleDir = this->name() ; // ntuple directory
337  m_nTupleOffSet = 0 ; // offset for ntuples
338  //
339  m_produceEvtCols = false ; // Switch ON/OFF ntupel production
340  m_splitEvtColDir = false ; // for HBOOK it is better to use 'true'
341  m_evtColLUN = "EVTCOL" ; // logical unit for ntuples
342  m_evtColTopDir = "" ; // top level ntuple directory
343  m_evtColDir = this->name() ; // ntuple directory
344  m_evtColOffSet = 0 ; // offset for ntuples
345  //
346  m_tuplesPrint = true ; // print tuples at end of job
347  m_evtColsPrint = false ; // print event collections at end of job
348  //
349  this -> declareProperty
350  ( "NTupleProduce" , m_produceNTuples ,
351  "General switch to enable/disable N-tuples" ) ;
352  this -> declareProperty
353  ( "NTuplePrint" , m_tuplesPrint ,
354  "Print N-tuple statistics" )
355  -> declareUpdateHandler ( &GaudiTuples<PBASE>::printNTupleHandler , this ) ;
356  this -> declareProperty
357  ( "NTupleSplitDir" , m_splitNTupleDir ,
358  "Split long directory names into short pieces (suitable for HBOOK)" ) ;
359  this -> declareProperty
360  ( "NTupleOffSet" , m_nTupleOffSet ,
361  "Offset for numerical N-tuple ID" ) ;
362  this -> declareProperty
363  ( "NTupleLUN" , m_nTupleLUN ,
364  "Logical File Unit for N-tuples" ) ;
365  this -> declareProperty
366  ( "NTupleTopDir" , m_nTupleTopDir ,
367  "Top-level directory for N-Tuples") ;
368  this -> declareProperty
369  ( "NTupleDir" , m_nTupleDir ,
370  "Subdirectory for N-Tuples" ) ;
371  // ========================================================================
372  this -> declareProperty
373  ( "EvtColsProduce" , m_produceEvtCols ,
374  "General switch to enable/disable Event Tag Collections" ) ;
375  this -> declareProperty
376  ( "EvtColsPrint" , m_evtColsPrint ,
377  "Print statistics for Event Tag Collections " )
378  -> declareUpdateHandler ( &GaudiTuples<PBASE>::printEvtColHandler , this ) ;
379  this -> declareProperty
380  ( "EvtColSplitDir" , m_splitEvtColDir ,
381  "Split long directory names into short pieces" ) ;
382  this -> declareProperty
383  ( "EvtColOffSet" , m_evtColOffSet ,
384  "Offset for numerical N-tuple ID" ) ;
385  this -> declareProperty
386  ( "EvtColLUN" , m_evtColLUN ,
387  "Logical File Unit for Event Tag Collections" ) ;
388  this -> declareProperty
389  ( "EvtColTopDir" , m_evtColTopDir ,
390  "Top-level directory for Event Tag Collections" ) ;
391  this -> declareProperty
392  ( "EvtColDir" , m_evtColDir ,
393  "Subdirectory for Event Tag Collections" ) ;
394  // ========================================================================
395  }
396  // ==========================================================================
397 private:
398  // ==========================================================================
400  void printNTupleHandler ( Property& /* theProp */ ) ; // "NTuplePrint"
402  void printEvtColHandler ( Property& /* theProp */ ) ; // "EvtcolsPrint"
403  // ==========================================================================
404 private:
405  // ==========================================================================
411  std::string m_nTupleLUN ;
413  std::string m_nTupleTopDir ;
415  std::string m_nTupleDir ;
417  TupleID::NumericID m_nTupleOffSet ;
418  // ==========================================================================
424  std::string m_evtColLUN ;
426  std::string m_evtColTopDir ;
428  std::string m_evtColDir ;
430  TupleID::NumericID m_evtColOffSet ;
431  // ==========================================================================
433  bool m_tuplesPrint ; // print tuples at finalization?
435  bool m_evtColsPrint ; // print event collections at finalization
436  // ==========================================================================
441  // ==========================================================================
446  // ==========================================================================
447 };
448 // ============================================================================
449 // The END
450 // ============================================================================
451 #endif // GAUDIALG_GAUDITUPLES_H
452 // ============================================================================
std::string m_nTupleTopDir
top level tuple directory
Definition: GaudiTuples.h:413
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:26
TupleMapTitle m_nTupleMapTitle
the actual storage of ntuples by title
Definition: GaudiTuples.h:438
std::string m_nTupleLUN
name of logical unit for tuple directory
Definition: GaudiTuples.h:411
Templated base class providing common 'ntupling' methods.
Definition: GaudiTuples.h:37
bool splitEvtColDir() const
get the flag for Event Tag Collection path split (property "EvtColsSplitDir")
Definition: GaudiTuples.h:224
const std::string & evtColDir() const
get the Event Tag Collection directory (property "EvtColsDir")
Definition: GaudiTuples.h:230
Header file for class TupleObj.
TupleMapTitle m_evtColMapTitle
the actual storage of event collections by title
Definition: GaudiTuples.h:443
std::string m_evtColDir
local tuple directory
Definition: GaudiTuples.h:428
const std::string & nTupleLUN() const
get the logical unit for N-Tuples (property "NTupleLUN")
Definition: GaudiTuples.h:212
Tuples::Tuple Tuple
the actual type of the tuple
Definition: GaudiTuples.h:44
GaudiAlg::TupleMapTitle TupleMapTitle
the actual type of (title) -> (tuple) mappping
Definition: GaudiTuples.h:48
const std::string & evtColTopDir() const
get the top-level Event Tag Collection directory (property "EvtColsTopDir")
Definition: GaudiTuples.h:228
TupleID::NumericID m_nTupleOffSet
the offset for ntuple numerical ID
Definition: GaudiTuples.h:417
const std::string & nTupleTopDir() const
get the top-level N-Tuple directory (property "NTupleTopDir")
Definition: GaudiTuples.h:214
bool evtColsPrint() const
print event collections at finalization
Definition: GaudiTuples.h:238
TupleID::NumericID m_evtColOffSet
the offset for ntuple numerical ID
Definition: GaudiTuples.h:430
std::string m_evtColLUN
name of Logical Unit for tuple directory
Definition: GaudiTuples.h:424
bool m_splitEvtColDir
flag to indicate splitting of tuple directories (useful for HBOOK)
Definition: GaudiTuples.h:422
TupleMapID m_evtColMapID
the actual storage of event collections by ID
Definition: GaudiTuples.h:445
A simple wrapper class over standard Gaudi NTuple::Tuple facility.
Definition: Tuple.h:115
std::string m_evtColTopDir
top level tuple directory
Definition: GaudiTuples.h:426
def nTuple
Retrieve (book-on-demand) 'Smart'-N-tuple object.
Definition: TupleUtils.py:66
const TupleMapTitle & nTupleMapTitle() const
access to the all ntuples by title
Definition: GaudiTuples.h:261
GaudiAlg::TupleID TupleID
the actual type of N-tuple ID
Definition: GaudiTuples.h:46
const TupleMapTitle & evtColMapTitle() const
access to the all evet tag collections by title
Definition: GaudiTuples.h:263
string type
Definition: gaudirun.py:126
bool m_splitNTupleDir
flag to indicate splitting of tuple directories (useful for HBOOK)
Definition: GaudiTuples.h:409
A simple wrapper class over standard Gaudi NTuple::Tuple facility.
Definition: TupleObj.h:180
GaudiAlg::TupleMapID TupleMapID
the actual type of (Numeric ID) -> (tuple) mappping
Definition: GaudiTuples.h:50
TupleID::NumericID nTupleOffSet() const
get the value for N-Tuple offset (property "NTupleOffSet")
Definition: GaudiTuples.h:218
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
Definition of the basic interface.
Definition: IInterface.h:160
GaudiAlg::HistoID HistoID
the actual type for histogram identifier
Definition: GaudiTuples.h:42
GaudiAlg::ID TupleID
the actual type for N-Tuple identifier (HBOOK-style)
Definition: TupleID.h:25
unsigned int CLID
Class ID definition.
Definition: ClassID.h:9
bool tuplesPrint() const
print tuples at finalization
Definition: GaudiTuples.h:236
bool m_tuplesPrint
print tuples at finalization?
Definition: GaudiTuples.h:433
Abstract base class which allows the user to interact with the actual N tuple implementation.
Definition: NTuple.h:367
bool m_produceEvtCols
flag to switch ON/OFF the ntuple filling and booking
Definition: GaudiTuples.h:420
void initGaudiTuplesConstructor()
Constructor initialization and job options.
Definition: GaudiTuples.h:330
Property base class allowing Property* collections to be "homogeneous".
Definition: Property.h:43
const TupleMapID & nTupleMapID() const
access to the all ntuples by numeric ID
Definition: GaudiTuples.h:265
TupleMapID m_nTupleMapID
the actual storage of ntuples by ID
Definition: GaudiTuples.h:440
const std::string & evtColLUN() const
get the logical unit for Event Tag Collections (property "EvtColsLUN")
Definition: GaudiTuples.h:226
const std::string & nTupleDir() const
get the N-Tuple directory (property "NTupleDir")
Definition: GaudiTuples.h:216
Common class providing an architecture-independent hash map.
Definition: HashMap.h:108
bool produceEvtCols() const
get the flag for Event Tag Collection production (property "EvtColsProduce")
Definition: GaudiTuples.h:222
std::string m_nTupleDir
local tuple directory
Definition: GaudiTuples.h:415
bool m_produceNTuples
flag to switch ON/OFF the ntuple filling and booking
Definition: GaudiTuples.h:407
TupleID::NumericID evtColOffSet() const
get the value for Event Tag Collection offset (property "EvtColsOffSet")
Definition: GaudiTuples.h:232
bool splitNTupleDir() const
get the flag for N-Tuple path split (property "NTupleSplitDir")
Definition: GaudiTuples.h:210
bool produceNTuples() const
get the flag for N-Tuple production (property "NTupleProduce")
Definition: GaudiTuples.h:208
bool m_evtColsPrint
print event collections at finalization
Definition: GaudiTuples.h:435
#define GAUDI_API
Definition: Kernel.h:108
ID class for Histogram and Ntuples.
Definition: GaudiHistoID.h:46
Header file for class : Tuple.
const TupleMapID & evtColMapID() const
access to the all evet tag collections by numeric ID
Definition: GaudiTuples.h:267