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

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

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

◆ RawDataTofMcHitCnv() [1/2]

RawDataTofMcHitCnv::RawDataTofMcHitCnv ( ISvcLocator *  svc)
protected

◆ RawDataTofMcHitCnv() [2/2]

RawDataTofMcHitCnv::RawDataTofMcHitCnv ( ISvcLocator *  svc)
protected

Member Function Documentation

◆ classID() [1/2]

const CLID & RawDataTofMcHitCnv::classID ( )
static

Definition at line 44 of file RawDataTofMcHitCnv.cxx.

45{
46 return CLID_TofMcHitCol;
47}
const CLID & CLID_TofMcHitCol
Definition: EventModel.cxx:218

Referenced by PackedRawDataCnvSvc::addConverters().

◆ classID() [2/2]

static const CLID & RawDataTofMcHitCnv::classID ( )
static

◆ createObj() [1/2]

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

Definition at line 114 of file RawDataTofMcHitCnv.cxx.

115{
116 MsgStream log(msgSvc(), "RawDataTofMcHitCnv");
117
118 //This converter will create an empty TofMcHitCol on the TDS
119 TofMcHitCol *tofMcHitCol = new TofMcHitCol;
120 pObj = tofMcHitCol;
121
122 RAWEVENT *evt = m_inputSvc->currentEvent();
123 if (evt == NULL) {
124 //log << MSG::ERROR << "RawDataCnv has no event!" << endreq;
125 return StatusCode::FAILURE;
126 }
127
128 assert((evt->getTofTruth().size())%9 == 0);
129
130 TofTruth_t m_TofTruth;
131 TofMcHit* tofMcHit;
132
133 std::vector<uint32_t>::const_iterator iter = evt->getTofTruth().begin();
134 std::vector<uint32_t>::const_iterator eiter = evt->getTofTruth().end();
135
136 for (int tofMcHitId = 0; iter != eiter; tofMcHitId++) {
137 // retrieve the TofTruth data
138 m_tofMcHitBuilder.unPack(iter, eiter, m_TofTruth);
139 // construct the identifier
140 Identifier ident;
141 unsigned int barrel_ec = m_TofTruth.partId;
142 // for scintillator
143 if( barrel_ec>=0 && barrel_ec<=2 ) {
144 unsigned int layer = 0;
145 if( m_TofTruth.scinNb > TofID::getPHI_BARREL_MAX() ) {
146 layer = 1;
147 m_TofTruth.scinNb -= ( TofID::getPHI_BARREL_MAX() + 1 );
148 }
149 ident = TofID::cell_id( barrel_ec, layer, m_TofTruth.scinNb, 0 );
150 }
151 // for ETF(MRPC)
152 else if( barrel_ec>=3 ) {
153 unsigned int endcap = 0;
154 if( barrel_ec==4 ) { endcap = 1; }
155 ident = TofID::cell_id( 3, endcap, m_TofTruth.scinNb, m_TofTruth.strip, 0 );
156 }
157 else {
158 log << MSG::ERROR << "barrel_ec is not correct! barrel_ec=" << barrel_ec << endreq;
159 }
160
161 //construct the TofMcHit
162 tofMcHit = new TofMcHit(ident, m_TofTruth.trackIndex,
163 m_TofTruth.x/(m_tofMcHitBuilder.m_xCoeff*1.0),
164 m_TofTruth.y/(m_tofMcHitBuilder.m_yCoeff*1.0),
165 m_TofTruth.z/(m_tofMcHitBuilder.m_zCoeff*1.0),
166 m_TofTruth.px/(m_tofMcHitBuilder.m_pxCoeff*1.0),
167 m_TofTruth.py/(m_tofMcHitBuilder.m_pyCoeff*1.0),
168 m_TofTruth.pz/(m_tofMcHitBuilder.m_pzCoeff*1.0),
169 m_TofTruth.trackLength/(m_tofMcHitBuilder.m_trackLengthCoeff*1.0),
170 m_TofTruth.time/(m_tofMcHitBuilder.m_timeCoeff*1.0) );
171 // And add the stuff to the container
172 tofMcHitCol->push_back(tofMcHit);
173 }
174
175 return StatusCode::SUCCESS;
176
177}
EvtStreamInputIterator< typename Generator::result_type > iter(Generator gen, int N=0)
virtual RAWEVENT * currentEvent()=0
static Identifier cell_id(int barrel_ec, int layer, int phi_module, int end)
For a single crystal.
Definition: TofID.cxx:143
static value_type getPHI_BARREL_MAX()
Definition: TofID.cxx:217
virtual void unPack(vector< uint32_t >::const_iterator &, vector< uint32_t >::const_iterator &, TofTruth_t &)
ObjectVector< TofMcHit > TofMcHitCol

