#include <PackedRawDataCnvSvc.h>
Inheritance diagram for PackedRawDataCnvSvc:
Public Member Functions | |
PackedRawDataCnvSvc (const std::string &name, ISvcLocator *svc) | |
Standard Constructor. | |
virtual | ~PackedRawDataCnvSvc () |
Standard Destructor. | |
virtual StatusCode | initialize () |
Initialize the service. | |
virtual StatusCode | updateServiceState (IOpaqueAddress *pAddress) |
Update state of the service. | |
virtual StatusCode | queryInterface (const InterfaceID &riid, void **ppvInterface) |
Override inherited queryInterface. | |
virtual StatusCode | connectOutput (const std::string &t) |
virtual StatusCode | connectOutput (const std::string &t, const std::string &) |
virtual StatusCode | commitOutput (const std::string &t, bool b) |
virtual WriteRawEvent *& | getRawEvent () |
virtual StatusCode | finalize () |
virtual StatusCode | declareObject (const IRawDataCnvSvc::Leaf &leaf) |
Associates a path on TDS with a particular converter. | |
virtual StatusCode | createAddress (long svc_type, const CLID &clid, const std::string *par, const unsigned long *ip, IOpaqueAddress *&refpAddress) |
virtual StatusCode | createAddress (long storageType, const CLID &clid, const std::string &, IOpaqueAddress *&refpAddress) |
Protected Member Functions | |
virtual StatusCode | addConverters () |
Add converters to the service. | |
Private Attributes | |
std::string | m_ioSvcName |
IRawDataOutputSvc * | m_ioSvc |
WriteRawEvent * | m_rawEvent |
uint32_t | m_status |
unsigned int | ef_info [4] |
Friends | |
class | CnvFactory< PackedRawDataCnvSvc > |
Definition at line 19 of file PackedRawDataCnvSvc.h.
PackedRawDataCnvSvc::PackedRawDataCnvSvc | ( | const std::string & | name, | |
ISvcLocator * | svc | |||
) |
Standard Constructor.
Definition at line 49 of file PackedRawDataCnvSvc.cxx.
References m_ioSvcName, and m_status.
00050 : RawDataCnvSvc(name, svc, PACKEDRAWEVENT_StorageType) 00051 { 00052 declareProperty("RawDataOutputSvc", m_ioSvcName); 00053 declareProperty("Status", m_status=0xFFFFFFFF); //fucd 00054 }
PackedRawDataCnvSvc::~PackedRawDataCnvSvc | ( | ) | [virtual] |
StatusCode PackedRawDataCnvSvc::addConverters | ( | ) | [protected, virtual] |
Add converters to the service.
Implements RawDataCnvSvc.
Definition at line 88 of file PackedRawDataCnvSvc.cxx.
References RawDataZddEventCnv::classID(), RawDataHltRawCnv::classID(), RawDataHltCnv::classID(), RawDataTrigGTDCnv::classID(), RawDataTrigCnv::classID(), RawDataMucDigiCnv::classID(), RawDataEmcDigiCnv::classID(), RawDataLumiDigiCnv::classID(), RawDataTofDigiCnv::classID(), RawDataMdcDigiCnv::classID(), RawDataDigiCnv::classID(), RawDataMucMcHitCnv::classID(), RawDataEmcMcHitCnv::classID(), RawDataTofMcHitCnv::classID(), RawDataMdcMcHitCnv::classID(), RawDataMcParticleCnv::classID(), RawDataMcCnv::classID(), RawDataEvtHeaderCnv::classID(), RawDataCnv::classID(), RawDataCnvSvc::declareObject(), EventModel::Digi::EmcDigiCol, EventModel::MC::EmcMcHitCol, EventModel::Hlt::Event, EventModel::Trig::Event, EventModel::Digi::Event, EventModel::MC::Event, EventModel::EventH, EventModel::EventHeader, EventModel::Hlt::HltRawCol, EventModel::Digi::LumiDigiCol, EventModel::MC::McParticleCol, EventModel::Digi::MdcDigiCol, EventModel::MC::MdcMcHitCol, EventModel::Digi::MucDigiCol, EventModel::MC::MucMcHitCol, EventModel::Digi::TofDigiCol, EventModel::MC::TofMcHitCol, EventModel::Trig::TrigGTDCol, and EventModel::Zdd::ZddEvent.
00088 { 00089 MsgStream log(messageService(), name()); 00090 //log << MSG::INFO << name() << " PackedRawDataCnvSvc::addConverters" << endreq; 00091 declareObject(IRawDataCnvSvc::Leaf(EventModel::EventH, RawDataCnv::classID(), "PASS", 0)); 00092 //log << MSG::INFO << "EventModel::EventH " << RawDataCnv::classID() << endreq; 00093 declareObject(IRawDataCnvSvc::Leaf(EventModel::EventHeader, RawDataEvtHeaderCnv::classID(), "PASS", 0)); 00094 //log << MSG::INFO << "EventModel::EventHeader " << RawDataEvtHeaderCnv::classID() << endreq; 00095 declareObject(IRawDataCnvSvc::Leaf(EventModel::MC::Event, RawDataMcCnv::classID(), "PASS", 0)); 00096 declareObject(IRawDataCnvSvc::Leaf(EventModel::MC::McParticleCol, RawDataMcParticleCnv::classID(), "PASS", 0)); 00097 declareObject(IRawDataCnvSvc::Leaf(EventModel::MC::MdcMcHitCol, RawDataMdcMcHitCnv::classID(), "PASS", 0)); 00098 declareObject(IRawDataCnvSvc::Leaf(EventModel::MC::TofMcHitCol, RawDataTofMcHitCnv::classID(), "PASS", 0)); 00099 declareObject(IRawDataCnvSvc::Leaf(EventModel::MC::EmcMcHitCol, RawDataEmcMcHitCnv::classID(), "PASS", 0)); 00100 declareObject(IRawDataCnvSvc::Leaf(EventModel::MC::MucMcHitCol, RawDataMucMcHitCnv::classID(), "PASS", 0)); 00101 declareObject(IRawDataCnvSvc::Leaf(EventModel::Digi::Event, RawDataDigiCnv::classID(), "PASS", 0)); 00102 declareObject(IRawDataCnvSvc::Leaf(EventModel::Digi::MdcDigiCol, RawDataMdcDigiCnv::classID(), "PASS", 0)); 00103 declareObject(IRawDataCnvSvc::Leaf(EventModel::Digi::TofDigiCol, RawDataTofDigiCnv::classID(), "PASS", 0)); 00104 declareObject(IRawDataCnvSvc::Leaf(EventModel::Digi::LumiDigiCol,RawDataLumiDigiCnv::classID(), "PASS", 0)); 00105 declareObject(IRawDataCnvSvc::Leaf(EventModel::Digi::EmcDigiCol, RawDataEmcDigiCnv::classID(), "PASS", 0)); 00106 declareObject(IRawDataCnvSvc::Leaf(EventModel::Digi::MucDigiCol, RawDataMucDigiCnv::classID(), "PASS", 0)); 00107 declareObject(IRawDataCnvSvc::Leaf(EventModel::Trig::Event, RawDataTrigCnv::classID(), "PASS", 0)); 00108 declareObject(IRawDataCnvSvc::Leaf(EventModel::Trig::TrigGTDCol, RawDataTrigGTDCnv::classID(), "PASS", 0)); 00109 declareObject(IRawDataCnvSvc::Leaf(EventModel::Hlt::Event, RawDataHltCnv::classID(), "PASS", 0)); 00110 declareObject(IRawDataCnvSvc::Leaf(EventModel::Hlt::HltRawCol, RawDataHltRawCnv::classID(), "PASS", 0)); 00111 declareObject(IRawDataCnvSvc::Leaf(EventModel::Zdd::ZddEvent, RawDataZddEventCnv::classID(), "PASS", 0)); 00112 00113 return StatusCode::SUCCESS; 00114 }
StatusCode PackedRawDataCnvSvc::commitOutput | ( | const std::string & | t, | |
bool | b | |||
) | [virtual] |
Definition at line 166 of file PackedRawDataCnvSvc.cxx.
References Bes_Common::DEBUG, calibUtil::ERROR, eformat::write::ROSFragment::first_child(), eformat::write::SubDetectorFragment::first_child(), eformat::write::FullEventFragment::first_child(), m_ioSvc, m_rawEvent, eformat::write::SubDetectorFragment::next(), eformat::write::ROSFragment::next(), eformat::write::ROBFragment::next(), IRawDataOutputSvc::putEvent(), and eformat::write::FullEventFragment::size_word().
00167 { 00168 MsgStream log(messageService(), name() ); 00169 00170 log << MSG::DEBUG << "In flushOutput" << endreq; 00171 00172 if (!m_ioSvc) { 00173 log << MSG::ERROR << "RawDataCnvSvc not configure for output" << endreq; 00174 return StatusCode::FAILURE; 00175 } 00176 00177 /*if (!m_rawEvent->is_valid()) { 00178 log << MSG::ERROR << "commitOutput failed, because FullEventFragment invalid" 00179 << m_rawEvent << endreq; 00180 return StatusCode::FAILURE; 00181 }*/ 00182 00183 log << MSG::DEBUG << "commitOutput: Size of Event (words) =" 00184 << m_rawEvent->size_word() << endreq; 00185 00186 if (!m_ioSvc->putEvent(m_rawEvent) ) { 00187 log << MSG::ERROR << "commitOutput failed to send output" << endreq; 00188 return StatusCode::FAILURE; 00189 } 00190 00191 // delete ... 00192 const eformat::write::SubDetectorFragment* sd = m_rawEvent->first_child(); 00193 while ( sd != 0) { 00194 const eformat::write::ROSFragment* ros = sd->first_child(); 00195 while (ros != 0) { 00196 const eformat::write::ROBFragment* rob = ros->first_child(); 00197 while (rob != 0) { 00198 const eformat::write::ROBFragment* rob_tmp = rob; 00199 rob = rob->next(); 00200 delete rob_tmp; 00201 } 00202 const eformat::write::ROSFragment* ros_tmp = ros; 00203 ros = ros->next(); 00204 delete ros_tmp; 00205 } 00206 const eformat::write::SubDetectorFragment* sd_tmp = sd; 00207 sd = sd->next(); 00208 delete sd_tmp; 00209 } 00210 delete m_rawEvent; 00211 00212 return StatusCode::SUCCESS; 00213 }
virtual StatusCode PackedRawDataCnvSvc::connectOutput | ( | const std::string & | t, | |
const std::string & | ||||
) | [inline, virtual] |
Definition at line 41 of file PackedRawDataCnvSvc.h.
References connectOutput().
00042 { 00043 return connectOutput(t) ; 00044 }
StatusCode PackedRawDataCnvSvc::connectOutput | ( | const std::string & | t | ) | [virtual] |
Definition at line 135 of file PackedRawDataCnvSvc.cxx.
References Bes_Common::DEBUG, ef_info, calibUtil::ERROR, EventModel::EventHeader, eventNo, m_rawEvent, m_status, runNo, and eformat::write::FullEventFragment::status().
Referenced by connectOutput().
00136 { 00137 00138 MsgStream log(messageService(), name() ); 00139 00140 log << MSG::DEBUG << " In connectOutput "<< endreq; 00141 00142 // Get DataObj from TDS 00143 SmartDataPtr<Event::EventHeader> evt(dataProvider(), EventModel::EventHeader); 00144 if (!evt) { 00145 log << MSG::ERROR << "Did not retrieve event" << endreq; 00146 return StatusCode::FAILURE; 00147 } 00148 unsigned int eventNo = evt->eventNumber(); 00149 unsigned int runNo = evt->runNumber(); 00150 00151 m_rawEvent = new WriteRawEvent(0x790000, // source_id 00152 eventNo, // global_id 00153 runNo, // run_no 00154 eventNo, // lel1_id 00155 0, // lel1_type 00156 0, // lel2_info 00157 ef_info // ef_info 00158 ); 00159 //const unsigned int status = 0; // place holder for status 00160 if(m_status!=0xFFFFFFFF) m_rawEvent->status(1, &m_status); 00161 else m_rawEvent->status(0, NULL); //fucd 00162 00163 return StatusCode::SUCCESS; 00164 }
StatusCode RawDataCnvSvc::createAddress | ( | long | storageType, | |
const CLID & | clid, | |||
const std::string & | , | |||
IOpaqueAddress *& | refpAddress | |||
) | [virtual, inherited] |
Definition at line 184 of file RawDataCnvSvc.cxx.
References RawDataCnvSvc::createAddress().
00188 { 00189 return createAddress(storageType, clid, NULL, NULL, refpAddress); 00190 }
StatusCode RawDataCnvSvc::createAddress | ( | long | svc_type, | |
const CLID & | clid, | |||
const std::string * | par, | |||
const unsigned long * | ip, | |||
IOpaqueAddress *& | refpAddress | |||
) | [virtual, inherited] |
Definition at line 162 of file RawDataCnvSvc.cxx.
References calibUtil::ERROR, and msgSvc().
Referenced by RawDataCnvSvc::createAddress(), and RawDataCnvSvc::updateServiceState().
00167 { 00168 MsgStream log( msgSvc(), name() ); 00169 00170 if (storageType != repSvcType() ) { 00171 log << MSG::ERROR << "bad storage type" << storageType << endreq; 00172 return StatusCode::FAILURE; 00173 } 00174 00175 refpAddress = new GenericAddress(storageType, 00176 clid, 00177 "", 00178 "", 00179 0); 00180 00181 return StatusCode::SUCCESS; 00182 }
StatusCode RawDataCnvSvc::declareObject | ( | const IRawDataCnvSvc::Leaf & | leaf | ) | [virtual, inherited] |
Associates a path on TDS with a particular converter.
Implements IRawDataCnvSvc.
Definition at line 83 of file RawDataCnvSvc.cxx.
References RawDataCnvSvc::m_leaves, IRawDataCnvSvc::Leaf::path, and dchain::value_type().
Referenced by addConverters().
00083 { 00084 // Purpose and Method: Callback from each of the individual converters that allows 00085 // association of TDS path and converter. 00086 Leaf* ll = new Leaf(leaf); 00087 std::pair<LeafMap::iterator, bool> p = m_leaves.insert(LeafMap::value_type( leaf.path, ll) ); 00088 if( p.second ) { 00089 return StatusCode::SUCCESS; 00090 } 00091 delete ll; 00092 return StatusCode::FAILURE; 00093 }
StatusCode RawDataCnvSvc::finalize | ( | ) | [virtual, inherited] |
Definition at line 74 of file RawDataCnvSvc.cxx.
References RawDataCnvSvc::m_leaves.
00074 { 00075 StatusCode status = ConversionSvc::finalize(); 00076 for (LeafMap::iterator k = m_leaves.begin(); k != m_leaves.end(); k++ ) { 00077 delete (*k).second; 00078 } 00079 m_leaves.erase(m_leaves.begin(), m_leaves.end()); 00080 return status; 00081 }
virtual WriteRawEvent*& PackedRawDataCnvSvc::getRawEvent | ( | ) | [inline, virtual] |
Definition at line 50 of file PackedRawDataCnvSvc.h.
References m_rawEvent.
Referenced by RawDataTofMcHitCnv::createRep(), RawDataTofDigiCnv::createRep(), RawDataMucMcHitCnv::createRep(), RawDataMucDigiCnv::createRep(), RawDataMdcMcHitCnv::createRep(), RawDataMdcDigiCnv::createRep(), RawDataMcParticleCnv::createRep(), RawDataHltRawCnv::createRep(), RawDataEmcMcHitCnv::createRep(), and RawDataEmcDigiCnv::createRep().
00050 { 00051 return m_rawEvent; 00052 }
StatusCode PackedRawDataCnvSvc::initialize | ( | ) | [virtual] |
Initialize the service.
Reimplemented from RawDataCnvSvc.
Definition at line 61 of file PackedRawDataCnvSvc.cxx.
References calibUtil::ERROR, Bes_Common::INFO, RawDataCnvSvc::initialize(), m_ioSvc, m_ioSvcName, and Bes_Common::WARNING.
00061 { 00062 MsgStream log(messageService(), name()); 00063 log << MSG::INFO << name() << " PackedRawDataCnvSvc::initialize RawDataOutputSvc:" << m_ioSvcName<< endreq; 00064 00065 StatusCode sc = RawDataCnvSvc::initialize(); 00066 if( sc.isFailure() ) { 00067 log << MSG::ERROR << "Unable to initialize service " << endreq; 00068 return sc; 00069 } 00070 00071 IService* svc ; 00072 sc = service(m_ioSvcName, svc); 00073 if (sc != StatusCode::SUCCESS ) { 00074 log << MSG::WARNING << "Cant get RawDataOutputSvc " << endreq; 00075 //return sc ; 00076 } 00077 00078 m_ioSvc = dynamic_cast<IRawDataOutputSvc*> (svc); 00079 if (m_ioSvc == 0 ) { 00080 log << MSG::WARNING << "Cant cast to RawDataOutputSvc " << endreq; 00081 //return StatusCode::FAILURE; 00082 } 00083 00084 return StatusCode::SUCCESS; 00085 }
StatusCode PackedRawDataCnvSvc::queryInterface | ( | const InterfaceID & | riid, | |
void ** | ppvInterface | |||
) | [virtual] |
Override inherited queryInterface.
Reimplemented from RawDataCnvSvc.
Definition at line 124 of file PackedRawDataCnvSvc.cxx.
References IID_IRawDataBaseCnv().
00124 { 00125 if ( IID_IRawDataBaseCnv == riid ) { 00126 *ppvInterface = (IRawDataCnvSvc*)this; 00127 } else { 00128 // Interface is not directly availible: try out a base class 00129 return ConversionSvc::queryInterface(riid, ppvInterface); 00130 } 00131 addRef(); 00132 return StatusCode::SUCCESS; 00133 }
StatusCode PackedRawDataCnvSvc::updateServiceState | ( | IOpaqueAddress * | pAddress | ) | [virtual] |
Update state of the service.
Reimplemented from RawDataCnvSvc.
Definition at line 117 of file PackedRawDataCnvSvc.cxx.
References RawDataCnvSvc::updateServiceState().
00117 { 00118 MsgStream log(messageService(), name()); 00119 StatusCode sc = RawDataCnvSvc::updateServiceState(pAddress); 00120 //log << MSG::INFO << "In PackedRawDataCnvSvc::updateServiceState" << endreq; 00121 return sc; 00122 }
friend class CnvFactory< PackedRawDataCnvSvc > [friend] |
Definition at line 21 of file PackedRawDataCnvSvc.h.
unsigned int PackedRawDataCnvSvc::ef_info[4] [private] |
IRawDataOutputSvc* PackedRawDataCnvSvc::m_ioSvc [private] |
Definition at line 61 of file PackedRawDataCnvSvc.h.
Referenced by commitOutput(), and initialize().
std::string PackedRawDataCnvSvc::m_ioSvcName [private] |
Definition at line 60 of file PackedRawDataCnvSvc.h.
Referenced by initialize(), and PackedRawDataCnvSvc().
WriteRawEvent* PackedRawDataCnvSvc::m_rawEvent [private] |
Definition at line 62 of file PackedRawDataCnvSvc.h.
Referenced by commitOutput(), connectOutput(), and getRawEvent().
uint32_t PackedRawDataCnvSvc::m_status [private] |
Definition at line 64 of file PackedRawDataCnvSvc.h.
Referenced by connectOutput(), and PackedRawDataCnvSvc().