#include <RawDataEmcMcHitCnv.h>
Inheritance diagram for RawDataEmcMcHitCnv:
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 | |
RawDataEmcMcHitCnv (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. | |
EmcMcHitBuilder | m_emcMcHitBuilder |
EmcMcHitBuilder for packing or unpacking data. | |
Friends | |
class | CnvFactory< RawDataEmcMcHitCnv > |
Definition at line 32 of file RawDataEmcMcHitCnv.h.
typedef Ty2 Converter< Ty1, Ty2 >::destination [inherited] |
Definition at line 19 of file Converter.h.
Definition at line 18 of file Converter.h.
RawDataEmcMcHitCnv::RawDataEmcMcHitCnv | ( | ISvcLocator * | svc | ) | [protected] |
Definition at line 34 of file RawDataEmcMcHitCnv.cxx.
00034 : 00035 RawDataBaseCnv(PACKEDRAWEVENT_StorageType, classID(), svc) 00036 { 00037 //init(); 00038 }
const CLID & RawDataEmcMcHitCnv::classID | ( | ) | [static] |
Reimplemented from RawDataBaseCnv.
Definition at line 42 of file RawDataEmcMcHitCnv.cxx.
References CLID_EmcMcHitCol.
Referenced by PackedRawDataCnvSvc::addConverters().
00043 { 00044 return CLID_EmcMcHitCol; 00045 }
virtual destination* Converter< Ty1, Ty2 >::convert | ( | const source & | ) | const [protected, pure virtual, inherited] |
StatusCode RawDataEmcMcHitCnv::createObj | ( | IOpaqueAddress * | pAddr, | |
DataObject *& | pObj | |||
) |
Definition at line 111 of file RawDataEmcMcHitCnv.cxx.
References EmcID::crystal_id(), IRawDataInputSvc::currentEvent(), EventModel::MC::EmcMcHitCol, RAWEVENT::getEmcTruth(), iter(), m_emcMcHitBuilder, m_inputSvc, EmcMcHitBuilder::m_pxCoeff, EmcMcHitBuilder::m_pyCoeff, EmcMcHitBuilder::m_pzCoeff, EmcMcHitBuilder::m_totalEdepCoeff, EmcMcHitBuilder::m_xCoeff, EmcMcHitBuilder::m_yCoeff, EmcMcHitBuilder::m_zCoeff, EmcTruth_t::numPhi, EmcTruth_t::numTheta, EmcTruth_t::partId, EmcTruth_t::px, EmcTruth_t::py, EmcTruth_t::pz, EmcTruth_t::totalEdep, EmcTruth_t::trackIndex, EmcMcHitBuilder::unPack(), EmcTruth_t::x, EmcTruth_t::y, and EmcTruth_t::z.
00112 { 00113 00114 //This converter will create an empty EmcMcHitCol on the TDS 00115 EmcMcHitCol *emcMcHitCol = new EmcMcHitCol; 00116 pObj = emcMcHitCol; 00117 00118 RAWEVENT *evt = m_inputSvc->currentEvent(); 00119 if (evt == NULL) { 00120 //MsgStream log(msgSvc(), "RawDataEmcMcHitCnv"); 00121 //log << MSG::ERROR << "RawDataCnv has no event!" << endreq; 00122 return StatusCode::FAILURE; 00123 } 00124 00125 EmcMcHit* emcMcHit; 00126 EmcTruth_t m_EmcTruth; 00127 00128 assert((evt->getEmcTruth().size()%8) == 0); 00129 00130 std::vector<uint32_t>::const_iterator iter = evt->getEmcTruth().begin(); 00131 std::vector<uint32_t>::const_iterator eiter = evt->getEmcTruth().end(); 00132 00133 for (int emcMcHitId = 0; iter != eiter; emcMcHitId++) { 00134 // retrieve the McTruth data 00135 m_emcMcHitBuilder.unPack(iter, eiter, m_EmcTruth); 00136 // construct the identifier 00137 Identifier ident = EmcID::crystal_id(m_EmcTruth.partId, m_EmcTruth.numTheta, m_EmcTruth.numPhi); 00138 // construct the EmcMcHit 00139 emcMcHit = new EmcMcHit(ident, m_EmcTruth.trackIndex, 00140 m_EmcTruth.x/(m_emcMcHitBuilder.m_xCoeff*1.0), 00141 m_EmcTruth.y/(m_emcMcHitBuilder.m_yCoeff*1.0), 00142 m_EmcTruth.z/(m_emcMcHitBuilder.m_zCoeff*1.0), 00143 m_EmcTruth.px/(m_emcMcHitBuilder.m_pxCoeff*1.0), 00144 m_EmcTruth.py/(m_emcMcHitBuilder.m_pyCoeff*1.0), 00145 m_EmcTruth.pz/(m_emcMcHitBuilder.m_pzCoeff*1.0), 00146 m_EmcTruth.totalEdep/(m_emcMcHitBuilder.m_totalEdepCoeff*1.0) ); 00147 // And add the stuff to the container 00148 emcMcHitCol->push_back(emcMcHit); 00149 } 00150 00151 return StatusCode::SUCCESS; 00152 00153 }
StatusCode RawDataEmcMcHitCnv::createRep | ( | DataObject * | pObj, | |
IOpaqueAddress *& | pAddr | |||
) | [virtual] |
Convert the transient object to the requested representation.
Reimplemented from RawDataBaseCnv.
Definition at line 155 of file RawDataEmcMcHitCnv.cxx.
References EventModel::MC::EmcMcHitCol, PackedRawDataCnvSvc::getRawEvent(), m_emcMcHitBuilder, m_RawDataAccess, and EmcMcHitBuilder::pack().
00156 { 00157 // convert PixelRaw in the container into ByteStream 00158 //MsgStream log(messageService(), "RawDataEmcMcHitCnv"); 00159 00160 WriteRawEvent*& re = m_RawDataAccess->getRawEvent(); 00161 00162 if (re == 0) { 00163 //log << " get RawEvent failed !" << endreq; 00164 return StatusCode::FAILURE; 00165 } 00166 00167 SmartDataPtr<EmcMcHitCol> mcHitCol(dataProvider(), EventModel::MC::EmcMcHitCol); 00168 00169 if (mcHitCol == 0) { 00170 //log << "no EmcMcHitCol found" << endreq; 00171 return StatusCode::FAILURE; 00172 } 00173 00174 StatusCode sc = m_emcMcHitBuilder.pack(mcHitCol, re); 00175 00176 return sc; 00177 00178 }
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 RawDataEmcMcHitCnv::initialize | ( | ) |
Reimplemented from RawDataBaseCnv.
Definition at line 47 of file RawDataEmcMcHitCnv.cxx.
References calibUtil::ERROR, RawDataBaseCnv::initialize(), m_inputSvc, m_RawDataAccess, deljobs::string, and Bes_Common::WARNING.
00048 { 00049 std::string PackedRawDataCnvSvc_Name("PackedRawDataCnvSvc"); 00050 std::string RawDataInputSvc_Name("RawDataInputSvc"); 00051 std::string RawDataEmcMcHitCnv_Name("RawDataEmcMcHitCnv"); 00052 00053 // for Mutil-thread by tianhl 00054 //ConversionSvc* pCnvSvc = 0; 00055 //if (pCnvSvc = dynamic_cast<ConversionSvc*>(conversionSvc())){ 00056 SmartIF<IService> pCnvSvc(conversionSvc()); 00057 if (isGaudiThreaded(pCnvSvc->name())){ 00058 PackedRawDataCnvSvc_Name += getGaudiThreadIDfromName(pCnvSvc->name()); 00059 RawDataInputSvc_Name += getGaudiThreadIDfromName(pCnvSvc->name()); 00060 RawDataEmcMcHitCnv_Name += getGaudiThreadIDfromName(pCnvSvc->name()); 00061 } 00062 //} 00063 00064 MsgStream log(messageService(), RawDataEmcMcHitCnv_Name.c_str()); 00065 00066 StatusCode sc = RawDataBaseCnv::initialize(); 00067 if (StatusCode::SUCCESS != sc) { 00068 log << MSG::ERROR << "RawDataBaseCnv: Cant initialize PackedRawDataCnvSvc" << endreq; 00069 return sc; 00070 } 00071 00072 // Check RawDataCnvSvc 00073 IService* isvc = 0; 00074 sc = serviceLocator()->service(PackedRawDataCnvSvc_Name.c_str(), isvc, true); 00075 if (sc != StatusCode::SUCCESS) { 00076 log << MSG::ERROR << "Cant get PackedRawDataCnvSvc" << endreq; 00077 } 00078 00079 m_RawDataAccess = dynamic_cast<PackedRawDataCnvSvc*> (isvc); 00080 if (m_RawDataAccess == 0 ) { 00081 log << MSG::ERROR << "RawDataEmcCnv: Cant cast to RawDataCnvSvc " << endreq; 00082 return StatusCode::FAILURE; 00083 } 00084 00085 sc = serviceLocator()->getService(RawDataInputSvc_Name.c_str(), isvc); 00086 if (sc != StatusCode::SUCCESS ) { 00087 log << MSG::WARNING << "Cant get RawDataInputSvc " << endreq; 00088 return sc ; 00089 } 00090 00091 m_inputSvc = dynamic_cast<RawDataInputSvc*> (isvc); 00092 if (m_inputSvc == 0 ) { 00093 log << MSG::WARNING << "Cant cast to RawDataInputSvc " << endreq; 00094 return StatusCode::FAILURE ; 00095 } 00096 00097 return StatusCode::SUCCESS; 00098 }
destination* Converter< Ty1, Ty2 >::operator | ( | const source & | ) | const [inline, inherited] |
virtual long RawDataEmcMcHitCnv::repSvcType | ( | ) | const [inline, virtual] |
Reimplemented from RawDataBaseCnv.
Definition at line 46 of file RawDataEmcMcHitCnv.h.
References PACKEDRAWEVENT_StorageType.
00046 { 00047 return PACKEDRAWEVENT_StorageType; 00048 }
static const unsigned char RawDataEmcMcHitCnv::storageType | ( | ) | [inline, static] |
Reimplemented from RawDataBaseCnv.
Definition at line 50 of file RawDataEmcMcHitCnv.h.
References PACKEDRAWEVENT_StorageType.
00050 { 00051 return PACKEDRAWEVENT_StorageType; 00052 }
StatusCode RawDataEmcMcHitCnv::updateObj | ( | IOpaqueAddress * | , | |
DataObject * | ||||
) | [virtual] |
override the RawDataBaseCnv version
Definition at line 101 of file RawDataEmcMcHitCnv.cxx.
00101 { 00102 // Purpose and Method: This method does nothing other than announce it has 00103 // been called. 00104 00105 //MsgStream log(msgSvc(), "RawDataEmcMcHitCnv"); 00106 //log << MSG::DEBUG << "RawDataEmcMcHitCnv::updateObj" << endreq; 00107 return Converter::updateObj(pAddr, pObj); 00108 }
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< RawDataEmcMcHitCnv > [friend] |
Definition at line 36 of file RawDataEmcMcHitCnv.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().
EmcMcHitBuilder for packing or unpacking data.
Definition at line 68 of file RawDataEmcMcHitCnv.h.
Referenced by createObj(), and createRep().
IRawDataInputSvc* RawDataEmcMcHitCnv::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.
Define the interface to raw data cnv.
Definition at line 66 of file RawDataEmcMcHitCnv.h.
Referenced by createRep(), and initialize().