CGEM BOSS 6.6.5.g
BESIII Offline Software System
Loading...
Searching...
No Matches
RawDataMucMcHitCnv Class Reference

#include <RawDataMucMcHitCnv.h>

+ Inheritance diagram for RawDataMucMcHitCnv:

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

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

Friends

class CnvFactory< RawDataMucMcHitCnv >
 

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

Constructor & Destructor Documentation

◆ RawDataMucMcHitCnv()

RawDataMucMcHitCnv::RawDataMucMcHitCnv ( ISvcLocator *  svc)
protected

Definition at line 38 of file RawDataMucMcHitCnv.cxx.

38 :
40{
41 //init();
42}
unsigned const long PACKEDRAWEVENT_StorageType
Definition: ClassID_temp.h:17
static const CLID & classID()

Member Function Documentation

◆ classID()

const CLID & RawDataMucMcHitCnv::classID ( )
static

Definition at line 46 of file RawDataMucMcHitCnv.cxx.

47{
48 return CLID_MucMcHitCol;
49}
const CLID & CLID_MucMcHitCol
Definition: EventModel.cxx:245

Referenced by PackedRawDataCnvSvc::addConverters().

◆ createObj()

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

Definition at line 116 of file RawDataMucMcHitCnv.cxx.

117{
118 //MsgStream log(msgSvc(), "RawDataMucMcHitCnv");
119
120 //This converter will create an empty MucMcHitCol on the TDS
121 MucMcHitCol *mucMcHitCol = new MucMcHitCol;
122 pObj = mucMcHitCol;
123
124 RAWEVENT *evt = m_inputSvc->currentEvent();
125 if (evt == NULL) {
126 //log << MSG::ERROR << "RawDataCnv has no event!" << endreq;
127 return StatusCode::FAILURE;
128 }
129
130 assert((evt->getMucTruth().size()%7) == 0);
131
132 MucMcHit* mucMcHit;
133 MucTruth_t m_MucTruth;
134
135 std::vector<uint32_t>::const_iterator iter = evt->getMucTruth().begin();
136 std::vector<uint32_t>::const_iterator eiter = evt->getMucTruth().end();
137
138 for (int mucMcHitId = 0; iter != eiter; mucMcHitId++) {
139 //retrieve the MucTruth data
140 m_mucMcHitBuilder.unPack(iter, eiter, m_MucTruth);
141 //construct the identifier
142 const Identifier ident = MucID::channel_id
143 (m_MucTruth.partId, m_MucTruth.segId, m_MucTruth.gapId, m_MucTruth.stripId);
144 //construct the MucMcHit
145 mucMcHit = new MucMcHit(ident, m_MucTruth.trackIndex%1000,
146 m_MucTruth.x/(m_mucMcHitBuilder.m_xCoeff*1.0),
147 m_MucTruth.y/(m_mucMcHitBuilder.m_yCoeff*1.0),
148 m_MucTruth.z/(m_mucMcHitBuilder.m_zCoeff*1.0),
149 m_MucTruth.px/(m_mucMcHitBuilder.m_pxCoeff*1.0),
150 m_MucTruth.py/(m_mucMcHitBuilder.m_pyCoeff*1.0),
151 m_MucTruth.pz/(m_mucMcHitBuilder.m_pzCoeff*1.0) );
152 // And add the stuff to the container
153 mucMcHitCol->push_back(mucMcHit);
154 }
155
156 return StatusCode::SUCCESS;
157
158}
EvtStreamInputIterator< typename Generator::result_type > iter(Generator gen, int N=0)
virtual RAWEVENT * currentEvent()=0
static Identifier channel_id(int barrel_ec, int segment, int layer, int channel)
For a single crystal.
Definition: MucID.cxx:135
virtual void unPack(vector< uint32_t >::const_iterator &, vector< uint32_t >::const_iterator &, MucTruth_t &)
const int_vector & getMucTruth() const
Definition: RAWEVENT.h:103
ObjectVector< MucMcHit > MucMcHitCol
Definition: MucMcHit.h:89

◆ createRep()

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

Convert the transient object to the requested representation.

Reimplemented from RawDataBaseCnv.

Definition at line 160 of file RawDataMucMcHitCnv.cxx.

161{
162 // convert PixelRaw in the container into ByteStream
163 //MsgStream log(messageService(), "RawDataMucMcHitCnv");
164
165 WriteRawEvent*& re = m_RawDataAccess->getRawEvent();
166
167 if (re == 0) {
168 //log << " get RawEvent failed !" << endreq;
169 return StatusCode::FAILURE;
170 }
171
172 SmartDataPtr<MucMcHitCol> mcHitCol(dataProvider(), EventModel::MC::MucMcHitCol);
173
174 if (mcHitCol == 0) {
175 //log << "no MucMcHitCol found" << endreq;
176 return StatusCode::FAILURE;
177 }
178
179 StatusCode sc = m_mucMcHitBuilder.pack(mcHitCol, re);
180
181 return sc;
182
183}
virtual StatusCode pack(MucMcHitCol *mucMcHitCol, WriteRawEvent *&re)
virtual WriteRawEvent *& getRawEvent()
_EXTERN_ std::string MucMcHitCol
Definition: EventModel.h:47

◆ initialize()

StatusCode RawDataMucMcHitCnv::initialize ( )

Definition at line 51 of file RawDataMucMcHitCnv.cxx.

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

◆ repSvcType()

virtual long RawDataMucMcHitCnv::repSvcType ( ) const
inlinevirtual

Reimplemented from RawDataBaseCnv.

Definition at line 46 of file RawDataMucMcHitCnv.h.

46 {
48 }

◆ storageType()

static const unsigned char RawDataMucMcHitCnv::storageType ( )
inlinestatic

Definition at line 50 of file RawDataMucMcHitCnv.h.

50 {
52 }

◆ updateObj()

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

override the RawDataBaseCnv version

Definition at line 106 of file RawDataMucMcHitCnv.cxx.

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

Friends And Related Function Documentation

◆ CnvFactory< RawDataMucMcHitCnv >

friend class CnvFactory< RawDataMucMcHitCnv >
friend

Definition at line 1 of file RawDataMucMcHitCnv.h.


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