BOSS 7.0.5
BESIII Offline Software System
Loading...
Searching...
No Matches
RawDataMcParticleCnv Class Reference

#include <RawDataMcParticleCnv.h>

+ Inheritance diagram for RawDataMcParticleCnv:

Public Member Functions

StatusCode initialize ()
 
virtual long repSvcType () const
 
StatusCode createObj (IOpaqueAddress *pAddr, DataObject *&pObj)
 
virtual StatusCode updateObj (IOpaqueAddress *pAddr, DataObject *pObj)
 override the RawDataBaseCnv version
 
virtual StatusCode createRep (DataObject *pObj, IOpaqueAddress *&pAddr)
 Convert the transient object to the requested representation.
 
StatusCode initialize ()
 
virtual long repSvcType () const
 
StatusCode createObj (IOpaqueAddress *pAddr, DataObject *&pObj)
 
virtual StatusCode updateObj (IOpaqueAddress *pAddr, DataObject *pObj)
 override the RawDataBaseCnv version
 
virtual StatusCode createRep (DataObject *pObj, IOpaqueAddress *&pAddr)
 Convert the transient object to the requested representation.
 
- Public Member Functions inherited from RawDataBaseCnv
 RawDataBaseCnv (ISvcLocator *svc)
 
 RawDataBaseCnv (unsigned char storageType, const CLID &clid, ISvcLocator *svc)
 
virtual ~RawDataBaseCnv ()
 
virtual long repSvcType () const
 
StatusCode initialize ()
 
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 createRep (DataObject *pObject, IOpaqueAddress *&refpAddress)
 Convert the transient object to the requested representation.
 
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.
 
 RawDataBaseCnv (ISvcLocator *svc)
 
 RawDataBaseCnv (unsigned char storageType, const CLID &clid, ISvcLocator *svc)
 
virtual ~RawDataBaseCnv ()
 
virtual long repSvcType () const
 
StatusCode initialize ()
 
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 createRep (DataObject *pObject, IOpaqueAddress *&refpAddress)
 Convert the transient object to the requested representation.
 
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.
 
- Public Member Functions inherited from Converter< Ty1, Ty2 >
destinationoperator (const source &) const
 
destinationoperator (const source &) const
 

Static Public Member Functions

static const CLID & classID ()
 
static const unsigned char storageType ()
 
static const CLID & classID ()
 
static const unsigned char storageType ()
 
- Static Public Member Functions inherited from RawDataBaseCnv
static const long storageType ()
 
static const CLID & classID ()
 
static const long storageType ()
 
static const CLID & classID ()
 

Protected Member Functions

 RawDataMcParticleCnv (ISvcLocator *svc)
 
 RawDataMcParticleCnv (ISvcLocator *svc)
 
- Protected Member Functions inherited from Converter< Ty1, Ty2 >
virtual destinationconvert (const source &) const =0
 
virtual destinationconvert (const source &) const =0
 

Friends

class CnvFactory< RawDataMcParticleCnv >
 

Additional Inherited Members

- Public Types inherited from Converter< Ty1, Ty2 >
typedef Ty1 source
 
typedef Ty2 destination
 
typedef Ty1 source
 
typedef Ty2 destination
 
- Protected Attributes inherited from RawDataBaseCnv
IRawDataCnvSvcm_CnvSvc
 Pointer to event conversion service interface.
 
std::vector< IRawDataCnvSvc::Leafm_leaves
 Leaf objects giving the locations of the objects in the data store.
 

Detailed Description

Constructor & Destructor Documentation

◆ RawDataMcParticleCnv() [1/2]

RawDataMcParticleCnv::RawDataMcParticleCnv ( ISvcLocator *  svc)
protected

◆ RawDataMcParticleCnv() [2/2]

RawDataMcParticleCnv::RawDataMcParticleCnv ( ISvcLocator *  svc)
protected

Member Function Documentation

◆ classID() [1/2]

const CLID & RawDataMcParticleCnv::classID ( )
static

Definition at line 40 of file RawDataMcPaticleCnv.cxx.

41{
42 return CLID_McParticleCol;
43}
const CLID & CLID_McParticleCol
Definition: EventModel.cxx:207

Referenced by PackedRawDataCnvSvc::addConverters().

◆ classID() [2/2]

static const CLID & RawDataMcParticleCnv::classID ( )
static

◆ createObj() [1/2]

StatusCode RawDataMcParticleCnv::createObj ( IOpaqueAddress *  pAddr,
DataObject *&  pObj 
)

