#include <RootTofCalibDataCnv.h>
Inheritance diagram for RootTofCalibDataCnv:
Public Types | |
typedef Ty2 | destination |
typedef Ty2 | destination |
typedef Ty1 | source |
typedef Ty1 | source |
Public Member Functions | |
virtual StatusCode | createObj (IOpaqueAddress *addr, DataObject *&refpObject) |
virtual StatusCode | createRoot (const std::string &fname, CalibData::CalibBase1 *pTDSObj) |
virtual StatusCode | finalize () |
ICalibRootSvc * | getCalibRootSvc () |
virtual StatusCode | initialize () |
const CLID & | objType () const |
destination * | operator (const source &) const |
destination * | operator (const source &) const |
virtual StatusCode | readRootObj (TTree *tree, const std::string &branch, TObject *&pCalib, unsigned index=0) |
virtual StatusCode | readRootObj (const std::string &treename, const std::string &branch, TObject *&pCalib, unsigned index=0) |
virtual long | repSvcType () const |
RootTofCalibDataCnv (ISvcLocator *svc) | |
virtual | ~RootTofCalibDataCnv () |
Static Public Member Functions | |
const CLID & | classID () |
const unsigned char | storageType () |
Protected Member Functions | |
StatusCode | closeRead () |
StatusCode | closeWrite () |
virtual destination * | convert (const source &) const =0 |
virtual destination * | convert (const source &) const =0 |
virtual StatusCode | fillRoot (CalibData::CalibBase *pTDSObj, TObject *pRootObj) |
virtual StatusCode | i_createObj (const std::string &fname, DataObject *&refpObject) |
virtual StatusCode | i_processObj (DataObject *pObject, IOpaqueAddress *address) |
In case there is additional work to do on the created object. | |
virtual StatusCode | internalCreateObj (const std::string &fname, DataObject *&refpObject, IOpaqueAddress *address) |
StatusCode | openRead (const std::string &fname) |
virtual StatusCode | openWrite (const std::string &fname) |
void | setBaseInfo (CalibData::CalibBase1 *pObj) |
Another utility for derived classes to use. | |
Protected Attributes | |
TFile * | m_inFile |
IInstrumentName * | m_instrSvc |
ICalibMetaCnvSvc * | m_metaSvc |
TFile * | m_outFile |
ICalibRootSvc * | m_rootSvc |
int | m_runfrm |
int | m_runto |
TDirectory * | m_saveDir |
int | m_serNo |
TTree * | m_ttree |
ITime * | m_vend |
ITime * | m_vstart |
Friends | |
class | CnvFactory<RootTofCalibDataCnv> |
|
|
|
|
|
|
|
|
|
00049 : 00050 RootCalBaseCnv(svc, CLID_Calib_TofCal) { 00051 }
|
|
00029 {};
|
|
00058 {
00059 return CLID_Calib_TofCal;
00060 }
|
|
Clean up when we've finished reading in 00132 { 00133 m_inFile->Close(); 00134 00135 delete m_inFile; 00136 m_inFile = 0; 00137 00138 if (m_saveDir) { 00139 m_saveDir->cd(); 00140 m_saveDir = 0; 00141 } 00142 return StatusCode::SUCCESS; 00143 }
|
|
Finish up writing file opened with openWrite: fill the tree write the file close the file Delete TFile (causes associated Tree to be deleted) 00179 { 00180 00181 MsgStream log(msgSvc(), "RootCalBaseCnv"); 00182 00183 StatusCode ret = StatusCode::SUCCESS; 00184 00185 m_outFile->cd(); 00186 m_outFile->Close(); 00187 delete m_outFile; 00188 m_outFile = 0; 00189 if (m_saveDir) m_saveDir->cd(); 00190 m_saveDir = 0; 00191 return ret; 00192 }
|
|
|
|
|
|
Create the transient representation of an object, given an opaque address. This and the following update method comprise the core functionality of calibration converters. 00250 { 00251 // StatusCode ret; 00252 00253 // first do the things we always need: 00254 // First string parameter of opaque address is file ident 00255 MsgStream log(msgSvc(), "RootCalBaseCnv"); 00256 log << MSG::DEBUG<<"RootCalBaseCnv::createObj( starting ...."<<endreq; 00257 const std::string* par = addr->par(); 00258 00259 std::string par0 = par[0]; 00260 00261 return internalCreateObj(par0, refpObject, addr); 00262 00263 }
|
|
Create ROOT file corresponding to TDS object input. Default implementation is to return an error. Must be separately implemented for each calibration type.
Reimplemented from RootCalBaseCnv. 00257 { 00258 MsgStream log(msgSvc(), "RootTofCalibDataCnv"); 00259 00260 // Open the file, create the branch 00261 StatusCode sc = openWrite(fname); 00262 if(!sc) 00263 { log<<MSG::ERROR<<"unable to open files"<<endreq; 00264 } 00265 // write the Data in the TCDS to RootFile 00266 int j; 00267 CalibData::TofCalibData* btof = dynamic_cast<CalibData::TofCalibData*>(pTDSObj); 00268 00269 // write btoftree---------------------------------------------------------------- 00270 double cnvBarAtten[nBarAtten]; 00271 double cnvBarSpeed[nBarSpeed]; 00272 double cnvBarPar1[nBarPar]; 00273 double cnvBarPar2[nBarPar]; 00274 double cnvBarParOff1[nBarParOff]; 00275 double cnvBarParOff2[nBarParOff]; 00276 double cnvFLeft[nBarSigma]; 00277 double cnvFRight[nBarSigma]; 00278 double cnvFCount[nBarSigCnt]; 00279 00280 char brname[8], ibrname[8]; 00281 TTree *btoftree = new TTree("BarTofPar", "BarTofPar"); 00282 for( unsigned int i=0; i<nBarAtten; i++ ) { 00283 sprintf( brname, "Atten%i", i ); 00284 sprintf( ibrname, "Atten%i/D", i ); 00285 btoftree -> Branch( brname, &cnvBarAtten[i], ibrname ); 00286 } 00287 for( unsigned int i=0; i<nBarSpeed; i++ ) { 00288 sprintf( brname, "Speed%i", i ); 00289 sprintf( ibrname, "Speed%i/D", i ); 00290 btoftree -> Branch( brname, &cnvBarSpeed[i], ibrname ); 00291 } 00292 for( unsigned int i=0; i<nBarPar; i++ ) { 00293 sprintf( brname, "P%i", i ); 00294 sprintf( ibrname, "P%i/D", i ); 00295 btoftree -> Branch( brname, &cnvBarPar1[i], ibrname ); 00296 } 00297 for( unsigned int i=0; i<nBarPar; i++ ) { 00298 sprintf( brname, "P%i", i+nBarPar ); 00299 sprintf( ibrname, "P%i/D", i+nBarPar ); 00300 btoftree -> Branch( brname, &cnvBarPar2[i], ibrname ); 00301 } 00302 for( unsigned int i=0; i<nBarParOff; i++ ) { 00303 sprintf( brname, "Poff%i", i ); 00304 sprintf( ibrname, "Poff%i/D", i ); 00305 btoftree -> Branch( brname, &cnvBarParOff1[i], ibrname ); 00306 } 00307 for( unsigned int i=0; i<nBarParOff; i++ ) { 00308 sprintf( brname, "Poff%i", i+nBarParOff ); 00309 sprintf( ibrname, "Poff%i/D", i+nBarParOff ); 00310 btoftree -> Branch( brname, &cnvBarParOff2[i], ibrname ); 00311 } 00312 for( unsigned int i=0; i<nBarSigma; i++ ) { 00313 sprintf( brname, "FLeft%i", i ); 00314 sprintf( ibrname, "FLeft%i/D", i ); 00315 btoftree -> Branch( brname, &cnvFLeft[i], ibrname ); 00316 } 00317 for( unsigned int i=0; i<nBarSigma; i++ ) { 00318 sprintf( brname, "FRight%i", i ); 00319 sprintf( ibrname, "FRight%i/D", i ); 00320 btoftree -> Branch( brname, &cnvFRight[i], ibrname ); 00321 } 00322 for( unsigned int i=0; i<nBarSigCnt; i++ ) { 00323 sprintf( brname, "FCounter%i", i ); 00324 sprintf( ibrname, "FCounter%i/D", i ); 00325 btoftree -> Branch( brname, &cnvFCount[i], ibrname ); 00326 } 00327 00328 for( int i=0; i<176; i++ ) { 00329 for(j=0;j<static_cast<int>(nBarAtten);j++) { 00330 cnvBarAtten[j] = btof->getBTofAtten(i,j); 00331 } 00332 for(j=0;j<static_cast<int>(nBarSpeed);j++) { 00333 cnvBarSpeed[j] = btof->getBTofSpeed(i,j); 00334 } 00335 for(j=0;j<static_cast<int>(nBarPar);j++){ 00336 cnvBarPar1[j] = btof->getBTofPleft(i,j); 00337 cnvBarPar2[j] = btof->getBTofPright(i,j); 00338 } 00339 for(j=0;j<static_cast<int>(nBarParOff);j++){ 00340 cnvBarParOff1[j] = btof->getBTofPoffleft(i,j); 00341 cnvBarParOff2[j] = btof->getBTofPoffright(i,j); 00342 } 00343 for(j=0;j<static_cast<int>(nBarSigma);j++){ 00344 cnvFLeft[j] = btof->getBTofFleft(i,j); 00345 cnvFRight[j] = btof->getBTofFright(i,j); 00346 } 00347 for(j=0;j<static_cast<int>(nBarSigCnt);j++){ 00348 cnvFCount[j] = btof->getBTofFcounter(i,j); 00349 } 00350 btoftree -> Fill(); 00351 } 00352 00353 //write etoftree---------------------------------------------------------------- 00354 double cnvEndAtten[nEndAtten]; 00355 double cnvEndSpeed[nEndSpeed]; 00356 double cnvEndPar[nEndPar]; 00357 double cnvEndFPar[nEndSigma]; 00358 00359 char ecname[8], iecname[8]; 00360 TTree *etoftree = new TTree("EndTofPar", "EndTofPar"); 00361 for( unsigned int i=0; i<nEndAtten; i++ ) { 00362 sprintf( ecname, "Atten%i", i ); 00363 sprintf( iecname, "Atten%i/D", i ); 00364 etoftree -> Branch( ecname, &cnvEndAtten[i], iecname ); 00365 } 00366 for( unsigned int i=0; i<nEndSpeed; i++ ) { 00367 sprintf( ecname, "Speed%i", i ); 00368 sprintf( iecname, "Speed%i/D", i ); 00369 etoftree -> Branch( ecname, &cnvEndSpeed[i], iecname ); 00370 } 00371 for( unsigned int i=0; i<nEndPar; i++ ) { 00372 sprintf( ecname, "P%i", i ); 00373 sprintf( iecname, "P%i/D", i ); 00374 etoftree -> Branch( ecname, &cnvEndPar[i], iecname ); 00375 } 00376 for( unsigned int i=0; i<nEndSigma; i++ ) { 00377 sprintf( ecname, "FCounter%i", i ); 00378 sprintf( iecname, "FCounter%i/D", i ); 00379 etoftree -> Branch( ecname, &cnvEndFPar[i], iecname ); 00380 } 00381 00382 for(int i=0; i<96; i++){ 00383 for(j=0;j<static_cast<int>(nEndAtten);j++) { 00384 cnvEndAtten[j] = btof->getETofAtten(i,j); 00385 } 00386 for(j=0;j<static_cast<int>(nEndSpeed);j++) { 00387 cnvEndSpeed[j] = btof->getETofSpeed(i,j); 00388 } 00389 for(j=0;j<static_cast<int>(nEndPar);j++){ 00390 cnvEndPar[j] = btof->getETofP(i,j); 00391 } 00392 for(j=0;j<static_cast<int>(nEndSigma);j++){ 00393 cnvEndFPar[j] = btof->getETofFP(i,j); 00394 } 00395 etoftree -> Fill(); 00396 } 00397 00398 // write all the trees 00399 btoftree -> Write(); 00400 etoftree -> Write(); 00401 delete btoftree; 00402 delete etoftree; 00403 closeWrite(); 00404 log<<MSG::INFO<<"successfully create RootFile"<<endreq; 00405 00406 return sc; 00407 }
|
|
Given a pointer to a TDS object which can be cast to "our" type, fill in corresponding information in the corresponding root class
00239 { 00240 00241 // Get instrument name from InstrumentName service Now handled by 00242 // RootCalBaseCnv 00243 // TString instr = TString((m_instrSvc->getInstrumentName()).c_str()); 00244 // pRootObj->setInstrument(instr); 00245 return StatusCode::SUCCESS; 00246 }
|
|
00079 {
00080 return Converter::finalize();
00081 }
|
|
00058 {
00059 return m_rootSvc;
00060 }
|
|
Read in object from specified branch. Don't need tree name; it's always Calib Reimplemented from RootCalBaseCnv. 00063 { 00064 00065 MsgStream log(msgSvc(), "RootTofCalibDataCnv"); 00066 log<<MSG::DEBUG<<"SetProperty"<<endreq; 00067 00068 // open the file 00069 StatusCode sc = openRead(fname); 00070 if(!sc) 00071 { log<<MSG::ERROR<<"unable to open files"<<endreq; 00072 } 00073 00074 CalibData::bTofCalibBase bTof; 00075 CalibData::eTofCalibBase eTof; 00076 CalibData::bTofCommonCalibBase bTofCommon; 00077 CalibData::tofCalibInfoBase tofinfo; 00078 00079 std::vector<CalibData::bTofCalibBase> tmpbTof;//; = new vector<CalibData::bTofCalibBase>; 00080 std::vector<CalibData::eTofCalibBase> tmpeTof; 00081 std::vector<CalibData::bTofCommonCalibBase> tmpbTofCommon; 00082 std::vector<CalibData::tofCalibInfoBase> tofinfoCol; 00083 // Read in the object 00084 int cnt; 00085 // read btoftree ------------------------------------------------------------ 00086 00087 double cnvBarAtten[nBarAtten]; 00088 double cnvBarSpeed[nBarSpeed]; 00089 double cnvBarPar1[nBarPar]; 00090 double cnvBarPar2[nBarPar]; 00091 double cnvBarParOff1[nBarParOff]; 00092 double cnvBarParOff2[nBarParOff]; 00093 double cnvFLeft[nBarSigma]; 00094 double cnvFRight[nBarSigma]; 00095 double cnvFCount[nBarSigCnt]; 00096 00097 TTree *btoftree = (TTree*)m_inFile -> Get("BarTofPar"); 00098 00099 char brname[10]; 00100 for( unsigned int i=0; i<nBarAtten; i++ ) { 00101 sprintf( brname, "Atten%i", i ); 00102 btoftree -> SetBranchAddress( brname, &cnvBarAtten[i] ); 00103 } 00104 for( unsigned int i=0; i<nBarSpeed; i++ ) { 00105 sprintf( brname, "Speed%i", i ); 00106 btoftree -> SetBranchAddress( brname, &cnvBarSpeed[i] ); 00107 } 00108 for( unsigned int i=0; i<nBarPar; i++ ) { 00109 sprintf( brname, "P%i", i ); 00110 btoftree -> SetBranchAddress( brname, &cnvBarPar1[i] ); 00111 } 00112 for( unsigned int i=0; i<nBarPar; i++ ) { 00113 sprintf( brname, "P%i", i+nBarPar ); 00114 btoftree -> SetBranchAddress( brname, &cnvBarPar2[i] ); 00115 } 00116 for( unsigned int i=0; i<nBarParOff; i++ ) { 00117 sprintf( brname, "Poff%i", i ); 00118 btoftree -> SetBranchAddress( brname, &cnvBarParOff1[i] ); 00119 } 00120 for( unsigned int i=0; i<nBarParOff; i++ ) { 00121 sprintf( brname, "Poff%i", i+nBarParOff ); 00122 btoftree -> SetBranchAddress( brname, &cnvBarParOff2[i] ); 00123 } 00124 for( unsigned int i=0; i<nBarSigma; i++ ) { 00125 sprintf( brname, "FLeft%i", i ); 00126 btoftree -> SetBranchAddress( brname, &cnvFLeft[i] ); 00127 } 00128 for( unsigned int i=0; i<nBarSigma; i++ ) { 00129 sprintf( brname, "FRight%i", i ); 00130 btoftree -> SetBranchAddress( brname, &cnvFRight[i] ); 00131 } 00132 for( unsigned int i=0; i<nBarSigCnt; i++ ) { 00133 sprintf( brname, "FCounter%i", i ); 00134 btoftree -> SetBranchAddress( brname, &cnvFCount[i] ); 00135 } 00136 00137 for(cnt=0; cnt<176; cnt++){ 00138 btoftree -> GetEntry(cnt); 00139 bTof.setAtten( cnvBarAtten ); 00140 bTof.setSpeed( cnvBarSpeed ); 00141 bTof.setP1( cnvBarPar1 ); 00142 bTof.setP2( cnvBarPar2 ); 00143 bTof.setPoff1( cnvBarParOff1 ); 00144 bTof.setPoff2( cnvBarParOff2 ); 00145 bTof.setFPleft( cnvFLeft ); 00146 bTof.setFPright( cnvFRight ); 00147 bTof.setFPcounter( cnvFCount ); 00148 tmpbTof.push_back(bTof); 00149 } 00150 00151 //read etoftree 00152 double cnvEndAtten[nEndAtten]; 00153 double cnvEndSpeed[nEndSpeed]; 00154 double cnvEndPar[nEndPar]; 00155 double cnvEndFPar[nEndSigma]; 00156 00157 TTree *etoftree = (TTree*)m_inFile -> Get("EndTofPar"); 00158 00159 char ecname[10]; 00160 for( unsigned int i=0; i<nEndAtten; i++ ) { 00161 sprintf( ecname, "Atten%i", i ); 00162 etoftree -> SetBranchAddress( ecname, &cnvEndAtten[i] ); 00163 } 00164 for( unsigned int i=0; i<nEndSpeed; i++ ) { 00165 sprintf( ecname, "Speed%i", i ); 00166 etoftree -> SetBranchAddress( ecname, &cnvEndSpeed[i] ); 00167 } 00168 for( unsigned int i=0; i<nEndPar; i++ ) { 00169 sprintf( ecname, "P%i", i ); 00170 etoftree -> SetBranchAddress( ecname, &cnvEndPar[i] ); 00171 } 00172 for( unsigned int i=0; i<nEndSigma; i++ ) { 00173 sprintf( ecname, "FCounter%i", i ); 00174 etoftree -> SetBranchAddress( ecname, &cnvEndFPar[i] ); 00175 } 00176 00177 for(cnt=0; cnt<96; cnt++){ 00178 etoftree -> GetEntry(cnt); 00179 eTof.setAtten( cnvEndAtten ); 00180 eTof.setSpeed( cnvEndSpeed ); 00181 eTof.setP( cnvEndPar ); 00182 eTof.setFP( cnvEndFPar ); 00183 tmpeTof.push_back(eTof); 00184 } 00185 00186 //read bTofCommonCalibBase 00187 double cnvBarSigCor[nBarSigCor]; 00188 double cnvBarOffset[nBarOffset]; 00189 TTree *btofcommontree = (TTree*)m_inFile -> Get("BarTofParCommon"); 00190 for( unsigned int i=0; i<nBarSigCor; i++ ) { 00191 sprintf( brname, "sigmaCorr%i", i ); 00192 btofcommontree-> SetBranchAddress( brname, &cnvBarSigCor[i] ); 00193 } 00194 for( unsigned int i=0; i<nBarOffset; i++ ) { 00195 sprintf( brname, "t0offset%i", i ); 00196 btofcommontree-> SetBranchAddress( brname, &cnvBarOffset[i]); 00197 } 00198 00199 int entries = btofcommontree->GetEntries(); 00200 for(cnt=0;cnt<entries;cnt++){ 00201 btofcommontree->GetEntry(cnt); 00202 bTofCommon.setSigmaCorr( cnvBarSigCor ); 00203 bTofCommon.setOffset( cnvBarOffset ); 00204 tmpbTofCommon.push_back(bTofCommon); 00205 } 00206 00207 int m_run1, m_run2, m_version; 00208 int m_qCorr, m_qElec, m_misLable; 00209 int m_tofidEast[5], m_tofidWest[5], m_tofidEndcap[5]; 00210 00211 TTree *CalibInfo = (TTree*)m_inFile -> Get("CalibInfo"); 00212 CalibInfo->SetBranchAddress("Run1",&m_run1); 00213 CalibInfo->SetBranchAddress("Run2",&m_run2); 00214 CalibInfo->SetBranchAddress("Version",&m_version); 00215 CalibInfo->SetBranchAddress("ebrId0",&m_tofidEast[0]); 00216 CalibInfo->SetBranchAddress("ebrId1",&m_tofidEast[1]); 00217 CalibInfo->SetBranchAddress("ebrId2",&m_tofidEast[2]); 00218 CalibInfo->SetBranchAddress("ebrId3",&m_tofidEast[3]); 00219 CalibInfo->SetBranchAddress("ebrId4",&m_tofidEast[4]); 00220 CalibInfo->SetBranchAddress("ecId0",&m_tofidEndcap[0]); 00221 CalibInfo->SetBranchAddress("ecId1",&m_tofidEndcap[1]); 00222 CalibInfo->SetBranchAddress("ecId2",&m_tofidEndcap[2]); 00223 CalibInfo->SetBranchAddress("ecId3",&m_tofidEndcap[3]); 00224 CalibInfo->SetBranchAddress("ecId4",&m_tofidEndcap[4]); 00225 CalibInfo->SetBranchAddress("wbrId0",&m_tofidWest[0]); 00226 CalibInfo->SetBranchAddress("wbrId1",&m_tofidWest[1]); 00227 CalibInfo->SetBranchAddress("wbrId2",&m_tofidWest[2]); 00228 CalibInfo->SetBranchAddress("wbrId3",&m_tofidWest[3]); 00229 CalibInfo->SetBranchAddress("wbrId4",&m_tofidWest[4]); 00230 CalibInfo->SetBranchAddress("misLable",&m_misLable); 00231 CalibInfo->SetBranchAddress("qCorr",&m_qCorr); 00232 CalibInfo->SetBranchAddress("qElec",&m_qElec); 00233 00234 entries= CalibInfo->GetEntries(); 00235 for(cnt=0;cnt<entries;cnt++){ 00236 CalibInfo->GetEntry(cnt); 00237 tofinfo.setRunBegin(m_run1); 00238 tofinfo.setRunEnd(m_run2); 00239 tofinfo.setVersion(m_version); 00240 tofinfo.setQCorr(m_qCorr); 00241 tofinfo.setQElec(m_qElec); 00242 tofinfo.setMisLable(m_misLable); 00243 tofinfo.setBrEast(m_tofidEast); 00244 tofinfo.setBrWest(m_tofidWest); 00245 tofinfo.setEndcap(m_tofidEndcap); 00246 tofinfoCol.push_back(tofinfo); 00247 } 00248 00249 CalibData::TofCalibData *tmpObject = new CalibData::TofCalibData(&tmpbTof,&tmpbTofCommon,&tmpeTof,&tofinfoCol); 00250 00251 refpObject=tmpObject; 00252 00253 return StatusCode::SUCCESS; 00254 }
|
|
In case there is additional work to do on the created object.
00320 {
00321 return StatusCode::SUCCESS;
00322 }
|
|
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 setDataProvider(dp); 00057 00058 // Locate the Root Conversion Service 00059 serviceLocator()->getService ("CalibRootCnvSvc", 00060 IID_ICalibRootSvc, 00061 (IInterface*&) m_rootSvc); 00062 00063 // Locate meta conversion service 00064 // Will anything need to be changed here to accommodate possibility 00065 // of two concrete implementations of ICalibMetaCnvSvc? Would 00066 // have different storage types. Could specify type desired 00067 // as job option. Ditto for name of class? 00068 serviceLocator()->getService("CalibMySQLCnvSvc", 00069 IID_ICalibMetaCnvSvc, 00070 (IInterface*&)m_metaSvc); 00071 00072 serviceLocator()->getService ("CalibDataSvc", 00073 IID_IInstrumentName, 00074 (IInterface*&)m_instrSvc); 00075 00076 return status; 00077 }
|
|
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.
00267 { 00268 MsgStream log(msgSvc(), "RootCalBaseCnv"); 00269 log << MSG::DEBUG<<"RootCalBaseCnv::internalCreateObj( starting ..... "<<endreq; 00270 RootCalBaseCnv* converter = this; 00271 CLID classId = address->clID(); 00272 00273 IConverter* conv = this->conversionSvc()->converter(classId); 00274 if (0 == conv) { 00275 log << MSG::WARNING 00276 << "No proper converter found for classID " << classId 00277 << ", the default converter" 00278 << " will be used. " << endreq; 00279 } else { 00280 converter = dynamic_cast <RootCalBaseCnv*> (conv); 00281 if (0 == converter) { 00282 log << MSG::ERROR 00283 << "The converter found for classID " << classId 00284 << " was not a descendent of RootCalBaseCnv as it should be " 00285 << "( was of type " << typeid (*converter).name() << "). " 00286 << "The default converter will be used" << endreq; 00287 converter = this; 00288 } 00289 } 00290 00291 m_runfrm =*( address->ipar()); 00292 m_runto =*( address->ipar()+1); 00293 // creates an object for the node found 00294 StatusCode sc = converter->i_createObj(fname, refpObject); 00295 if (sc.isFailure()) { 00296 return sc; 00297 } 00298 CalibData::CalibBase1* tmpObject = dynamic_cast <CalibData::CalibBase1*> (refpObject); 00299 setBaseInfo(tmpObject); 00300 // ends up the object construction 00301 sc = converter->i_processObj(refpObject, address); 00302 if (sc.isSuccess()) { 00303 log << MSG::DEBUG << "Successfully created calib. object " << endreq; 00304 } 00305 closeRead(); 00306 return sc; 00307 }
|
|
00054 {
00055 return CLID_Calib_TofCal;
00056 }
|
|
Utility for "leaf" converters to call
00095 { 00096 00097 MsgStream log(msgSvc(), "RootCalBaseCnv"); 00098 00099 // Check fname isn't empty 00100 if (fname == std::string("")) return StatusCode::FAILURE; 00101 00102 if (doClean() ) { 00103 log << MSG::WARNING << "Previous operation didn't clean up! " << endreq; 00104 } 00105 m_saveDir = gDirectory; 00106 00107 std::string ourName(fname); 00108 facilities::Util::expandEnvVar(&ourName); 00109 00110 m_inFile = new TFile(ourName.c_str()); 00111 00112 if (!m_inFile->IsOpen() ) { 00113 log << MSG::ERROR << "ROOT file " << ourName 00114 << "could not be opened for reading " << endreq; 00115 delete m_inFile; 00116 m_inFile = 0; 00117 return StatusCode::FAILURE; 00118 } 00119 else { 00120 log << MSG::INFO 00121 << "Successfully opened ROOT file " << fname << " aka " << ourName 00122 << " for reading " << endreq; 00123 } 00124 00125 00126 m_inFile->cd(); // Maybe will need this 00127 00128 00129 return StatusCode::SUCCESS; 00130 }
|
|
Utility used by derived converters to start writing a ROOT file (open TFile, make a TTree, give it a branch)
00145 { 00146 00147 MsgStream log(msgSvc(), "RootCalBaseCnv"); 00148 00149 // Check fname isn't empty 00150 if (fname == std::string("")) return StatusCode::FAILURE; 00151 00152 std::string ourName(fname); 00153 facilities::Util::expandEnvVar(&ourName); 00154 00155 if (doClean() ) { 00156 log << MSG::WARNING << "Previous operation didn't clean up! " << endreq; 00157 } 00158 00159 m_saveDir = gDirectory; 00160 00161 00162 m_outFile = new TFile(ourName.c_str(), "RECREATE"); 00163 if (!m_outFile->IsOpen()) { 00164 log << MSG::ERROR << "ROOT file " << fname << " aka " << ourName 00165 << " could not be opened for writing" << endreq; 00166 delete m_outFile; 00167 m_outFile = 0; 00168 return StatusCode::FAILURE; 00169 } 00170 else { 00171 log << MSG::INFO 00172 << "Successfully opened ROOT file " << fname << " aka " << ourName 00173 << " for writing " << endreq; 00174 } 00175 m_outFile->cd(); 00176 return StatusCode::SUCCESS; 00177 }
|
|
|
|
|
|
00205 { 00206 TBranch* pBranch=pTree->GetBranch(branch.c_str()); 00207 pBranch->SetAddress(&pObj); 00208 int nBytes = pBranch->GetEntry(ix); 00209 return (nBytes > 0) ? StatusCode::SUCCESS : StatusCode::FAILURE; 00210 }
|
|
Read in object (by default the first) from specified branch. 00197 { 00198 TTree* pTree = (TTree*)m_inFile->Get(treename.c_str()); 00199 00200 return readRootObj(pTree, branch, pObj, ix); 00201 }
|
|
00034 {
00035 return CALIBROOT_StorageType;
00036 }
|
|
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. 00325 { 00326 MsgStream log(msgSvc(), "RootCalBaseCnv"); 00327 log << MSG::DEBUG<<"set the runfrm and runto Numbers in the converter"<<endreq; 00328 pObj->setrunfrm(m_runfrm); 00329 pObj->setrunto(m_runto); 00330 }
|
|
00062 {return CALIBROOT_StorageType;}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|