RootTofCalibDataCnv Class Reference

#include <RootTofCalibDataCnv.h>

Inheritance diagram for RootTofCalibDataCnv:

RootCalBaseCnv Converter< Ty1, Ty2 > List of all members.

Public Types

typedef Ty1 source
typedef Ty2 destination

Public Member Functions

const CLID & objType () const
 RootTofCalibDataCnv (ISvcLocator *svc)
virtual ~RootTofCalibDataCnv ()
virtual StatusCode createRoot (const std::string &fname, CalibData::CalibBase1 *pTDSObj)
virtual long repSvcType () const
virtual StatusCode initialize ()
virtual StatusCode finalize ()
virtual StatusCode createObj (IOpaqueAddress *addr, DataObject *&refpObject)
ICalibRootSvcgetCalibRootSvc ()
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)
destinationoperator (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 destinationconvert (const source &) const =0

Protected Attributes

ICalibRootSvcm_rootSvc
ICalibMetaCnvSvcm_metaSvc
IInstrumentNamem_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< RootTofCalibDataCnv >

Detailed Description

Definition at line 20 of file RootTofCalibDataCnv.h.


Member Typedef Documentation

template<class Ty1, class Ty2>
typedef Ty2 Converter< Ty1, Ty2 >::destination [inherited]

Definition at line 19 of file Converter.h.

template<class Ty1, class Ty2>
typedef Ty1 Converter< Ty1, Ty2 >::source [inherited]

Definition at line 18 of file Converter.h.


Constructor & Destructor Documentation

RootTofCalibDataCnv::RootTofCalibDataCnv ( ISvcLocator *  svc  ) 

Definition at line 51 of file RootTofCalibDataCnv.cxx.

00051                                                           :
00052   RootCalBaseCnv(svc, CLID_Calib_TofCal) { 
00053  }

virtual RootTofCalibDataCnv::~RootTofCalibDataCnv (  )  [inline, virtual]

Definition at line 29 of file RootTofCalibDataCnv.h.

00029 {};


Member Function Documentation

const CLID & RootTofCalibDataCnv::classID (  )  [static]

Definition at line 60 of file RootTofCalibDataCnv.cxx.

References CLID_Calib_TofCal.

00060                                          {
00061   return CLID_Calib_TofCal;
00062 }

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 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 }

template<class Ty1, class Ty2>
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 RootTofCalibDataCnv::createRoot ( const std::string fname,
CalibData::CalibBase1 pTDSObj 
) [virtual]

Create ROOT file corresponding to TDS object input. Default implementation is to return an error. Must be separately implemented for each calibration type.

Parameters:
fname Filename for output file
pTDSObj Pointer to tds object to be converted

Reimplemented from RootCalBaseCnv.

Definition at line 355 of file RootTofCalibDataCnv.cxx.

References RootCalBaseCnv::closeWrite(), calibUtil::ERROR, CalibData::TofCalibData::getBTofAtten(), CalibData::TofCalibData::getBTofFcounter(), CalibData::TofCalibData::getBTofFleft(), CalibData::TofCalibData::getBTofFright(), CalibData::TofCalibData::getBTofPleft(), CalibData::TofCalibData::getBTofPoffleft_bunch0(), CalibData::TofCalibData::getBTofPoffleft_bunch1(), CalibData::TofCalibData::getBTofPoffleft_bunch2(), CalibData::TofCalibData::getBTofPoffleft_bunch3(), CalibData::TofCalibData::getBTofPoffright_bunch0(), CalibData::TofCalibData::getBTofPoffright_bunch1(), CalibData::TofCalibData::getBTofPoffright_bunch2(), CalibData::TofCalibData::getBTofPoffright_bunch3(), CalibData::TofCalibData::getBTofPright(), CalibData::TofCalibData::getBTofSpeed(), CalibData::TofCalibData::getEtfPBunch(), CalibData::TofCalibData::getEtfPcombine(), CalibData::TofCalibData::getEtfPleft(), CalibData::TofCalibData::getEtfPright(), CalibData::TofCalibData::getEtfSpeed(), CalibData::TofCalibData::getETofAtten(), CalibData::TofCalibData::getETofFP(), CalibData::TofCalibData::getETofP(), CalibData::TofCalibData::getETofSpeed(), genRecEmupikp::i, Bes_Common::INFO, ganga-rec::j, msgSvc(), nBarAtten, nBarPar, nBarParOff, nBarSigCnt, nBarSigma, nBarSpeed, nEndAtten, nEndPar, nEndSigma, nEndSpeed, nEtfBunch, nEtfPar, nEtfSpeed, and RootCalBaseCnv::openWrite().

