#include <RawDataMcParticleCnv.h>
Inheritance diagram for RawDataMcParticleCnv:
Public Types | |
typedef Ty2 | destination |
typedef Ty2 | destination |
typedef Ty1 | source |
typedef Ty1 | source |
Public Member Functions | |
StatusCode | createObj (IOpaqueAddress *pAddr, DataObject *&pObj) |
StatusCode | createObj (IOpaqueAddress *pAddr, DataObject *&pObj) |
virtual StatusCode | createRep (DataObject *pObj, IOpaqueAddress *&pAddr) |
Convert the transient object to the requested representation. | |
virtual StatusCode | createRep (DataObject *pObj, IOpaqueAddress *&pAddr) |
Convert the transient object to the requested representation. | |
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. | |
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 | fillRepRefs (IOpaqueAddress *pAddress, DataObject *pObject) |
Resolve the references of the converted object. | |
virtual StatusCode | finalize () |
virtual StatusCode | finalize () |
StatusCode | initialize () |
StatusCode | initialize () |
destination * | operator (const source &) const |
destination * | operator (const source &) const |
virtual long | repSvcType () const |
virtual long | repSvcType () const |
virtual StatusCode | updateObj (IOpaqueAddress *pAddr, DataObject *pObj) |
override the RawDataBaseCnv version | |
virtual StatusCode | updateObj (IOpaqueAddress *pAddr, DataObject *pObj) |
override the RawDataBaseCnv version | |
virtual StatusCode | updateRep (IOpaqueAddress *pAddress, DataObject *pObject) |
Update the converted representation of a transient 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. | |
virtual StatusCode | updateRepRefs (IOpaqueAddress *pAddress, DataObject *pObject) |
Update the references of an already converted object. | |
Static Public Member Functions | |
const CLID & | classID () |
const CLID & | classID () |
const unsigned char | storageType () |
const unsigned char | storageType () |
Protected Member Functions | |
virtual destination * | convert (const source &) const =0 |
virtual destination * | convert (const source &) const =0 |
RawDataMcParticleCnv (ISvcLocator *svc) | |
RawDataMcParticleCnv (ISvcLocator *svc) | |
Protected Attributes | |
IRawDataCnvSvc * | m_CnvSvc |
Pointer to event conversion service interface. | |
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. | |
std::vector< IRawDataCnvSvc::Leaf > | m_leaves |
Leaf objects giving the locations of the objects in the data store. | |
Private Member Functions | |
void | addMother (McParticle *currentParticle, McParticleCol *particleCol) |
void | addMother (McParticle *currentParticle, McParticleCol *particleCol) |
Private Attributes | |
IRawDataInputSvc * | m_inputSvc |
IRawDataInputSvc * | m_inputSvc |
McParticleBuilder | m_mcParticleBuilder |
MdcBuilder for packing or unpacking data. | |
PackedRawDataCnvSvc * | m_RawDataAccess |
Define the interface to raw data cnv. | |
PackedRawDataCnvSvc * | m_RawDataAccess |
Define the interface to raw data cnv. | |
Friends | |
class | CnvFactory<RawDataMcParticleCnv> |
|
|
|
|
|
|
|
|
|
00032 : 00033 RawDataBaseCnv(PACKEDRAWEVENT_StorageType, classID(), svc) 00034 { 00035 //init(); 00036 }
|
|
|
|
|
|
00187 { 00188 00189 if (currentParticle->leafParticle()) return; 00190 00191 bool found = false; 00192 McParticleCol::iterator iter = particleCol->begin(); 00193 //std::cout << "particleCol->size() = " << particleCol->size() << std::endl; 00194 for ( ; iter != particleCol->end(); iter++) { 00195 if (currentParticle->vertexIndex1() == (*iter)->vertexIndex0()) { 00196 found = true; 00197 (*iter)->setMother(currentParticle); 00198 currentParticle->addDaughter(*iter); 00199 addMother((*iter), particleCol); 00200 } 00201 } 00202 00203 if (!found) 00204 std::cout << "RawDataMcParticleCnv::addMother: inconsistency was found!" << std::endl; 00205 }
|
|
Reimplemented from RawDataBaseCnv. |
|
Reimplemented from RawDataBaseCnv. 00041 {
00042 return CLID_McParticleCol;
00043 }
|
|
|
|
|
|
|
|
00110 { 00111 //MsgStream log(msgSvc(), "RawDataMcParticleCnv"); 00112 00113 //This converter will create an empty McParticleCol on the TDS 00114 McParticleCol *mcParticleCol = new McParticleCol; 00115 pObj = mcParticleCol; 00116 00117 RAWEVENT *evt = m_inputSvc->currentEvent(); 00118 if (evt == NULL) { 00119 //log << MSG::ERROR << "RawDataCnv has no event!" << endreq; 00120 return StatusCode::FAILURE; 00121 } 00122 00123 const BufferHolder& mcParBuf = evt->getMcParBuf(); 00124 if (mcParBuf.nBuf() == 0) { 00125 //cerr << "no McParticle Data Buffer found!!!" << endl; 00126 return StatusCode::FAILURE; 00127 } 00128 uint32_t* buf = mcParBuf(0); 00129 00130 uint32_t nParticle = (buf[0] >> 16); 00131 //uint32_t nVertex = (buf[0] & 0xFFFF); 00132 double* vPointer = (double*)(buf + nParticle*11 + 1); 00133 00134 for (uint32_t i = 0; i < nParticle; i++) { 00135 McParticle* mcPar = new McParticle; 00136 m_mcParticleBuilder.unPack((buf+1+i*11), vPointer, mcPar); 00137 mcParticleCol->push_back(mcPar); 00138 } 00139 00140 // Get primary McParticles 00141 SmartRefVector<McParticle> primaryParticleCol; 00142 McParticleCol::iterator iter_particle = mcParticleCol->begin(); 00143 for ( ; iter_particle != mcParticleCol->end(); iter_particle++) { 00144 if ((*iter_particle)->primaryParticle()) { 00145 McParticle* mcPart = (McParticle*)(*iter_particle); 00146 primaryParticleCol.push_back(mcPart); 00147 } 00148 } 00149 00150 if (primaryParticleCol.empty()) { 00151 //log << MSG::WARNING << "createObj error: no primary particle found!" << endreq; 00152 } 00153 00154 // Add mother particle recursively 00155 SmartRefVector<McParticle>::iterator iter_primary = primaryParticleCol.begin(); 00156 //std::cout << "primaryParticleCol.size() = " << primaryParticleCol.size() << std::endl; 00157 for ( ; iter_primary != primaryParticleCol.end(); iter_primary++) { 00158 00159 if (!(*iter_primary)->leafParticle()) 00160 addMother((*iter_primary), mcParticleCol); 00161 } 00162 00163 return StatusCode::SUCCESS; 00164 }
|
|
Convert the transient object to the requested representation.
Reimplemented from RawDataBaseCnv. |
|
Convert the transient object to the requested representation.
Reimplemented from RawDataBaseCnv. 00167 { 00168 // convert PixelRaw in the container into ByteStream 00169 //MsgStream log(messageService(), "RawDataMcParticleCnv"); 00170 00171 WriteRawEvent*& re = m_RawDataAccess->getRawEvent(); 00172 if (re == 0) { 00173 //log << " get RawEvent failed !" << endreq; 00174 return StatusCode::FAILURE; 00175 } 00176 00177 SmartDataPtr<McParticleCol> mcParticleCol(dataProvider(), EventModel::MC::McParticleCol); 00178 if (mcParticleCol == 0) { 00179 //log << "no McParticleCol found" << endreq; 00180 return StatusCode::FAILURE; 00181 } 00182 00183 return m_mcParticleBuilder.pack(mcParticleCol, re); 00184 }
|
|
Store TDS path to link a particular converter to an object on the TDS.
|
|
Store TDS path to link a particular converter to an object on the TDS.
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 }
|
|
Resolve the references of the converted object.
|
|
Resolve the references of the converted object.
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 }
|
|
|
|
00073 { 00074 if ( m_CnvSvc ) { 00075 m_CnvSvc->release(); 00076 m_CnvSvc = 0; 00077 } 00078 return Converter::finalize(); 00079 }
|
|
Reimplemented from RawDataBaseCnv. |
|
Reimplemented from RawDataBaseCnv. 00046 { 00047 00048 std::string PackedRawDataCnvSvc_Name("PackedRawDataCnvSvc"); 00049 std::string RawDataInputSvc_Name("RawDataInputSvc"); 00050 std::string RawDataMcParticleCnv_Name("RawDataMcParticleCnv"); 00051 00052 // for Mutil-thread by tianhl 00053 ConversionSvc* pCnvSvc = 0; 00054 if (pCnvSvc = dynamic_cast<ConversionSvc*>(conversionSvc())){ 00055 if (isGaudiThreaded(pCnvSvc->name())){ 00056 PackedRawDataCnvSvc_Name += getGaudiThreadIDfromName(pCnvSvc->name()); 00057 RawDataInputSvc_Name += getGaudiThreadIDfromName(pCnvSvc->name()); 00058 RawDataMcParticleCnv_Name += getGaudiThreadIDfromName(pCnvSvc->name()); 00059 } 00060 } 00061 00062 MsgStream log(messageService(), RawDataMcParticleCnv_Name.c_str()); 00063 00064 StatusCode sc = RawDataBaseCnv::initialize(); 00065 if (StatusCode::SUCCESS != sc) { 00066 log << MSG::ERROR << "RawDataBaseCnv: Cant initialize PackedRawDataCnvSvc" << endreq; 00067 return sc; 00068 } 00069 00070 // Check RawDataCnvSvc 00071 IService* isvc = 0; 00072 sc = serviceLocator()->service(PackedRawDataCnvSvc_Name.c_str(), isvc, true); 00073 if (sc != StatusCode::SUCCESS) { 00074 log << MSG::ERROR << "Cant get PackedRawDataCnvSvc" << endreq; 00075 } 00076 00077 m_RawDataAccess = dynamic_cast<PackedRawDataCnvSvc*> (isvc); 00078 if (m_RawDataAccess == 0 ) { 00079 log << MSG::ERROR << "RawDataMcParticleCnv: Cant cast to RawDataCnvSvc " << endreq; 00080 return StatusCode::FAILURE; 00081 } 00082 00083 sc = serviceLocator()->getService(RawDataInputSvc_Name.c_str(), isvc); 00084 if (sc != StatusCode::SUCCESS ) { 00085 log << MSG::WARNING << "Cant get RawDataInputSvc " << endreq; 00086 return sc ; 00087 } 00088 00089 m_inputSvc = dynamic_cast<RawDataInputSvc*> (isvc); 00090 if (m_inputSvc == 0 ) { 00091 log << MSG::WARNING << "Cant cast to RawDataInputSvc " << endreq; 00092 return StatusCode::FAILURE ; 00093 } 00094 00095 return StatusCode::SUCCESS; 00096 }
|
|
|
|
|
|
Reimplemented from RawDataBaseCnv. 00046 {
00047 return PACKEDRAWEVENT_StorageType;
00048 }
|
|
Reimplemented from RawDataBaseCnv. 00046 {
00047 return PACKEDRAWEVENT_StorageType;
00048 }
|
|
Reimplemented from RawDataBaseCnv. 00050 {
00051 return PACKEDRAWEVENT_StorageType;
00052 }
|
|
Reimplemented from RawDataBaseCnv. 00050 {
00051 return PACKEDRAWEVENT_StorageType;
00052 }
|
|
override the RawDataBaseCnv version
|
|
override the RawDataBaseCnv version
00099 { 00100 // Purpose and Method: This method does nothing other than announce it has 00101 // been called. 00102 00103 //MsgStream log(msgSvc(), "RawDataMcParticleCnv"); 00104 //log << MSG::DEBUG << "RawDataMcParticleCnv::updateObj" << endreq; 00105 return Converter::updateObj(pAddr, pObj); 00106 }
|
|
Update the converted representation of a transient object.
|
|
Update the converted representation of a transient object.
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 }
|
|
Update the references of an already converted object.
|
|
Update the references of an already converted object.
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 }
|
|
|
|
Pointer to event conversion service interface.
|
|
Pointer to event conversion service interface.
|
|
|
|
|
|
Leaf objects giving the locations of the objects in the data store.
|
|
Leaf objects giving the locations of the objects in the data store.
|
|
MdcBuilder for packing or unpacking data.
|
|
Define the interface to raw data cnv.
|
|
Define the interface to raw data cnv.
|