Definition at line 110 of file RawDataMcPaticleCnv.cxx.

111{
112 //MsgStream log(msgSvc(), "RawDataMcParticleCnv");
113
114 //This converter will create an empty McParticleCol on the TDS
115 McParticleCol *mcParticleCol = new McParticleCol;
116 pObj = mcParticleCol;
117
118 RAWEVENT *evt = m_inputSvc->currentEvent();
119 if (evt == NULL) {
120 //log << MSG::ERROR << "RawDataCnv has no event!" << endreq;
121 return StatusCode::FAILURE;
122 }
123
124 const BufferHolder& mcParBuf = evt->getMcParBuf();
125 if (mcParBuf.nBuf() == 0) {
126 //cerr << "no McParticle Data Buffer found!!!" << endl;
127 return StatusCode::FAILURE;
128 }
129 uint32_t* buf = mcParBuf(0);
130
131 uint32_t nParticle = (buf[0] >> 16);
132 //uint32_t nVertex = (buf[0] & 0xFFFF);
133 double* vPointer = (double*)(buf + nParticle*11 + 1);
134
135 for (uint32_t i = 0; i < nParticle; i++) {
136 McParticle* mcPar = new McParticle;
137 m_mcParticleBuilder.unPack((buf+1+i*11), vPointer, mcPar);
138 mcParticleCol->push_back(mcPar);
139 }
140
141 // Get primary McParticles
142 SmartRefVector<McParticle> primaryParticleCol;
143 McParticleCol::iterator iter_particle = mcParticleCol->begin();
144 for ( ; iter_particle != mcParticleCol->end(); iter_particle++) {
145 if ((*iter_particle)->primaryParticle()) {
146 McParticle* mcPart = (McParticle*)(*iter_particle);
147 primaryParticleCol.push_back(mcPart);
148 }
149 }
150
151 if (primaryParticleCol.empty()) {
152 //log << MSG::WARNING << "createObj error: no primary particle found!" << endreq;
153 }
154
155 // Add mother particle recursively
156 SmartRefVector<McParticle>::iterator iter_primary = primaryParticleCol.begin();
157 //std::cout << "primaryParticleCol.size() = " << primaryParticleCol.size() << std::endl;
158 for ( ; iter_primary != primaryParticleCol.end(); iter_primary++) {
159
160 if (!(*iter_primary)->leafParticle())
161 addMother((*iter_primary), mcParticleCol);
162 }
163
164 return StatusCode::SUCCESS;
165}
virtual RAWEVENT * currentEvent()=0
virtual void unPack(uint32_t *buf, double *vPointer, McParticle *mcPar)
ObjectList< McParticle > McParticleCol

◆ createObj() [2/2]

StatusCode RawDataMcParticleCnv::createObj ( IOpaqueAddress *  pAddr,
DataObject *&  pObj 
)

◆ createRep() [1/2]

StatusCode RawDataMcParticleCnv::createRep ( DataObject *  pObject,
IOpaqueAddress *&  refpAddress 
)
virtual

Convert the transient object to the requested representation.

Reimplemented from RawDataBaseCnv.

Definition at line 167 of file RawDataMcPaticleCnv.cxx.

168{
169 // convert PixelRaw in the container into ByteStream
170 //MsgStream log(messageService(), "RawDataMcParticleCnv");
171
172 WriteRawEvent*& re = m_RawDataAccess->getRawEvent();
173 if (re == 0) {
174 //log << " get RawEvent failed !" << endreq;
175 return StatusCode::FAILURE;
176 }
177
178 SmartDataPtr<McParticleCol> mcParticleCol(dataProvider(), EventModel::MC::McParticleCol);
179 if (mcParticleCol == 0) {
180 //log << "no McParticleCol found" << endreq;
181 return StatusCode::FAILURE;
182 }
183
184 return m_mcParticleBuilder.pack(mcParticleCol, re);
185}
virtual StatusCode pack(McParticleCol *mcParticleCol, WriteRawEvent *&re)

◆ createRep() [2/2]

virtual StatusCode RawDataMcParticleCnv::createRep ( DataObject *  pObject,
IOpaqueAddress *&  refpAddress 
)
virtual

Convert the transient object to the requested representation.

Reimplemented from RawDataBaseCnv.

◆ initialize() [1/2]

StatusCode RawDataMcParticleCnv::initialize ( )

Definition at line 45 of file RawDataMcPaticleCnv.cxx.

