BOSS 7.0.6
BESIII Offline Software System
Loading...
Searching...
No Matches
RawDataEmcMcHitCnv Class Reference

#include <RawDataEmcMcHitCnv.h>

+ Inheritance diagram for RawDataEmcMcHitCnv:

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.
 
- 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.
 
- Public Member Functions inherited from Converter< Ty1, Ty2 >
destinationoperator (const source &) const
 

Static Public Member Functions

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

Protected Member Functions

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

Friends

class CnvFactory< RawDataEmcMcHitCnv >
 

Additional Inherited Members

- Public Types inherited from Converter< Ty1, Ty2 >
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

Definition at line 32 of file RawDataEmcMcHitCnv.h.

Constructor & Destructor Documentation

◆ RawDataEmcMcHitCnv()

RawDataEmcMcHitCnv::RawDataEmcMcHitCnv ( ISvcLocator *  svc)
protected

Definition at line 34 of file RawDataEmcMcHitCnv.cxx.

34 :
36{
37 //init();
38}
unsigned const long PACKEDRAWEVENT_StorageType
Definition: ClassID_temp.h:17
static const CLID & classID()

Member Function Documentation

◆ classID()

const CLID & RawDataEmcMcHitCnv::classID ( )
static

Definition at line 42 of file RawDataEmcMcHitCnv.cxx.

43{
44 return CLID_EmcMcHitCol;
45}
const CLID & CLID_EmcMcHitCol
Definition: EventModel.cxx:221

Referenced by PackedRawDataCnvSvc::addConverters().

◆ createObj()

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

Definition at line 111 of file RawDataEmcMcHitCnv.cxx.

112{
113
114 //This converter will create an empty EmcMcHitCol on the TDS
115 EmcMcHitCol *emcMcHitCol = new EmcMcHitCol;
116 pObj = emcMcHitCol;
117
118 RAWEVENT *evt = m_inputSvc->currentEvent();
119 if (evt == NULL) {
120 //MsgStream log(msgSvc(), "RawDataEmcMcHitCnv");
121 //log << MSG::ERROR << "RawDataCnv has no event!" << endreq;
122 return StatusCode::FAILURE;
123 }
124
125 EmcMcHit* emcMcHit;
126 EmcTruth_t m_EmcTruth;
127
128 assert((evt->getEmcTruth().size()%8) == 0);
129
130 std::vector<uint32_t>::const_iterator iter = evt->getEmcTruth().begin();
131 std::vector<uint32_t>::const_iterator eiter = evt->getEmcTruth().end();
132
133 for (int emcMcHitId = 0; iter != eiter; emcMcHitId++) {
134 // retrieve the McTruth data
135 m_emcMcHitBuilder.unPack(iter, eiter, m_EmcTruth);
136 // construct the identifier
137 Identifier ident = EmcID::crystal_id(m_EmcTruth.partId, m_EmcTruth.numTheta, m_EmcTruth.numPhi);
138 // construct the EmcMcHit
139 emcMcHit = new EmcMcHit(ident, m_EmcTruth.trackIndex,
140 m_EmcTruth.x/(m_emcMcHitBuilder.m_xCoeff*1.0),
141 m_EmcTruth.y/(m_emcMcHitBuilder.m_yCoeff*1.0),
142 m_EmcTruth.z/(m_emcMcHitBuilder.m_zCoeff*1.0),
143 m_EmcTruth.px/(m_emcMcHitBuilder.m_pxCoeff*1.0),
144 m_EmcTruth.py/(m_emcMcHitBuilder.m_pyCoeff*1.0),
145 m_EmcTruth.pz/(m_emcMcHitBuilder.m_pzCoeff*1.0),
146 m_EmcTruth.totalEdep/(m_emcMcHitBuilder.m_totalEdepCoeff*1.0) );
147 // And add the stuff to the container
148 emcMcHitCol->push_back(emcMcHit);
149 }
150
151 return StatusCode::SUCCESS;
152
153}
EvtStreamInputIterator< typename Generator::result_type > iter(Generator gen, int N=0)
static Identifier crystal_id(const unsigned int barrel_ec, const unsigned int theta_module, const unsigned int phi_module)
For a single crystal.
Definition: EmcID.cxx:71
virtual void unPack(vector< uint32_t >::const_iterator &, vector< uint32_t >::const_iterator &, EmcTruth_t &)
uint64_t m_totalEdepCoeff
virtual RAWEVENT * currentEvent()=0
const int_vector & getEmcTruth() const
Definition: RAWEVENT.h:109
ObjectVector< EmcMcHit > EmcMcHitCol
Definition: EmcMcHit.h:132

◆ createRep()

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

Convert the transient object to the requested representation.

Reimplemented from RawDataBaseCnv.

Definition at line 155 of file RawDataEmcMcHitCnv.cxx.

156{
157 // convert PixelRaw in the container into ByteStream
158 //MsgStream log(messageService(), "RawDataEmcMcHitCnv");
159
160 WriteRawEvent*& re = m_RawDataAccess->getRawEvent();
161
162 if (re == 0) {
163 //log << " get RawEvent failed !" << endreq;
164 return StatusCode::FAILURE;
165 }
166
167 SmartDataPtr<EmcMcHitCol> mcHitCol(dataProvider(), EventModel::MC::EmcMcHitCol);
168
169 if (mcHitCol == 0) {
170 //log << "no EmcMcHitCol found" << endreq;
171 return StatusCode::FAILURE;
172 }
173
174 StatusCode sc = m_emcMcHitBuilder.pack(mcHitCol, re);
175
176 return sc;
177
178}
virtual StatusCode pack(EmcMcHitCol *emcMcHitCol, WriteRawEvent *&re)
virtual WriteRawEvent *& getRawEvent()
_EXTERN_ std::string EmcMcHitCol
Definition: EventModel.h:46

◆ initialize()

StatusCode RawDataEmcMcHitCnv::initialize ( )

Definition at line 47 of file RawDataEmcMcHitCnv.cxx.

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

◆ repSvcType()

virtual long RawDataEmcMcHitCnv::repSvcType ( ) const
inlinevirtual

Reimplemented from RawDataBaseCnv.

Definition at line 46 of file RawDataEmcMcHitCnv.h.

46 {
48 }

◆ storageType()

static const unsigned char RawDataEmcMcHitCnv::storageType ( )
inlinestatic

Definition at line 50 of file RawDataEmcMcHitCnv.h.

50 {
52 }

◆ updateObj()

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

override the RawDataBaseCnv version

Definition at line 101 of file RawDataEmcMcHitCnv.cxx.

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

Friends And Related Function Documentation

◆ CnvFactory< RawDataEmcMcHitCnv >

friend class CnvFactory< RawDataEmcMcHitCnv >
friend

Definition at line 1 of file RawDataEmcMcHitCnv.h.


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