/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Calibration/CalibSvc/CalibROOTCnv/CalibROOTCnv-00-01-13/src/cnv/RootCalBaseCnv.h

Go to the documentation of this file.
00001 // $Header: /bes/bes/BossCvs/Calibration/CalibSvc/CalibROOTCnv/src/cnv/RootCalBaseCnv.h,v 1.2 2006/04/06 03:01:49 maqm Exp $
00002 #ifndef RootCalBaseCnv_h
00003 #define RootCalBaseCnv_h
00004 
00013 #include "GaudiKernel/Converter.h"
00014 #include "GaudiKernel/CnvFactory.h"
00015 #include <string>
00016 
00017 #include "CalibDataSvc/ICalibRootSvc.h"
00018 #include "TObject.h"
00019 
00020 class ISvcLocator;
00021 class GenericAddress;
00022 class ICalibRootSvc;
00023 class ICalibMetaCnvSvc;
00024 class IInstrumentName;
00025 class ITime;
00026 
00027 class TFile;
00028 class TTree;
00029 class TDirectory;
00030 class TObject;
00031 
00032 namespace CalibData {
00033   class CalibTime;
00034   class CalibBase;
00035   class CalibBase1;
00036   class DacCol;
00037 }
00038 
00039 class  RootCalBaseCnv : public Converter {
00040 
00041 
00042 public:
00043 
00044   virtual ~RootCalBaseCnv();
00045 
00046   // Standard public converter stuff
00047   virtual StatusCode initialize();
00048   virtual StatusCode finalize();
00049 
00055   virtual StatusCode createObj(IOpaqueAddress* addr,
00056                                DataObject*& refpObject);
00057 
00058   ICalibRootSvc* getCalibRootSvc() {
00059     return m_rootSvc;
00060   }
00061 
00062   static const unsigned char storageType() {return CALIBROOT_StorageType;}
00063 
00069   RootCalBaseCnv(ISvcLocator* svc, const CLID& clid);
00070 
00071   // End standard public converter stuff
00072 
00082   virtual StatusCode createRoot(const std::string& fname, 
00083                                 CalibData::CalibBase1* pTDSObj);
00084 
00088   virtual StatusCode readRootObj(const std::string& treename,
00089                                  const std::string& branch, TObject*& pCalib,
00090                                  unsigned index=0);
00091 
00092   virtual StatusCode readRootObj(TTree*  tree,
00093                                  const std::string& branch, TObject*& pCalib,
00094                                  unsigned index=0);
00095 
00096 protected:
00110   virtual StatusCode internalCreateObj (const std::string& fname,
00111                                         // was TObject*     pRootObj,
00112                                         DataObject*& refpObject,
00113                                         IOpaqueAddress* address);
00114   
00126   virtual StatusCode i_createObj (const std::string& fname,
00127                                   DataObject*& refpObject);
00128 
00130   virtual StatusCode i_processObj(DataObject* pObject,
00131                                   IOpaqueAddress* address);
00132 
00144   virtual StatusCode fillRoot(CalibData::CalibBase* pTDSObj, 
00145                               TObject* pRootObj);
00146 
00147 
00157   virtual StatusCode openWrite(const std::string& fname);
00158 
00166   StatusCode closeWrite();
00167   
00168 
00176   //  StatusCode openRead(const std::string& fname, const std::string& branch,
00177   //                      TObject*& pCalib);
00178   StatusCode openRead(const std::string& fname);
00179 
00181   StatusCode closeRead();
00182 
00186   void setBaseInfo(CalibData::CalibBase1* pObj);
00187 
00188   // Might want to verify that instrument, calType are correct,
00189   // for example.  If so, might as well provide the service in
00190   // the base converter.
00192 
00193   ICalibRootSvc* m_rootSvc;
00194   ICalibMetaCnvSvc* m_metaSvc;
00195   IInstrumentName* m_instrSvc;
00196 
00197   int m_serNo;
00198   ITime*  m_vstart;
00199   ITime*  m_vend;
00200   int m_runfrm;
00201   int m_runto;
00202   // Note by keeping this stuff here we're disallowing possibility of 
00203   // interleaved writes of different calibrations
00204   TFile*  m_outFile;
00205   TTree*  m_ttree;
00206 
00207   TFile*  m_inFile;
00208 
00209   TDirectory* m_saveDir;
00210 
00211   // Don't think we want this after all
00212   // store pointer to intermediate (between TDS and permanent file) form
00213   // of calibration data as root obj.  It will normally be the responsibility
00214   // of the "leaf" calibration converter to create and delete it.
00215   //    calibRootData::Base* m_rootObj;
00216 
00217   // Is it reasonable to always call our TTree "Calib" ?
00218   // Branches will be named after calibration type
00219 private:
00220   // Return true if something was there to be cleaned
00221   bool doClean();
00222   
00223 };
00224 
00225 #endif

Generated on Tue Nov 29 22:57:50 2016 for BOSS_7.0.2 by  doxygen 1.4.7