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

#include <McParticleBuilder.h>

Inheritance diagram for McParticleBuilder:

Public Member Functions

 McParticleBuilder ()
virtual ~McParticleBuilder ()
virtual StatusCode initialize (string &initFile)
virtual uint32_t getTEID (uint32_t teid)
virtual uint32_t getREID (uint32_t reid)
virtual void unPack (uint32_t *buf, double *vPointer, McParticle *mcPar)
virtual StatusCode pack (McParticleCol *mcParticleCol, WriteRawEvent *&re)
 McParticleBuilder ()
virtual ~McParticleBuilder ()
virtual StatusCode initialize (string &initFile)
virtual uint32_t getTEID (uint32_t teid)
virtual uint32_t getREID (uint32_t reid)
virtual void unPack (uint32_t *buf, double *vPointer, McParticle *mcPar)
virtual StatusCode pack (McParticleCol *mcParticleCol, WriteRawEvent *&re)
 McParticleBuilder ()
virtual ~McParticleBuilder ()
virtual StatusCode initialize (string &initFile)
virtual uint32_t getTEID (uint32_t teid)
virtual uint32_t getREID (uint32_t reid)
virtual void unPack (uint32_t *buf, double *vPointer, McParticle *mcPar)
virtual StatusCode pack (McParticleCol *mcParticleCol, WriteRawEvent *&re)

Additional Inherited Members

Public Types inherited from Builder
typedef std::map< uint32_t, uint32_t > TE2REMAP
typedef std::map< uint32_t, uint32_t > TE2REMAP
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)
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)
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, uint32_t shift=0)
 Builder ()
virtual ~Builder ()
void append2event (WriteRawEvent *&re, uint32_t source_id, uint32_t size, uint32_t shift=0)
 Builder ()
virtual ~Builder ()
void append2event (WriteRawEvent *&re, uint32_t source_id, uint32_t size, uint32_t shift=0)
Protected Attributes inherited from Builder
uint32_t * m_buf
uint32_t m_status
Static Protected Attributes inherited from Builder
static string m_confFile

Detailed Description

Constructor & Destructor Documentation

◆ McParticleBuilder() [1/3]

McParticleBuilder::McParticleBuilder ( )

Definition at line 6 of file McParticleBuilder.cxx.

6 : Builder() {
7 // initialize(Builder::m_confFile);
8}
Builder()
Definition Builder.cxx:11

◆ ~McParticleBuilder() [1/3]

virtual McParticleBuilder::~McParticleBuilder ( )
inlinevirtual

◆ McParticleBuilder() [2/3]

McParticleBuilder::McParticleBuilder ( )

◆ ~McParticleBuilder() [2/3]

virtual McParticleBuilder::~McParticleBuilder ( )
inlinevirtual

◆ McParticleBuilder() [3/3]

McParticleBuilder::McParticleBuilder ( )

◆ ~McParticleBuilder() [3/3]

virtual McParticleBuilder::~McParticleBuilder ( )
inlinevirtual

Member Function Documentation

◆ getREID() [1/3]

uint32_t McParticleBuilder::getREID ( uint32_t reid)
virtual

Implements Builder.

Definition at line 133 of file McParticleBuilder.cxx.

133{ return 0; }

◆ getREID() [2/3]

virtual uint32_t McParticleBuilder::getREID ( uint32_t reid)
virtual

Implements Builder.

◆ getREID() [3/3]

virtual uint32_t McParticleBuilder::getREID ( uint32_t reid)
virtual

Implements Builder.

◆ getTEID() [1/3]

uint32_t McParticleBuilder::getTEID ( uint32_t teid)
virtual

Implements Builder.

Definition at line 131 of file McParticleBuilder.cxx.

131{ return 0; }

◆ getTEID() [2/3]

virtual uint32_t McParticleBuilder::getTEID ( uint32_t teid)
virtual

Implements Builder.

◆ getTEID() [3/3]

virtual uint32_t McParticleBuilder::getTEID ( uint32_t teid)
virtual

Implements Builder.

◆ initialize() [1/3]

StatusCode McParticleBuilder::initialize ( string & initFile)
virtual

Reimplemented from Builder.

Definition at line 108 of file McParticleBuilder.cxx.

108 {
109 ifstream f;
110
111 // read init file
112 f.open( initFile.c_str() );
113
114 if ( f.bad() )
115 {
116 cerr << "Error: could not open file " << initFile << endl;
117 return StatusCode::FAILURE;
118 }
119
120 if ( !Builder::find( f, "##McParticleConf", initFile ) )
121 {
122 cerr << "Error: could not find '##McParticleConf' in file " << initFile << endl;
123 return StatusCode::FAILURE;
124 }
125
126 f.close();
127
128 return StatusCode::SUCCESS;
129}
TFile f("ana_bhabha660a_dqa_mcPat_zy_old.root")
static bool find(ifstream &f, string msg, string fname)
Definition Builder.cxx:52

◆ initialize() [2/3]

virtual StatusCode McParticleBuilder::initialize ( string & initFile)
virtual

Reimplemented from Builder.

◆ initialize() [3/3]

virtual StatusCode McParticleBuilder::initialize ( string & initFile)
virtual

Reimplemented from Builder.

◆ pack() [1/3]

StatusCode McParticleBuilder::pack ( McParticleCol * mcParticleCol,
WriteRawEvent *& re )
virtual

Definition at line 37 of file McParticleBuilder.cxx.

