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

#include <RawDataMdcMcHitCnv.h>

+ Inheritance diagram for RawDataMdcMcHitCnv:

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.
 
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.
 
 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

 RawDataMdcMcHitCnv (ISvcLocator *svc)
 
 RawDataMdcMcHitCnv (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< RawDataMdcMcHitCnv >
 

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

◆ RawDataMdcMcHitCnv() [1/2]

RawDataMdcMcHitCnv::RawDataMdcMcHitCnv ( ISvcLocator *  svc)
protected

◆ RawDataMdcMcHitCnv() [2/2]

RawDataMdcMcHitCnv::RawDataMdcMcHitCnv ( ISvcLocator *  svc)
protected

Member Function Documentation

◆ classID() [1/2]

const CLID & RawDataMdcMcHitCnv::classID ( )
static

Definition at line 44 of file RawDataMdcMcHitCnv.cxx.

45{
46 return CLID_MdcMcHitCol;
47}
const CLID & CLID_MdcMcHitCol
Definition: EventModel.cxx:215

Referenced by PackedRawDataCnvSvc::addConverters().

◆ classID() [2/2]

static const CLID & RawDataMdcMcHitCnv::classID ( )
static

◆ createObj() [1/2]

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

construct the MdcMcHit

Definition at line 115 of file RawDataMdcMcHitCnv.cxx.

116{
117 //MsgStream log(msgSvc(), "RawDataMdcMcHitCnv");
118
119 //This converter will create an empty MdcMcHitCol on the TDS
120 MdcMcHitCol *mdcMcHitCol = new MdcMcHitCol;
121 pObj = mdcMcHitCol;
122
123 RAWEVENT *evt = m_inputSvc->currentEvent();
124 if (evt == NULL) {
125 //log << MSG::ERROR << "RawDataCnv has no event!" << endreq;
126 return StatusCode::FAILURE;
127 }
128
129 assert((evt->getMdcTruth().size())%6 == 0);
130
131 MdcTruth_t m_MdcTruth;
132 MdcMcHit* mdcMcHit;
133
134 std::vector<uint32_t>::const_iterator iter = evt->getMdcTruth().begin();
135 std::vector<uint32_t>::const_iterator eiter = evt->getMdcTruth().end();
136
137 for (int mdcMcHitId = 0; iter != eiter; mdcMcHitId++) {
138 // retrieve the MdcTruth data
139 m_mdcMcHitBuilder.unPack(iter, eiter, m_MdcTruth);
140 //construct the identifier
141 const Identifier ident = MdcID::wire_id (m_MdcTruth.layerId, m_MdcTruth.cellId);
142 /// construct the MdcMcHit
143 mdcMcHit = new MdcMcHit(ident, m_MdcTruth.trackIndex,
144 m_MdcTruth.x/(m_mdcMcHitBuilder.m_xCoeff*1.0),
145 m_MdcTruth.y/(m_mdcMcHitBuilder.m_yCoeff*1.0),
146 m_MdcTruth.z/(m_mdcMcHitBuilder.m_zCoeff*1.0),
147 m_MdcTruth.driftD/(m_mdcMcHitBuilder.m_driftDCoeff*1.0),
148 m_MdcTruth.edep/(m_mdcMcHitBuilder.m_edepCoeff*1.0),
149 m_MdcTruth.posFlag );
150 // And add the stuff to the container
151 mdcMcHitCol->push_back(mdcMcHit);
152 }
153
154 return StatusCode::SUCCESS;
155}
EvtStreamInputIterator< typename Generator::result_type > iter(Generator gen, int N=0)
virtual RAWEVENT * currentEvent()=0
static Identifier wire_id(int wireType, int layer, int wire)
For a single wire.
Definition: MdcID.cxx:77
virtual void unPack(vector< uint32_t >::const_iterator &, vector< uint32_t >::const_iterator &, MdcTruth_t &)
ObjectVector< MdcMcHit > MdcMcHitCol

◆ createObj() [2/2]

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

◆ createRep() [1/2]

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

Convert the transient object to the requested representation.

Reimplemented from RawDataBaseCnv.

Definition at line 157 of file RawDataMdcMcHitCnv.cxx.

158{
159 // convert PixelRaw in the container into ByteStream
160 //MsgStream log(messageService(), "RawDataMdcMcHitCnv");
161
162 WriteRawEvent*& re = m_RawDataAccess->getRawEvent();
163
164 if (re == 0) {
165 //log << " get RawEvent failed !" << endreq;
166 return StatusCode::FAILURE;
167 }
168
169 SmartDataPtr<MdcMcHitCol> mdcHitCol(dataProvider(), EventModel::MC::MdcMcHitCol);
170
171 if (mdcHitCol == 0) {
172 //log << "no MdcMcHitCol found" << endreq;
173 return StatusCode::FAILURE;
174 }
175 /*else {
176 log << MSG::INFO << endreq << "Detailed dump of 1st event: " << endreq;
177 int nMcHit = 0;
178 MdcMcHitCol::const_iterator pMdcMcHit = mdcHitCol->begin();
179 for ( ; pMdcMcHit != mdcHitCol->end(); pMdcMcHit++) {
180 log << MSG::INFO << "McHit " << nMcHit++ << " "
181 << (*pMdcMcHit)->getTrackIndex() << " "
182 << (*pMdcMcHit)->identify() << " "
183 << (*pMdcMcHit)->getDepositEnergy() << " "
184 << (*pMdcMcHit)->getDriftDistance() << " "
185 << (*pMdcMcHit)->getPositionX() << " "
186 << (*pMdcMcHit)->getPositionY() << " "
187 << (*pMdcMcHit)->getPositionZ() << endreq;
188 }
189 }*/
190
191 StatusCode sc = m_mdcMcHitBuilder.pack(mdcHitCol, re);
192
193 return sc;
194
195}
virtual StatusCode pack(MdcMcHitCol *mdcMcHitCol, WriteRawEvent *&re)

◆ createRep() [2/2]

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

Convert the transient object to the requested representation.

Reimplemented from RawDataBaseCnv.

◆ initialize() [1/2]

StatusCode RawDataMdcMcHitCnv::initialize ( )

Definition at line 49 of file RawDataMdcMcHitCnv.cxx.

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

◆ initialize() [2/2]

StatusCode RawDataMdcMcHitCnv::initialize ( )

◆ repSvcType() [1/2]

virtual long RawDataMdcMcHitCnv::repSvcType ( ) const
inlinevirtual

Reimplemented from RawDataBaseCnv.

Definition at line 46 of file Event/RawDataCnv/RawDataCnv-00-05-04/RawDataCnv/RawDataMdcMcHitCnv.h.

46 {
48 }

◆ repSvcType() [2/2]

virtual long RawDataMdcMcHitCnv::repSvcType ( ) const
inlinevirtual

Reimplemented from RawDataBaseCnv.

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

46 {
48 }

◆ storageType() [1/2]

static const unsigned char RawDataMdcMcHitCnv::storageType ( )
inlinestatic

◆ storageType() [2/2]

static const unsigned char RawDataMdcMcHitCnv::storageType ( )
inlinestatic

◆ updateObj() [1/2]

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

override the RawDataBaseCnv version

Definition at line 105 of file RawDataMdcMcHitCnv.cxx.

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

◆ updateObj() [2/2]

virtual StatusCode RawDataMdcMcHitCnv::updateObj ( IOpaqueAddress *  ,
DataObject *   
)
virtual

override the RawDataBaseCnv version

Friends And Related Function Documentation

◆ CnvFactory< RawDataMdcMcHitCnv >


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