00356                                                                       {
00357   MsgStream log(msgSvc(), "RootTofCalibDataCnv");
00358 
00359   // Open the file, create the branch
00360   StatusCode sc = openWrite(fname);
00361   if(!sc)
00362     { log<<MSG::ERROR<<"unable to open files"<<endreq;
00363     }
00364   // write the Data in the TCDS to RootFile
00365   int j;
00366   CalibData::TofCalibData* btof = dynamic_cast<CalibData::TofCalibData*>(pTDSObj);
00367 
00368   // write  btoftree----------------------------------------------------------------
00369   double cnvBarAtten[nBarAtten];
00370   double cnvBarSpeed[nBarSpeed];
00371   double cnvBarPar1[nBarPar];
00372   double cnvBarPar2[nBarPar];
00373   double cnvBarParOff1_bunch0[nBarParOff];
00374   double cnvBarParOff2_bunch0[nBarParOff];
00375   double cnvBarParOff1_bunch1[nBarParOff];
00376   double cnvBarParOff2_bunch1[nBarParOff];
00377   double cnvBarParOff1_bunch2[nBarParOff];
00378   double cnvBarParOff2_bunch2[nBarParOff];
00379   double cnvBarParOff1_bunch3[nBarParOff];
00380   double cnvBarParOff2_bunch3[nBarParOff];
00381   double cnvFLeft[nBarSigma];
00382   double cnvFRight[nBarSigma];
00383   double cnvFCount[nBarSigCnt];
00384 
00385   char brname[8], ibrname[8];
00386   TTree *btoftree = new TTree("BarTofPar", "BarTofPar");
00387   for( unsigned int i=0; i<nBarAtten; i++ ) {
00388     sprintf(  brname, "Atten%i",   i );
00389     sprintf( ibrname, "Atten%i/D", i );
00390     btoftree -> Branch( brname, &cnvBarAtten[i], ibrname );
00391   }
00392   for( unsigned int i=0; i<nBarSpeed; i++ ) {
00393     sprintf(  brname, "Speed%i",   i );
00394     sprintf( ibrname, "Speed%i/D", i );
00395     btoftree -> Branch( brname, &cnvBarSpeed[i], ibrname );
00396   }
00397   for( unsigned int i=0; i<nBarPar; i++ ) {
00398     sprintf(  brname, "P%i",   i );
00399     sprintf( ibrname, "P%i/D", i );
00400     btoftree -> Branch( brname, &cnvBarPar1[i], ibrname );
00401   }
00402   for( unsigned int i=0; i<nBarPar; i++ ) {
00403     sprintf(  brname, "P%i",   i+nBarPar );
00404     sprintf( ibrname, "P%i/D", i+nBarPar );
00405     btoftree -> Branch( brname, &cnvBarPar2[i], ibrname );
00406   }
00407   for( unsigned int i=0; i<nBarParOff; i++ ) {
00408     sprintf(  brname, "Bunch0_Poff%i",   i );
00409     sprintf( ibrname, "Bunch0_Poff%i/D", i );
00410     btoftree -> Branch( brname, &cnvBarParOff1_bunch0[i], ibrname );
00411   }
00412   for( unsigned int i=0; i<nBarParOff; i++ ) {
00413     sprintf(  brname, "Bunch0_Poff%i",   i+nBarParOff );
00414     sprintf( ibrname, "Bunch0_Poff%i/D", i+nBarParOff );
00415     btoftree -> Branch( brname, &cnvBarParOff2_bunch0[i], ibrname );
00416   }
00417   for( unsigned int i=0; i<nBarParOff; i++ ) {
00418     sprintf(  brname, "Bunch1_Poff%i",   i );
00419     sprintf( ibrname, "Bunch1_Poff%i/D", i );
00420     btoftree -> Branch( brname, &cnvBarParOff1_bunch1[i], ibrname );
00421   }
00422   for( unsigned int i=0; i<nBarParOff; i++ ) {
00423     sprintf(  brname, "Bunch1_Poff%i",   i+nBarParOff );
00424     sprintf( ibrname, "Bunch1_Poff%i/D", i+nBarParOff );
00425     btoftree -> Branch( brname, &cnvBarParOff2_bunch1[i], ibrname );
00426   }
00427   for( unsigned int i=0; i<nBarParOff; i++ ) {
00428     sprintf(  brname, "Bunch2_Poff%i",   i );
00429     sprintf( ibrname, "Bunch2_Poff%i/D", i );
00430     btoftree -> Branch( brname, &cnvBarParOff1_bunch2[i], ibrname );
00431   }
00432   for( unsigned int i=0; i<nBarParOff; i++ ) {
00433     sprintf(  brname, "Bunch2_Poff%i",   i+nBarParOff );
00434     sprintf( ibrname, "Bunch2_Poff%i/D", i+nBarParOff );
00435     btoftree -> Branch( brname, &cnvBarParOff2_bunch2[i], ibrname );
00436   }
00437   for( unsigned int i=0; i<nBarParOff; i++ ) {
00438     sprintf(  brname, "Bunch3_Poff%i",   i );
00439     sprintf( ibrname, "Bunch3_Poff%i/D", i );
00440     btoftree -> Branch( brname, &cnvBarParOff1_bunch3[i], ibrname );
00441   }
00442   for( unsigned int i=0; i<nBarParOff; i++ ) {
00443     sprintf(  brname, "Bunch3_Poff%i",   i+nBarParOff );
00444     sprintf( ibrname, "Bunch3_Poff%i/D", i+nBarParOff );
00445     btoftree -> Branch( brname, &cnvBarParOff2_bunch3[i], ibrname );
00446   }
00447   for( unsigned int i=0; i<nBarSigma; i++ ) {
00448     sprintf(  brname, "FLeft%i",   i );
00449     sprintf( ibrname, "FLeft%i/D", i );
00450     btoftree -> Branch( brname, &cnvFLeft[i], ibrname );
00451   }
00452   for( unsigned int i=0; i<nBarSigma; i++ ) {
00453     sprintf(  brname, "FRight%i",   i );
00454     sprintf( ibrname, "FRight%i/D", i );
00455     btoftree -> Branch( brname, &cnvFRight[i], ibrname );
00456   }
00457   for( unsigned int i=0; i<nBarSigCnt; i++ ) {
00458     sprintf(  brname, "FCounter%i",   i );
00459     sprintf( ibrname, "FCounter%i/D", i );
00460     btoftree -> Branch( brname, &cnvFCount[i], ibrname );
00461   }
00462 
00463   for( int i=0; i<176; i++ ) {
00464     for(j=0;j<static_cast<int>(nBarAtten);j++) {
00465       cnvBarAtten[j] = btof->getBTofAtten(i,j);
00466     }
00467     for(j=0;j<static_cast<int>(nBarSpeed);j++) {
00468       cnvBarSpeed[j] = btof->getBTofSpeed(i,j);
00469     }
00470     for(j=0;j<static_cast<int>(nBarPar);j++){
00471       cnvBarPar1[j] = btof->getBTofPleft(i,j);
00472       cnvBarPar2[j] = btof->getBTofPright(i,j);
00473     }
00474     for(j=0;j<static_cast<int>(nBarParOff);j++){
00475       cnvBarParOff1_bunch0[j] = btof->getBTofPoffleft_bunch0(i,j);
00476       cnvBarParOff2_bunch0[j] = btof->getBTofPoffright_bunch0(i,j);
00477     }
00478     for(j=0;j<static_cast<int>(nBarParOff);j++){
00479       cnvBarParOff1_bunch1[j] = btof->getBTofPoffleft_bunch1(i,j);
00480       cnvBarParOff2_bunch1[j] = btof->getBTofPoffright_bunch1(i,j);
00481     }
00482     for(j=0;j<static_cast<int>(nBarParOff);j++){
00483       cnvBarParOff1_bunch2[j] = btof->getBTofPoffleft_bunch2(i,j);
00484       cnvBarParOff2_bunch2[j] = btof->getBTofPoffright_bunch2(i,j);
00485     }
00486     for(j=0;j<static_cast<int>(nBarParOff);j++){
00487       cnvBarParOff1_bunch3[j] = btof->getBTofPoffleft_bunch3(i,j);
00488       cnvBarParOff2_bunch3[j] = btof->getBTofPoffright_bunch3(i,j);
00489     }
00490     for(j=0;j<static_cast<int>(nBarSigma);j++){
00491       cnvFLeft[j]  = btof->getBTofFleft(i,j);
00492       cnvFRight[j] = btof->getBTofFright(i,j);
00493     }
00494     for(j=0;j<static_cast<int>(nBarSigCnt);j++){
00495       cnvFCount[j] = btof->getBTofFcounter(i,j);
00496     }
00497     btoftree -> Fill();
00498   }
00499      
00500  //write  etoftree----------------------------------------------------------------
00501   double cnvEndAtten[nEndAtten];
00502   double cnvEndSpeed[nEndSpeed];
00503   double cnvEndPar[nEndPar];
00504   double cnvEndFPar[nEndSigma];
00505 
00506   char ecname[8], iecname[8];
00507   TTree *etoftree = new TTree("EndTofPar", "EndTofPar");
00508   for( unsigned int i=0; i<nEndAtten; i++ ) {
00509     sprintf(  ecname, "Atten%i",   i );
00510     sprintf( iecname, "Atten%i/D", i );
00511     etoftree -> Branch( ecname, &cnvEndAtten[i], iecname );
00512   }
00513   for( unsigned int i=0; i<nEndSpeed; i++ ) {
00514     sprintf(  ecname, "Speed%i",   i );
00515     sprintf( iecname, "Speed%i/D", i );
00516     etoftree -> Branch( ecname, &cnvEndSpeed[i], iecname );
00517   }
00518   for( unsigned int i=0; i<nEndPar; i++ ) {
00519     sprintf(  ecname, "P%i",   i );
00520     sprintf( iecname, "P%i/D", i );
00521     etoftree -> Branch( ecname, &cnvEndPar[i], iecname );
00522   }
00523   for( unsigned int i=0; i<nEndSigma; i++ ) {
00524     sprintf(  ecname, "FCounter%i",   i );
00525     sprintf( iecname, "FCounter%i/D", i );
00526     etoftree -> Branch( ecname, &cnvEndFPar[i], iecname );
00527   }
00528     
00529   for(int i=0; i<96; i++){
00530     for(j=0;j<static_cast<int>(nEndAtten);j++) {
00531       cnvEndAtten[j] = btof->getETofAtten(i,j);
00532     }
00533     for(j=0;j<static_cast<int>(nEndSpeed);j++) {
00534       cnvEndSpeed[j] = btof->getETofSpeed(i,j);
00535     }
00536     for(j=0;j<static_cast<int>(nEndPar);j++){
00537       cnvEndPar[j] = btof->getETofP(i,j);
00538     }
00539     for(j=0;j<static_cast<int>(nEndSigma);j++){
00540       cnvEndFPar[j] = btof->getETofFP(i,j);
00541     }
00542     etoftree -> Fill();
00543   }
00544 
00545  //write  etftree----------------------------------------------------------------
00546   double cnvEtfSpeed[nEtfSpeed];
00547   double cnvEtfPar[nEtfPar];
00548   double cnvEtfPar1[nEtfPar];
00549   double cnvEtfPar2[nEtfPar];
00550 
00551   char etfname[8], ietfname[8];
00552   TTree *etftree = new TTree("EtfTofPar", "EtfTofPar");
00553   for( unsigned int i=0; i<nEtfSpeed; i++ ) {
00554     sprintf(  etfname, "Speed%i",   i );
00555     sprintf( ietfname, "Speed%i/D", i );
00556     etftree -> Branch( etfname, &cnvEtfSpeed[i], ietfname );
00557   }
00558   for( unsigned int i=0; i<nEtfPar; i++ ) {
00559     sprintf(  etfname, "P%i",   i );
00560     sprintf( ietfname, "P%i/D", i );
00561     etftree -> Branch( etfname, &cnvEtfPar[i], ietfname );
00562   }
00563   for( unsigned int i=0; i<nEtfPar; i++ ) {
00564     sprintf(  etfname, "P%i",   i+nEtfPar );
00565     sprintf( ietfname, "P%i/D", i+nEtfPar );
00566     etftree -> Branch( etfname, &cnvEtfPar1[i], ietfname );
00567   }
00568   for( unsigned int i=0; i<nEtfPar; i++ ) {
00569     sprintf(  etfname, "P%i",   i+2*nEtfPar );
00570     sprintf( ietfname, "P%i/D", i+2*nEtfPar );
00571     etftree -> Branch( etfname, &cnvEtfPar2[i], ietfname );
00572   }
00573 
00574   for( int i=0; i<72; i++ ) {
00575     for( int k=0; k<12; k++ ) {
00576       for(j=0;j<static_cast<int>(nEtfSpeed);j++) {
00577         cnvEtfSpeed[j] = btof->getEtfSpeed(i,k,j);
00578       }
00579       for(j=0;j<static_cast<int>(nEtfPar);j++){
00580         cnvEtfPar[j] = btof->getEtfPcombine(i,k,j);
00581         cnvEtfPar1[j] = btof->getEtfPleft(i,k,j);
00582         cnvEtfPar2[j] = btof->getEtfPright(i,k,j);
00583       }
00584       etftree -> Fill();
00585     }
00586   }
00587 
00588  //write  etftree----------------------------------------------------------------
00589   double cnvEtfBunchP[nEtfBunch];
00590 
00591   char etfbunchname[8], ietfbunchname[8];
00592   TTree *etfbunchtree = new TTree("EtfTofBunch", "EtfTofBunch");
00593   for( unsigned int i=0; i<nEtfBunch; i++ ) {
00594     sprintf(  etfbunchname, "pbunch%i",   i );
00595     sprintf( ietfbunchname, "pbunch%i/D", i );
00596     etfbunchtree -> Branch( etfbunchname, &cnvEtfBunchP[i], ietfbunchname );
00597   }
00598 
00599   for(j=0;j<static_cast<int>(nEtfBunch);j++) {
00600     cnvEtfBunchP[j] = btof->getEtfPBunch(j);
00601   }
00602   etfbunchtree -> Fill();
00603 
00604 
00605   //  write all the trees
00606   btoftree -> Write();
00607   etoftree -> Write();
00608   etftree -> Write();
00609   etfbunchtree -> Write();
00610   delete btoftree;
00611   delete etoftree;
00612   delete etftree;
00613   delete etfbunchtree;
00614   closeWrite();
00615   log<<MSG::INFO<<"successfully create RootFile"<<endreq;
00616   
00617   return sc;
00618 }

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