37 {
38 if ( mcParticleCol == 0 )
39 {
40 cerr << "McParticleBuilder::pack can't get mcParticleCol" << endl;
41 return StatusCode::FAILURE;
42 }
43
44 uint32_t nParticle = mcParticleCol->size();
45 uint32_t nVertex = 0;
46 vector<bool> vFlag( nParticle + 1, false );
47 double* vPointer = (double*)( m_buf + nParticle * 11 + 1 );
48
49 uint32_t index = 0;
50 int tIndex, vIndex0, vIndex1;
51 int parId;
52 uint32_t statusFlag;
53
54 m_buf[index++] = ( nParticle << 16 );
55
56 McParticleCol::const_iterator itPar = mcParticleCol->begin();
57 for ( ; itPar != mcParticleCol->end(); itPar++ )
58 {
59 tIndex = ( *itPar )->trackIndex();
60 vIndex0 = ( *itPar )->vertexIndex0();
61 vIndex1 = ( *itPar )->vertexIndex1();
62 if ( vIndex1 == -99 ) vIndex1 = 0xFF;
63 parId = ( *itPar )->particleProperty();
64 statusFlag = ( *itPar )->statusFlags();
65 const HepLorentzVector& p4vec = ( *itPar )->initialFourMomentum();
66 m_buf[index++] = ( ( tIndex << 16 ) | ( vIndex0 << 8 ) | ( vIndex1 ) );
67 m_buf[index++] = (uint32_t)parId;
68 m_buf[index++] = statusFlag;
69 double* ptmp = (double*)( m_buf + index );
70 ptmp[0] = p4vec.x();
71 ptmp[1] = p4vec.y();
72 ptmp[2] = p4vec.z();
73 ptmp[3] = p4vec.t();
74 index += 8;
75
76 if ( !vFlag[vIndex0] )
77 {
78 const HepLorentzVector& initPos = ( *itPar )->initialPosition();
79 vPointer[vIndex0 * 4 + 0] = initPos.px();
80 vPointer[vIndex0 * 4 + 1] = initPos.py();
81 vPointer[vIndex0 * 4 + 2] = initPos.pz();
82 vPointer[vIndex0 * 4 + 3] = initPos.e();
83 vFlag[vIndex0] = true;
84 nVertex++;
85 }
86
87 if ( ( vIndex1 != 0xFF ) && ( !vFlag[vIndex1] ) )
88 {
89 const HepLorentzVector& finalPos = ( *itPar )->finalPosition();
90 vPointer[vIndex1 * 4 + 0] = finalPos.px();
91 vPointer[vIndex1 * 4 + 1] = finalPos.py();
92 vPointer[vIndex1 * 4 + 2] = finalPos.pz();
93 vPointer[vIndex1 * 4 + 3] = finalPos.e();
94 vFlag[vIndex1] = true;
95 nVertex++;
96 }
97 }
98
99 m_buf[0] |= nVertex;
100
101 append2event( re, 0xf10000, ( nParticle * 11 + nVertex * 8 + 1 ) );
102
103 return StatusCode::SUCCESS;
104}
void append2event(WriteRawEvent *&re, uint32_t source_id, uint32_t size, uint32_t shift=0)
Definition Builder.cxx:69

◆ pack() [2/3]

virtual StatusCode McParticleBuilder::pack ( McParticleCol * mcParticleCol,
WriteRawEvent *& re )
virtual

◆ pack() [3/3]

virtual StatusCode McParticleBuilder::pack ( McParticleCol * mcParticleCol,
WriteRawEvent *& re )
virtual

◆ unPack() [1/3]

void McParticleBuilder::unPack ( uint32_t * buf,
double * vPointer,
McParticle * mcPar )
virtual

Definition at line 10 of file McParticleBuilder.cxx.

10 {
11 uint32_t trkIndex = ( buf[0] >> 16 );
12 uint32_t vIndex0 = ( buf[0] >> 8 ) & 0xFF;
13 uint32_t vIndex1 = buf[0] & 0xFF;
14
15 double* ptmp = (double*)( buf + 3 );
16 double* v0Pointer = vPointer + 4 * vIndex0;
17 HepLorentzVector initMomentum( ptmp[0], ptmp[1], ptmp[2], ptmp[3] );
18 HepLorentzVector initPosition( v0Pointer[0], v0Pointer[1], v0Pointer[2], v0Pointer[3] );
19
20 mcPar->initialize( buf[1], buf[2], initMomentum, initPosition, "" );
21 mcPar->setTrackIndex( trkIndex );
22 mcPar->setVertexIndex0( vIndex0 );
23
24 if ( vIndex1 == 0xFF ) { mcPar->setVertexIndex1( -99 ); }
25 else
26 {
27 mcPar->setVertexIndex1( vIndex1 );
28
29 double* v1Pointer = vPointer + 4 * vIndex1;
30 HepLorentzVector finalPosition( v1Pointer[0], v1Pointer[1], v1Pointer[2], v1Pointer[3] );
31 mcPar->finalize( finalPosition );
32 }
33
34 return;
35}

◆ unPack() [2/3]

virtual void McParticleBuilder::unPack ( uint32_t * buf,
double * vPointer,
McParticle * mcPar )
virtual

◆ unPack() [3/3]

virtual void McParticleBuilder::unPack ( uint32_t * buf,
double * vPointer,
McParticle * mcPar )
virtual

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