TreeTofCalibDataCnv Class Reference

#include <TreeTofCalibDataCnv.h>

Inheritance diagram for TreeTofCalibDataCnv:

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

Public Types

typedef Ty1 source
typedef Ty2 destination

Public Member Functions

const CLID & objType () const
 TreeTofCalibDataCnv (ISvcLocator *svc)
virtual ~TreeTofCalibDataCnv ()
virtual long repSvcType () const
virtual StatusCode initialize ()
virtual StatusCode finalize ()
virtual StatusCode createObj (IOpaqueAddress *addr, DataObject *&refpObject)
ICalibTreeSvcgetCalibTreeSvc ()
virtual StatusCode createRoot (const std::string &fname, CalibData::CalibBase1 *pTDSObj)
destinationoperator (const source &) const

Static Public Member Functions

static const CLID & classID ()
static const unsigned char storageType ()

Protected Member Functions

virtual StatusCode i_createObj (IOpaqueAddress *address, DataObject *&refpObject)
virtual StatusCode internalCreateObj (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)
void setBaseInfo (CalibData::CalibBase1 *pObj)
 Another utility for derived classes to use.
virtual destinationconvert (const source &) const =0

Protected Attributes

ICalibTreeSvcm_treeSvc
ICalibMetaCnvSvcm_metaSvc
IInstrumentNamem_instrSvc
int m_serNo
int m_runfrm
int m_runto
TFile * m_outFile
TTree * m_ttree
TFile * m_inFile
TDirectory * m_saveDir

Friends

class CnvFactory< TreeTofCalibDataCnv >

Detailed Description

Base class for CAL calibration converters from Ttrees to TCDS. All such converters need to do certain things, which are handled here. Methods common to *all* calibrations are in the base class TreeCalBaseCnv

Author:
huang bin

Definition at line 20 of file TreeTofCalibDataCnv.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

TreeTofCalibDataCnv::TreeTofCalibDataCnv ( ISvcLocator *  svc  ) 

Definition at line 48 of file TreeTofCalibDataCnv.cxx.

00048                                                           :
00049         TreeCalBaseCnv(svc, CLID_Calib_TofCal) { 
00050 
00051         }

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

Definition at line 29 of file TreeTofCalibDataCnv.h.

00029 {};


Member Function Documentation

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

Definition at line 58 of file TreeTofCalibDataCnv.cxx.

References CLID_Calib_TofCal.

00058                                          {
00059         return CLID_Calib_TofCal;
00060 }

template<class Ty1, class Ty2>
virtual destination* Converter< Ty1, Ty2 >::convert ( const source  )  const [protected, pure virtual, inherited]

StatusCode TreeCalBaseCnv::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 111 of file TreeCalBaseCnv.cxx.

References Bes_Common::DEBUG, TreeCalBaseCnv::internalCreateObj(), and msgSvc().

00112                                                            {
00113   //  StatusCode ret;
00114 
00115   // first do the things we always need:
00116   //   First string parameter of opaque address is file ident
00117   MsgStream log(msgSvc(), "TreeCalBaseCnv");
00118    log << MSG::DEBUG<<"TreeCalBaseCnv::createObj( starting ...."<<endreq;
00119  //  const std::string* par = addr->par();
00120 
00121  // std::string par0 = par[0];
00122    
00123 //  return internalCreateObj(par0, refpObject, addr);
00124   return internalCreateObj(refpObject, addr);
00125 
00126 }

StatusCode TreeCalBaseCnv::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.

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

Definition at line 89 of file TreeCalBaseCnv.cxx.

References calibUtil::ERROR, and msgSvc().

00090                                                                        {
00091   MsgStream log(msgSvc(), "TreeCalBaseCnv");
00092   log << MSG::ERROR 
00093       << "createRoot method not implemented for this calibration type" 
00094       << endreq;
00095   return StatusCode::FAILURE;
00096 }

StatusCode TreeCalBaseCnv::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 100 of file TreeCalBaseCnv.cxx.

00101                                                           {
00102 
00103   // Get instrument name from InstrumentName service  Now handled by 
00104   // TreeCalBaseCnv
00105   //  TString instr = TString((m_instrSvc->getInstrumentName()).c_str());
00106   //  pRootObj->setInstrument(instr);
00107   return StatusCode::SUCCESS;
00108 }

StatusCode TreeCalBaseCnv::finalize (  )  [virtual, inherited]

Definition at line 82 of file TreeCalBaseCnv.cxx.

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

