3#include "Identifier/EmcID.h"
4#include "RawDataCnv/EventManagement/EmcBuilder.h"
11 m_re2te =
new uint32_t[8192];
12 memset((
void*)m_re2te, 0xFF, 8192*
sizeof(uint32_t));
25 REId = (reDigi&m_idMask) >> m_idIndex;
26 TETDC = (reDigi&m_tdcMask) >> m_tdcIndex;
27 TEADC = (reDigi&m_adcMask) >> m_adcIndex;
28 measure = (reDigi&m_measureMask) >> m_measureIndex;
36 cerr <<
"EmcBuilder::pack can't get digiCol" << endl;
37 return StatusCode::FAILURE;
41 uint32_t teid = 0, tetdc = 0, teadc = 0, reid = 0, redigi = 0, measure = 0;
43 EmcDigiCol::const_iterator pEmcDigi = digiCol->begin();
44 for (pEmcDigi; pEmcDigi!= digiCol->end(); pEmcDigi++) {
45 teid = (*pEmcDigi)->getIntId();
47 tetdc = (*pEmcDigi)->getTimeChannel();
48 teadc = (*pEmcDigi)->getChargeChannel();
49 measure = (*pEmcDigi)->getMeasure();
52 if(teadc&0x80000000)
continue;
54 redigi = ((reid<<m_idIndex)&m_idMask)|
55 ((tetdc<<m_tdcIndex)&m_tdcMask)|
56 ((teadc<<m_adcIndex)&m_adcMask)|
57 ((measure<<m_measureIndex)&m_measureMask);
58 m_buf[size++] = redigi;
63 return StatusCode::SUCCESS;
72 uint32_t nREThetaPos, nREPhiPos, nREEaWePos;
73 uint32_t nREThetaMask, nREPhiMask, nREEaWeMask;
77 f.open( initFile.c_str());
81 cerr <<
"Error: could not open file " << initFile << endl;
86 cerr <<
"Error: could not find '##EmcDigiConf' in file " << initFile << endl;
87 return StatusCode::FAILURE;
108 uint32_t TEthetaMax, TEphiMax;
109 uint32_t TEthetaMin, TEphiMin;
110 uint32_t eawe, theta, phi;
126 for(uint32_t TEtheta = TEthetaMin; TEtheta <= TEthetaMax; TEtheta++ )
152 for(uint32_t TEphi = TEphiMin; TEphi <= TEphiMax; TEphi++ )
157 uint32_t reid = ((eawe<<nREEaWePos)&nREEaWeMask)|
158 ((theta<<nREThetaPos)&nREThetaMask)|
159 ((phi<<nREPhiPos)&nREPhiMask);
167 cerr <<
"Error: REID overflow !" << reid << endl;
172 m_re2te[reid] = teid;
173 m_te2reMap.insert(TE2REMAP::value_type(teid, reid)) ;
178 return StatusCode::SUCCESS;
184 TE2REMAP::iterator itr = m_te2reMap.find(teid);
186 if (itr == m_te2reMap.end()) {
187 cout<<
"wrong teid in emc "<<teid<<endl;
ObjectVector< EmcDigi > EmcDigiCol
void append2event(WriteRawEvent *&re, uint32_t source_id, uint32_t size, uint32_t shift=0)
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 find(ifstream &f, string msg, string fname)
StatusCode initialize(string &initFile)
StatusCode pack(EmcDigiCol *digiCol, WriteRawEvent *&re)
void unPack(uint32_t reDigi, uint32_t &REId, uint32_t &TETDC, uint32_t &TEADC, uint32_t &measure)
uint32_t getREID(uint32_t teid)
static unsigned int getPHI_BARREL_MAX()
static unsigned int getBARREL_EC_MIN()
static unsigned int getBARREL_EC_MAX()
static unsigned int getTHETA_ENDCAP_MIN()
static unsigned int getTHETA_ENDCAP_MAX()
static unsigned int getBARREL()
static unsigned int getTHETA_BARREL_MIN()
static unsigned int getIntID(const unsigned int barrel_ec, const unsigned int theta_module, const unsigned int phi_module)
static unsigned int getTHETA_BARREL_MAX()
static unsigned int getPHI_ENDCAP_MAX(const unsigned int theta)
static unsigned int getPHI_ENDCAP_MIN()
static unsigned int getPHI_BARREL_MIN()
TFile f("ana_bhabha660a_dqa_mcPat_zy_old.root")