#include <RootTofQElecDataCnv.h>
Inheritance diagram for RootTofElecDataCnv:
Public Types | |
typedef Ty1 | source |
typedef Ty2 | destination |
Public Member Functions | |
const CLID & | objType () const |
RootTofElecDataCnv (ISvcLocator *svc) | |
virtual | ~RootTofElecDataCnv () |
virtual long | repSvcType () const |
virtual StatusCode | initialize () |
virtual StatusCode | finalize () |
virtual StatusCode | createObj (IOpaqueAddress *addr, DataObject *&refpObject) |
ICalibRootSvc * | getCalibRootSvc () |
virtual StatusCode | createRoot (const std::string &fname, CalibData::CalibBase1 *pTDSObj) |
virtual StatusCode | readRootObj (const std::string &treename, const std::string &branch, TObject *&pCalib, unsigned index=0) |
virtual StatusCode | readRootObj (TTree *tree, const std::string &branch, TObject *&pCalib, unsigned index=0) |
destination * | operator (const source &) const |
Static Public Member Functions | |
static const CLID & | classID () |
static const unsigned char | storageType () |
Protected Member Functions | |
virtual StatusCode | i_createObj (const std::string &fname, DataObject *&refpObject) |
virtual StatusCode | internalCreateObj (const std::string &fname, DataObject *&refpObject, IOpaqueAddress *address) |
virtual StatusCode | i_processObj (DataObject *pObject, IOpaqueAddress *address) |
In case there is additional work to do on the created object. | |
virtual StatusCode | fillRoot (CalibData::CalibBase *pTDSObj, TObject *pRootObj) |
virtual StatusCode | openWrite (const std::string &fname) |
StatusCode | closeWrite () |
StatusCode | openRead (const std::string &fname) |
StatusCode | closeRead () |
void | setBaseInfo (CalibData::CalibBase1 *pObj) |
Another utility for derived classes to use. | |
virtual destination * | convert (const source &) const =0 |
Protected Attributes | |
ICalibRootSvc * | m_rootSvc |
ICalibMetaCnvSvc * | m_metaSvc |
IInstrumentName * | m_instrSvc |
int | m_serNo |
ITime * | m_vstart |
ITime * | m_vend |
int | m_runfrm |
int | m_runto |
TFile * | m_outFile |
TTree * | m_ttree |
TFile * | m_inFile |
TDirectory * | m_saveDir |
Friends | |
class | CnvFactory< RootTofElecDataCnv > |
Definition at line 20 of file RootTofQElecDataCnv.h.
typedef Ty2 Converter< Ty1, Ty2 >::destination [inherited] |
Definition at line 19 of file Converter.h.
Definition at line 18 of file Converter.h.
RootTofElecDataCnv::RootTofElecDataCnv | ( | ISvcLocator * | svc | ) |
Definition at line 30 of file RootTofQElecDataCnv.cxx.
00030 : 00031 RootCalBaseCnv(svc, CLID_TofQ_Elec) { 00032 00033 }
virtual RootTofElecDataCnv::~RootTofElecDataCnv | ( | ) | [inline, virtual] |
const CLID & RootTofElecDataCnv::classID | ( | ) | [static] |
Definition at line 40 of file RootTofQElecDataCnv.cxx.
References CLID_TofQ_Elec.
00040 { 00041 return CLID_TofQ_Elec; 00042 }
StatusCode RootCalBaseCnv::closeRead | ( | ) | [protected, inherited] |
Clean up when we've finished reading in
Definition at line 135 of file RootCalBaseCnv.cxx.
References RootCalBaseCnv::m_inFile, and RootCalBaseCnv::m_saveDir.
Referenced by RootCalBaseCnv::internalCreateObj().
00135 { 00136 m_inFile->Close(); 00137 00138 delete m_inFile; 00139 m_inFile = 0; 00140 00141 if (m_saveDir) { 00142 m_saveDir->cd(); 00143 m_saveDir = 0; 00144 } 00145 return StatusCode::SUCCESS; 00146 }
StatusCode RootCalBaseCnv::closeWrite | ( | ) | [protected, inherited] |
Finish up writing file opened with openWrite: fill the tree write the file close the file Delete TFile (causes associated Tree to be deleted)
Definition at line 182 of file RootCalBaseCnv.cxx.
References RootCalBaseCnv::m_outFile, RootCalBaseCnv::m_saveDir, and msgSvc().
Referenced by RootTofCalibDataCnv::createRoot(), RootMdcCalibDataCnv::createRoot(), RootEstTofCalibDataCnv::createRoot(), RootEmcCalibDataCnv::createRoot(), and RootDedxCalibDataCnv::createRoot().
00182 { 00183 00184 MsgStream log(msgSvc(), "RootCalBaseCnv"); 00185 00186 StatusCode ret = StatusCode::SUCCESS; 00187 00188 m_outFile->cd(); 00189 m_outFile->Close(); 00190 delete m_outFile; 00191 m_outFile = 0; 00192 if (m_saveDir) m_saveDir->cd(); 00193 m_saveDir = 0; 00194 return ret; 00195 }
virtual destination* Converter< Ty1, Ty2 >::convert | ( | const source & | ) | const [protected, pure virtual, inherited] |
StatusCode RootCalBaseCnv::createObj | ( | IOpaqueAddress * | addr, | |
DataObject *& | refpObject | |||
) | [virtual, inherited] |
Create the transient representation of an object, given an opaque address. This and the following update method comprise the core functionality of calibration converters.
Definition at line 252 of file RootCalBaseCnv.cxx.
References Bes_Common::DEBUG, RootCalBaseCnv::internalCreateObj(), msgSvc(), and deljobs::string.
00253 { 00254 // StatusCode ret; 00255 00256 // first do the things we always need: 00257 // First string parameter of opaque address is file ident 00258 MsgStream log(msgSvc(), "RootCalBaseCnv"); 00259 log << MSG::DEBUG<<"RootCalBaseCnv::createObj( starting ...."<<endreq; 00260 const std::string* par = addr->par(); 00261 00262 std::string par0 = par[0]; 00263 00264 return internalCreateObj(par0, refpObject, addr); 00265 00266 }
StatusCode RootCalBaseCnv::createRoot | ( | const std::string & | fname, | |
CalibData::CalibBase1 * | pTDSObj | |||
) | [virtual, inherited] |
Create ROOT file corresponding to TDS object input. Default implementation is to return an error. Must be separately implemented for each calibration type.
fname | Filename for output file | |
pTDSObj | Pointer to tds object to be converted |
Reimplemented in RootDedxCalibDataCnv, RootDedxSimDataCnv, RootEmcCalibDataCnv, RootEsTimeCalibDataCnv, RootEstTofCalibDataCnv, RootMdcCalibDataCnv, RootMucCalibDataCnv, RootTofCalibDataCnv, and RootTofSimDataCnv.
Definition at line 89 of file RootCalBaseCnv.cxx.
References calibUtil::ERROR, and msgSvc().
Referenced by CalibRootCnvSvc::writeToRoot().
00090 { 00091 MsgStream log(msgSvc(), "RootCalBaseCnv"); 00092 log << MSG::ERROR 00093 << "createRoot method not implemented for this calibration type" 00094 << endreq; 00095 return StatusCode::FAILURE; 00096 }
StatusCode RootCalBaseCnv::fillRoot | ( | CalibData::CalibBase * | pTDSObj, | |
TObject * | pRootObj | |||
) | [protected, virtual, inherited] |
Given a pointer to a TDS object which can be cast to "our" type, fill in corresponding information in the corresponding root class
pTDSObj | Pointer to tds object to be converted | |
pRootObj | Pointer to destination root object |
Definition at line 241 of file RootCalBaseCnv.cxx.
00242 { 00243 00244 // Get instrument name from InstrumentName service Now handled by 00245 // RootCalBaseCnv 00246 // TString instr = TString((m_instrSvc->getInstrumentName()).c_str()); 00247 // pRootObj->setInstrument(instr); 00248 return StatusCode::SUCCESS; 00249 }
StatusCode RootCalBaseCnv::finalize | ( | ) | [virtual, inherited] |
ICalibRootSvc* RootCalBaseCnv::getCalibRootSvc | ( | ) | [inline, inherited] |
Definition at line 58 of file RootCalBaseCnv.h.
References RootCalBaseCnv::m_rootSvc.
00058 { 00059 return m_rootSvc; 00060 }
StatusCode RootTofElecDataCnv::i_createObj | ( | const std::string & | fname, | |
DataObject *& | refpObject | |||
) | [protected, virtual] |
Read in object from specified branch. Don't need tree name; it's always Calib
Reimplemented from RootCalBaseCnv.
Definition at line 44 of file RootTofQElecDataCnv.cxx.
References Bes_Common::DEBUG, calibUtil::ERROR, RootCalBaseCnv::m_inFile, msgSvc(), num, num1, RootCalBaseCnv::openRead(), CalibData::EndcapElec::setNum(), CalibData::BarrelElec::setNumEast(), CalibData::BarrelElec::setNumWest(), CalibData::EndcapElec::setP(), CalibData::BarrelElec::setP1(), CalibData::BarrelElec::setP2(), CalibData::EndcapElec::setSimP(), CalibData::BarrelElec::setSimP1(), and CalibData::BarrelElec::setSimP2().
00045 { 00046 00047 MsgStream log(msgSvc(), "RootTofElecDataCnv"); 00048 log<<MSG::DEBUG<<"SetProperty"<<endreq; 00049 StatusCode sc = openRead(fname); 00050 if(!sc) 00051 { log<<MSG::ERROR<<"unable to open files"<<endreq; 00052 } 00053 00054 TTree *BarBoardNum=(TTree*)m_inFile -> Get("BarBoardNum"); 00055 TTree *EndBoardNum= (TTree*)m_inFile -> Get("EndBoardNum"); 00056 TTree *QElecBarParEast = (TTree*)m_inFile -> Get("QElecBarParEast"); 00057 TTree *QElecBarParWest = (TTree*)m_inFile -> Get("QElecBarParWest"); 00058 TTree *QElecEndPar = (TTree*)m_inFile -> Get("QElecEndPar"); 00059 TTree *SimQElecBarParEast = (TTree*)m_inFile -> Get("SimQElecBarParEast"); 00060 TTree *SimQElecBarParWest = (TTree*)m_inFile -> Get("SimQElecBarParWest"); 00061 TTree *SimQElecEndPar = (TTree*)m_inFile -> Get("SimQElecEndPar"); 00062 00063 CalibData::BarrelElec bTof; 00064 CalibData::EndcapElec eTof; 00065 00066 std::vector<CalibData::BarrelElec> tmpbTof;//; = new vector<CalibData::bTofCalibBase>; 00067 std::vector<CalibData::EndcapElec> tmpeTof; 00068 00069 // Read in the object 00070 int cnt; 00071 // read btoftree ------------------------------------------------------------ 00072 unsigned int num[4]; 00073 double num1[4]; 00074 BarBoardNum -> SetBranchAddress("Board", &num1[0]); 00075 BarBoardNum -> SetBranchAddress("Channel", &num1[1]); 00076 BarBoardNum -> SetBranchAddress("Crate", &num1[2]); 00077 BarBoardNum -> SetBranchAddress("Fee", &num1[3]); 00078 double p[11]; 00079 QElecBarParEast->SetBranchAddress("P0",&p[0]); 00080 QElecBarParEast->SetBranchAddress("P1",&p[1]); 00081 QElecBarParEast->SetBranchAddress("P2",&p[2]); 00082 QElecBarParEast->SetBranchAddress("P3",&p[3]); 00083 QElecBarParEast->SetBranchAddress("P4",&p[4]); 00084 QElecBarParEast->SetBranchAddress("P5",&p[5]); 00085 QElecBarParEast->SetBranchAddress("P6",&p[6]); 00086 QElecBarParEast->SetBranchAddress("P7",&p[7]); 00087 QElecBarParEast->SetBranchAddress("P8",&p[8]); 00088 QElecBarParEast->SetBranchAddress("P9",&p[9]); 00089 QElecBarParEast->SetBranchAddress("P10",&p[10]); 00090 double p_w[11]; 00091 QElecBarParWest->SetBranchAddress("P0",&p_w[0]); 00092 QElecBarParWest->SetBranchAddress("P1",&p_w[1]); 00093 QElecBarParWest->SetBranchAddress("P2",&p_w[2]); 00094 QElecBarParWest->SetBranchAddress("P3",&p_w[3]); 00095 QElecBarParWest->SetBranchAddress("P4",&p_w[4]); 00096 QElecBarParWest->SetBranchAddress("P5",&p_w[5]); 00097 QElecBarParWest->SetBranchAddress("P6",&p_w[6]); 00098 QElecBarParWest->SetBranchAddress("P7",&p_w[7]); 00099 QElecBarParWest->SetBranchAddress("P8",&p_w[8]); 00100 QElecBarParWest->SetBranchAddress("P9",&p_w[9]); 00101 QElecBarParWest->SetBranchAddress("P10",&p_w[10]); 00102 double p_se[11]; 00103 SimQElecBarParEast->SetBranchAddress("P0",&p_se[0]); 00104 SimQElecBarParEast->SetBranchAddress("P1",&p_se[1]); 00105 SimQElecBarParEast->SetBranchAddress("P2",&p_se[2]); 00106 SimQElecBarParEast->SetBranchAddress("P3",&p_se[3]); 00107 SimQElecBarParEast->SetBranchAddress("P4",&p_se[4]); 00108 SimQElecBarParEast->SetBranchAddress("P5",&p_se[5]); 00109 SimQElecBarParEast->SetBranchAddress("P6",&p_se[6]); 00110 SimQElecBarParEast->SetBranchAddress("P7",&p_se[7]); 00111 SimQElecBarParEast->SetBranchAddress("P8",&p_se[8]); 00112 SimQElecBarParEast->SetBranchAddress("P9",&p_se[9]); 00113 SimQElecBarParEast->SetBranchAddress("P10",&p_se[10]); 00114 double p_sw[11]; 00115 SimQElecBarParWest->SetBranchAddress("P0",&p_sw[0]); 00116 SimQElecBarParWest->SetBranchAddress("P1",&p_sw[1]); 00117 SimQElecBarParWest->SetBranchAddress("P2",&p_sw[2]); 00118 SimQElecBarParWest->SetBranchAddress("P3",&p_sw[3]); 00119 SimQElecBarParWest->SetBranchAddress("P4",&p_sw[4]); 00120 SimQElecBarParWest->SetBranchAddress("P5",&p_sw[5]); 00121 SimQElecBarParWest->SetBranchAddress("P6",&p_sw[6]); 00122 SimQElecBarParWest->SetBranchAddress("P7",&p_sw[7]); 00123 SimQElecBarParWest->SetBranchAddress("P8",&p_sw[8]); 00124 SimQElecBarParWest->SetBranchAddress("P9",&p_sw[9]); 00125 SimQElecBarParWest->SetBranchAddress("P10",&p_sw[10]); 00126 00127 for(cnt=0; cnt<352; cnt++){ 00128 BarBoardNum -> GetEntry(cnt); 00129 num[0]=num1[0]; 00130 num[1]=num1[1]; 00131 num[2]=num1[2]; 00132 num[3]=num1[3]; 00133 if(cnt%2!=0){ 00134 bTof.setNumWest(num); 00135 } 00136 if(cnt%2==0){ 00137 bTof.setNumEast(num); 00138 int kkk=cnt/2; 00139 QElecBarParEast->GetEntry(kkk); 00140 QElecBarParWest->GetEntry(kkk); 00141 SimQElecBarParEast->GetEntry(kkk); 00142 SimQElecBarParWest->GetEntry(kkk); 00143 bTof.setP1(p); 00144 bTof.setP2(p_w); 00145 bTof.setSimP1(p_se); 00146 bTof.setSimP2(p_sw); 00147 } 00148 if(cnt%2!=0) 00149 tmpbTof.push_back(bTof); 00150 } 00151 00152 //read etoftree 00153 EndBoardNum -> SetBranchAddress("Board", &num1[0]); 00154 EndBoardNum -> SetBranchAddress("Channel", &num1[1]); 00155 EndBoardNum -> SetBranchAddress("Crate", &num1[2]); 00156 EndBoardNum -> SetBranchAddress("Fee", &num1[3]); 00157 QElecEndPar-> SetBranchAddress("P0",&p[0]); 00158 QElecEndPar->SetBranchAddress("P1",&p[1]); 00159 QElecEndPar->SetBranchAddress("P2",&p[2]); 00160 QElecEndPar->SetBranchAddress("P3",&p[3]); 00161 QElecEndPar->SetBranchAddress("P4",&p[4]); 00162 QElecEndPar->SetBranchAddress("P5",&p[5]); 00163 QElecEndPar->SetBranchAddress("P6",&p[6]); 00164 QElecEndPar->SetBranchAddress("P7",&p[7]); 00165 QElecEndPar->SetBranchAddress("P8",&p[8]); 00166 QElecEndPar->SetBranchAddress("P9",&p[9]); 00167 QElecEndPar->SetBranchAddress("P10",&p[10]); 00168 SimQElecEndPar-> SetBranchAddress("P0",&p_w[0]); 00169 SimQElecEndPar->SetBranchAddress("P1",&p_w[1]); 00170 SimQElecEndPar->SetBranchAddress("P2",&p_w[2]); 00171 SimQElecEndPar->SetBranchAddress("P3",&p_w[3]); 00172 SimQElecEndPar->SetBranchAddress("P4",&p_w[4]); 00173 SimQElecEndPar->SetBranchAddress("P5",&p_w[5]); 00174 SimQElecEndPar->SetBranchAddress("P6",&p_w[6]); 00175 SimQElecEndPar->SetBranchAddress("P7",&p_w[7]); 00176 SimQElecEndPar->SetBranchAddress("P8",&p_w[8]); 00177 SimQElecEndPar->SetBranchAddress("P9",&p_w[9]); 00178 SimQElecEndPar->SetBranchAddress("P10",&p_w[10]); 00179 for(cnt=0; cnt<96; cnt++){ 00180 EndBoardNum->GetEntry(cnt); 00181 QElecEndPar->GetEntry(cnt); 00182 SimQElecEndPar->GetEntry(cnt); 00183 num[0]=num1[0]; 00184 num[1]=num1[1]; 00185 num[2]=num1[2]; 00186 num[3]=num1[3]; 00187 eTof.setNum(num); 00188 eTof.setP(p); 00189 eTof.setSimP(p_w); 00190 tmpeTof.push_back(eTof); 00191 } 00192 00193 CalibData::TofElecData *tmpObject = new CalibData::TofElecData(&tmpbTof,&tmpeTof); 00194 00195 00196 refpObject=tmpObject; 00197 delete BarBoardNum; 00198 delete EndBoardNum; 00199 delete QElecBarParEast; 00200 delete QElecBarParWest; 00201 delete QElecEndPar; 00202 delete SimQElecBarParEast; 00203 delete SimQElecBarParWest; 00204 delete SimQElecEndPar; 00205 00206 return StatusCode::SUCCESS; 00207 00208 00209 }
StatusCode RootCalBaseCnv::i_processObj | ( | DataObject * | pObject, | |
IOpaqueAddress * | address | |||
) | [protected, virtual, inherited] |
In case there is additional work to do on the created object.
Definition at line 322 of file RootCalBaseCnv.cxx.
Referenced by RootCalBaseCnv::internalCreateObj().
StatusCode RootCalBaseCnv::initialize | ( | ) | [virtual, inherited] |
Definition at line 46 of file RootCalBaseCnv.cxx.
References IID_ICalibMetaCnvSvc(), IID_ICalibRootSvc(), IID_IInstrumentName(), RootCalBaseCnv::m_instrSvc, RootCalBaseCnv::m_metaSvc, and RootCalBaseCnv::m_rootSvc.
00046 { 00047 StatusCode status = Converter::initialize(); 00048 00049 IDataProviderSvc* dp; 00050 00051 // I guess the service names are assigned in jobOptions? 00052 00053 /*serviceLocator()->getService ("CalibDataSvc", 00054 IID_IDataProviderSvc, 00055 (IInterface*&)dp);*/ 00056 serviceLocator()->getService ("CalibDataSvc", 00057 IDataProviderSvc::interfaceID(), 00058 (IInterface*&)dp); 00059 setDataProvider(dp); 00060 00061 // Locate the Root Conversion Service 00062 serviceLocator()->getService ("CalibRootCnvSvc", 00063 IID_ICalibRootSvc, 00064 (IInterface*&) m_rootSvc); 00065 00066 // Locate meta conversion service 00067 // Will anything need to be changed here to accommodate possibility 00068 // of two concrete implementations of ICalibMetaCnvSvc? Would 00069 // have different storage types. Could specify type desired 00070 // as job option. Ditto for name of class? 00071 serviceLocator()->getService("CalibMySQLCnvSvc", 00072 IID_ICalibMetaCnvSvc, 00073 (IInterface*&)m_metaSvc); 00074 00075 serviceLocator()->getService ("CalibDataSvc", 00076 IID_IInstrumentName, 00077 (IInterface*&)m_instrSvc); 00078 00079 return status; 00080 }
StatusCode RootCalBaseCnv::internalCreateObj | ( | const std::string & | fname, | |
DataObject *& | refpObject, | |||
IOpaqueAddress * | address | |||
) | [protected, virtual, inherited] |
This creates the transient representation of an object from the corresponding ROOT object it, then fills it and process it. This implementation actually only calls the i_* methods of the "right" converter to do the job; so the very first thing it does is get a pointer to the appropriate derived converter. Converters typically don't need to override this method but only to override/implement some of the i_* methods.
pRootObj | pointer to the ROOT object | |
refpObject | the object to be built | |
address | the opaque address for this object |
Definition at line 268 of file RootCalBaseCnv.cxx.
References RootCalBaseCnv::closeRead(), Bes_Common::DEBUG, calibUtil::ERROR, RootCalBaseCnv::i_createObj(), RootCalBaseCnv::i_processObj(), RootCalBaseCnv::m_runfrm, RootCalBaseCnv::m_runto, msgSvc(), RootCalBaseCnv::setBaseInfo(), and Bes_Common::WARNING.
Referenced by RootCalBaseCnv::createObj().
00270 { 00271 MsgStream log(msgSvc(), "RootCalBaseCnv"); 00272 log << MSG::DEBUG<<"RootCalBaseCnv::internalCreateObj( starting ..... "<<endreq; 00273 RootCalBaseCnv* converter = this; 00274 CLID classId = address->clID(); 00275 00276 IConverter* conv = this->conversionSvc()->converter(classId); 00277 if (0 == conv) { 00278 log << MSG::WARNING 00279 << "No proper converter found for classID " << classId 00280 << ", the default converter" 00281 << " will be used. " << endreq; 00282 } else { 00283 converter = dynamic_cast <RootCalBaseCnv*> (conv); 00284 if (0 == converter) { 00285 log << MSG::ERROR 00286 << "The converter found for classID " << classId 00287 << " was not a descendent of RootCalBaseCnv as it should be " 00288 << "( was of type " << typeid (*converter).name() << "). " 00289 << "The default converter will be used" << endreq; 00290 converter = this; 00291 } 00292 } 00293 00294 m_runfrm =*( address->ipar()); 00295 m_runto =*( address->ipar()+1); 00296 // creates an object for the node found 00297 StatusCode sc = converter->i_createObj(fname, refpObject); 00298 if (sc.isFailure()) { 00299 return sc; 00300 } 00301 CalibData::CalibBase1* tmpObject = dynamic_cast <CalibData::CalibBase1*> (refpObject); 00302 setBaseInfo(tmpObject); 00303 // ends up the object construction 00304 sc = converter->i_processObj(refpObject, address); 00305 if (sc.isSuccess()) { 00306 log << MSG::DEBUG << "Successfully created calib. object " << endreq; 00307 } 00308 closeRead(); 00309 return sc; 00310 }
const CLID & RootTofElecDataCnv::objType | ( | ) | const |
Definition at line 36 of file RootTofQElecDataCnv.cxx.
References CLID_TofQ_Elec.
00036 { 00037 return CLID_TofQ_Elec; 00038 }
StatusCode RootCalBaseCnv::openRead | ( | const std::string & | fname | ) | [protected, inherited] |
Utility for "leaf" converters to call
Root | file to open for read | |
Name | of branch to be read in | |
ref. | to pCalib pointer which will be set to address of read-in object |
Definition at line 98 of file RootCalBaseCnv.cxx.
References RootCalBaseCnv::doClean(), calibUtil::ERROR, Bes_Common::INFO, RootCalBaseCnv::m_inFile, RootCalBaseCnv::m_saveDir, msgSvc(), deljobs::string, and Bes_Common::WARNING.
Referenced by RootTofSimDataCnv::i_createObj(), i_createObj(), RootTofCalibDataCnv::i_createObj(), RootMucCalibDataCnv::i_createObj(), RootMdcCalibDataCnv::i_createObj(), RootEstTofCalibDataCnv::i_createObj(), RootEsTimeCalibDataCnv::i_createObj(), RootEmcCalibDataCnv::i_createObj(), RootDedxSimDataCnv::i_createObj(), and RootDedxCalibDataCnv::i_createObj().
00098 { 00099 00100 MsgStream log(msgSvc(), "RootCalBaseCnv"); 00101 00102 // Check fname isn't empty 00103 if (fname == std::string("")) return StatusCode::FAILURE; 00104 00105 if (doClean() ) { 00106 log << MSG::WARNING << "Previous operation didn't clean up! " << endreq; 00107 } 00108 m_saveDir = gDirectory; 00109 00110 std::string ourName(fname); 00111 facilities::Util::expandEnvVar(&ourName); 00112 00113 m_inFile = new TFile(ourName.c_str()); 00114 00115 if (!m_inFile->IsOpen() ) { 00116 log << MSG::ERROR << "ROOT file " << ourName 00117 << "could not be opened for reading " << endreq; 00118 delete m_inFile; 00119 m_inFile = 0; 00120 return StatusCode::FAILURE; 00121 } 00122 else { 00123 log << MSG::INFO 00124 << "Successfully opened ROOT file " << fname << " aka " << ourName 00125 << " for reading " << endreq; 00126 } 00127 00128 00129 m_inFile->cd(); // Maybe will need this 00130 00131 00132 return StatusCode::SUCCESS; 00133 }
StatusCode RootCalBaseCnv::openWrite | ( | const std::string & | fname | ) | [protected, virtual, inherited] |
Utility used by derived converters to start writing a ROOT file (open TFile, make a TTree, give it a branch)
fname | Name for new file | |
className | Name of class for object specified in next parameter; used to name branch as well) | |
pCalib | pointer to object used to create the branch |
Definition at line 148 of file RootCalBaseCnv.cxx.
References RootCalBaseCnv::doClean(), calibUtil::ERROR, Bes_Common::INFO, RootCalBaseCnv::m_outFile, RootCalBaseCnv::m_saveDir, msgSvc(), deljobs::string, and Bes_Common::WARNING.
Referenced by RootTofSimDataCnv::createRoot(), RootTofCalibDataCnv::createRoot(), RootMdcCalibDataCnv::createRoot(), RootEstTofCalibDataCnv::createRoot(), RootEsTimeCalibDataCnv::createRoot(), RootEmcCalibDataCnv::createRoot(), RootDedxSimDataCnv::createRoot(), and RootDedxCalibDataCnv::createRoot().
00148 { 00149 00150 MsgStream log(msgSvc(), "RootCalBaseCnv"); 00151 00152 // Check fname isn't empty 00153 if (fname == std::string("")) return StatusCode::FAILURE; 00154 00155 std::string ourName(fname); 00156 facilities::Util::expandEnvVar(&ourName); 00157 00158 if (doClean() ) { 00159 log << MSG::WARNING << "Previous operation didn't clean up! " << endreq; 00160 } 00161 00162 m_saveDir = gDirectory; 00163 00164 00165 m_outFile = new TFile(ourName.c_str(), "RECREATE"); 00166 if (!m_outFile->IsOpen()) { 00167 log << MSG::ERROR << "ROOT file " << fname << " aka " << ourName 00168 << " could not be opened for writing" << endreq; 00169 delete m_outFile; 00170 m_outFile = 0; 00171 return StatusCode::FAILURE; 00172 } 00173 else { 00174 log << MSG::INFO 00175 << "Successfully opened ROOT file " << fname << " aka " << ourName 00176 << " for writing " << endreq; 00177 } 00178 m_outFile->cd(); 00179 return StatusCode::SUCCESS; 00180 }
destination* Converter< Ty1, Ty2 >::operator | ( | const source & | ) | const [inline, inherited] |
StatusCode RootCalBaseCnv::readRootObj | ( | TTree * | tree, | |
const std::string & | branch, | |||
TObject *& | pCalib, | |||
unsigned | index = 0 | |||
) | [virtual, inherited] |
Definition at line 206 of file RootCalBaseCnv.cxx.
00208 { 00209 TBranch* pBranch=pTree->GetBranch(branch.c_str()); 00210 pBranch->SetAddress(&pObj); 00211 int nBytes = pBranch->GetEntry(ix); 00212 return (nBytes > 0) ? StatusCode::SUCCESS : StatusCode::FAILURE; 00213 }
StatusCode RootCalBaseCnv::readRootObj | ( | const std::string & | treename, | |
const std::string & | branch, | |||
TObject *& | pCalib, | |||
unsigned | index = 0 | |||
) | [virtual, inherited] |
Read in object (by default the first) from specified branch.
Definition at line 198 of file RootCalBaseCnv.cxx.
References RootCalBaseCnv::m_inFile.
00200 { 00201 TTree* pTree = (TTree*)m_inFile->Get(treename.c_str()); 00202 00203 return readRootObj(pTree, branch, pObj, ix); 00204 }
virtual long RootTofElecDataCnv::repSvcType | ( | ) | const [inline, virtual] |
Definition at line 34 of file RootTofQElecDataCnv.h.
References CALIBROOT_StorageType.
00034 { 00035 return CALIBROOT_StorageType; 00036 }
void RootCalBaseCnv::setBaseInfo | ( | CalibData::CalibBase1 * | pObj | ) | [protected, inherited] |
Another utility for derived classes to use.
Another convenience for derived classes: sets information belonging to the calibration base class, namely validity interval and serial number.
Definition at line 328 of file RootCalBaseCnv.cxx.
References Bes_Common::DEBUG, RootCalBaseCnv::m_runfrm, RootCalBaseCnv::m_runto, msgSvc(), CalibData::CalibBase1::setrunfrm(), and CalibData::CalibBase1::setrunto().
Referenced by RootCalBaseCnv::internalCreateObj().
00328 { 00329 MsgStream log(msgSvc(), "RootCalBaseCnv"); 00330 log << MSG::DEBUG<<"set the runfrm and runto Numbers in the converter"<<endreq; 00331 pObj->setrunfrm(m_runfrm); 00332 pObj->setrunto(m_runto); 00333 }
static const unsigned char RootCalBaseCnv::storageType | ( | ) | [inline, static, inherited] |
Definition at line 62 of file RootCalBaseCnv.h.
References CALIBROOT_StorageType.
00062 {return CALIBROOT_StorageType;}
friend class CnvFactory< RootTofElecDataCnv > [friend] |
Definition at line 22 of file RootTofQElecDataCnv.h.
TFile* RootCalBaseCnv::m_inFile [protected, inherited] |
Definition at line 207 of file RootCalBaseCnv.h.
Referenced by RootCalBaseCnv::closeRead(), RootCalBaseCnv::doClean(), RootTofSimDataCnv::i_createObj(), i_createObj(), RootTofCalibDataCnv::i_createObj(), RootMucCalibDataCnv::i_createObj(), RootMdcCalibDataCnv::i_createObj(), RootEstTofCalibDataCnv::i_createObj(), RootEsTimeCalibDataCnv::i_createObj(), RootEmcCalibDataCnv::i_createObj(), RootDedxSimDataCnv::i_createObj(), RootDedxCalibDataCnv::i_createObj(), RootCalBaseCnv::openRead(), and RootCalBaseCnv::readRootObj().
IInstrumentName* RootCalBaseCnv::m_instrSvc [protected, inherited] |
ICalibMetaCnvSvc* RootCalBaseCnv::m_metaSvc [protected, inherited] |
TFile* RootCalBaseCnv::m_outFile [protected, inherited] |
Definition at line 204 of file RootCalBaseCnv.h.
Referenced by RootCalBaseCnv::closeWrite(), RootCalBaseCnv::doClean(), and RootCalBaseCnv::openWrite().
ICalibRootSvc* RootCalBaseCnv::m_rootSvc [protected, inherited] |
Definition at line 193 of file RootCalBaseCnv.h.
Referenced by RootCalBaseCnv::getCalibRootSvc(), and RootCalBaseCnv::initialize().
int RootCalBaseCnv::m_runfrm [protected, inherited] |
Definition at line 200 of file RootCalBaseCnv.h.
Referenced by RootCalBaseCnv::internalCreateObj(), and RootCalBaseCnv::setBaseInfo().
int RootCalBaseCnv::m_runto [protected, inherited] |
Definition at line 201 of file RootCalBaseCnv.h.
Referenced by RootCalBaseCnv::internalCreateObj(), and RootCalBaseCnv::setBaseInfo().
TDirectory* RootCalBaseCnv::m_saveDir [protected, inherited] |
Definition at line 209 of file RootCalBaseCnv.h.
Referenced by RootCalBaseCnv::closeRead(), RootCalBaseCnv::closeWrite(), RootCalBaseCnv::doClean(), RootCalBaseCnv::openRead(), and RootCalBaseCnv::openWrite().
int RootCalBaseCnv::m_serNo [protected, inherited] |
Definition at line 197 of file RootCalBaseCnv.h.
TTree* RootCalBaseCnv::m_ttree [protected, inherited] |
ITime* RootCalBaseCnv::m_vend [protected, inherited] |
Definition at line 199 of file RootCalBaseCnv.h.
ITime* RootCalBaseCnv::m_vstart [protected, inherited] |
Definition at line 198 of file RootCalBaseCnv.h.