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

#include <RawDataEmcMcHitCnv.hpp>

Inheritance diagram for RawDataEmcMcHitCnv:

Public Member Functions

 RawDataEmcMcHitCnv (ISvcLocator *svc)
StatusCode createObj (IOpaqueAddress *pAddr, DataObject *&pObj)
StatusCode createRep (DataObject *pObj, IOpaqueAddress *&pAddr)
Public Member Functions inherited from RawDataBaseCnv
StatusCode initialize ()
long repSvcType () const
const long storageType ()
Public Member Functions inherited from Converter< Ty1, Ty2 >
destinationoperator (const source &) const
destinationoperator (const source &) const
destinationoperator (const source &) const

Static Public Member Functions

static const CLID & classID ()

Additional Inherited Members

Public Types inherited from Converter< Ty1, Ty2 >
typedef Ty1 source
typedef Ty2 destination
typedef Ty1 source
typedef Ty2 destination
typedef Ty1 source
typedef Ty2 destination
Protected Member Functions inherited from RawDataBaseCnv
 RawDataBaseCnv (long storageType, const CLID &clid, ISvcLocator *svc)
 RawDataBaseCnv (ISvcLocator *svc, const CLID &clid)
Protected Member Functions inherited from Converter< Ty1, Ty2 >
virtual destinationconvert (const source &) const =0
virtual destinationconvert (const source &) const =0
virtual destinationconvert (const source &) const =0
Protected Attributes inherited from RawDataBaseCnv
std::vector< IRawDataCnvSvc::Leafm_leaves
IRawDataCnvSvcm_cnvSvc
IRawDataInputSvcm_inputSvc

Detailed Description

Definition at line 13 of file RawDataEmcMcHitCnv.hpp.

Constructor & Destructor Documentation

◆ RawDataEmcMcHitCnv()

RawDataEmcMcHitCnv::RawDataEmcMcHitCnv ( ISvcLocator * svc)
inline

Definition at line 15 of file RawDataEmcMcHitCnv.hpp.

15: RawDataBaseCnv( svc, classID() ) {}
RawDataBaseCnv(long storageType, const CLID &clid, ISvcLocator *svc)
static const CLID & classID()

Member Function Documentation

◆ classID()

const CLID & RawDataEmcMcHitCnv::classID ( )
inlinestatic

Definition at line 17 of file RawDataEmcMcHitCnv.hpp.

17{ return CLID_EmcMcHitCol; }
const CLID & CLID_EmcMcHitCol

Referenced by RawDataCnvSvc::addConverters(), RawDataCnvSvc::createConverter(), and RawDataEmcMcHitCnv().

◆ createObj()

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

Definition at line 19 of file RawDataEmcMcHitCnv.hpp.

19 {
20
21 // This converter will create an empty EmcMcHitCol on the TDS
22 EmcMcHitCol* emcMcHitCol = new EmcMcHitCol;
23 pObj = emcMcHitCol;
24
25 RAWEVENT* evt = m_inputSvc->currentEvent();
26 if ( evt == NULL )
27 {
28 // MsgStream log(msgSvc(), "RawDataEmcMcHitCnv");
29 // log << MSG::ERROR << "RawDataCnv has no event!" << endmsg;
30 return StatusCode::FAILURE;
31 }
32
33 EmcMcHit* emcMcHit;
34 EmcTruth_t m_EmcTruth;
35
36 assert( ( evt->getEmcTruth().size() % 8 ) == 0 );
37
38 std::vector<uint32_t>::const_iterator iter = evt->getEmcTruth().begin();
39 std::vector<uint32_t>::const_iterator eiter = evt->getEmcTruth().end();
40
41 for ( int emcMcHitId = 0; iter != eiter; emcMcHitId++ )
42 {
43 // retrieve the McTruth data
44 m_emcMcHitBuilder.unPack( iter, eiter, m_EmcTruth );
45 // construct the identifier
46 Identifier ident =
47 EmcID::crystal_id( m_EmcTruth.partId, m_EmcTruth.numTheta, m_EmcTruth.numPhi );
48 // construct the EmcMcHit
49 emcMcHit = new EmcMcHit(
50 ident, m_EmcTruth.trackIndex, m_EmcTruth.x / ( m_emcMcHitBuilder.m_xCoeff * 1.0 ),
51 m_EmcTruth.y / ( m_emcMcHitBuilder.m_yCoeff * 1.0 ),
52 m_EmcTruth.z / ( m_emcMcHitBuilder.m_zCoeff * 1.0 ),
53 m_EmcTruth.px / ( m_emcMcHitBuilder.m_pxCoeff * 1.0 ),
54 m_EmcTruth.py / ( m_emcMcHitBuilder.m_pyCoeff * 1.0 ),
55 m_EmcTruth.pz / ( m_emcMcHitBuilder.m_pzCoeff * 1.0 ),
56 m_EmcTruth.totalEdep / ( m_emcMcHitBuilder.m_totalEdepCoeff * 1.0 ) );
57 // And add the stuff to the container
58 emcMcHitCol->push_back( emcMcHit );
59 }
60
61 return StatusCode::SUCCESS;
62 }
ObjectVector< EmcMcHit > EmcMcHitCol
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:63
IRawDataInputSvc * m_inputSvc

◆ createRep()

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

Definition at line 64 of file RawDataEmcMcHitCnv.hpp.

64 {
65 // convert PixelRaw in the container into ByteStream
66 // MsgStream log(msgSvc(), "RawDataEmcMcHitCnv");
67
68 WriteRawEvent*& re = m_cnvSvc->getRawEvent();
69
70 if ( re == 0 )
71 {
72 // log << " get RawEvent failed !" << endmsg;
73 return StatusCode::FAILURE;
74 }
75
76 SmartDataPtr<EmcMcHitCol> mcHitCol( dataProvider(), EventModel::MC::EmcMcHitCol );
77
78 if ( mcHitCol == 0 )
79 {
80 // log << "no EmcMcHitCol found" << endmsg;
81 return StatusCode::FAILURE;
82 }
83
84 StatusCode sc = m_emcMcHitBuilder.pack( mcHitCol, re );
85
86 return sc;
87 }
eformat::write::FullEventFragment WriteRawEvent
IRawDataCnvSvc * m_cnvSvc

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