#include <RawDataTofMcHitCnv.h>
Inheritance diagram for RawDataTofMcHitCnv:
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 | |
RawDataTofMcHitCnv (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. | |
TofMcHitBuilder | m_tofMcHitBuilder |
TofMcHitder for packing or unpacking data. | |
Friends | |
class | CnvFactory< RawDataTofMcHitCnv > |
Definition at line 32 of file RawDataTofMcHitCnv.h.
typedef Ty2 Converter< Ty1, Ty2 >::destination [inherited] |
Definition at line 19 of file Converter.h.
Definition at line 18 of file Converter.h.
RawDataTofMcHitCnv::RawDataTofMcHitCnv | ( | ISvcLocator * | svc | ) | [protected] |
Definition at line 36 of file RawDataTofMcHitCnv.cxx.
00036 : 00037 RawDataBaseCnv(PACKEDRAWEVENT_StorageType, classID(), svc) 00038 { 00039 //init(); 00040 }
const CLID & RawDataTofMcHitCnv::classID | ( | ) | [static] |
Reimplemented from RawDataBaseCnv.
Definition at line 44 of file RawDataTofMcHitCnv.cxx.
References CLID_TofMcHitCol.
Referenced by PackedRawDataCnvSvc::addConverters().
00045 { 00046 return CLID_TofMcHitCol; 00047 }
virtual destination* Converter< Ty1, Ty2 >::convert | ( | const source & | ) | const [protected, pure virtual, inherited] |
StatusCode RawDataTofMcHitCnv::createObj | ( | IOpaqueAddress * | pAddr, | |
DataObject *& | pObj | |||
) |
Definition at line 114 of file RawDataTofMcHitCnv.cxx.
References TofID::cell_id(), IRawDataInputSvc::currentEvent(), calibUtil::ERROR, TofID::getPHI_BARREL_MAX(), RAWEVENT::getTofTruth(), iter(), m_inputSvc, TofMcHitBuilder::m_pxCoeff, TofMcHitBuilder::m_pyCoeff, TofMcHitBuilder::m_pzCoeff, TofMcHitBuilder::m_timeCoeff, m_tofMcHitBuilder, TofMcHitBuilder::m_trackLengthCoeff, TofMcHitBuilder::m_xCoeff, TofMcHitBuilder::m_yCoeff, TofMcHitBuilder::m_zCoeff, msgSvc(), TofTruth_t::partId, TofTruth_t::px, TofTruth_t::py, TofTruth_t::pz, TofTruth_t::scinNb, TofTruth_t::strip, TofTruth_t::time, EventModel::MC::TofMcHitCol, TofTruth_t::trackIndex, TofTruth_t::trackLength, TofMcHitBuilder::unPack(), TofTruth_t::x, TofTruth_t::y, and TofTruth_t::z.
00115 { 00116 MsgStream log(msgSvc(), "RawDataTofMcHitCnv"); 00117 00118 //This converter will create an empty TofMcHitCol on the TDS 00119 TofMcHitCol *tofMcHitCol = new TofMcHitCol; 00120 pObj = tofMcHitCol; 00121 00122 RAWEVENT *evt = m_inputSvc->currentEvent(); 00123 if (evt == NULL) { 00124 //log << MSG::ERROR << "RawDataCnv has no event!" << endreq; 00125 return StatusCode::FAILURE; 00126 } 00127 00128 assert((evt->getTofTruth().size())%9 == 0); 00129 00130 TofTruth_t m_TofTruth; 00131 TofMcHit* tofMcHit; 00132 00133 std::vector<uint32_t>::const_iterator iter = evt->getTofTruth().begin(); 00134 std::vector<uint32_t>::const_iterator eiter = evt->getTofTruth().end(); 00135 00136 for (int tofMcHitId = 0; iter != eiter; tofMcHitId++) { 00137 // retrieve the TofTruth data 00138 m_tofMcHitBuilder.unPack(iter, eiter, m_TofTruth); 00139 // construct the identifier 00140 Identifier ident; 00141 unsigned int barrel_ec = m_TofTruth.partId; 00142 // for scintillator 00143 if( barrel_ec>=0 && barrel_ec<=2 ) { 00144 unsigned int layer = 0; 00145 if( m_TofTruth.scinNb > TofID::getPHI_BARREL_MAX() ) { 00146 layer = 1; 00147 m_TofTruth.scinNb -= ( TofID::getPHI_BARREL_MAX() + 1 ); 00148 } 00149 ident = TofID::cell_id( barrel_ec, layer, m_TofTruth.scinNb, 0 ); 00150 } 00151 // for ETF(MRPC) 00152 else if( barrel_ec>=3 ) { 00153 unsigned int endcap = 0; 00154 if( barrel_ec==4 ) { endcap = 1; } 00155 ident = TofID::cell_id( 3, endcap, m_TofTruth.scinNb, m_TofTruth.strip, 0 ); 00156 } 00157 else { 00158 log << MSG::ERROR << "barrel_ec is not correct! barrel_ec=" << barrel_ec << endreq; 00159 } 00160 00161 //construct the TofMcHit 00162 tofMcHit = new TofMcHit(ident, m_TofTruth.trackIndex, 00163 m_TofTruth.x/(m_tofMcHitBuilder.m_xCoeff*1.0), 00164 m_TofTruth.y/(m_tofMcHitBuilder.m_yCoeff*1.0), 00165 m_TofTruth.z/(m_tofMcHitBuilder.m_zCoeff*1.0), 00166 m_TofTruth.px/(m_tofMcHitBuilder.m_pxCoeff*1.0), 00167 m_TofTruth.py/(m_tofMcHitBuilder.m_pyCoeff*1.0), 00168 m_TofTruth.pz/(m_tofMcHitBuilder.m_pzCoeff*1.0), 00169 m_TofTruth.trackLength/(m_tofMcHitBuilder.m_trackLengthCoeff*1.0), 00170 m_TofTruth.time/(m_tofMcHitBuilder.m_timeCoeff*1.0) ); 00171 // And add the stuff to the container 00172 tofMcHitCol->push_back(tofMcHit); 00173 } 00174 00175 return StatusCode::SUCCESS; 00176 00177 }
StatusCode RawDataTofMcHitCnv::createRep | ( | DataObject * | pObj, | |
IOpaqueAddress *& | pAddr | |||
) | [virtual] |
Convert the transient object to the requested representation.
Reimplemented from RawDataBaseCnv.
Definition at line 179 of file RawDataTofMcHitCnv.cxx.
References PackedRawDataCnvSvc::getRawEvent(), m_RawDataAccess, m_tofMcHitBuilder, TofMcHitBuilder::pack(), and EventModel::MC::TofMcHitCol.
00180 { 00181 // convert PixelRaw in the container into ByteStream 00182 //MsgStream log(messageService(), "RawDataTofMcHitCnv"); 00183 00184 WriteRawEvent*& re = m_RawDataAccess->getRawEvent(); 00185 00186 if (re == 0) { 00187 //log << " get RawEvent failed !" << endreq; 00188 return StatusCode::FAILURE; 00189 } 00190 00191 SmartDataPtr<TofMcHitCol> mcHitCol(dataProvider(), EventModel::MC::TofMcHitCol); 00192 00193 if (mcHitCol == 0) { 00194 //log << "no TofMcHitCol found" << endreq; 00195 return StatusCode::FAILURE; 00196 } 00197 00198 StatusCode sc = m_tofMcHitBuilder.pack(mcHitCol, re); 00199 00200 return sc; 00201 00202 }
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 RawDataTofMcHitCnv::initialize | ( | ) |
Reimplemented from RawDataBaseCnv.
Definition at line 49 of file RawDataTofMcHitCnv.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 RawDataTofMcHitCnv_Name("RawDataTofMcHitCnv"); 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 RawDataTofMcHitCnv_Name += getGaudiThreadIDfromName(pCnvSvc->name()); 00064 } 00065 //} 00066 00067 MsgStream log(messageService(), RawDataTofMcHitCnv_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 << "RawDataTofCnv: Cant cast to RawDataCnvSvc " << endreq; 00085 return StatusCode::FAILURE; 00086 } 00087 00088 sc = serviceLocator()->getService(RawDataInputSvc_Name.c_str(), isvc); 00089 if (sc != StatusCode::SUCCESS ) { 00090 log << MSG::WARNING << "Cant get RawDataInputSvc " << endreq; 00091 return sc ; 00092 } 00093 00094 m_inputSvc = dynamic_cast<RawDataInputSvc*> (isvc); 00095 if (m_inputSvc == 0 ) { 00096 log << MSG::WARNING << "Cant cast to RawDataInputSvc " << endreq; 00097 return StatusCode::FAILURE ; 00098 } 00099 00100 return StatusCode::SUCCESS; 00101 }
destination* Converter< Ty1, Ty2 >::operator | ( | const source & | ) | const [inline, inherited] |
virtual long RawDataTofMcHitCnv::repSvcType | ( | ) | const [inline, virtual] |
Reimplemented from RawDataBaseCnv.
Definition at line 46 of file RawDataTofMcHitCnv.h.
References PACKEDRAWEVENT_StorageType.
00046 { 00047 return PACKEDRAWEVENT_StorageType; 00048 }
static const unsigned char RawDataTofMcHitCnv::storageType | ( | ) | [inline, static] |
Reimplemented from RawDataBaseCnv.
Definition at line 50 of file RawDataTofMcHitCnv.h.
References PACKEDRAWEVENT_StorageType.
00050 { 00051 return PACKEDRAWEVENT_StorageType; 00052 }
StatusCode RawDataTofMcHitCnv::updateObj | ( | IOpaqueAddress * | , | |
DataObject * | ||||
) | [virtual] |
override the RawDataBaseCnv version
Definition at line 104 of file RawDataTofMcHitCnv.cxx.
00104 { 00105 // Purpose and Method: This method does nothing other than announce it has 00106 // been called. 00107 00108 //MsgStream log(msgSvc(), "RawDataTofMcHitCnv"); 00109 //log << MSG::DEBUG << "RawDataTofMcHitCnv::updateObj" << endreq; 00110 return Converter::updateObj(pAddr, pObj); 00111 }
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< RawDataTofMcHitCnv > [friend] |
Definition at line 36 of file RawDataTofMcHitCnv.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* RawDataTofMcHitCnv::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 RawDataTofMcHitCnv.h.
Referenced by createRep(), and initialize().
TofMcHitder for packing or unpacking data.
Definition at line 68 of file RawDataTofMcHitCnv.h.
Referenced by createObj(), and createRep().