CGEM BOSS 6.6.5.h
BESIII Offline Software System
Loading...
Searching...
No Matches
MdcMcHitBuilder Class Reference

#include <MdcMcHitBuilder.h>

+ Inheritance diagram for MdcMcHitBuilder:

Public Member Functions

 MdcMcHitBuilder ()
 
virtual ~MdcMcHitBuilder ()
 
virtual StatusCode initialize (string &initFile)
 
virtual uint32_t getTEID (uint32_t teid)
 
virtual uint32_t getREID (uint32_t reid)
 
virtual void unPack (vector< uint32_t >::const_iterator &, vector< uint32_t >::const_iterator &, MdcTruth_t &)
 
virtual StatusCode pack (MdcMcHitCol *mdcMcHitCol, WriteRawEvent *&re)
 
- Public Member Functions inherited from Builder

Public Attributes

uint64_t m_edepCoeff
 
uint64_t m_driftDCoeff
 
uint64_t m_xCoeff
 
uint64_t m_yCoeff
 
uint64_t m_zCoeff
 

Additional Inherited Members

- Public Types inherited from Builder
typedef std::map< uint32_t, uint32_t > TE2REMAP
 
- Static Public Member Functions inherited from Builder
static bool expect (ifstream &f, string msg, string fname)
 
static bool expectInt (ifstream &f, string msg, string fname, uint32_t &val1, uint32_t &val2)
 
static bool expectLong (ifstream &f, string msg, string fname, uint64_t &val)
 
static bool find (ifstream &f, string msg, string fname)
 
- Protected Member Functions inherited from Builder
 Builder ()
 
virtual ~Builder ()
 
void append2event (WriteRawEvent *&re, uint32_t source_id, uint32_t size)
 
- Protected Attributes inherited from Builder
PropertyMgr m_propMgr
 
uint32_t * m_buf
 
uint32_t m_status
 
- Static Protected Attributes inherited from Builder
static string m_confFile
 

Detailed Description

Definition at line 12 of file MdcMcHitBuilder.h.

Constructor & Destructor Documentation

◆ MdcMcHitBuilder()

MdcMcHitBuilder::MdcMcHitBuilder ( )

Definition at line 7 of file MdcMcHitBuilder.cxx.

◆ ~MdcMcHitBuilder()

virtual MdcMcHitBuilder::~MdcMcHitBuilder ( )
inlinevirtual

Definition at line 17 of file MdcMcHitBuilder.h.

17{};

Member Function Documentation

◆ getREID()

uint32_t MdcMcHitBuilder::getREID ( uint32_t reid)
virtual

Implements Builder.

Definition at line 112 of file MdcMcHitBuilder.cxx.

113{
114 return 0;
115}

◆ getTEID()

uint32_t MdcMcHitBuilder::getTEID ( uint32_t teid)
virtual

Implements Builder.

Definition at line 106 of file MdcMcHitBuilder.cxx.

107{
108 return 0;
109}

◆ initialize()

StatusCode MdcMcHitBuilder::initialize ( string & initFile)
virtual

Reimplemented from Builder.

Definition at line 70 of file MdcMcHitBuilder.cxx.

71{
72 ifstream f;
73
74 //read init file
75 f.open(initFile.c_str());
76
77 if ( f.bad() ) {
78 cerr << "Error: could not open file " << initFile << endl;
79 return StatusCode::FAILURE;
80 }
81
82 if (!Builder::find( f, "##MdcTruthConf", initFile)) {
83 cerr << "Error: could not find '##MdcTruthConf' in file " << initFile << endl;
84 return StatusCode::FAILURE;
85 }
86
87 if ( !Builder::expect( f, "#MdcTruthShift", initFile) ||
88 !Builder::expectInt( f, "trackIndex", initFile, m_trackIndexIndex, m_trackIndexMask) ||
89 !Builder::expectInt( f, "layerId", initFile, m_layerIdIndex, m_layerIdMask) ||
90 !Builder::expectInt( f, "cellId", initFile, m_cellIdIndex, m_cellIdMask) ||
91 !Builder::expectInt( f, "posFlag", initFile, m_posFlagIndex, m_posFlagMask) ||
92 !Builder::expect( f, "#MdcTruthCoeff", initFile) ||
93 !Builder::expectLong( f, "edep", initFile, m_edepCoeff) ||
94 !Builder::expectLong( f, "driftD", initFile, m_driftDCoeff) ||
95 !Builder::expectLong( f, "x", initFile, m_xCoeff) ||
96 !Builder::expectLong( f, "y", initFile, m_yCoeff) ||
97 !Builder::expectLong( f, "z", initFile, m_zCoeff) )
98 return StatusCode::FAILURE;
99
100 f.close();
101
102 return StatusCode::SUCCESS;
103}
static bool find(ifstream &f, string msg, string fname)
Definition Builder.cxx:60
static bool expect(ifstream &f, string msg, string fname)
Definition Builder.cxx:28
static bool expectLong(ifstream &f, string msg, string fname, uint64_t &val)
Definition Builder.cxx:52
static bool expectInt(ifstream &f, string msg, string fname, uint32_t &val1, uint32_t &val2)
Definition Builder.cxx:44

