Gaudi Framework, version v23r7

Home   Generated: Wed Mar 20 2013
 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
221  {
222  const std::string path = nTupleLUN() + "/" + nTupleTopDir() + nTupleDir();
223  return ( splitNTupleDir() ? dirHbookName( path ) : path ) ;
224  }
226  bool produceEvtCols () const { return m_produceEvtCols ; }
228  bool splitEvtColDir () const { return m_splitEvtColDir ; }
230  const std::string& evtColLUN () const { return m_evtColLUN ; }
232  const std::string& evtColTopDir () const { return m_evtColTopDir ; }
234  const std::string& evtColDir () const { return m_evtColDir ; }
236  TupleID::NumericID evtColOffSet () const { return m_evtColOffSet ; }
238  std::string evtColPath () const
239  {
240  std::string path = evtColLUN() + "/" + evtColTopDir() + evtColDir();
241  return ( splitEvtColDir() ? dirHbookName( path ) : path );
242  }
244  bool tuplesPrint () const { return m_tuplesPrint ; }
246  bool evtColsPrint () const { return m_evtColsPrint ; }
247  // ==========================================================================
248 public :
249  // ==========================================================================
253  long printTuples () const ;
257  long printEvtCols () const ;
258  // ==========================================================================
259 public :
260  // ==========================================================================
262  bool nTupleExists ( const TupleID& ID ) const;
264  bool evtColExists ( const TupleID& ID ) const;
265  // ==========================================================================
266 protected:
267  // ==========================================================================
269  const TupleMapTitle& nTupleMapTitle () const { return m_nTupleMapTitle ; }
271  const TupleMapTitle& evtColMapTitle () const { return m_evtColMapTitle ; }
273  const TupleMapID& nTupleMapID () const { return m_nTupleMapID ; }
275  const TupleMapID& evtColMapID () const { return m_evtColMapID ; }
276  // ==========================================================================
277 protected:
278  // ==========================================================================
286  virtual Tuples::TupleObj*
287  createNTuple ( const std::string& name ,
288  NTuple::Tuple* tuple ,
289  const CLID& clid ) const ;
297  virtual Tuples::TupleObj*
298  createEvtCol ( const std::string& name ,
299  NTuple::Tuple* tuple ,
300  const CLID& clid ) const ;
301  // ==========================================================================
302 public:
303  // ==========================================================================
305  GaudiTuples ( const std::string & name,
306  ISvcLocator * pSvcLocator );
308  GaudiTuples ( const std::string& type ,
309  const std::string& name ,
310  const IInterface* parent );
312  virtual ~GaudiTuples();
313  // ==========================================================================
314 protected:
315  // ==========================================================================
319  virtual StatusCode initialize()
320 #ifdef __ICC
321  { return i_gtInitialize(); }
322  StatusCode i_gtInitialize()
323 #endif
324  ;
328  virtual StatusCode finalize()
329 #ifdef __ICC
330  { return i_gtFinalize(); }
331  StatusCode i_gtFinalize()
332 #endif
333  ;
334  // ==========================================================================
335 private:
336  // ==========================================================================
338  inline void initGaudiTuplesConstructor()
339  {
340  m_produceNTuples = true ; // Switch ON/OFF ntuple production
341  m_splitNTupleDir = false ; // for HBOOK it is better to use 'true'
342  m_nTupleLUN = "FILE1" ; // logical unit for ntuples
343  m_nTupleTopDir = "" ; // top level ntuple directory
344  m_nTupleDir = this->name() ; // ntuple directory
345  m_nTupleOffSet = 0 ; // offset for ntuples
346  //
347  m_produceEvtCols = false ; // Switch ON/OFF ntupel production
348  m_splitEvtColDir = false ; // for HBOOK it is better to use 'true'
349  m_evtColLUN = "EVTCOL" ; // logical unit for ntuples
350  m_evtColTopDir = "" ; // top level ntuple directory
351  m_evtColDir = this->name() ; // ntuple directory
352  m_evtColOffSet = 0 ; // offset for ntuples
353  //
354  m_tuplesPrint = true ; // print tuples at end of job
355  m_evtColsPrint = false ; // print event collections at end of job
356  //
357  this -> declareProperty
358  ( "NTupleProduce" , m_produceNTuples ,
359  "General switch to enable/disable N-tuples" ) ;
360  this -> declareProperty
361  ( "NTuplePrint" , m_tuplesPrint ,
362  "Print N-tuple statistics" )
363  -> declareUpdateHandler ( &GaudiTuples<PBASE>::printNTupleHandler , this ) ;
364  this -> declareProperty
365  ( "NTupleSplitDir" , m_splitNTupleDir ,
366  "Split long directory names into short pieces (suitable for HBOOK)" ) ;
367  this -> declareProperty
368  ( "NTupleOffSet" , m_nTupleOffSet ,
369  "Offset for numerical N-tuple ID" ) ;
370  this -> declareProperty
371  ( "NTupleLUN" , m_nTupleLUN ,
372  "Logical File Unit for N-tuples" ) ;
373  this -> declareProperty
374  ( "NTupleTopDir" , m_nTupleTopDir ,
375  "Top-level directory for N-Tuples") ;
376  this -> declareProperty
377  ( "NTupleDir" , m_nTupleDir ,
378  "Subdirectory for N-Tuples" ) ;
379  // ========================================================================
380  this -> declareProperty
381  ( "EvtColsProduce" , m_produceEvtCols ,
382  "General switch to enable/disable Event Tag Collections" ) ;
383  this -> declareProperty
384  ( "EvtColsPrint" , m_evtColsPrint ,
385  "Print statistics for Event Tag Collections " )
386  -> declareUpdateHandler ( &GaudiTuples<PBASE>::printEvtColHandler , this ) ;
387  this -> declareProperty
388  ( "EvtColSplitDir" , m_splitEvtColDir ,
389  "Split long directory names into short pieces" ) ;
390  this -> declareProperty
391  ( "EvtColOffSet" , m_evtColOffSet ,
392  "Offset for numerical N-tuple ID" ) ;
393  this -> declareProperty
394  ( "EvtColLUN" , m_evtColLUN ,
395  "Logical File Unit for Event Tag Collections" ) ;
396  this -> declareProperty
397  ( "EvtColTopDir" , m_evtColTopDir ,
398  "Top-level directory for Event Tag Collections" ) ;
399  this -> declareProperty
400  ( "EvtColDir" , m_evtColDir ,
401  "Subdirectory for Event Tag Collections" ) ;
402  // ========================================================================
403  }
404  // ==========================================================================
405 private:
406  // ==========================================================================
408  void printNTupleHandler ( Property& /* theProp */ ) ; // "NTuplePrint"
410  void printEvtColHandler ( Property& /* theProp */ ) ; // "EvtcolsPrint"
411  // ==========================================================================
412 private:
413  // ==========================================================================
425  TupleID::NumericID m_nTupleOffSet ;
426  // ==========================================================================
438  TupleID::NumericID m_evtColOffSet ;
439  // ==========================================================================
441  bool m_tuplesPrint ; // print tuples at finalization?
443  bool m_evtColsPrint ; // print event collections at finalization
444  // ==========================================================================
449  // ==========================================================================
454  // ==========================================================================
455 };
456 // ============================================================================
457 // The END
458 // ============================================================================
459 #endif // GAUDIALG_GAUDITUPLES_H
460 // ============================================================================

Generated at Wed Mar 20 2013 17:59:36 for Gaudi Framework, version v23r7 by Doxygen version 1.8.2 written by Dimitri van Heesch, © 1997-2004