Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

CalibTreeCnvSvc Class Reference

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

#include <CalibTreeCnvSvc.h>

Inheritance diagram for CalibTreeCnvSvc:

ICalibTreeSvc ICalibTreeSvc List of all members.

Public Member Functions

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

Static Public Member Functions

const InterfaceID & interfaceID ()
const InterfaceID & interfaceID ()

Protected Member Functions

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

Private Attributes

IDataProviderSvc * m_detDataSvc
 Handle to IDataProviderSvc interface of CalibDataSvc.
IDataProviderSvc * m_detDataSvc
 Handle to IDataProviderSvc interface of CalibDataSvc.
IConversionSvc * m_detPersSvc
 Handle to the IConversionSvc interface of the DetectorPersistencySvc.
IConversionSvc * m_detPersSvc
 Handle to the IConversionSvc interface of the DetectorPersistencySvc.
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


Constructor & Destructor Documentation

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

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

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

00042 {}

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

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

00042 {}


Member Function Documentation

virtual 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

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

virtual StatusCode CalibTreeCnvSvc::finalize  )  [virtual]
 

StatusCode CalibTreeCnvSvc::finalize  )  [virtual]
 

00114                                      {
00115   // If anything was allocated, get rid of it.  So far, nothing was.
00116 
00117   return ConversionSvc::finalize();
00118 }

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.

00086         { return m_rootfile[0];}

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.

00086         { return m_rootfile[0];}

virtual StatusCode CalibTreeCnvSvc::initialize  )  [virtual]
 

StatusCode CalibTreeCnvSvc::initialize  )  [virtual]
 

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   if ( !sc.isSuccess() ) {
00056     log << MSG::ERROR << "Could not locate CalibDataSvc" << endreq;
00057     return sc;
00058   }
00059 
00060  /*  IInstrumentName* iInstrumentName;
00061   sc = m_detDataSvc->queryInterface(IID_IInstrumentName,
00062                                     (void**) &iInstrumentName);
00063 */
00064   // Set the CalibDataSvc as data provider service
00065   sc = setDataProvider(m_detDataSvc);
00066   if ( !sc.isSuccess() ) {
00067     log << MSG::ERROR << "Could not set data provider" << endreq;
00068     return sc;
00069   }
00070   //huangb add 
00071  sc = setProperties();
00072 
00073   // Locate IConversionSvc interface of the DetectorPersistencySvc
00074   sc = serviceLocator()->service 
00075     ("DetectorPersistencySvc", m_detPersSvc, true);
00076   if ( !sc.isSuccess() ) {
00077     log << MSG::ERROR 
00078         << "Cannot locate IConversionSvc interface of DetectorPersistencySvc"
00079         << endreq;
00080     return sc;
00081   } else {
00082     log << MSG::DEBUG 
00083         << "Retrieved IConversionSvc interface of DetectorPersistencySvc"
00084         << endreq;
00085   }
00086   
00087   // Query the IAddressCreator interface of the detector persistency service
00088   IAddressCreator* iAddrCreator;
00089   sc = m_detPersSvc->queryInterface(IID_IAddressCreator, 
00090                                     (void**) &iAddrCreator);
00091   if ( !sc.isSuccess() ) {
00092     log << MSG::ERROR 
00093         << "Cannot query IAddressCreator interface of DetectorPersistencySvc" 
00094         << endreq;
00095     return sc;
00096   } else {
00097     log << MSG::DEBUG 
00098         << "Retrieved IAddressCreator interface of DetectorPersistencySvc" 
00099         << endreq;
00100   }
00101   log << MSG::DEBUG 
00102       << "Set it as the address creator of the CalibTreeCnvSvc" << endreq;
00103   sc = setAddressCreator(iAddrCreator);
00104   if ( !sc.isSuccess() ) {
00105     log << MSG::ERROR   << "Cannot set the address creator" << endreq;
00106     return sc;
00107   }
00108 
00109   // set properties if there are any??
00110 
00111   return sc;
00112 }

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

00036 { return IID_ICalibTreeSvc; }

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

00036 { return IID_ICalibTreeSvc; }

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

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

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 }

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

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

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


Friends And Related Function Documentation

SvcFactory<CalibTreeCnvSvc> [friend]
 

Only factories can access protected constructors.


Member Data Documentation

IDataProviderSvc* CalibTreeCnvSvc::m_detDataSvc [private]
 

Handle to IDataProviderSvc interface of CalibDataSvc.

IDataProviderSvc* CalibTreeCnvSvc::m_detDataSvc [private]
 

Handle to IDataProviderSvc interface of CalibDataSvc.

IConversionSvc* CalibTreeCnvSvc::m_detPersSvc [private]
 

Handle to the IConversionSvc interface of the DetectorPersistencySvc.

IConversionSvc* CalibTreeCnvSvc::m_detPersSvc [private]
 

Handle to the IConversionSvc interface of the DetectorPersistencySvc.

std::string CalibTreeCnvSvc::m_rootfile [private]
 


The documentation for this class was generated from the following files:
Generated on Wed Feb 2 15:55:56 2011 for BOSS6.5.5 by  doxygen 1.3.9.1