CalibTreeCnvSvc Class Reference

--------------------------------------------------------------------------- More...

#include <CalibTreeCnvSvc.h>

Inheritance diagram for CalibTreeCnvSvc:

ICalibTreeSvc List of all members.

Public Member Functions

virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvInterface)
virtual StatusCode updateObj (IOpaqueAddress *pAddress, DataObject *pObject)
virtual StatusCode initialize ()
virtual StatusCode finalize ()
virtual StatusCode createAddress (long svc_type, const CLID &clid, const std::string *par, const unsigned long *ip, IOpaqueAddress *&refpAddress)
std::string getrootfile ()

Static Public Member Functions

static const InterfaceID & interfaceID ()

Protected Member Functions

 CalibTreeCnvSvc (const std::string &name, ISvcLocator *svc)
virtual ~CalibTreeCnvSvc ()

Private Attributes

IConversionSvc * m_detPersSvc
 Handle to the IConversionSvc interface of the DetectorPersistencySvc.
IDataProviderSvc * m_detDataSvc
 Handle to IDataProviderSvc interface of CalibDataSvc.
std::string m_rootfile [4]

Friends

class SvcFactory< CalibTreeCnvSvc >
 Only factories can access protected constructors.

Detailed Description

---------------------------------------------------------------------------

A conversion service for GLAST calibration bulk data in ROOT format.

Author:
J. Bogart
Date:
July 2004

Definition at line 34 of file CalibTreeCnvSvc.h.


Constructor & Destructor Documentation

CalibTreeCnvSvc::CalibTreeCnvSvc ( const std::string name,
ISvcLocator *  svc 
) [protected]

Definition at line 21 of file CalibTreeCnvSvc.cxx.

00022                                                  :
00023   ConversionSvc(name, svc, CALIBTREE_StorageType),
00024   m_detPersSvc(0), m_detDataSvc(0)   {
00025   //huangb add
00026 }

virtual CalibTreeCnvSvc::~CalibTreeCnvSvc (  )  [inline, protected, virtual]

Definition at line 42 of file CalibTreeCnvSvc.h.

00042 {}


Member Function Documentation

StatusCode CalibTreeCnvSvc::createAddress ( long  svc_type,
const CLID &  clid,
const std::string par,
const unsigned long *  ip,
IOpaqueAddress *&  refpAddress 
) [virtual]

Create a ROOT address using explicit arguments to identify a single object

Parameters:
svc_type the service type
CLID the CLID of the ROOT Element for which an address is created
par an array of three strings containing the format version, calibration type name and the flavor, in this order
ip has a single element, the serial number of the MySQL row which corresponds to this element
refpAddress the new address created
Returns:
a StatusCode giving the status of the address creation

Definition at line 124 of file CalibTreeCnvSvc.cxx.

References CALIBTREE_StorageType, CLID_Calib_DedxCal, CLID_Calib_EmcCal, CLID_Calib_MdcCal, CLID_Calib_TofCal, calibUtil::ERROR, msgSvc(), deljobs::string, and Bes_Common::WARNING.

