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

#include <RawDataMucMcHitCnv.hpp>

Inheritance diagram for RawDataMucMcHitCnv:

Public Member Functions

 RawDataMucMcHitCnv (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 11 of file RawDataMucMcHitCnv.hpp.

Constructor & Destructor Documentation

◆ RawDataMucMcHitCnv()

RawDataMucMcHitCnv::RawDataMucMcHitCnv ( ISvcLocator * svc)
inline

Definition at line 17 of file RawDataMucMcHitCnv.hpp.

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

Member Function Documentation

◆ classID()

const CLID & RawDataMucMcHitCnv::classID ( )
inlinestatic

Definition at line 19 of file RawDataMucMcHitCnv.hpp.

19{ return CLID_MucMcHitCol; }
const CLID & CLID_MucMcHitCol

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

◆ createObj()

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

Definition at line 21 of file RawDataMucMcHitCnv.hpp.

21 {
22 // MsgStream log(msgSvc(), "RawDataMucMcHitCnv");
23
24 // This converter will create an empty MucMcHitCol on the TDS
25 MucMcHitCol* mucMcHitCol = new MucMcHitCol;
26 pObj = mucMcHitCol;
27
28 RAWEVENT* evt = m_inputSvc->currentEvent();
29 if ( evt == NULL )
30 {
31 // log << MSG::ERROR << "RawDataCnv has no event!" << endmsg;
32 return StatusCode::FAILURE;
33 }
34
35 assert( ( evt->getMucTruth().size() % 7 ) == 0 );
36
37 MucMcHit* mucMcHit;
38 MucTruth_t m_MucTruth;
39
40 std::vector<uint32_t>::const_iterator iter = evt->getMucTruth().begin();
41 std::vector<uint32_t>::const_iterator eiter = evt->getMucTruth().end();
42
43 for ( int mucMcHitId = 0; iter != eiter; mucMcHitId++ )
44 {
45 // retrieve the MucTruth data
46 m_mucMcHitBuilder.unPack( iter, eiter, m_MucTruth );
47 // construct the identifier
48 const Identifier ident = MucID::channel_id( m_MucTruth.partId, m_MucTruth.segId,
49 m_MucTruth.gapId, m_MucTruth.stripId );
50 // construct the MucMcHit
51 mucMcHit = new MucMcHit( ident, m_MucTruth.trackIndex % 1000,
52 m_MucTruth.x / ( m_mucMcHitBuilder.m_xCoeff * 1.0 ),
53 m_MucTruth.y / ( m_mucMcHitBuilder.m_yCoeff * 1.0 ),
54 m_MucTruth.z / ( m_mucMcHitBuilder.m_zCoeff * 1.0 ),
55 m_MucTruth.px / ( m_mucMcHitBuilder.m_pxCoeff * 1.0 ),
56 m_MucTruth.py / ( m_mucMcHitBuilder.m_pyCoeff * 1.0 ),
57 m_MucTruth.pz / ( m_mucMcHitBuilder.m_pzCoeff * 1.0 ) );
58 // And add the stuff to the container
59 mucMcHitCol->push_back( mucMcHit );
60 }
61
62 return StatusCode::SUCCESS;
63 }
ObjectVector< MucMcHit > MucMcHitCol
EvtStreamInputIterator< typename Generator::result_type > iter(Generator gen, int N=0)
static Identifier channel_id(int barrel_ec, int segment, int layer, int channel)
For a single crystal.
Definition MucID.cxx:114
IRawDataInputSvc * m_inputSvc

◆ createRep()

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

Definition at line 65 of file RawDataMucMcHitCnv.hpp.

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

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