ICalibTreeSvc* TreeCalBaseCnv::getCalibTreeSvc (  )  [inline, inherited]

Definition at line 58 of file TreeCalBaseCnv.h.

References TreeCalBaseCnv::m_treeSvc.

00058                                    {
00059     return m_treeSvc;
00060   }

StatusCode TreeTofCalibDataCnv::i_createObj ( IOpaqueAddress *  address,
DataObject *&  refpObject 
) [protected, virtual]

This creates the transient representation of an object from the corresponding ROOT object. This actually does the "new" operation and deals with the attributes of the node. This base class implementation does nothing; it should not normally be called because it doesn't correspond to any TCDS class. Instead, i_createObj of some derived class will be called.

Parameters:
fname The ROOT file to be read in to be used to builds the object
refpObject the object to be built
Returns:
status depending on the completion of the call

Reimplemented from TreeCalBaseCnv.

Definition at line 62 of file TreeTofCalibDataCnv.cxx.

References Bes_Common::DEBUG, genRecEmupikp::i, msgSvc(), nBarAtten, nBarOffset, nBarPar, nBarParOff, nBarSigCnt, nBarSigCor, nBarSigma, nBarSpeed, nEndAtten, nEndPar, nEndSigma, nEndSpeed, nEtfBunch, nEtfPar, nEtfSpeed, TreeAddress::pp(), 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().

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

StatusCode TreeCalBaseCnv::i_processObj ( DataObject *  pObject,
IOpaqueAddress *  address 
) [protected, virtual, inherited]

In case there is additional work to do on the created object.

Definition at line 190 of file TreeCalBaseCnv.cxx.

Referenced by TreeCalBaseCnv::internalCreateObj().

00191                                                                       {
00192   return StatusCode::SUCCESS;
00193 }

StatusCode TreeCalBaseCnv::initialize (  )  [virtual, inherited]

Definition at line 46 of file TreeCalBaseCnv.cxx.