46{
47
48 std::string PackedRawDataCnvSvc_Name("PackedRawDataCnvSvc");
49 std::string RawDataInputSvc_Name("RawDataInputSvc");
50 std::string RawDataMcParticleCnv_Name("RawDataMcParticleCnv");
51
52 // for Mutil-thread by tianhl
53 //ConversionSvc* pCnvSvc = 0;
54 //if (pCnvSvc = dynamic_cast<ConversionSvc*>(conversionSvc())){
55 SmartIF<IService> pCnvSvc(conversionSvc());
56 if (isGaudiThreaded(pCnvSvc->name())){
57 PackedRawDataCnvSvc_Name += getGaudiThreadIDfromName(pCnvSvc->name());
58 RawDataInputSvc_Name += getGaudiThreadIDfromName(pCnvSvc->name());
59 RawDataMcParticleCnv_Name += getGaudiThreadIDfromName(pCnvSvc->name());
60 }
61 //}
62
63 MsgStream log(messageService(), RawDataMcParticleCnv_Name.c_str());
64
65 StatusCode sc = RawDataBaseCnv::initialize();
66 if (StatusCode::SUCCESS != sc) {
67 log << MSG::ERROR << "RawDataBaseCnv: Cant initialize PackedRawDataCnvSvc" << endreq;
68 return sc;
69 }
70
71 // Check RawDataCnvSvc
72 IService* isvc = 0;
73 sc = serviceLocator()->service(PackedRawDataCnvSvc_Name.c_str(), isvc, true);
74 if (sc != StatusCode::SUCCESS) {
75 log << MSG::ERROR << "Cant get PackedRawDataCnvSvc" << endreq;
76 }
77
78 m_RawDataAccess = dynamic_cast<PackedRawDataCnvSvc*> (isvc);
79 if (m_RawDataAccess == 0 ) {
80 log << MSG::ERROR << "RawDataMcParticleCnv: Cant cast to RawDataCnvSvc " << endreq;
81 return StatusCode::FAILURE;
82 }
83
84 sc = serviceLocator()->getService(RawDataInputSvc_Name.c_str(), isvc);
85 if (sc != StatusCode::SUCCESS ) {
86 log << MSG::WARNING << "Cant get RawDataInputSvc " << endreq;
87 return sc ;
88 }
89
90 m_inputSvc = dynamic_cast<RawDataInputSvc*> (isvc);
91 if (m_inputSvc == 0 ) {
92 log << MSG::WARNING << "Cant cast to RawDataInputSvc " << endreq;
93 return StatusCode::FAILURE ;
94 }
95
96 return StatusCode::SUCCESS;
97}
StatusCode initialize()

◆ initialize() [2/2]

StatusCode RawDataMcParticleCnv::initialize ( )

◆ repSvcType() [1/2]

virtual long RawDataMcParticleCnv::repSvcType ( ) const
inlinevirtual

◆ repSvcType() [2/2]

virtual long RawDataMcParticleCnv::repSvcType ( ) const
inlinevirtual

Reimplemented from RawDataBaseCnv.

Definition at line 46 of file InstallArea/include/RawDataCnv/RawDataCnv/RawDataMcParticleCnv.h.

46 {
48 }

◆ storageType() [1/2]

static const unsigned char RawDataMcParticleCnv::storageType ( )
inlinestatic

◆ storageType() [2/2]

static const unsigned char RawDataMcParticleCnv::storageType ( )
inlinestatic

◆ updateObj() [1/2]

StatusCode RawDataMcParticleCnv::updateObj ( IOpaqueAddress *  pAddr,
DataObject *  pObj 
)
virtual

override the RawDataBaseCnv version

Definition at line 100 of file RawDataMcPaticleCnv.cxx.

100 {
101 // Purpose and Method: This method does nothing other than announce it has
102 // been called.
103
104 //MsgStream log(msgSvc(), "RawDataMcParticleCnv");
105 //log << MSG::DEBUG << "RawDataMcParticleCnv::updateObj" << endreq;
106 return Converter::updateObj(pAddr, pObj);
107}

◆ updateObj() [2/2]

virtual StatusCode RawDataMcParticleCnv::updateObj ( IOpaqueAddress *  pAddr,
DataObject *  pObj 
)
virtual

override the RawDataBaseCnv version

Friends And Related Function Documentation

◆ CnvFactory< RawDataMcParticleCnv >


The documentation for this class was generated from the following files: