#include <McParticleBuilder.h>
Inheritance diagram for McParticleBuilder:
Public Types | |
typedef std::map< uint32_t, uint32_t > | TE2REMAP |
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) |
Static Public Member Functions | |
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 | |
void | append2event (WriteRawEvent *&re, uint32_t source_id, uint32_t size) |
Protected Attributes | |
PropertyMgr | m_propMgr |
uint32_t * | m_buf |
uint32_t | m_status |
Static Protected Attributes | |
static string | m_confFile |
Definition at line 11 of file McParticleBuilder.h.
typedef std::map<uint32_t, uint32_t> Builder::TE2REMAP [inherited] |
McParticleBuilder::McParticleBuilder | ( | ) |
Definition at line 6 of file McParticleBuilder.cxx.
00007 :Builder() 00008 { 00009 //initialize(Builder::m_confFile); 00010 }
virtual McParticleBuilder::~McParticleBuilder | ( | ) | [inline, virtual] |
void Builder::append2event | ( | WriteRawEvent *& | re, | |
uint32_t | source_id, | |||
uint32_t | size | |||
) | [protected, inherited] |
Definition at line 76 of file Builder.cxx.
References eformat::write::FullEventFragment::append(), eformat::write::SubDetectorFragment::append(), eformat::write::ROSFragment::append(), eformat::write::FullEventFragment::lvl1_id(), Builder::m_buf, Builder::m_status, eformat::write::ROBFragment::rod_status(), eformat::write::FullEventFragment::run_no(), eformat::write::SubDetectorFragment::status(), eformat::write::ROSFragment::status(), and eformat::write::ROBFragment::status().
Referenced by TofBuilder::pack(), MucBuilder::pack(), MdcBuilder::pack(), pack(), HltBuilder::pack(), and EmcBuilder::pack().
00077 { 00078 uint32_t run_no = re->run_no(); 00079 uint32_t lvl1_id = re->lvl1_id(); 00080 uint32_t bc_id = 0; // ? 00081 // ROB 00082 eformat::write::ROBFragment* nrob = new eformat::write::ROBFragment( 00083 source_id, // source_id 00084 run_no, // run_no 00085 lvl1_id, // lvl1_id 00086 bc_id, // bc_id 00087 0, // lvl1_type 00088 0, // detev_type 00089 size, // ndata 00090 m_buf, // data 00091 0 // status_position 00092 ); 00093 if(m_status==0xFFFFFFFF){ 00094 nrob->status(0, NULL); 00095 nrob->rod_status(0, NULL); 00096 } 00097 else{ //fucd 00098 nrob->status(1, &m_status); 00099 nrob->rod_status(1, &m_status); 00100 } 00101 // ROS 00102 eformat::write::ROSFragment* nros = new eformat::write::ROSFragment( 00103 source_id, // source_id 00104 run_no, // run_no 00105 lvl1_id, // lvl1_id 00106 bc_id // bc_id 00107 ); 00108 if(m_status==0xFFFFFFFF) nros->status(0, NULL); 00109 else nros->status(1, &m_status); //fucd 00110 // SubDetector 00111 eformat::write::SubDetectorFragment* nsd = new eformat::write::SubDetectorFragment(source_id); 00112 if(m_status==0xFFFFFFFF) nsd->status(0, NULL); 00113 else nsd->status(1, &m_status); //fucd 00114 // append to FullEventFragment 00115 nros->append(nrob); 00116 nsd->append(nros); 00117 re->append(nsd); 00118 }
Definition at line 28 of file Builder.cxx.
References deljobs::string.
Referenced by Builder::expectInt(), Builder::expectLong(), TofMcHitBuilder::initialize(), TofBuilder::initialize(), MucMcHitBuilder::initialize(), MdcMcHitBuilder::initialize(), MdcBuilder::initialize(), HltBuilder::initialize(), EmcMcHitBuilder::initialize(), and EmcBuilder::initialize().
00029 { 00030 string str; 00031 if( f.bad() ) 00032 { 00033 cerr << "Error: file " << fname << " is bad" << endl; 00034 return false; 00035 } 00036 f >> str; 00037 if( str == msg ) 00038 return true; 00039 00040 cerr << "Error: expected `" << msg << "|" << str <<"` in " << fname << endl; 00041 return false; 00042 }
bool Builder::expectInt | ( | ifstream & | f, | |
string | msg, | |||
string | fname, | |||
uint32_t & | val1, | |||
uint32_t & | val2 | |||
) | [static, inherited] |
Definition at line 44 of file Builder.cxx.
References Builder::expect().
Referenced by TofMcHitBuilder::initialize(), TofBuilder::initialize(), MucMcHitBuilder::initialize(), MdcMcHitBuilder::initialize(), MdcBuilder::initialize(), HltBuilder::initialize(), EmcMcHitBuilder::initialize(), and EmcBuilder::initialize().
00045 { 00046 if( !expect( f, msg, fname ) || f.bad() ) 00047 return false; 00048 f >> val1 >> val2; 00049 return true; 00050 }
bool Builder::expectLong | ( | ifstream & | f, | |
string | msg, | |||
string | fname, | |||
uint64_t & | val | |||
) | [static, inherited] |
Definition at line 52 of file Builder.cxx.
References Builder::expect().
Referenced by TofMcHitBuilder::initialize(), MucMcHitBuilder::initialize(), MdcMcHitBuilder::initialize(), and EmcMcHitBuilder::initialize().
00053 { 00054 if ( !expect(f, msg, fname) || f.bad() ) 00055 return false; 00056 f >> val; 00057 return true; 00058 }
Definition at line 60 of file Builder.cxx.
References deljobs::string.
Referenced by TofMcHitBuilder::initialize(), TofBuilder::initialize(), MucMcHitBuilder::initialize(), MdcMcHitBuilder::initialize(), MdcBuilder::initialize(), initialize(), HltBuilder::initialize(), EmcMcHitBuilder::initialize(), and EmcBuilder::initialize().
00061 { 00062 if ( f.bad() ) { 00063 cerr << "Error: file " << fname << " bad checked" << endl; 00064 return false; 00065 } 00066 00067 string str; 00068 while ( !f.eof() ) { 00069 f >> str; 00070 if ( str == msg ) return true; 00071 } 00072 00073 return false; 00074 }
uint32_t McParticleBuilder::getREID | ( | uint32_t | reid | ) | [virtual] |
uint32_t McParticleBuilder::getTEID | ( | uint32_t | teid | ) | [virtual] |
StatusCode McParticleBuilder::initialize | ( | string & | initFile | ) | [virtual] |
Reimplemented from Builder.
Definition at line 109 of file McParticleBuilder.cxx.
References Builder::find().
00110 { 00111 ifstream f; 00112 00113 //read init file 00114 f.open(initFile.c_str()); 00115 00116 if ( f.bad() ) { 00117 cerr << "Error: could not open file " << initFile << endl; 00118 return StatusCode::FAILURE; 00119 } 00120 00121 if (!Builder::find( f, "##McParticleConf", initFile)) { 00122 cerr << "Error: could not find '##McParticleConf' in file " << initFile << endl; 00123 return StatusCode::FAILURE; 00124 } 00125 00126 f.close(); 00127 00128 return StatusCode::SUCCESS; 00129 }
StatusCode McParticleBuilder::pack | ( | McParticleCol * | mcParticleCol, | |
WriteRawEvent *& | re | |||
) | [virtual] |
Definition at line 41 of file McParticleBuilder.cxx.
References Builder::append2event(), and Builder::m_buf.
Referenced by RawDataMcParticleCnv::createRep().
00042 { 00043 if (mcParticleCol == 0 ) { 00044 cerr << "McParticleBuilder::pack can't get mcParticleCol" << endl; 00045 return StatusCode::FAILURE; 00046 } 00047 00048 uint32_t nParticle = mcParticleCol->size(); 00049 uint32_t nVertex = 0; 00050 vector<bool> vFlag(nParticle+1, false); 00051 double* vPointer = (double*)(m_buf + nParticle*11 + 1); 00052 00053 uint32_t index = 0; 00054 int tIndex, vIndex0, vIndex1; 00055 int parId; 00056 uint32_t statusFlag; 00057 00058 m_buf[index++] = (nParticle<<16); 00059 00060 McParticleCol::const_iterator itPar = mcParticleCol->begin(); 00061 for( ; itPar != mcParticleCol->end(); itPar++) { 00062 tIndex = (*itPar)->trackIndex(); 00063 vIndex0 = (*itPar)->vertexIndex0(); 00064 vIndex1 = (*itPar)->vertexIndex1(); 00065 if (vIndex1 == -99) vIndex1 = 0xFF; 00066 parId = (*itPar)->particleProperty(); 00067 statusFlag = (*itPar)->statusFlags(); 00068 const HepLorentzVector& p4vec = (*itPar)->initialFourMomentum(); 00069 m_buf[index++] = ((tIndex<<16) | (vIndex0<<8) | (vIndex1)); 00070 m_buf[index++] = (uint32_t)parId; 00071 m_buf[index++] = statusFlag; 00072 double* ptmp = (double*)(m_buf+index); 00073 ptmp[0] = p4vec.x(); 00074 ptmp[1] = p4vec.y(); 00075 ptmp[2] = p4vec.z(); 00076 ptmp[3] = p4vec.t(); 00077 index += 8; 00078 00079 if ( !vFlag[vIndex0] ) { 00080 const HepLorentzVector& initPos = (*itPar)->initialPosition(); 00081 vPointer[vIndex0*4 + 0] = initPos.px(); 00082 vPointer[vIndex0*4 + 1] = initPos.py(); 00083 vPointer[vIndex0*4 + 2] = initPos.pz(); 00084 vPointer[vIndex0*4 + 3] = initPos.e(); 00085 vFlag[vIndex0] = true; 00086 nVertex++; 00087 } 00088 00089 if ( (vIndex1 != 0xFF) && (!vFlag[vIndex1]) ) { 00090 const HepLorentzVector& finalPos = (*itPar)->finalPosition(); 00091 vPointer[vIndex1*4 + 0] = finalPos.px(); 00092 vPointer[vIndex1*4 + 1] = finalPos.py(); 00093 vPointer[vIndex1*4 + 2] = finalPos.pz(); 00094 vPointer[vIndex1*4 + 3] = finalPos.e(); 00095 vFlag[vIndex1] = true; 00096 nVertex++; 00097 } 00098 } 00099 00100 m_buf[0] |= nVertex; 00101 00102 append2event(re, 0xf10000, (nParticle*11 + nVertex*8 + 1)); 00103 00104 return StatusCode::SUCCESS; 00105 }
virtual void McParticleBuilder::unPack | ( | uint32_t * | buf, | |
double * | vPointer, | |||
McParticle * | mcPar | |||
) | [virtual] |
Referenced by RawDataMcParticleCnv::createObj().
uint32_t* Builder::m_buf [protected, inherited] |
Definition at line 46 of file Builder.h.
Referenced by Builder::append2event(), Builder::Builder(), TofBuilder::pack(), MucBuilder::pack(), MdcBuilder::pack(), pack(), HltBuilder::pack(), EmcBuilder::pack(), and Builder::~Builder().
string Builder::m_confFile [static, protected, inherited] |
Definition at line 47 of file Builder.h.
Referenced by Builder::Builder(), EmcBuilder::EmcBuilder(), EmcMcHitBuilder::EmcMcHitBuilder(), HltBuilder::HltBuilder(), MdcBuilder::MdcBuilder(), MdcMcHitBuilder::MdcMcHitBuilder(), MucMcHitBuilder::MucMcHitBuilder(), TofBuilder::TofBuilder(), and TofMcHitBuilder::TofMcHitBuilder().
PropertyMgr Builder::m_propMgr [protected, inherited] |
Reimplemented in EmcBuilder, EmcMcHitBuilder, HltBuilder, MdcBuilder, MdcMcHitBuilder, MucBuilder, MucMcHitBuilder, TofBuilder, and TofMcHitBuilder.
Definition at line 43 of file Builder.h.
Referenced by Builder::Builder().
uint32_t Builder::m_status [protected, inherited] |
Definition at line 49 of file Builder.h.
Referenced by Builder::append2event(), and Builder::Builder().