Gaudi Framework, version v21r8

Home   Generated: 17 Mar 2010

GaudiTuples.h

Go to the documentation of this file.
00001 // $Id: GaudiTuples.h,v 1.7 2008/10/27 19:22:20 marcocle Exp $
00002 // ============================================================================
00003 #ifndef GAUDIALG_GAUDITUPLES_H
00004 #define GAUDIALG_GAUDITUPLES_H 1
00005 // ============================================================================
00006 /* @file GaudiTuples.h
00007  *
00008  *  Header file for class : GaudiTuples
00009  *
00010  *  @author Chris Jones   Christopher.Rob.Jones@cern.ch
00011  *  @author Vanya BELYAEV Ivan.Belyaev@itep.ru
00012  *  @date   2005-08-08
00013  */
00014 // ============================================================================
00015 // Include files
00016 // ============================================================================
00017 // GaudiKernel
00018 // ============================================================================
00019 #include "GaudiKernel/ClassID.h"
00020 // ============================================================================
00021 // GaudiAlg
00022 // ============================================================================
00023 #include "GaudiAlg/Maps.h"
00024 #include "GaudiAlg/Tuple.h"
00025 #include "GaudiAlg/TupleObj.h"
00026 // ============================================================================
00035 // ============================================================================
00036 template <class PBASE>
00037 class GAUDI_API GaudiTuples: public PBASE
00038 {
00039 public:
00040   // ==========================================================================
00042   typedef GaudiAlg::HistoID         HistoID;
00044   typedef Tuples::Tuple             Tuple         ;
00046   typedef GaudiAlg::TupleID         TupleID       ;
00048   typedef GaudiAlg::TupleMapTitle   TupleMapTitle ;
00050   typedef GaudiAlg::TupleMapID      TupleMapID ;
00051   // ==========================================================================
00052 public:
00053   // ==========================================================================
00085   Tuple  nTuple ( const std::string& title                        ,
00086                   const CLID&        clid  = CLID_ColumnWiseTuple ) const ;
00087 
00126   Tuple  nTuple ( const TupleID&     ID                           ,
00127                   const std::string& title                        ,
00128                   const CLID&        clid  = CLID_ColumnWiseTuple ) const ;
00129 
00160   Tuple  evtCol ( const std::string& title                        ,
00161                   const CLID&        clid  = CLID_ColumnWiseTuple ) const ;
00162 
00201   Tuple  evtCol ( const TupleID&     ID                           ,
00202                   const std::string& title                        ,
00203                   const CLID&        clid  = CLID_ColumnWiseTuple ) const ;
00204   // ==========================================================================
00205 public:  // trivial accessors
00206   // ==========================================================================
00208   bool               produceNTuples () const { return m_produceNTuples ; }
00210   bool               splitNTupleDir () const { return m_splitNTupleDir ; }
00212   const std::string& nTupleLUN      () const { return m_nTupleLUN      ; }
00214   const std::string& nTupleTopDir   () const { return m_nTupleTopDir   ; }
00216   const std::string& nTupleDir      () const { return m_nTupleDir      ; }
00218   TupleID::NumericID nTupleOffSet   () const { return m_nTupleOffSet   ; }
00220   std::string        nTuplePath     () const
00221   {
00222     const std::string path = nTupleLUN() + "/" + nTupleTopDir() + nTupleDir();
00223     return ( splitNTupleDir() ? dirHbookName( path ) : path ) ;
00224   }
00226   bool               produceEvtCols () const { return m_produceEvtCols ; }
00228   bool               splitEvtColDir () const { return m_splitEvtColDir ; }
00230   const std::string& evtColLUN      () const { return m_evtColLUN      ; }
00232   const std::string& evtColTopDir   () const { return m_evtColTopDir   ; }
00234   const std::string& evtColDir      () const { return m_evtColDir      ; }
00236   TupleID::NumericID evtColOffSet   () const { return m_evtColOffSet   ; }
00238   std::string        evtColPath     () const
00239   {
00240     std::string path = evtColLUN() + "/" + evtColTopDir() + evtColDir();
00241     return ( splitEvtColDir() ? dirHbookName( path ) : path );
00242   }
00244   bool tuplesPrint  () const { return m_tuplesPrint  ; }
00246   bool evtColsPrint () const { return m_evtColsPrint ; }
00247   // ==========================================================================
00248 public :
00249   // ==========================================================================
00253   long printTuples  () const ;
00257   long printEvtCols () const ;
00258   // ==========================================================================
00259 public :
00260   // ==========================================================================
00262   bool nTupleExists ( const TupleID& ID ) const;
00264   bool evtColExists ( const TupleID& ID ) const;
00265   // ==========================================================================
00266 protected:
00267   // ==========================================================================
00269   const TupleMapTitle& nTupleMapTitle () const { return m_nTupleMapTitle ; }
00271   const TupleMapTitle& evtColMapTitle () const { return m_evtColMapTitle ; }
00273   const TupleMapID&    nTupleMapID    () const { return m_nTupleMapID    ; }
00275   const TupleMapID&    evtColMapID    () const { return m_evtColMapID    ; }
00276   // ==========================================================================
00277 protected:
00278   // ==========================================================================
00286   virtual Tuples::TupleObj*
00287   createNTuple ( const std::string& name  ,
00288                  NTuple::Tuple*     tuple ,
00289                  const CLID&        clid  ) const ;
00297   virtual Tuples::TupleObj*
00298   createEvtCol ( const std::string& name  ,
00299                  NTuple::Tuple*     tuple ,
00300                  const CLID&        clid  ) const ;
00301   // ==========================================================================
00302 public:
00303   // ==========================================================================
00305   GaudiTuples ( const std::string & name,
00306                 ISvcLocator * pSvcLocator );
00308   GaudiTuples ( const std::string& type   ,
00309                 const std::string& name   ,
00310                 const IInterface*  parent );
00312   virtual ~GaudiTuples();
00313   // ==========================================================================
00314 protected:
00315   // ==========================================================================
00319   virtual StatusCode initialize()
00320 #ifdef __ICC
00321     { return i_gtInitialize(); }
00322   StatusCode i_gtInitialize()
00323 #endif
00324   ;
00328   virtual StatusCode finalize()
00329 #ifdef __ICC
00330     { return i_gtFinalize(); }
00331   StatusCode i_gtFinalize()
00332 #endif
00333   ;
00334   // ==========================================================================
00335 private:
00336   // ==========================================================================
00338   inline void initGaudiTuplesConstructor()
00339   {
00340     m_produceNTuples = true ;     // Switch ON/OFF ntuple production
00341     m_splitNTupleDir = false ;    // for HBOOK it is better to use 'true'
00342     m_nTupleLUN      = "FILE1" ;  // logical unit for ntuples
00343     m_nTupleTopDir   = "" ;       // top level ntuple directory
00344     m_nTupleDir      = this->name() ;   // ntuple directory
00345     m_nTupleOffSet   = 0  ;       // offset for ntuples
00346     //
00347     m_produceEvtCols = false ;    // Switch ON/OFF ntupel production
00348     m_splitEvtColDir = false ;    // for HBOOK it is better to use 'true'
00349     m_evtColLUN      = "EVTCOL" ; // logical unit for ntuples
00350     m_evtColTopDir   = ""    ;    // top level ntuple directory
00351     m_evtColDir      = this->name() ;   // ntuple directory
00352     m_evtColOffSet   = 0   ;      // offset for ntuples
00353     //
00354     m_tuplesPrint    = true  ;    // print tuples at end of job
00355     m_evtColsPrint   = false  ;   // print event collections at end of job
00356     //
00357     this -> declareProperty
00358       ( "NTupleProduce"  , m_produceNTuples         ,
00359         "General switch to enable/disable N-tuples" ) ;
00360     this -> declareProperty
00361       ( "NTuplePrint"    , m_tuplesPrint    ,
00362         "Print N-tuple statistics"        )
00363       -> declareUpdateHandler ( &GaudiTuples<PBASE>::printNTupleHandler , this ) ;
00364     this -> declareProperty
00365       ( "NTupleSplitDir" , m_splitNTupleDir ,
00366         "Split long directory names into short pieces (suitable for HBOOK)" ) ;
00367     this -> declareProperty
00368       ( "NTupleOffSet"   , m_nTupleOffSet   ,
00369         "Offset for numerical N-tuple ID" ) ;
00370     this -> declareProperty
00371       ( "NTupleLUN"      , m_nTupleLUN      ,
00372         "Logical File Unit for N-tuples"  ) ;
00373     this -> declareProperty
00374       ( "NTupleTopDir"   , m_nTupleTopDir   ,
00375         "Top-level directory for N-Tuples") ;
00376     this -> declareProperty
00377       ( "NTupleDir"      , m_nTupleDir      ,
00378         "Subdirectory for N-Tuples"       ) ;
00379     // ========================================================================
00380     this -> declareProperty
00381       ( "EvtColsProduce" , m_produceEvtCols ,
00382         "General switch to enable/disable Event Tag Collections" ) ;
00383     this -> declareProperty
00384       ( "EvtColsPrint"   , m_evtColsPrint   ,
00385         "Print statistics for Event Tag Collections " )
00386       -> declareUpdateHandler ( &GaudiTuples<PBASE>::printEvtColHandler , this ) ;
00387     this -> declareProperty
00388       ( "EvtColSplitDir" , m_splitEvtColDir ,
00389         "Split long directory names into short pieces" ) ;
00390     this -> declareProperty
00391       ( "EvtColOffSet"   , m_evtColOffSet   ,
00392         "Offset for numerical N-tuple ID" ) ;
00393     this -> declareProperty
00394       ( "EvtColLUN"      , m_evtColLUN      ,
00395         "Logical File Unit for Event Tag Collections"   ) ;
00396     this -> declareProperty
00397       ( "EvtColTopDir"   , m_evtColTopDir   ,
00398         "Top-level directory for Event Tag Collections" ) ;
00399     this -> declareProperty
00400       ( "EvtColDir"      , m_evtColDir      ,
00401         "Subdirectory for Event Tag Collections"        ) ;
00402     // ========================================================================
00403   }
00404   // ==========================================================================
00405 private:
00406   // ==========================================================================
00408   void printNTupleHandler  ( Property& /* theProp */ ) ; //       "NTuplePrint"
00410   void printEvtColHandler  ( Property& /* theProp */ ) ; //      "EvtcolsPrint"
00411   // ==========================================================================
00412 private:
00413   // ==========================================================================
00415   bool        m_produceNTuples ;
00417   bool        m_splitNTupleDir ;
00419   std::string m_nTupleLUN      ;
00421   std::string m_nTupleTopDir   ;
00423   std::string m_nTupleDir      ;
00425   TupleID::NumericID     m_nTupleOffSet   ;
00426   // ==========================================================================
00428   bool        m_produceEvtCols ;
00430   bool        m_splitEvtColDir ;
00432   std::string m_evtColLUN      ;
00434   std::string m_evtColTopDir   ;
00436   std::string m_evtColDir      ;
00438   TupleID::NumericID     m_evtColOffSet   ;
00439   // ==========================================================================
00441   bool m_tuplesPrint    ;                      // print tuples at finalization?
00443   bool m_evtColsPrint   ;            // print event collections at finalization
00444   // ==========================================================================
00446   mutable TupleMapTitle  m_nTupleMapTitle ;
00448   mutable TupleMapID     m_nTupleMapID    ;
00449   // ==========================================================================
00451   mutable TupleMapTitle  m_evtColMapTitle ;
00453   mutable TupleMapID     m_evtColMapID    ;
00454   // ==========================================================================
00455 };
00456 // ============================================================================
00457 // The END
00458 // ============================================================================
00459 #endif // GAUDIALG_GAUDITUPLES_H
00460 // ============================================================================

Generated at Wed Mar 17 18:06:04 2010 for Gaudi Framework, version v21r8 by Doxygen version 1.5.6 written by Dimitri van Heesch, © 1997-2004