Parameters:
pTDSObj Pointer to tds object to be converted
pRootObj Pointer to destination root object
...maybe don't need pRootObj argument; keep this as the (protected) data member m_rootObj. Or else this routine could set the protected member to this passed-in value

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]

Definition at line 82 of file RootCalBaseCnv.cxx.

00082                                     {
00083   return Converter::finalize();
00084 }

ICalibRootSvc* RootCalBaseCnv::getCalibRootSvc (  )  [inline, inherited]

Definition at line 58 of file RootCalBaseCnv.h.

References RootCalBaseCnv::m_rootSvc.

00058                                    {
00059     return m_rootSvc;
00060   }

StatusCode RootTofCalibDataCnv::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 64 of file RootTofCalibDataCnv.cxx.

References Bes_Common::DEBUG, calibUtil::ERROR, genRecEmupikp::i, RootCalBaseCnv::m_inFile, msgSvc(), nBarAtten, nBarOffset, nBarPar, nBarParOff, nBarSigCnt, nBarSigCor, nBarSigma, nBarSpeed, nEndAtten, nEndPar, nEndSigma, nEndSpeed, nEtfBunch, nEtfPar, nEtfSpeed, RootCalBaseCnv::openRead(), CalibData::eTofCalibBase::setAtten(), CalibData::bTofCalibBase::setAtten(), CalibData::tofCalibInfoBase::setBrEast(), CalibData::tofCalibInfoBase::setBrWest(), CalibData::tofCalibInfoBase::setEndcap(), CalibData::eTofCalibBase::setFP(), CalibData::bTofCalibBase::setFPcounter(), CalibData::bTofCalibBase::setFPleft(), CalibData::bTofCalibBase::setFPright(), CalibData::tofCalibInfoBase::setMisLable(), CalibData::bTofCommonCalibBase::setOffset(), CalibData::etfCalibBase::setP(), CalibData::eTofCalibBase::setP(), CalibData::etfCalibBase::setP1(), CalibData::bTofCalibBase::setP1(), CalibData::etfCalibBase::setP2(), CalibData::bTofCalibBase::setP2(), CalibData::etfBunchCalibBase::setPBunch(), CalibData::bTofCalibBase::setPoff1_bunch0(), CalibData::bTofCalibBase::setPoff1_bunch1(), CalibData::bTofCalibBase::setPoff1_bunch2(), CalibData::bTofCalibBase::setPoff1_bunch3(), CalibData::bTofCalibBase::setPoff2_bunch0(), CalibData::bTofCalibBase::setPoff2_bunch1(), CalibData::bTofCalibBase::setPoff2_bunch2(), CalibData::bTofCalibBase::setPoff2_bunch3(), CalibData::tofCalibInfoBase::setQCorr(), CalibData::tofCalibInfoBase::setQElec(), CalibData::tofCalibInfoBase::setRunBegin(), CalibData::tofCalibInfoBase::setRunEnd(), CalibData::bTofCommonCalibBase::setSigmaCorr(), CalibData::etfCalibBase::setSpeed(), CalibData::eTofCalibBase::setSpeed(), CalibData::bTofCalibBase::setSpeed(), and CalibData::tofCalibInfoBase::setVersion().