Referenced by MdcMcHitBuilder().

◆ pack()

StatusCode MdcMcHitBuilder::pack ( MdcMcHitCol * mdcMcHitCol,
WriteRawEvent *& re )
virtual

Definition at line 31 of file MdcMcHitBuilder.cxx.

32{
33/*
34 if (mdcMcHitCol == NULL) {
35 cout << "MdcMcHitBuilder::pack cant get MdcMcHitCol" << endl;
36 return StatusCode::FAILURE;
37 }
38
39 MdcTruth_t m_MdcTruth;
40 vector<uint32_t> *mdcReMcHitVec = new vector<uint32_t>;
41
42 MdcMcHitCol::const_iterator pMdcMcHit = mdcMcHitCol->begin();
43 for ( ; pMdcMcHit != mdcMcHitCol->end(); pMdcMcHit++) {
44 // Make MdcTruth data
45 makeMdcTruth(pMdcMcHit, m_MdcTruth);
46 // pack the trackIndex, layerId and cellId.
47 uint32_t helpVal = (m_MdcTruth.trackIndex<<m_trackIndexIndex) & m_trackIndexMask;
48 helpVal |= ((m_MdcTruth.layerId<<m_layerIdIndex) & m_layerIdMask);
49 helpVal |= ((m_MdcTruth.cellId<<m_cellIdIndex) & m_cellIdMask);
50 if (m_MdcTruth.posFlag) helpVal |= ((0x1<<m_posFlagIndex) & m_posFlagMask);
51 //fill the McHit Vector
52 mdcReMcHitVec->push_back(helpVal);
53 mdcReMcHitVec->push_back(m_MdcTruth.edep);
54 mdcReMcHitVec->push_back(m_MdcTruth.driftD);
55 mdcReMcHitVec->push_back(m_MdcTruth.x);
56 mdcReMcHitVec->push_back(m_MdcTruth.y);
57 mdcReMcHitVec->push_back(m_MdcTruth.z);
58 }
59
60 OfflineEventFormat::SubDetectorHeader sh(OfflineEventFormat::MDCTRUTH);
61 SubRawEvent *sub = new SubRawEvent(sh, mdcReMcHitVec);
62 re->append(sub);
63 */
64
65 return StatusCode::SUCCESS;
66}

Referenced by RawDataMdcMcHitCnv::createRep().

◆ unPack()

void MdcMcHitBuilder::unPack ( vector< uint32_t >::const_iterator & iter,
vector< uint32_t >::const_iterator & eiter,
MdcTruth_t & mt )
virtual

Definition at line 13 of file MdcMcHitBuilder.cxx.

15{
16 uint32_t helpVal = *(iter++); assert(iter != eiter);
17 mt.edep = *(iter++); assert(iter != eiter);
18 mt.driftD = *(iter++); assert(iter != eiter);
19 mt.x = *(iter++); assert(iter != eiter);
20 mt.y = *(iter++); assert(iter != eiter);
21 mt.z = *(iter++);
22
23 mt.trackIndex = (helpVal & m_trackIndexMask) >> m_trackIndexIndex;
24 mt.layerId = (helpVal & m_layerIdMask) >> m_layerIdIndex;
25 mt.cellId = (helpVal & m_cellIdMask) >> m_cellIdIndex;
26 mt.posFlag = (helpVal & m_posFlagMask) ? 1 : 0 ;
27
28 return;
29}
EvtStreamInputIterator< typename Generator::result_type > iter(Generator gen, int N=0)

Referenced by RawDataMdcMcHitCnv::createObj().

Member Data Documentation

◆ m_driftDCoeff

uint64_t MdcMcHitBuilder::m_driftDCoeff

Definition at line 40 of file MdcMcHitBuilder.h.

Referenced by RawDataMdcMcHitCnv::createObj(), and initialize().

◆ m_edepCoeff

uint64_t MdcMcHitBuilder::m_edepCoeff

Definition at line 39 of file MdcMcHitBuilder.h.

Referenced by RawDataMdcMcHitCnv::createObj(), and initialize().

◆ m_xCoeff

uint64_t MdcMcHitBuilder::m_xCoeff

Definition at line 41 of file MdcMcHitBuilder.h.

Referenced by RawDataMdcMcHitCnv::createObj(), and initialize().

◆ m_yCoeff

uint64_t MdcMcHitBuilder::m_yCoeff

Definition at line 42 of file MdcMcHitBuilder.h.

Referenced by RawDataMdcMcHitCnv::createObj(), and initialize().

◆ m_zCoeff

uint64_t MdcMcHitBuilder::m_zCoeff

Definition at line 43 of file MdcMcHitBuilder.h.

Referenced by RawDataMdcMcHitCnv::createObj(), and initialize().


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