References IID_ICalibMetaCnvSvc(), IID_ICalibTreeSvc(), IID_IInstrumentName(), TreeCalBaseCnv::m_instrSvc, TreeCalBaseCnv::m_metaSvc, and TreeCalBaseCnv::m_treeSvc.

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 ("CalibTreeCnvSvc",
00063                                 IID_ICalibTreeSvc,
00064                                 (IInterface*&) m_treeSvc);
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 TreeCalBaseCnv::internalCreateObj ( 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 131 of file TreeCalBaseCnv.cxx.

References Bes_Common::DEBUG, calibUtil::ERROR, TreeAddress::getRunFrom(), TreeAddress::getRunTo(), TreeCalBaseCnv::i_createObj(), TreeCalBaseCnv::i_processObj(), TreeCalBaseCnv::m_runfrm, TreeCalBaseCnv::m_runto, msgSvc(), TreeCalBaseCnv::setBaseInfo(), and Bes_Common::WARNING.

Referenced by TreeCalBaseCnv::createObj().

00132                                                                    {
00133 
00134   MsgStream log(msgSvc(), "TreeCalBaseCnv");
00135    log << MSG::DEBUG<<"TreeCalBaseCnv::internalCreateObj( starting ..... "<<endreq;
00136    TreeCalBaseCnv* converter = this;
00137   CLID classId = address->clID();
00138 
00139   IConverter* conv = this->conversionSvc()->converter(classId);
00140   if (0 == conv) {
00141     log << MSG::WARNING
00142         << "No proper converter found for classID " << classId
00143             << ", the default converter"
00144             << " will be used. " << endreq;
00145   } else {
00146     converter = dynamic_cast <TreeCalBaseCnv*> (conv);
00147     if (0 == converter) {
00148       log << MSG::ERROR
00149           << "The converter found for classID " << classId
00150               << " was not a descendent of TreeCalBaseCnv as it should be "
00151               << "( was of type " << typeid (*converter).name() << "). "
00152               << "The default converter will be used" << endreq;
00153       converter = this;
00154     }
00155   }
00156 
00157   TreeAddress* treeAddress =  dynamic_cast <TreeAddress*> (address);
00158   m_runfrm = treeAddress->getRunFrom();
00159   m_runto = treeAddress->getRunTo();
00160     //m_runfrm =*( address->ipar());
00161     //m_runto =*( address->ipar()+1);
00162  //   m_runfrm = 100;
00163  //   m_runto =1000;
00164    // creates an object for the node found
00165    StatusCode sc = converter->i_createObj(address, refpObject);
00166      if (sc.isFailure()) {
00167     return sc;
00168   } 
00169      CalibData::CalibBase1* tmpObject =  dynamic_cast <CalibData::CalibBase1*> (refpObject);
00170      setBaseInfo(tmpObject);
00171   // ends up the object construction
00172   sc = converter->i_processObj(refpObject, address);
00173   if (sc.isSuccess()) {
00174     log << MSG::DEBUG << "Successfully created calib. object " << endreq;
00175   }
00176  // closeRead();
00177   return sc;
00178 }

const CLID & TreeTofCalibDataCnv::objType (  )  const

Definition at line 54 of file TreeTofCalibDataCnv.cxx.

References CLID_Calib_TofCal.

00054                                                {
00055         return CLID_Calib_TofCal;
00056 }

template<class Ty1, class Ty2>
destination* Converter< Ty1, Ty2 >::operator ( const source  )  const [inline, inherited]

virtual long TreeTofCalibDataCnv::repSvcType (  )  const [inline, virtual]

Definition at line 34 of file TreeTofCalibDataCnv.h.

References CALIBTREE_StorageType.

00034                                   { 
00035           return CALIBTREE_StorageType; 
00036       } 

void TreeCalBaseCnv::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 196 of file TreeCalBaseCnv.cxx.

References Bes_Common::DEBUG, TreeCalBaseCnv::m_runfrm, TreeCalBaseCnv::m_runto, msgSvc(), CalibData::CalibBase1::setrunfrm(), and CalibData::CalibBase1::setrunto().

Referenced by TreeCalBaseCnv::internalCreateObj().

00196                                                           {
00197    MsgStream log(msgSvc(), "TreeCalBaseCnv");
00198    log << MSG::DEBUG<<"set the runfrm and runto Numbers in the converter"<<endreq;
00199   pObj->setrunfrm(m_runfrm);
00200   pObj->setrunto(m_runto);
00201 }

static const unsigned char TreeCalBaseCnv::storageType (  )  [inline, static, inherited]

Definition at line 62 of file TreeCalBaseCnv.h.

References CALIBTREE_StorageType.

00062 {return CALIBTREE_StorageType;}


Friends And Related Function Documentation

friend class CnvFactory< TreeTofCalibDataCnv > [friend]

Definition at line 22 of file TreeTofCalibDataCnv.h.


Member Data Documentation

TFile* TreeCalBaseCnv::m_inFile [protected, inherited]

Definition at line 212 of file TreeCalBaseCnv.h.

IInstrumentName* TreeCalBaseCnv::m_instrSvc [protected, inherited]

Definition at line 202 of file TreeCalBaseCnv.h.

Referenced by TreeCalBaseCnv::initialize().

ICalibMetaCnvSvc* TreeCalBaseCnv::m_metaSvc [protected, inherited]

Definition at line 201 of file TreeCalBaseCnv.h.

Referenced by TreeCalBaseCnv::initialize().

TFile* TreeCalBaseCnv::m_outFile [protected, inherited]

Definition at line 209 of file TreeCalBaseCnv.h.

int TreeCalBaseCnv::m_runfrm [protected, inherited]

Definition at line 205 of file TreeCalBaseCnv.h.

Referenced by TreeCalBaseCnv::internalCreateObj(), and TreeCalBaseCnv::setBaseInfo().

int TreeCalBaseCnv::m_runto [protected, inherited]

Definition at line 206 of file TreeCalBaseCnv.h.

Referenced by TreeCalBaseCnv::internalCreateObj(), and TreeCalBaseCnv::setBaseInfo().

TDirectory* TreeCalBaseCnv::m_saveDir [protected, inherited]

Definition at line 214 of file TreeCalBaseCnv.h.

int TreeCalBaseCnv::m_serNo [protected, inherited]

Definition at line 204 of file TreeCalBaseCnv.h.

ICalibTreeSvc* TreeCalBaseCnv::m_treeSvc [protected, inherited]

Definition at line 200 of file TreeCalBaseCnv.h.

Referenced by TreeCalBaseCnv::getCalibTreeSvc(), and TreeCalBaseCnv::initialize().

TTree* TreeCalBaseCnv::m_ttree [protected, inherited]

Definition at line 210 of file TreeCalBaseCnv.h.


Generated on Tue Nov 29 23:36:11 2016 for BOSS_7.0.2 by  doxygen 1.4.7