| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

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 #ifndef GAUDIALG_GAUDITUPLES_H
00003 #define GAUDIALG_GAUDITUPLES_H 1
00004 
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 
00016 // Include files
00017 // ============================================================================
00018 // GaudiKernel
00019 // ============================================================================
00020 #include "GaudiKernel/ClassID.h"
00021 // ============================================================================
00022 // GaudiAlg
00023 // ============================================================================
00024 #include "GaudiAlg/Maps.h"
00025 #include "GaudiAlg/Tuple.h"
00026 #include "GaudiAlg/TupleObj.h"
00027 
00028 // ============================================================================
00037 // ============================================================================
00038 
00039 template <class PBASE>
00040 class GaudiTuples : public PBASE
00041 {
00042 
00043 public:
00044 
00046   typedef GaudiAlg::HistoID         HistoID;
00047 
00049   typedef Tuples::Tuple             Tuple         ;
00051   typedef GaudiAlg::TupleID         TupleID       ;
00052 
00054   typedef GaudiAlg::TupleMapTitle      TupleMapTitle ;
00056   typedef GaudiAlg::TupleMapNumericID  TupleMapNumID ;
00058   typedef GaudiAlg::TupleMapLiteralID  TupleMapLitID ;
00059 
00060 public:
00061 
00093   Tuple  nTuple ( const std::string& title                        ,
00094                   const CLID&        clid  = CLID_ColumnWiseTuple ) const ;
00095 
00134   Tuple  nTuple ( const TupleID&     ID                           ,
00135                   const std::string& title                        ,
00136                   const CLID&        clid  = CLID_ColumnWiseTuple ) const ;
00137 
00168   Tuple  evtCol ( const std::string& title                        ,
00169                   const CLID&        clid  = CLID_ColumnWiseTuple ) const ;
00170 
00209   Tuple  evtCol ( const TupleID&     ID                           ,
00210                   const std::string& title                        ,
00211                   const CLID&        clid  = CLID_ColumnWiseTuple ) const ;
00212 
00213 public:  // trivial accessors
00214 
00216   bool               produceNTuples () const { return m_produceNTuples ; }
00218   bool               splitNTupleDir () const { return m_splitNTupleDir ; }
00220   const std::string& nTupleLUN      () const { return m_nTupleLUN      ; }
00222   const std::string& nTupleTopDir   () const { return m_nTupleTopDir   ; }
00224   const std::string& nTupleDir      () const { return m_nTupleDir      ; }
00226   TupleID::NumericID nTupleOffSet   () const { return m_nTupleOffSet   ; }
00228   std::string        nTuplePath     () const
00229   {
00230     const std::string path = nTupleLUN() + "/" + nTupleTopDir() + nTupleDir();
00231     return ( splitNTupleDir() ? dirHbookName( path ) : path ) ;
00232   }
00233 
00235   bool               produceEvtCols () const { return m_produceEvtCols ; }
00237   bool               splitEvtColDir () const { return m_splitEvtColDir ; }
00239   const std::string& evtColLUN      () const { return m_evtColLUN      ; }
00241   const std::string& evtColTopDir   () const { return m_evtColTopDir   ; }
00243   const std::string& evtColDir      () const { return m_evtColDir      ; }
00245   TupleID::NumericID evtColOffSet   () const { return m_evtColOffSet   ; }
00247   std::string        evtColPath     () const
00248   {
00249     std::string path = evtColLUN() + "/" + evtColTopDir() + evtColDir();
00250     return ( splitEvtColDir() ? dirHbookName( path ) : path );
00251   }
00252 
00254   bool tuplesPrint  () const { return m_tuplesPrint  ; }
00256   bool evtColsPrint () const { return m_evtColsPrint ; }
00257 
00258 public :
00259 
00263   long printTuples  () const ;
00264 
00268   long printEvtCols () const ;
00269 
00270 public :
00271 
00273   bool nTupleExists ( const TupleID& ID ) const;
00274 
00276   bool evtColExists ( const TupleID& ID ) const;
00277 
00278 protected:
00279 
00281   const TupleMapTitle& nTupleMapTitle () const { return m_nTupleMapTitle ; }
00283   const TupleMapTitle& evtColMapTitle () const { return m_evtColMapTitle ; }
00285   const TupleMapNumID& nTupleMapNumID () const { return m_nTupleMapNumID ; }
00287   const TupleMapNumID& evtColMapNumID () const { return m_evtColMapNumID ; }
00289   const TupleMapLitID& nTupleMapLitID () const { return m_nTupleMapLitID ; }
00291   const TupleMapLitID& evtColMapLitID () const { return m_evtColMapLitID ; }
00292 
00293 protected:
00294 
00302   virtual Tuples::TupleObj*
00303   createNTuple ( const std::string& name  ,
00304                  NTuple::Tuple*     tuple ,
00305                  const CLID&        clid  ) const ;
00306 
00314   virtual Tuples::TupleObj*
00315   createEvtCol ( const std::string& name  ,
00316                  NTuple::Tuple*     tuple ,
00317                  const CLID&        clid  ) const ;
00318 
00319 public:
00320 
00322   GaudiTuples ( const std::string & name,
00323                 ISvcLocator * pSvcLocator );
00324 
00326   GaudiTuples ( const std::string& type   ,
00327                 const std::string& name   ,
00328                 const IInterface*  parent );
00329 
00331   virtual ~GaudiTuples();
00332 
00333 protected:
00334 
00338   virtual StatusCode initialize ();
00339 
00343   virtual StatusCode finalize   ();
00344 
00345 private:
00346 
00348   inline void initGaudiTuplesConstructor()
00349   {
00350     m_produceNTuples = true ;     // Switch ON/OFF ntuple production
00351     m_splitNTupleDir = false ;    // for HBOOK it is better to use 'true'
00352     m_nTupleLUN      = "FILE1" ;  // logical unit for ntuples
00353     m_nTupleTopDir   = "" ;       // top level ntuple directory
00354     m_nTupleDir      = this->name() ;   // ntuple directory
00355     m_nTupleOffSet   = 0  ;       // offset for ntuples
00356     //
00357     m_produceEvtCols = false ;    // Switch ON/OFF ntupel production
00358     m_splitEvtColDir = false ;    // for HBOOK it is better to use 'true'
00359     m_evtColLUN      = "EVTCOL" ; // logical unit for ntuples
00360     m_evtColTopDir   = ""    ;    // top level ntuple directory
00361     m_evtColDir      = this->name() ;   // ntuple directory
00362     m_evtColOffSet   = 0   ;      // offset for ntuples
00363     //
00364     m_tuplesPrint    = true  ;    // print tuples at end of job
00365     m_evtColsPrint   = false  ;   // print event collections at end of job
00366     //
00367     this->declareProperty ( "NTupleProduce"  , m_produceNTuples ) ;
00368     this->declareProperty ( "NTuplePrint"    , m_tuplesPrint    ) ;
00369     this->declareProperty ( "NTupleSplitDir" , m_splitNTupleDir ) ;
00370     this->declareProperty ( "NTupleOffSet"   , m_nTupleOffSet   ) ;
00371     this->declareProperty ( "NTupleLUN"      , m_nTupleLUN      ) ;
00372     this->declareProperty ( "NTupleTopDir"   , m_nTupleTopDir   ) ;
00373     this->declareProperty ( "NTupleDir"      , m_nTupleDir      ) ;
00374     //
00375     this->declareProperty ( "EvtColsProduce" , m_produceEvtCols ) ;
00376     this->declareProperty ( "EvtColsPrint"   , m_evtColsPrint   ) ;
00377     this->declareProperty ( "EvtColSplitDir" , m_splitEvtColDir ) ;
00378     this->declareProperty ( "EvtColOffSet"   , m_evtColOffSet   ) ;
00379     this->declareProperty ( "EvtColLUN"      , m_evtColLUN      ) ;
00380     this->declareProperty ( "EvtColTopDir"   , m_evtColTopDir   ) ;
00381     this->declareProperty ( "EvtColDir"      , m_evtColDir      ) ;
00382   }
00383 
00384 private:
00385 
00387   bool        m_produceNTuples ;
00389   bool        m_splitNTupleDir ;
00391   std::string m_nTupleLUN      ;
00393   std::string m_nTupleTopDir   ;
00395   std::string m_nTupleDir      ;
00397   TupleID::NumericID     m_nTupleOffSet   ;
00398 
00400   bool        m_produceEvtCols ;
00402   bool        m_splitEvtColDir ;
00404   std::string m_evtColLUN      ;
00406   std::string m_evtColTopDir   ;
00408   std::string m_evtColDir      ;
00410   TupleID::NumericID     m_evtColOffSet   ;
00411 
00413   bool m_tuplesPrint    ; 
00414 
00415   bool m_evtColsPrint   ; 
00416 
00418   mutable TupleMapTitle  m_nTupleMapTitle ;
00420   mutable TupleMapNumID  m_nTupleMapNumID    ;
00422   mutable TupleMapLitID  m_nTupleMapLitID    ;
00423 
00425   mutable TupleMapTitle  m_evtColMapTitle ;
00427   mutable TupleMapNumID  m_evtColMapNumID    ;
00429   mutable TupleMapLitID  m_evtColMapLitID    ;
00430 
00431 };
00432 
00433 #endif // GAUDIALG_GAUDITUPLES_H
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 19:58:14 2011 for GaudiAlg by doxygen 1.4.7