28 if (
debug_)
cout <<
"enter in TCCBlockFormatter::DigiToRaw " << endl;
30 int HEADER_SIZE = 8 * 9;
40 int iDCC = TheMapping -> DCCid(detid);
41 int TCCid = TheMapping -> TCCid(detid);
45 cout <<
"Wrong TCCid in TCCBlockFormatter::DigiToRaw " << endl;
62 itcc_block = 2 * pair + inner + 1;
63 if (inner == 1) NTT_max = 28;
68 int nsamples = trigprim.
size();
71 int iTT = TheMapping -> iTT(detid);
72 if (
debug_)
cout <<
"This is a TrigTower iDCC iTT iTCCBlock TCCid " <<
dec <<
73 iDCC <<
" " << iTT <<
" " << itcc_block <<
" " << TCCid << endl;
75 if (iTT <= 0 || iTT > NTT_max) {
76 cout <<
"invalid iTT " << iTT << endl;
83 if ((
int)rawdata.
size() != HEADER_SIZE) {
84 FE_index = rawdata.
size() / 8 - NTCC*(Nrows_TCC+1);
86 if (
debug_)
cout <<
"TCCid already there. FE_index = " << FE_index << endl;
89 if (
debug_)
cout <<
"New TTCid added on Raw data, TTCid = " <<
dec << TCCid <<
" 0x" << hex << TCCid << endl;
90 FE_index = rawdata.
size() / 8;
91 int fe_index = FE_index;
92 for (
int iblock=0; iblock < NTCC; iblock++) {
94 unsigned char* ppData = rawdata.
data();
95 ppData[8*fe_index] = TCCid & 0xFF;
96 ppData[8*fe_index+2] = bx & 0xFF;
97 ppData[8*fe_index+3] = (bx & 0xF00)>>8;
98 ppData[8*fe_index+3] |= 0x60;
99 ppData[8*fe_index+4] = lv1 & 0xFF;
100 ppData[8*fe_index+5] = (lv1 & 0xF00)>>8;
101 ppData[8*fe_index+6] = NTT_max;
102 ppData[8*fe_index+6] |= ((nsamples & 0x1)<<7);
103 ppData[8*fe_index+7] = ((nsamples & 0xE)>>1);
104 ppData[8*fe_index+7] |= 0x60;
105 if (iblock == 0) FE_index ++;
106 fe_index += Nrows_TCC+1;
107 rawdata.
resize (rawdata.
size() + 8*Nrows_TCC);
109 if (
debug_)
cout <<
"Added headers and empty lines : " << endl;
114 unsigned char* ppData = rawdata.
data();
115 for (
int iline=FE_index-1;
iline < FE_index + (Nrows_TCC+1)*NTCC -1 ;
iline++) {
116 ppData[8*
iline + 7] |= 0x60;
117 ppData[8*
iline + 3] |= 0x60;
121 unsigned char* pData = rawdata.
data();
126 int irow = jTT/4 + (itcc_block-1)*(Nrows_TCC+1);
136 if (
debug_)
cout <<
"Now add tower " <<
dec << iTT <<
" irow ival " <<
dec << irow <<
" " <<
dec << ival << endl;
137 if (
debug_)
cout <<
"new data will be added at line " <<
dec << FE_index << endl;
141 int ttflag = trigprim.
ttFlag();
143 if (
debug_ && (ttflag != 0)) {
144 cout <<
"in TCCBlock : this tower has a non zero flag" << endl;
145 cout <<
"Fedid iTT flag " <<
dec << FEDid <<
" " << iTT <<
" " <<
"0x" << hex << ttflag << endl;
147 pData[8*FE_index + ival*2] = et & 0xFF;
148 pData[8*FE_index + ival*2+1] = (ttflag<<1) + (fg&0
x1);
151 int ibase = 8*(FE_index - (
int)(jTT/4) -1);
152 pData[ibase] = TCCid & 0xFF;
153 pData[ibase+6] = NTT_max;
154 pData[ibase+6] |= ((nsamples & 0x1)<<7);
155 pData[ibase+7] |= ((nsamples & 0xE)>>1);
157 if (
debug_)
cout <<
"pData[8*FE_index + ival*2+1] = " << hex << (
int)pData[8*FE_index + ival*2+1] << endl;
158 if (
debug_)
cout <<
"ttflag ttflag<<1 " << hex << ttflag <<
" " << hex << (ttflag<<1) << endl;
159 if (
debug_)
cout <<
"fg&0x1 " << hex << (fg&0x1) << endl;
160 if (
debug_)
cout <<
"sum " << hex << ( (ttflag<<1) + (fg&0x1) ) << endl;
161 if (ival %2 == 1) pData[8*FE_index + ival*2+1] |= 0x60;
162 if (
debug_)
cout <<
"ttflag et fgbit " << hex << ttflag <<
" " << hex << et <<
" " << hex << fg << endl;
static const int MAX_TCCID
size_t size() const
Lenght of the data buffer in bytes.
int ieta() const
get the tower ieta
int compressedEt() const
get the encoded/compressed Et of interesting sample
int ietaAbs() const
get the absolute value of the tower ieta
void resize(size_t newsize)
static const int MAX_DCCID_EEM
int iphi() const
get the tower iphi
const EcalTrigTowerDetId & id() const
et
define resolution functions of each parameter
EcalSubdetector subDet() const
get the subDetector associated to the Trigger Tower
static const int MAX_DCCID_EEP
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
bool fineGrain() const
get the fine-grain bit of interesting sample
int ttFlag() const
get the Trigger tower Flag of interesting sample
static const int MIN_DCCID_EEM
static const int MIN_DCCID_EEP