00001 #ifndef TreeCalBaseCnv_h 00002 #define TreeCalBaseCnv_h 00003 00012 #include "GaudiKernel/Converter.h" 00013 #include "GaudiKernel/CnvFactory.h" 00014 #include <string> 00015 00016 #include "CalibDataSvc/ICalibTreeSvc.h" 00017 #include "TObject.h" 00018 #include "TBufferFile.h" 00019 00020 class ISvcLocator; 00021 class GenericAddress; 00022 class ICalibTreeSvc; 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 TreeCalBaseCnv : public Converter { 00040 00041 00042 public: 00043 00044 virtual ~TreeCalBaseCnv(); 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 ICalibTreeSvc* getCalibTreeSvc() { 00059 return m_treeSvc; 00060 } 00061 00062 static const unsigned char storageType() {return CALIBTREE_StorageType;} 00063 00069 TreeCalBaseCnv(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 00115 */ 00116 virtual StatusCode internalCreateObj (DataObject*& refpObject, 00117 IOpaqueAddress* address); 00118 00130 virtual StatusCode i_createObj (IOpaqueAddress* address, 00131 DataObject*& refpObject); 00132 // virtual StatusCode i_createObj (const std::string& fname, 00133 // DataObject*& refpObject); 00134 00135 00137 virtual StatusCode i_processObj(DataObject* pObject, 00138 IOpaqueAddress* address); 00139 00151 virtual StatusCode fillRoot(CalibData::CalibBase* pTDSObj, 00152 TObject* pRootObj); 00153 00154 00164 // virtual StatusCode openWrite(const std::string& fname); 00165 00173 // StatusCode closeWrite(); 00174 00175 00183 // StatusCode openRead(const std::string& fname, const std::string& branch, 00184 // TObject*& pCalib); 00185 // StatusCode openRead(const std::string& fname); 00186 00188 // StatusCode closeRead(); 00189 00193 void setBaseInfo(CalibData::CalibBase1* pObj); 00194 00195 // Might want to verify that instrument, calType are correct, 00196 // for example. If so, might as well provide the service in 00197 // the base converter. 00199 00200 ICalibTreeSvc* m_treeSvc; 00201 ICalibMetaCnvSvc* m_metaSvc; 00202 IInstrumentName* m_instrSvc; 00203 00204 int m_serNo; 00205 int m_runfrm; 00206 int m_runto; 00207 // Note by keeping this stuff here we're disallowing possibility of 00208 // interleaved writes of different calibrations 00209 TFile* m_outFile; 00210 TTree* m_ttree; 00211 00212 TFile* m_inFile; 00213 00214 TDirectory* m_saveDir; 00215 00216 // Don't think we want this after all 00217 // store pointer to intermediate (between TDS and permanent file) form 00218 // of calibration data as root obj. It will normally be the responsibility 00219 // of the "leaf" calibration converter to create and delete it. 00220 // calibRootData::Base* m_rootObj; 00221 00222 // Is it reasonable to always call our TTree "Calib" ? 00223 // Branches will be named after calibration type 00224 private: 00225 // Return true if something was there to be cleaned 00226 bool doClean(); 00227 00228 }; 00229 00230 #endif