00001 00002 #include "DybStoreAlg.h" 00003 #include "DybKernel/IDybStorageSvc.h" 00004 #include "Event/RegistrationSequence.h" 00005 00006 using namespace DayaBay; 00007 00008 DybStoreAlg::DybStoreAlg(const std::string& name, ISvcLocator* pSvcLocator) 00009 : GaudiAlgorithm(name,pSvcLocator) 00010 { 00011 declareProperty("StorageService",m_dybStorageSvcName="DybStorageSvc", 00012 "Name of an IDybStorageSvc."); 00013 declareProperty("ControlLocation", 00014 m_controlPath=RegistrationSequence::defaultLocation(), 00015 "TES location at which to find the RegistrationSequence"); 00016 } 00017 00018 DybStoreAlg::~DybStoreAlg() 00019 { 00020 } 00021 00022 StatusCode DybStoreAlg::initialize() 00023 { 00024 debug() << "initialize()" << endreq; 00025 StatusCode sc = this->GaudiAlgorithm::initialize(); 00026 if (sc.isFailure()) { 00027 error() << "Failed to initialize base class" << endreq; 00028 return sc; 00029 } 00030 00031 sc = serviceLocator()->getService(m_dybStorageSvcName, 00032 IID_IDybStorageSvc, 00033 *pp_cast<IInterface>(&m_dybStorageSvc)); 00034 if (sc.isFailure()) { 00035 error() << "Failed to get DybStorageSvc" << endreq; 00036 } 00037 return sc; 00038 } 00039 00040 StatusCode DybStoreAlg::execute() 00041 { 00042 DataObject *d = get<DataObject>("/Event"); 00043 d = 0; // just checking 00044 00045 if (!exist<RegistrationSequence>(m_controlPath)) { 00046 error() << "No RegistrationSequence at " 00047 << m_controlPath << endreq; 00048 return StatusCode::FAILURE; 00049 } 00050 00051 RegistrationSequence* rs = get<RegistrationSequence>(m_controlPath); 00052 00053 StatusCode sc = m_dybStorageSvc->store(*rs); 00054 if (sc.isFailure()) { 00055 error() << "DybStorageSvc failed to store" << endreq; 00056 } 00057 return sc; 00058 } 00059 00060 StatusCode DybStoreAlg::finalize() 00061 { 00062 return this->GaudiAlgorithm::finalize(); 00063 } 00064