00065                                                                 {
00066 
00067   MsgStream log(msgSvc(), "RootTofCalibDataCnv");
00068   log<<MSG::DEBUG<<"SetProperty"<<endreq;
00069  
00070  // open the file
00071   StatusCode sc = openRead(fname);
00072   if(!sc)
00073     { log<<MSG::ERROR<<"unable to open files"<<endreq;
00074     }
00075  
00076   CalibData::bTofCalibBase bTof;
00077   CalibData::eTofCalibBase eTof;
00078   CalibData::etfCalibBase  etf;
00079   CalibData::etfBunchCalibBase  etfBunch;
00080   CalibData::bTofCommonCalibBase bTofCommon;
00081   CalibData::tofCalibInfoBase tofinfo;
00082 
00083   std::vector<CalibData::bTofCalibBase> tmpbTof;
00084   std::vector<CalibData::eTofCalibBase> tmpeTof;
00085   std::vector<CalibData::etfCalibBase>  tmpetf;
00086   std::vector<CalibData::etfBunchCalibBase>  tmpetfBunch;
00087   std::vector<CalibData::bTofCommonCalibBase> tmpbTofCommon;
00088   std::vector<CalibData::tofCalibInfoBase> tofinfoCol;
00089    // Read in the object
00090   int cnt;
00091   // read btoftree ------------------------------------------------------------
00092 
00093   double cnvBarAtten[nBarAtten];
00094   double cnvBarSpeed[nBarSpeed];
00095   double cnvBarPar1[nBarPar];
00096   double cnvBarPar2[nBarPar];
00097   double cnvBarParOff1_bunch0[nBarParOff];
00098   double cnvBarParOff2_bunch0[nBarParOff];
00099   double cnvBarParOff1_bunch1[nBarParOff];
00100   double cnvBarParOff2_bunch1[nBarParOff];
00101   double cnvBarParOff1_bunch2[nBarParOff];
00102   double cnvBarParOff2_bunch2[nBarParOff];
00103   double cnvBarParOff1_bunch3[nBarParOff];
00104   double cnvBarParOff2_bunch3[nBarParOff];
00105   double cnvFLeft[nBarSigma];
00106   double cnvFRight[nBarSigma];
00107   double cnvFCount[nBarSigCnt];
00108 
00109   TTree *btoftree = (TTree*)m_inFile -> Get("BarTofPar");
00110 
00111   char brname[10];
00112   for( unsigned int i=0; i<nBarAtten; i++ ) {
00113     sprintf( brname, "Atten%i", i );
00114     btoftree -> SetBranchAddress( brname, &cnvBarAtten[i] );    
00115   }
00116   for( unsigned int i=0; i<nBarSpeed; i++ ) {
00117     sprintf( brname, "Speed%i", i );
00118     btoftree -> SetBranchAddress( brname, &cnvBarSpeed[i] );    
00119   }
00120   for( unsigned int i=0; i<nBarPar; i++ ) {
00121     sprintf( brname, "P%i", i );
00122     btoftree -> SetBranchAddress( brname, &cnvBarPar1[i] );    
00123   }
00124   for( unsigned int i=0; i<nBarPar; i++ ) {
00125     sprintf( brname, "P%i", i+nBarPar );
00126     btoftree -> SetBranchAddress( brname, &cnvBarPar2[i] );    
00127   }
00128   for( unsigned int i=0; i<nBarParOff; i++ ) {
00129     sprintf( brname, "Bunch0_Poff%i", i );
00130     btoftree -> SetBranchAddress( brname, &cnvBarParOff1_bunch0[i] );    
00131   }
00132   for( unsigned int i=0; i<nBarParOff; i++ ) {
00133     sprintf( brname, "Bunch0_Poff%i", i+nBarParOff );
00134     btoftree -> SetBranchAddress( brname, &cnvBarParOff2_bunch0[i] );    
00135   }
00136   for( unsigned int i=0; i<nBarParOff; i++ ) {
00137     sprintf( brname, "Bunch1_Poff%i", i );
00138     btoftree -> SetBranchAddress( brname, &cnvBarParOff1_bunch1[i] );
00139   }
00140   for( unsigned int i=0; i<nBarParOff; i++ ) {
00141     sprintf( brname, "Bunch1_Poff%i", i+nBarParOff );
00142     btoftree -> SetBranchAddress( brname, &cnvBarParOff2_bunch1[i] );
00143   }
00144   for( unsigned int i=0; i<nBarParOff; i++ ) {
00145     sprintf( brname, "Bunch2_Poff%i", i );
00146     btoftree -> SetBranchAddress( brname, &cnvBarParOff1_bunch2[i] );
00147   }
00148   for( unsigned int i=0; i<nBarParOff; i++ ) {
00149     sprintf( brname, "Bunch2_Poff%i", i+nBarParOff );
00150     btoftree -> SetBranchAddress( brname, &cnvBarParOff2_bunch2[i] );
00151   }
00152   for( unsigned int i=0; i<nBarParOff; i++ ) {
00153     sprintf( brname, "Bunch3_Poff%i", i );
00154     btoftree -> SetBranchAddress( brname, &cnvBarParOff1_bunch3[i] );
00155   }
00156   for( unsigned int i=0; i<nBarParOff; i++ ) {
00157     sprintf( brname, "Bunch3_Poff%i", i+nBarParOff );
00158     btoftree -> SetBranchAddress( brname, &cnvBarParOff2_bunch3[i] );
00159   }
00160   for( unsigned int i=0; i<nBarSigma; i++ ) {
00161     sprintf( brname, "FLeft%i", i );
00162     btoftree -> SetBranchAddress( brname, &cnvFLeft[i] );    
00163   }
00164   for( unsigned int i=0; i<nBarSigma; i++ ) {
00165     sprintf( brname, "FRight%i", i );
00166     btoftree -> SetBranchAddress( brname, &cnvFRight[i] );    
00167   }
00168   for( unsigned int i=0; i<nBarSigCnt; i++ ) {
00169     sprintf( brname, "FCounter%i", i );
00170     btoftree -> SetBranchAddress( brname, &cnvFCount[i] );    
00171   }
00172 
00173   for(cnt=0; cnt<176; cnt++){
00174     btoftree -> GetEntry(cnt);
00175     bTof.setAtten( cnvBarAtten );
00176     bTof.setSpeed( cnvBarSpeed );
00177     bTof.setP1( cnvBarPar1 );
00178     bTof.setP2( cnvBarPar2 );
00179     bTof.setPoff1_bunch0( cnvBarParOff1_bunch0 );
00180     bTof.setPoff2_bunch0( cnvBarParOff2_bunch0 );
00181     bTof.setPoff1_bunch1( cnvBarParOff1_bunch1 );
00182     bTof.setPoff2_bunch1( cnvBarParOff2_bunch1 );
00183     bTof.setPoff1_bunch2( cnvBarParOff1_bunch2 );
00184     bTof.setPoff2_bunch2( cnvBarParOff2_bunch2 );
00185     bTof.setPoff1_bunch3( cnvBarParOff1_bunch3 );
00186     bTof.setPoff2_bunch3( cnvBarParOff2_bunch3 );
00187     bTof.setFPleft( cnvFLeft );
00188     bTof.setFPright( cnvFRight );
00189     bTof.setFPcounter( cnvFCount );
00190     tmpbTof.push_back(bTof);
00191   }
00192 
00193   //read etoftree
00194   double cnvEndAtten[nEndAtten];
00195   double cnvEndSpeed[nEndSpeed];
00196   double cnvEndPar[nEndPar];
00197   double cnvEndFPar[nEndSigma];
00198 
00199   TTree *etoftree = (TTree*)m_inFile -> Get("EndTofPar");
00200 
00201   char ecname[10];
00202   for( unsigned int i=0; i<nEndAtten; i++ ) {
00203     sprintf( ecname, "Atten%i", i );
00204     etoftree -> SetBranchAddress( ecname, &cnvEndAtten[i] );
00205   }
00206   for( unsigned int i=0; i<nEndSpeed; i++ ) {
00207     sprintf( ecname, "Speed%i", i );
00208     etoftree -> SetBranchAddress( ecname, &cnvEndSpeed[i] );
00209   }
00210   for( unsigned int i=0; i<nEndPar; i++ ) {
00211     sprintf( ecname, "P%i", i );
00212     etoftree -> SetBranchAddress( ecname, &cnvEndPar[i] );
00213   }
00214   for( unsigned int i=0; i<nEndSigma; i++ ) {
00215     sprintf( ecname, "FCounter%i", i );
00216     etoftree -> SetBranchAddress( ecname, &cnvEndFPar[i] );
00217   }
00218 
00219   for(cnt=0; cnt<96; cnt++){
00220     etoftree -> GetEntry(cnt);
00221     eTof.setAtten( cnvEndAtten );
00222     eTof.setSpeed( cnvEndSpeed );
00223     eTof.setP( cnvEndPar );
00224     eTof.setFP( cnvEndFPar );
00225     tmpeTof.push_back(eTof);
00226   }
00227 
00228   //read etftree
00229   double cnvEtfSpeed[nEtfSpeed];
00230   double cnvEtfPar[nEtfPar];
00231   double cnvEtfPar1[nEtfPar];
00232   double cnvEtfPar2[nEtfPar];
00233 
00234   if( NULL!=m_inFile->Get("EtfTofPar") ) {
00235     TTree *etftree = (TTree*)m_inFile -> Get("EtfTofPar");
00236 
00237     char etfname[10];
00238     for( unsigned int i=0; i<nEtfSpeed; i++ ) {
00239       sprintf( etfname, "Speed%i", i );
00240       etftree -> SetBranchAddress( etfname, &cnvEtfSpeed[i] );
00241     }
00242     for( unsigned int i=0; i<nEtfPar; i++ ) {
00243       sprintf( etfname, "P%i", i );
00244       etftree -> SetBranchAddress( etfname, &cnvEtfPar[i] );    
00245     }
00246     for( unsigned int i=0; i<nEtfPar; i++ ) {
00247       sprintf( etfname, "P%i", i+nEtfPar );
00248       etftree -> SetBranchAddress( etfname, &cnvEtfPar1[i] );    
00249     }
00250     for( unsigned int i=0; i<nEtfPar; i++ ) {
00251       sprintf( etfname, "P%i", i+2*nEtfPar );
00252       etftree -> SetBranchAddress( etfname, &cnvEtfPar2[i] );    
00253     }
00254 
00255     for(cnt=0; cnt<(72*12); cnt++){
00256       etftree -> GetEntry(cnt);
00257       etf.setSpeed( cnvEtfSpeed );
00258       etf.setP( cnvEtfPar );
00259       etf.setP1( cnvEtfPar1 );
00260       etf.setP2( cnvEtfPar2 );
00261       tmpetf.push_back(etf);
00262     }
00263   }
00264 
00265   //read etfbunchtree
00266   double cnvEtfBunchP[nEtfBunch];
00267 
00268   if( NULL!=m_inFile->Get("EtfTofBunch") ) {
00269     TTree *etfbunchtree = (TTree*)m_inFile -> Get("EtfTofBunch");
00270 
00271     char etfbunchname[10];
00272     for( unsigned int i=0; i<nEtfBunch; i++ ) {
00273       sprintf( etfbunchname, "pbunch%i", i );
00274       etfbunchtree -> SetBranchAddress( etfbunchname, &cnvEtfBunchP[i] );
00275     }
00276 
00277     int entries= etfbunchtree->GetEntries();
00278     for(cnt=0;cnt<entries;cnt++){
00279       etfbunchtree -> GetEntry(cnt);
00280       etfBunch.setPBunch( cnvEtfBunchP );
00281       tmpetfBunch.push_back( etfBunch );
00282     }
00283   }
00284 
00285   //read bTofCommonCalibBase
00286   double cnvBarSigCor[nBarSigCor];
00287   double cnvBarOffset[nBarOffset];
00288   TTree *btofcommontree = (TTree*)m_inFile -> Get("BarTofParCommon");
00289   for( unsigned int i=0; i<nBarSigCor; i++ ) {
00290     sprintf( brname, "sigmaCorr%i", i );
00291     btofcommontree-> SetBranchAddress( brname, &cnvBarSigCor[i] );
00292   }
00293   for( unsigned int i=0; i<nBarOffset; i++ ) {
00294     sprintf( brname, "t0offset%i", i );
00295     btofcommontree-> SetBranchAddress( brname, &cnvBarOffset[i]);
00296   }
00297 
00298   int entries = btofcommontree->GetEntries();
00299   for(cnt=0;cnt<entries;cnt++){
00300     btofcommontree->GetEntry(cnt);
00301     bTofCommon.setSigmaCorr( cnvBarSigCor );
00302     bTofCommon.setOffset( cnvBarOffset );
00303     tmpbTofCommon.push_back(bTofCommon);   
00304   }
00305   
00306   int m_run1, m_run2, m_version;
00307   int m_qCorr, m_qElec, m_misLable;
00308   int m_tofidEast[5], m_tofidWest[5], m_tofidEndcap[5];
00309 
00310   TTree *CalibInfo = (TTree*)m_inFile -> Get("CalibInfo");
00311   CalibInfo->SetBranchAddress("Run1",    &m_run1           );
00312   CalibInfo->SetBranchAddress("Run2",    &m_run2           );
00313   CalibInfo->SetBranchAddress("Version", &m_version        );
00314   CalibInfo->SetBranchAddress("ebrId0",  &m_tofidEast[0]   );
00315   CalibInfo->SetBranchAddress("ebrId1",  &m_tofidEast[1]   );
00316   CalibInfo->SetBranchAddress("ebrId2",  &m_tofidEast[2]   );
00317   CalibInfo->SetBranchAddress("ebrId3",  &m_tofidEast[3]   );
00318   CalibInfo->SetBranchAddress("ebrId4",  &m_tofidEast[4]   );
00319   CalibInfo->SetBranchAddress("ecId0",   &m_tofidEndcap[0] );
00320   CalibInfo->SetBranchAddress("ecId1",   &m_tofidEndcap[1] );
00321   CalibInfo->SetBranchAddress("ecId2",   &m_tofidEndcap[2] );
00322   CalibInfo->SetBranchAddress("ecId3",   &m_tofidEndcap[3] );
00323   CalibInfo->SetBranchAddress("ecId4",   &m_tofidEndcap[4] );
00324   CalibInfo->SetBranchAddress("wbrId0",  &m_tofidWest[0]   );
00325   CalibInfo->SetBranchAddress("wbrId1",  &m_tofidWest[1]   );
00326   CalibInfo->SetBranchAddress("wbrId2",  &m_tofidWest[2]   );
00327   CalibInfo->SetBranchAddress("wbrId3",  &m_tofidWest[3]   );
00328   CalibInfo->SetBranchAddress("wbrId4",  &m_tofidWest[4]   );
00329   CalibInfo->SetBranchAddress("misLable",&m_misLable       );
00330   CalibInfo->SetBranchAddress("qCorr",   &m_qCorr          );
00331   CalibInfo->SetBranchAddress("qElec",   &m_qElec          );
00332 
00333   entries= CalibInfo->GetEntries();
00334   for(cnt=0;cnt<entries;cnt++){
00335     CalibInfo->GetEntry(cnt);
00336     tofinfo.setRunBegin(m_run1);
00337     tofinfo.setRunEnd(m_run2);
00338     tofinfo.setVersion(m_version);
00339     tofinfo.setQCorr(m_qCorr);
00340     tofinfo.setQElec(m_qElec);
00341     tofinfo.setMisLable(m_misLable);
00342     tofinfo.setBrEast(m_tofidEast);      
00343     tofinfo.setBrWest(m_tofidWest);
00344     tofinfo.setEndcap(m_tofidEndcap); 
00345     tofinfoCol.push_back(tofinfo);  
00346   }
00347 
00348   CalibData::TofCalibData *tmpObject = new CalibData::TofCalibData(&tmpbTof,&tmpbTofCommon,&tmpeTof,&tmpetf,&tmpetfBunch,&tofinfoCol);
00349   
00350   refpObject=tmpObject;
00351 
00352   return StatusCode::SUCCESS;
00353 }

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().