00128                                                                           {
00129  //createAddress of   CalibTreeCnvSvc
00130     MsgStream log( msgSvc(), name() );
00131     if (svc_type != CALIBTREE_StorageType) {
00132     log << MSG::ERROR << "bad storage type" << (int)svc_type << endreq;
00133     return StatusCode::FAILURE;
00134   }
00135     std::string dataIdent;
00136     std::string fullpath;
00137     int index ;
00138     if(clid==CLID_Calib_MdcCal) 
00139       { index=0;}
00140     else if(clid==CLID_Calib_TofCal)
00141       {index =1;}
00142     else if(clid==CLID_Calib_DedxCal)
00143       {index =2;}
00144     else if(clid==CLID_Calib_EmcCal)
00145       {index =3;}
00146     else{ 
00147       log << MSG::WARNING<<"Wrong CLID"<<endreq;
00148     }
00149     
00150   //see if svctype set in the CalibDataSvc is MYSQL_StorageType or  CALIBROOT_StorageType
00151 /*  IInstrumentName* iInstrumentName;
00152   StatusCode sc = m_detDataSvc->queryInterface(IID_IInstrumentName,
00153                                     (void**) &iInstrumentName);
00154 
00155   if ( !sc.isSuccess() ) {
00156     log << MSG::ERROR
00157         << "Cannot query IInstrumentName interface of CalibDataSvc"
00158         << endreq;
00159     return sc;
00160   } else {
00161     log << MSG::DEBUG
00162         << "Retrieved IInstrumentName interface of CalibDataSvc"
00163         << endreq;
00164   }
00165 
00166    int svctype = iInstrumentName->getsvctype();
00167     if(svctype== CALIBROOT_StorageType)
00168       {
00169         dataIdent = m_rootfile[index];
00170         fullpath = par[0];
00171       }
00172 
00173    if(svctype== MYSQL_StorageType)
00174       {   log << MSG::INFO<<"rootfile is not set in the jobOption,get it from MySQL"<<endreq;
00175       dataIdent = par[0];
00176       fullpath = par[1];
00177       }
00178 
00179    if ((svctype != CALIBROOT_StorageType)&&(svctype!= MYSQL_StorageType)) {
00180     log << MSG::ERROR << "bad storage type" << (int)svctype << endreq;
00181     return StatusCode::FAILURE;
00182   }
00183 */
00184    // std::string dataIdent(par[0]); // file identifier for PDS version of data
00185   // log << MSG::INFO<<"dataIdent is:"<<dataIdent<<endreq;
00186    //std::string fullpath(par[1]);  // path within TCDS for the object
00187  //  log << MSG::INFO<<"fullpath is :"<<fullpath<<endreq;
00188  
00189  
00190    int runfrm = ip[0];
00191    int runto = ip[1];
00192    dataIdent = par[0];
00193    fullpath = par[1];
00194 
00195    // for now have to ignore fmtVersion because of defective implementation
00196   // of GenericAddress. If we want it, should probably write new
00197   // opaque address implementation for this package to use.  All
00198   // dealings with (calibration) opaque addresses are confined to
00199   // the CalibSvc package.
00200   refpAddress = new GenericAddress(CALIBTREE_StorageType,
00201                                    clid,
00202                                    dataIdent,  
00203                                    fullpath,
00204                                    runfrm,
00205                                    runto);
00206                                    
00207                                
00208   return StatusCode::SUCCESS; 
00209 
00210 }

StatusCode CalibTreeCnvSvc::finalize (  )  [virtual]

Definition at line 118 of file CalibTreeCnvSvc.cxx.

00118                                      {
00119   // If anything was allocated, get rid of it.  So far, nothing was.
00120 
00121   return ConversionSvc::finalize();
00122 }

std::string CalibTreeCnvSvc::getrootfile (  )  [inline, virtual]

Method to write a ROOT file corresponding to TDS object

Parameters:
fileName the name of the file to be written
Returns:
the document issued from the parsing

Implements ICalibTreeSvc.

Definition at line 85 of file CalibTreeCnvSvc.h.

References m_rootfile.

00086         { return m_rootfile[0];}

StatusCode CalibTreeCnvSvc::initialize (  )  [virtual]

Definition at line 43 of file CalibTreeCnvSvc.cxx.

References Bes_Common::DEBUG, calibUtil::ERROR, m_detDataSvc, m_detPersSvc, and msgSvc().