◆ createObj() [2/2]

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

◆ createRep() [1/2]

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

Convert the transient object to the requested representation.

Reimplemented from RawDataBaseCnv.

Definition at line 179 of file RawDataTofMcHitCnv.cxx.

180{
181 // convert PixelRaw in the container into ByteStream
182 //MsgStream log(messageService(), "RawDataTofMcHitCnv");
183
184 WriteRawEvent*& re = m_RawDataAccess->getRawEvent();
185
186 if (re == 0) {
187 //log << " get RawEvent failed !" << endreq;
188 return StatusCode::FAILURE;
189 }
190
191 SmartDataPtr<TofMcHitCol> mcHitCol(dataProvider(), EventModel::MC::TofMcHitCol);
192
193 if (mcHitCol == 0) {
194 //log << "no TofMcHitCol found" << endreq;
195 return StatusCode::FAILURE;
196 }
197
198 StatusCode sc = m_tofMcHitBuilder.pack(mcHitCol, re);
199
200 return sc;
201
202}
virtual StatusCode pack(TofMcHitCol *tofMcHitCol, WriteRawEvent *&re)

◆ createRep() [2/2]

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

Convert the transient object to the requested representation.

Reimplemented from RawDataBaseCnv.

◆ initialize() [1/2]

StatusCode RawDataTofMcHitCnv::initialize ( )

Definition at line 49 of file RawDataTofMcHitCnv.cxx.

50{
51
52 std::string PackedRawDataCnvSvc_Name("PackedRawDataCnvSvc");
53 std::string RawDataInputSvc_Name("RawDataInputSvc");
54 std::string RawDataTofMcHitCnv_Name("RawDataTofMcHitCnv");
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 RawDataTofMcHitCnv_Name += getGaudiThreadIDfromName(pCnvSvc->name());
64 }
65 //}
66
67 MsgStream log(messageService(), RawDataTofMcHitCnv_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 << "RawDataTofCnv: Cant cast to RawDataCnvSvc " << endreq;
85 return StatusCode::FAILURE;
86 }
87
88 sc = serviceLocator()->getService(RawDataInputSvc_Name.c_str(), isvc);
89 if (sc != StatusCode::SUCCESS ) {
90 log << MSG::WARNING << "Cant get RawDataInputSvc " << endreq;
91 return sc ;
92 }
93
94 m_inputSvc = dynamic_cast<RawDataInputSvc*> (isvc);
95 if (m_inputSvc == 0 ) {
96 log << MSG::WARNING << "Cant cast to RawDataInputSvc " << endreq;
97 return StatusCode::FAILURE ;
98 }
99
100 return StatusCode::SUCCESS;
101}
StatusCode initialize()

◆ initialize() [2/2]

StatusCode RawDataTofMcHitCnv::initialize ( )

◆ repSvcType() [1/2]

virtual long RawDataTofMcHitCnv::repSvcType ( ) const
inlinevirtual

Reimplemented from RawDataBaseCnv.

Definition at line 46 of file Event/RawDataCnv/RawDataCnv-00-04-37/RawDataCnv/RawDataTofMcHitCnv.h.

46 {
48 }

◆ repSvcType() [2/2]

virtual long RawDataTofMcHitCnv::repSvcType ( ) const
inlinevirtual

Reimplemented from RawDataBaseCnv.

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

46 {
48 }

◆ storageType() [1/2]

static const unsigned char RawDataTofMcHitCnv::storageType ( )
inlinestatic

◆ storageType() [2/2]

static const unsigned char RawDataTofMcHitCnv::storageType ( )
inlinestatic

◆ updateObj() [1/2]

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

override the RawDataBaseCnv version

Definition at line 104 of file RawDataTofMcHitCnv.cxx.

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

◆ updateObj() [2/2]

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

override the RawDataBaseCnv version

Friends And Related Function Documentation

◆ CnvFactory< RawDataTofMcHitCnv >


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