#include <RawDataMdcMcHitCnv.h>
Inheritance diagram for RawDataMdcMcHitCnv:
Public Types | |
typedef Ty1 | source |
typedef Ty2 | destination |
Public Member Functions | |
StatusCode | initialize () |
virtual long | repSvcType () const |
StatusCode | createObj (IOpaqueAddress *pAddr, DataObject *&pObj) |
virtual StatusCode | updateObj (IOpaqueAddress *, DataObject *) |
override the RawDataBaseCnv version | |
virtual StatusCode | createRep (DataObject *pObj, IOpaqueAddress *&pAddr) |
Convert the transient object to the requested representation. | |
virtual StatusCode | finalize () |
void | declareObject (const std::string &fullPath, const CLID &clid, const std::string &bank, long par=0) |
Store TDS path to link a particular converter to an object on the TDS. | |
virtual StatusCode | fillRepRefs (IOpaqueAddress *pAddress, DataObject *pObject) |
Resolve the references of the converted object. | |
virtual StatusCode | updateRep (IOpaqueAddress *pAddress, DataObject *pObject) |
Update the converted representation of a transient object. | |
virtual StatusCode | updateRepRefs (IOpaqueAddress *pAddress, DataObject *pObject) |
Update the references of an already converted object. | |
destination * | operator (const source &) const |
Static Public Member Functions | |
static const CLID & | classID () |
static const unsigned char | storageType () |
Protected Member Functions | |
RawDataMdcMcHitCnv (ISvcLocator *svc) | |
virtual destination * | convert (const source &) const =0 |
Protected Attributes | |
IRawDataCnvSvc * | m_CnvSvc |
Pointer to event conversion service interface. | |
std::vector< IRawDataCnvSvc::Leaf > | m_leaves |
Leaf objects giving the locations of the objects in the data store. | |
Private Attributes | |
IRawDataInputSvc * | m_inputSvc |
PackedRawDataCnvSvc * | m_RawDataAccess |
Define the interface to raw data cnv. | |
MdcMcHitBuilder | m_mdcMcHitBuilder |
MdcBuilder for packing or unpacking data. | |
Friends | |
class | CnvFactory< RawDataMdcMcHitCnv > |
Definition at line 32 of file RawDataMdcMcHitCnv.h.
typedef Ty2 Converter< Ty1, Ty2 >::destination [inherited] |
Definition at line 19 of file Converter.h.
Definition at line 18 of file Converter.h.
RawDataMdcMcHitCnv::RawDataMdcMcHitCnv | ( | ISvcLocator * | svc | ) | [protected] |
Definition at line 36 of file RawDataMdcMcHitCnv.cxx.
00036 : 00037 RawDataBaseCnv(PACKEDRAWEVENT_StorageType, classID(), svc) 00038 { 00039 //init(); 00040 }
const CLID & RawDataMdcMcHitCnv::classID | ( | ) | [static] |
Reimplemented from RawDataBaseCnv.
Definition at line 44 of file RawDataMdcMcHitCnv.cxx.
References CLID_MdcMcHitCol.
Referenced by PackedRawDataCnvSvc::addConverters().
00045 { 00046 return CLID_MdcMcHitCol; 00047 }
virtual destination* Converter< Ty1, Ty2 >::convert | ( | const source & | ) | const [protected, pure virtual, inherited] |
StatusCode RawDataMdcMcHitCnv::createObj | ( | IOpaqueAddress * | pAddr, | |
DataObject *& | pObj | |||
) |
Definition at line 115 of file RawDataMdcMcHitCnv.cxx.
References MdcTruth_t::cellId, IRawDataInputSvc::currentEvent(), MdcTruth_t::driftD, MdcTruth_t::edep, RAWEVENT::getMdcTruth(), iter(), MdcTruth_t::layerId, MdcMcHitBuilder::m_driftDCoeff, MdcMcHitBuilder::m_edepCoeff, m_inputSvc, m_mdcMcHitBuilder, MdcMcHitBuilder::m_xCoeff, MdcMcHitBuilder::m_yCoeff, MdcMcHitBuilder::m_zCoeff, EventModel::MC::MdcMcHitCol, MdcTruth_t::posFlag, MdcTruth_t::trackIndex, MdcMcHitBuilder::unPack(), MdcID::wire_id(), MdcTruth_t::x, MdcTruth_t::y, and MdcTruth_t::z.
00116 { 00117 //MsgStream log(msgSvc(), "RawDataMdcMcHitCnv"); 00118 00119 //This converter will create an empty MdcMcHitCol on the TDS 00120 MdcMcHitCol *mdcMcHitCol = new MdcMcHitCol; 00121 pObj = mdcMcHitCol; 00122 00123 RAWEVENT *evt = m_inputSvc->currentEvent(); 00124 if (evt == NULL) { 00125 //log << MSG::ERROR << "RawDataCnv has no event!" << endreq; 00126 return StatusCode::FAILURE; 00127 } 00128 00129 assert((evt->getMdcTruth().size())%6 == 0); 00130 00131 MdcTruth_t m_MdcTruth; 00132 MdcMcHit* mdcMcHit; 00133 00134 std::vector<uint32_t>::const_iterator iter = evt->getMdcTruth().begin(); 00135 std::vector<uint32_t>::const_iterator eiter = evt->getMdcTruth().end(); 00136 00137 for (int mdcMcHitId = 0; iter != eiter; mdcMcHitId++) { 00138 // retrieve the MdcTruth data 00139 m_mdcMcHitBuilder.unPack(iter, eiter, m_MdcTruth); 00140 //construct the identifier 00141 const Identifier ident = MdcID::wire_id (m_MdcTruth.layerId, m_MdcTruth.cellId); 00143 mdcMcHit = new MdcMcHit(ident, m_MdcTruth.trackIndex, 00144 m_MdcTruth.x/(m_mdcMcHitBuilder.m_xCoeff*1.0), 00145 m_MdcTruth.y/(m_mdcMcHitBuilder.m_yCoeff*1.0), 00146 m_MdcTruth.z/(m_mdcMcHitBuilder.m_zCoeff*1.0), 00147 m_MdcTruth.driftD/(m_mdcMcHitBuilder.m_driftDCoeff*1.0), 00148 m_MdcTruth.edep/(m_mdcMcHitBuilder.m_edepCoeff*1.0), 00149 m_MdcTruth.posFlag ); 00150 // And add the stuff to the container 00151 mdcMcHitCol->push_back(mdcMcHit); 00152 } 00153 00154 return StatusCode::SUCCESS; 00155 }
StatusCode RawDataMdcMcHitCnv::createRep | ( | DataObject * | pObj, | |
IOpaqueAddress *& | pAddr | |||
) | [virtual] |
Convert the transient object to the requested representation.
Reimplemented from RawDataBaseCnv.
Definition at line 157 of file RawDataMdcMcHitCnv.cxx.
References PackedRawDataCnvSvc::getRawEvent(), m_mdcMcHitBuilder, m_RawDataAccess, EventModel::MC::MdcMcHitCol, and MdcMcHitBuilder::pack().
00158 { 00159 // convert PixelRaw in the container into ByteStream 00160 //MsgStream log(messageService(), "RawDataMdcMcHitCnv"); 00161 00162 WriteRawEvent*& re = m_RawDataAccess->getRawEvent(); 00163 00164 if (re == 0) { 00165 //log << " get RawEvent failed !" << endreq; 00166 return StatusCode::FAILURE; 00167 } 00168 00169 SmartDataPtr<MdcMcHitCol> mdcHitCol(dataProvider(), EventModel::MC::MdcMcHitCol); 00170 00171 if (mdcHitCol == 0) { 00172 //log << "no MdcMcHitCol found" << endreq; 00173 return StatusCode::FAILURE; 00174 } 00175 /*else { 00176 log << MSG::INFO << endreq << "Detailed dump of 1st event: " << endreq; 00177 int nMcHit = 0; 00178 MdcMcHitCol::const_iterator pMdcMcHit = mdcHitCol->begin(); 00179 for ( ; pMdcMcHit != mdcHitCol->end(); pMdcMcHit++) { 00180 log << MSG::INFO << "McHit " << nMcHit++ << " " 00181 << (*pMdcMcHit)->getTrackIndex() << " " 00182 << (*pMdcMcHit)->identify() << " " 00183 << (*pMdcMcHit)->getDepositEnergy() << " " 00184 << (*pMdcMcHit)->getDriftDistance() << " " 00185 << (*pMdcMcHit)->getPositionX() << " " 00186 << (*pMdcMcHit)->getPositionY() << " " 00187 << (*pMdcMcHit)->getPositionZ() << endreq; 00188 } 00189 }*/ 00190 00191 StatusCode sc = m_mdcMcHitBuilder.pack(mdcHitCol, re); 00192 00193 return sc; 00194 00195 }
void RawDataBaseCnv::declareObject | ( | const std::string & | fullPath, | |
const CLID & | clid, | |||
const std::string & | bank, | |||
long | par = 0 | |||
) | [inherited] |
Store TDS path to link a particular converter to an object on the TDS.
Definition at line 81 of file RawDataBaseCnv.cxx.
00082 { 00083 // Purpose and Method: Save the path on the TDS, in the m_leaves vector, 00084 // corresponding to the DataObject that the converter handles. 00085 // m_leaves.push_back(IRawDataCnvSvc::Leaf(path, cl, bank, par)); 00086 }
StatusCode RawDataBaseCnv::fillRepRefs | ( | IOpaqueAddress * | pAddress, | |
DataObject * | pObject | |||
) | [virtual, inherited] |
Resolve the references of the converted object.
Definition at line 29 of file RawDataBaseCnv.cxx.
00030 { 00031 // Purpose and Method: Resolve the references of the converted object. 00032 // It is expected that derived classes will override this method. 00033 return StatusCode::SUCCESS; 00034 }
StatusCode RawDataBaseCnv::finalize | ( | ) | [virtual, inherited] |
Definition at line 73 of file RawDataBaseCnv.cxx.
References RawDataBaseCnv::m_CnvSvc.
00073 { 00074 if ( m_CnvSvc ) { 00075 m_CnvSvc->release(); 00076 m_CnvSvc = 0; 00077 } 00078 return Converter::finalize(); 00079 }
StatusCode RawDataMdcMcHitCnv::initialize | ( | ) |
Reimplemented from RawDataBaseCnv.
Definition at line 49 of file RawDataMdcMcHitCnv.cxx.
References calibUtil::ERROR, RawDataBaseCnv::initialize(), m_inputSvc, m_RawDataAccess, deljobs::string, and Bes_Common::WARNING.
00050 { 00051 00052 std::string PackedRawDataCnvSvc_Name("PackedRawDataCnvSvc"); 00053 std::string RawDataInputSvc_Name("RawDataInputSvc"); 00054 std::string RawDataMdcMcHitCnv_Name("RawDataMdcMcHitCnv"); 00055 00056 // for Mutil-thread by tianhl 00057 //ConversionSvc* pCnvSvc = 0; 00058 //if (pCnvSvc = dynamic_cast<ConversionSvc*>(conversionSvc())){ 00059 SmartIF<IService> pCnvSvc(conversionSvc()); 00060 if (isGaudiThreaded(pCnvSvc->name())){ 00061 PackedRawDataCnvSvc_Name += getGaudiThreadIDfromName(pCnvSvc->name()); 00062 RawDataInputSvc_Name += getGaudiThreadIDfromName(pCnvSvc->name()); 00063 RawDataMdcMcHitCnv_Name += getGaudiThreadIDfromName(pCnvSvc->name()); 00064 } 00065 //} 00066 00067 MsgStream log(messageService(), RawDataMdcMcHitCnv_Name.c_str()); 00068 00069 StatusCode sc = RawDataBaseCnv::initialize(); 00070 if (StatusCode::SUCCESS != sc) { 00071 log << MSG::ERROR << "RawDataBaseCnv: Cant initialize PackedRawDataCnvSvc" << endreq; 00072 return sc; 00073 } 00074 00075 // Check RawDataCnvSvc 00076 IService* isvc = 0; 00077 sc = serviceLocator()->service(PackedRawDataCnvSvc_Name.c_str(), isvc, true); 00078 if (sc != StatusCode::SUCCESS) { 00079 log << MSG::ERROR << "Cant get PackedRawDataCnvSvc" << endreq; 00080 } 00081 00082 m_RawDataAccess = dynamic_cast<PackedRawDataCnvSvc*> (isvc); 00083 if (m_RawDataAccess == 0 ) { 00084 log << MSG::ERROR << "RawDataMdcCnv: Cant cast to RawDataCnvSvc " << endreq; 00085 return StatusCode::FAILURE; 00086 } 00087 00088 IService* svc = 0; 00089 sc = serviceLocator()->getService(RawDataInputSvc_Name.c_str(), svc); 00090 if (sc != StatusCode::SUCCESS ) { 00091 log << MSG::WARNING << "Cant get RawDataInputSvc " << endreq; 00092 return sc ; 00093 } 00094 00095 m_inputSvc = dynamic_cast<RawDataInputSvc*> (svc); 00096 if (m_inputSvc == 0 ) { 00097 log << MSG::WARNING << "Cant cast to RawDataInputSvc " << endreq; 00098 return StatusCode::FAILURE ; 00099 } 00100 00101 return StatusCode::SUCCESS; 00102 }
destination* Converter< Ty1, Ty2 >::operator | ( | const source & | ) | const [inline, inherited] |
virtual long RawDataMdcMcHitCnv::repSvcType | ( | ) | const [inline, virtual] |
Reimplemented from RawDataBaseCnv.
Definition at line 46 of file RawDataMdcMcHitCnv.h.
References PACKEDRAWEVENT_StorageType.
00046 { 00047 return PACKEDRAWEVENT_StorageType; 00048 }
static const unsigned char RawDataMdcMcHitCnv::storageType | ( | ) | [inline, static] |
Reimplemented from RawDataBaseCnv.
Definition at line 50 of file RawDataMdcMcHitCnv.h.
References PACKEDRAWEVENT_StorageType.
00050 { 00051 return PACKEDRAWEVENT_StorageType; 00052 }
StatusCode RawDataMdcMcHitCnv::updateObj | ( | IOpaqueAddress * | , | |
DataObject * | ||||
) | [virtual] |
override the RawDataBaseCnv version
Definition at line 105 of file RawDataMdcMcHitCnv.cxx.
00105 { 00106 // Purpose and Method: This method does nothing other than announce it has 00107 // been called. 00108 00109 //MsgStream log(msgSvc(), "RawDataMdcMcHitCnv"); 00110 //log << MSG::DEBUG << "RawDataMdcMcHitCnv::updateObj" << endreq; 00111 return Converter::updateObj(pAddr, pObj); 00112 }
StatusCode RawDataBaseCnv::updateRep | ( | IOpaqueAddress * | pAddress, | |
DataObject * | pObject | |||
) | [virtual, inherited] |
Update the converted representation of a transient object.
Definition at line 36 of file RawDataBaseCnv.cxx.
00037 { 00038 // Purpose and Method: Update the converted representation of a transient 00039 // object. It is expected that derived classes will override this. 00040 return StatusCode::SUCCESS; 00041 }
StatusCode RawDataBaseCnv::updateRepRefs | ( | IOpaqueAddress * | pAddress, | |
DataObject * | pObject | |||
) | [virtual, inherited] |
Update the references of an already converted object.
Definition at line 43 of file RawDataBaseCnv.cxx.
00044 { 00045 // Purpose and Method: Update the references of an already converted object. 00046 // It is expected that derived classes will override this method. 00047 return StatusCode::SUCCESS; 00048 }
friend class CnvFactory< RawDataMdcMcHitCnv > [friend] |
Definition at line 36 of file RawDataMdcMcHitCnv.h.
IRawDataCnvSvc* RawDataBaseCnv::m_CnvSvc [protected, inherited] |
Pointer to event conversion service interface.
Definition at line 28 of file RawDataBaseCnv.h.
Referenced by RawDataBaseCnv::finalize().
IRawDataInputSvc* RawDataMdcMcHitCnv::m_inputSvc [private] |
std::vector<IRawDataCnvSvc::Leaf> RawDataBaseCnv::m_leaves [protected, inherited] |
Leaf objects giving the locations of the objects in the data store.
Definition at line 30 of file RawDataBaseCnv.h.
MdcBuilder for packing or unpacking data.
Definition at line 68 of file RawDataMdcMcHitCnv.h.
Referenced by createObj(), and createRep().
Define the interface to raw data cnv.
Definition at line 66 of file RawDataMdcMcHitCnv.h.
Referenced by createRep(), and initialize().