00043                                        {
00044   StatusCode sc = ConversionSvc::initialize();
00045 
00046   MsgStream log(msgSvc(), "CalibTreeCnvSvc");
00047 
00048   if (!sc.isSuccess()) return sc;
00049 
00050   // Locate the Calib Data Service.  Since it inherits from DataSvc
00051   // it has to implement IDataProviderSvc
00052   m_detDataSvc = 0;
00053   /*sc = serviceLocator()->getService 
00054     ("CalibDataSvc",  IID_IDataProviderSvc,(IInterface*&) m_detDataSvc);*/
00055   sc = serviceLocator()->getService 
00056     ("CalibDataSvc",  IDataProviderSvc::interfaceID(),(IInterface*&) m_detDataSvc);
00057   if ( !sc.isSuccess() ) {
00058     log << MSG::ERROR << "Could not locate CalibDataSvc" << endreq;
00059     return sc;
00060   }
00061 
00062  /*  IInstrumentName* iInstrumentName;
00063   sc = m_detDataSvc->queryInterface(IID_IInstrumentName,
00064                                     (void**) &iInstrumentName);
00065 */
00066   // Set the CalibDataSvc as data provider service
00067   sc = setDataProvider(m_detDataSvc);
00068   if ( !sc.isSuccess() ) {
00069     log << MSG::ERROR << "Could not set data provider" << endreq;
00070     return sc;
00071   }
00072   //huangb add 
00073  sc = setProperties();
00074 
00075   // Locate IConversionSvc interface of the DetectorPersistencySvc
00076   sc = serviceLocator()->service 
00077     ("DetectorPersistencySvc", m_detPersSvc, true);
00078   if ( !sc.isSuccess() ) {
00079     log << MSG::ERROR 
00080         << "Cannot locate IConversionSvc interface of DetectorPersistencySvc"
00081         << endreq;
00082     return sc;
00083   } else {
00084     log << MSG::DEBUG 
00085         << "Retrieved IConversionSvc interface of DetectorPersistencySvc"
00086         << endreq;
00087   }
00088   
00089   // Query the IAddressCreator interface of the detector persistency service
00090   IAddressCreator* iAddrCreator;
00091   /*sc = m_detPersSvc->queryInterface(IID_IAddressCreator, 
00092                                     (void**) &iAddrCreator);*/
00093   sc = m_detPersSvc->queryInterface(IAddressCreator::interfaceID(), 
00094                                     (void**) &iAddrCreator);
00095   if ( !sc.isSuccess() ) {
00096     log << MSG::ERROR 
00097         << "Cannot query IAddressCreator interface of DetectorPersistencySvc" 
00098         << endreq;
00099     return sc;
00100   } else {
00101     log << MSG::DEBUG 
00102         << "Retrieved IAddressCreator interface of DetectorPersistencySvc" 
00103         << endreq;
00104   }
00105   log << MSG::DEBUG 
00106       << "Set it as the address creator of the CalibTreeCnvSvc" << endreq;
00107   sc = setAddressCreator(iAddrCreator);
00108   if ( !sc.isSuccess() ) {
00109     log << MSG::ERROR   << "Cannot set the address creator" << endreq;
00110     return sc;
00111   }
00112 
00113   // set properties if there are any??
00114 
00115   return sc;
00116 }

static const InterfaceID& ICalibTreeSvc::interfaceID (  )  [inline, static, inherited]

Definition at line 36 of file ICalibTreeSvc.h.

References IID_ICalibTreeSvc().

00036 { return IID_ICalibTreeSvc; }

StatusCode CalibTreeCnvSvc::queryInterface ( const InterfaceID &  riid,
void **  ppvInterface 
) [virtual]

Definition at line 28 of file CalibTreeCnvSvc.cxx.

References IID_ICalibTreeSvc().

00029                                                                {
00030   /* Uncomment if choose to derive from abstract root conv. interface */
00031   if (IID_ICalibTreeSvc.versionMatch(riid))  {
00032     *ppvInterface = (ICalibTreeSvc*)this;
00033   }
00034   else {
00035     // Interface is not directly availible: try out a base class
00036     return ConversionSvc::queryInterface(riid, ppvInterface);
00037     /*  }  */
00038   addRef();
00039   }
00040   return StatusCode::SUCCESS;
00041 }

StatusCode CalibTreeCnvSvc::updateObj ( IOpaqueAddress *  pAddress,
DataObject *  pObject 
) [virtual]

Definition at line 213 of file CalibTreeCnvSvc.cxx.

References Bes_Common::DEBUG, and msgSvc().

00214                                                                   {
00215 
00216   //  using facilities::Timestamp;
00217 
00218    MsgStream log(msgSvc(), "CalibTreeCnvSvc" );
00219    
00220    // Don't update when we're using enter time
00221    log << MSG::DEBUG << "CalibTreeCnvSvc::updateObj starting ...."<<endreq;
00222 }


Friends And Related Function Documentation

friend class SvcFactory< CalibTreeCnvSvc > [friend]

Only factories can access protected constructors.

Definition at line 37 of file CalibTreeCnvSvc.h.


Member Data Documentation

IDataProviderSvc* CalibTreeCnvSvc::m_detDataSvc [private]

Handle to IDataProviderSvc interface of CalibDataSvc.

Definition at line 104 of file CalibTreeCnvSvc.h.

Referenced by initialize().

IConversionSvc* CalibTreeCnvSvc::m_detPersSvc [private]

Handle to the IConversionSvc interface of the DetectorPersistencySvc.

Definition at line 101 of file CalibTreeCnvSvc.h.

Referenced by initialize().

std::string CalibTreeCnvSvc::m_rootfile[4] [private]

Definition at line 105 of file CalibTreeCnvSvc.h.

Referenced by getrootfile().


Generated on Tue Nov 29 23:18:02 2016 for BOSS_7.0.2 by  doxygen 1.4.7