Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

ntupleWriterSvc.h

Go to the documentation of this file.
00001 
00002 #ifndef _H_ntupleWriterSvc_
00003 #define _H_ntupleWriterSvc_
00004 
00005 
00006 // includes
00007 #include "GaudiKernel/Service.h"
00008 #include "GaudiKernel/IIncidentListener.h"
00009 #include "ntupleWriterSvc/INTupleWriterSvc.h"
00010 #include "GaudiKernel/INTupleSvc.h"
00011 #include "GaudiKernel/NTuple.h"
00012 
00013 #include <map>
00014 
00015 //forward declarations
00016 template <class TYPE> class SvcFactory;
00017 
00021 class ntupleWriterSvc :  public Service, virtual public IIncidentListener,
00022                         virtual public INTupleWriterSvc
00023 {  
00024 
00025 
00026 public:
00027 
00028     //------------------------------------------------------------------
00029     //  stuff required by a Service
00030     
00032     virtual StatusCode initialize ();
00033     
00035     virtual StatusCode finalize ();
00036     //------------------------------------------------------------------
00038     virtual void handle(const Incident& inc);    
00039  
00041    virtual StatusCode queryInterface( const IID& riid, void** ppvUnknown );
00042 
00044    virtual SmartDataPtr<NTuple::Tuple> getNTuple(const char *tupleName);
00045 
00047    virtual StatusCode addItem(const char *tupleName, const char *item, double val);
00048 
00050    virtual StatusCode saveNTuples();
00051 
00052    // Set a flag to denote whether or not to store a row
00053    virtual void storeRowFlag(bool flag) { m_storeFlag = flag; };
00054    // retrieve the flag that denotes whether or not to store a row
00055    virtual bool storeRowFlag() { return m_storeFlag; };
00056 
00058    int isFinite(float val);
00059 
00060 protected: 
00061 
00063     ntupleWriterSvc ( const std::string& name, ISvcLocator* al );
00064     
00065 
00066 private:
00067 
00068     INTupleSvc *ntupleSvc;
00069 
00070     // Allow SvcFactory to instantiate the service.
00071     friend class SvcFactory<ntupleWriterSvc>;
00073     void beginEvent();
00075     void endEvent();
00077     StatusCode bookNTuple(int index, const char *title);
00079     StatusCode writeNTuple(int index);
00081     StatusCode addValue(const char *tupleName, const char *item, double val);
00082 
00083 
00085 
00087     std::vector<std::string> m_tuple_name;
00089     std::vector<std::string> m_TDS_tuple_name;  
00091     std::vector<std::string> m_fileName;
00092 
00094     std::map<std::string, std::string> m_tuples;
00095 
00096     bool m_storeFlag;
00097 
00098     static unsigned int m_tupleCounter;
00099 };
00100 
00101 
00102 #endif // _H_ntupleWriterSvc

Generated at Wed Nov 21 12:20:37 2001 by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000