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

#include <RawDataTofMcHitCnv.h>

+ Inheritance diagram for RawDataTofMcHitCnv:

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

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

Friends

class CnvFactory< RawDataTofMcHitCnv >
 

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

Constructor & Destructor Documentation

◆ RawDataTofMcHitCnv()

RawDataTofMcHitCnv::RawDataTofMcHitCnv ( ISvcLocator *  svc)
protected

Definition at line 39 of file RawDataTofMcHitCnv.cxx.

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

Member Function Documentation

◆ classID()

const CLID & RawDataTofMcHitCnv::classID ( )
static

Definition at line 47 of file RawDataTofMcHitCnv.cxx.

48{
49 return CLID_TofMcHitCol;
50}
const CLID & CLID_TofMcHitCol
Definition: EventModel.cxx:239

Referenced by PackedRawDataCnvSvc::addConverters().

◆ createObj()

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

Definition at line 117 of file RawDataTofMcHitCnv.cxx.

118{
119 //MsgStream log(msgSvc(), "RawDataTofMcHitCnv");
120
121 //This converter will create an empty TofMcHitCol on the TDS
122 TofMcHitCol *tofMcHitCol = new TofMcHitCol;
123 pObj = tofMcHitCol;
124
125 RAWEVENT *evt = m_inputSvc->currentEvent();
126 if (evt == NULL) {
127 //log << MSG::ERROR << "RawDataCnv has no event!" << endreq;
128 return StatusCode::FAILURE;
129 }
130
131 assert((evt->getTofTruth().size())%9 == 0);
132
133 TofTruth_t m_TofTruth;
134 TofMcHit* tofMcHit;
135
136 std::vector<uint32_t>::const_iterator iter = evt->getTofTruth().begin();
137 std::vector<uint32_t>::const_iterator eiter = evt->getTofTruth().end();
138
139 for (int tofMcHitId = 0; iter != eiter; tofMcHitId++) {
140 // retrieve the TofTruth data
141 m_tofMcHitBuilder.unPack(iter, eiter, m_TofTruth);
142 // construct the identifier
143 unsigned int layer = 0;
144 unsigned int barrel_ec = m_TofTruth.partId;
145 if (TofID::is_barrel(barrel_ec) && m_TofTruth.scinNb > TofID::getPHI_BARREL_MAX()) {
146 layer = 1;
147 m_TofTruth.scinNb -= (TofID::getPHI_BARREL_MAX() + 1);
148 }
149
150
151
152
153
154
155
156
157 Identifier ident;
158
159 if(barrel_ec==0 || barrel_ec==1 || barrel_ec==2 ) //Old-Tof
160 {
161 ident = TofID::cell_id(barrel_ec, layer, m_TofTruth.scinNb, 0);
162 }
163 else //MRPC Part
164 {
165 int help = BesTofDigitizerEcV4::Calculate_Readoutstrip_number_continuum(m_TofTruth.x*mm, m_TofTruth.y*mm, barrel_ec, m_TofTruth.scinNb);
167 ident = TofID::cell_id_mrpc_mc( barrel_ec, scinNum);
168 }
169
170
171
172
173
174
175
176 //construct the TofMcHit
177 tofMcHit = new TofMcHit(ident, m_TofTruth.trackIndex,
178 m_TofTruth.x/(m_tofMcHitBuilder.m_xCoeff*1.0),
179 m_TofTruth.y/(m_tofMcHitBuilder.m_yCoeff*1.0),
180 m_TofTruth.z/(m_tofMcHitBuilder.m_zCoeff*1.0),
181 m_TofTruth.px/(m_tofMcHitBuilder.m_pxCoeff*1.0),
182 m_TofTruth.py/(m_tofMcHitBuilder.m_pyCoeff*1.0),
183 m_TofTruth.pz/(m_tofMcHitBuilder.m_pzCoeff*1.0),
184 m_TofTruth.trackLength/(m_tofMcHitBuilder.m_trackLengthCoeff*1.0),
185 m_TofTruth.time/(m_tofMcHitBuilder.m_timeCoeff*1.0) );
186 // And add the stuff to the container
187 tofMcHitCol->push_back(tofMcHit);
188 }
189
190 return StatusCode::SUCCESS;
191
192}
EvtStreamInputIterator< typename Generator::result_type > iter(Generator gen, int N=0)
std::string help()
Definition: HelloServer.cpp:35
static G4int Produce_unique_identifier(G4int module_mrpc_f, G4int readoutstripnumber_f)
static G4int Calculate_Readoutstrip_number_continuum(G4double x_mm, G4double y_mm, G4int partId_f, G4int module_mrpc_f)
virtual RAWEVENT * currentEvent()=0
const int_vector & getTofTruth() const
Definition: RAWEVENT.h:102
static Identifier cell_id(int barrel_ec, int layer, int phi_module, int end)
For a single crystal.
Definition: TofID.cxx:156
static value_type getPHI_BARREL_MAX()
Definition: TofID.cxx:237
static bool is_barrel(const Identifier &id)
Test for barrel.
Definition: TofID.cxx:78
static Identifier cell_id_mrpc_mc(int partID, int scinNum)
Definition: TofID.cxx:189
virtual void unPack(vector< uint32_t >::const_iterator &, vector< uint32_t >::const_iterator &, TofTruth_t &)
uint64_t m_trackLengthCoeff
uint64_t m_timeCoeff
ObjectVector< TofMcHit > TofMcHitCol
Definition: TofMcHit.h:100

◆ createRep()

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

Convert the transient object to the requested representation.

Reimplemented from RawDataBaseCnv.

Definition at line 194 of file RawDataTofMcHitCnv.cxx.

195{
196 // convert PixelRaw in the container into ByteStream
197 //MsgStream log(messageService(), "RawDataTofMcHitCnv");
198
199 WriteRawEvent*& re = m_RawDataAccess->getRawEvent();
200
201 if (re == 0) {
202 //log << " get RawEvent failed !" << endreq;
203 return StatusCode::FAILURE;
204 }
205
206 SmartDataPtr<TofMcHitCol> mcHitCol(dataProvider(), EventModel::MC::TofMcHitCol);
207
208 if (mcHitCol == 0) {
209 //log << "no TofMcHitCol found" << endreq;
210 return StatusCode::FAILURE;
211 }
212
213 StatusCode sc = m_tofMcHitBuilder.pack(mcHitCol, re);
214
215 return sc;
216
217}
virtual WriteRawEvent *& getRawEvent()
virtual StatusCode pack(TofMcHitCol *tofMcHitCol, WriteRawEvent *&re)
_EXTERN_ std::string TofMcHitCol
Definition: EventModel.h:45

◆ initialize()

StatusCode RawDataTofMcHitCnv::initialize ( )

Definition at line 52 of file RawDataTofMcHitCnv.cxx.

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

◆ repSvcType()

virtual long RawDataTofMcHitCnv::repSvcType ( ) const
inlinevirtual

Reimplemented from RawDataBaseCnv.

Definition at line 46 of file RawDataTofMcHitCnv.h.

46 {
48 }

◆ storageType()

static const unsigned char RawDataTofMcHitCnv::storageType ( )
inlinestatic

Definition at line 50 of file RawDataTofMcHitCnv.h.

50 {
52 }

◆ updateObj()

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

override the RawDataBaseCnv version

Definition at line 107 of file RawDataTofMcHitCnv.cxx.

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

Friends And Related Function Documentation

◆ CnvFactory< RawDataTofMcHitCnv >

friend class CnvFactory< RawDataTofMcHitCnv >
friend

Definition at line 1 of file RawDataTofMcHitCnv.h.


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