00323                                                                       {
00324   return StatusCode::SUCCESS;
00325 }

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.

Parameters:
pRootObj pointer to the ROOT object
refpObject the object to be built
address the opaque address for this object
Returns:
status depending on the completion of the call

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 & RootTofCalibDataCnv::objType (  )  const

Definition at line 56 of file RootTofCalibDataCnv.cxx.

References CLID_Calib_TofCal.

00056                                                {
00057   return CLID_Calib_TofCal;
00058 }

StatusCode RootCalBaseCnv::openRead ( const std::string fname  )  [protected, inherited]

Utility for "leaf" converters to call

Parameters:
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(), RootTofElecDataCnv::i_createObj(), 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)

Parameters:
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(), 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 }

template<class Ty1, class Ty2>
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 RootTofCalibDataCnv::repSvcType (  )  const [inline, virtual]

Definition at line 34 of file RootTofCalibDataCnv.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;}


Friends And Related Function Documentation

friend class CnvFactory< RootTofCalibDataCnv > [friend]

Definition at line 22 of file RootTofCalibDataCnv.h.


Member Data Documentation

TFile* RootCalBaseCnv::m_inFile [protected, inherited]

Definition at line 207 of file RootCalBaseCnv.h.

Referenced by RootCalBaseCnv::closeRead(), RootCalBaseCnv::doClean(), RootTofSimDataCnv::i_createObj(), RootTofElecDataCnv::i_createObj(), 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]

Definition at line 195 of file RootCalBaseCnv.h.

Referenced by RootCalBaseCnv::initialize().

ICalibMetaCnvSvc* RootCalBaseCnv::m_metaSvc [protected, inherited]

Definition at line 194 of file RootCalBaseCnv.h.

Referenced by RootCalBaseCnv::initialize().

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]

Definition at line 205 of file RootCalBaseCnv.h.

Referenced by RootCalBaseCnv::doClean().

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.


Generated on Tue Nov 29 23:35:52 2016 for BOSS_7.0.2 by  doxygen 1.4.7