24 if (
debug_)
cout <<
"enter in TCCBlockFormatter::DigiToRaw " << endl;
26 int HEADER_SIZE = 8 * 9;
36 int iDCC = TheMapping -> DCCid(detid);
37 int TCCid = TheMapping -> TCCid(detid);
41 cout <<
"Wrong TCCid in TCCBlockFormatter::DigiToRaw " << endl;
58 itcc_block = 2 * pair + inner + 1;
59 if (inner == 1) NTT_max = 28;
64 int nsamples = trigprim.
size();
67 int iTT = TheMapping -> iTT(detid);
68 if (
debug_)
cout <<
"This is a TrigTower iDCC iTT iTCCBlock TCCid " <<
dec <<
69 iDCC <<
" " << iTT <<
" " << itcc_block <<
" " << TCCid << endl;
71 if (iTT <= 0 || iTT > NTT_max) {
72 cout <<
"invalid iTT " << iTT << endl;
79 if ((
int)rawdata.
size() != HEADER_SIZE) {
80 FE_index = rawdata.
size() / 8 - NTCC*(Nrows_TCC+1);
82 if (
debug_)
cout <<
"TCCid already there. FE_index = " << FE_index << endl;
85 if (
debug_)
cout <<
"New TTCid added on Raw data, TTCid = " <<
dec << TCCid <<
" 0x" << hex << TCCid << endl;
86 FE_index = rawdata.
size() / 8;
87 int fe_index = FE_index;
88 for (
int iblock=0; iblock < NTCC; iblock++) {
90 unsigned char* ppData = rawdata.
data();
91 ppData[8*fe_index] = TCCid & 0xFF;
92 ppData[8*fe_index+2] = bx & 0xFF;
93 ppData[8*fe_index+3] = (bx & 0xF00)>>8;
94 ppData[8*fe_index+3] |= 0x60;
95 ppData[8*fe_index+4] = lv1 & 0xFF;
96 ppData[8*fe_index+5] = (lv1 & 0xF00)>>8;
97 ppData[8*fe_index+6] = NTT_max;
98 ppData[8*fe_index+6] |= ((nsamples & 0x1)<<7);
99 ppData[8*fe_index+7] = ((nsamples & 0xE)>>1);
100 ppData[8*fe_index+7] |= 0x60;
101 if (iblock == 0) FE_index ++;
102 fe_index += Nrows_TCC+1;
103 rawdata.
resize (rawdata.
size() + 8*Nrows_TCC);
105 if (
debug_)
cout <<
"Added headers and empty lines : " << endl;
110 unsigned char* ppData = rawdata.
data();
111 for (
int iline=FE_index-1;
iline < FE_index + (Nrows_TCC+1)*NTCC -1 ;
iline++) {
112 ppData[8*
iline + 7] |= 0x60;
113 ppData[8*
iline + 3] |= 0x60;
117 unsigned char* pData = rawdata.
data();
122 int irow = jTT/4 + (itcc_block-1)*(Nrows_TCC+1);
132 if (
debug_)
cout <<
"Now add tower " <<
dec << iTT <<
" irow ival " <<
dec << irow <<
" " <<
dec << ival << endl;
133 if (
debug_)
cout <<
"new data will be added at line " <<
dec << FE_index << endl;
137 int ttflag = trigprim.
ttFlag();
139 if (
debug_ && (ttflag != 0)) {
140 cout <<
"in TCCBlock : this tower has a non zero flag" << endl;
141 cout <<
"Fedid iTT flag " <<
dec << FEDid <<
" " << iTT <<
" " <<
"0x" << hex << ttflag << endl;
143 pData[8*FE_index + ival*2] = et & 0xFF;
144 pData[8*FE_index + ival*2+1] = (ttflag<<1) + (fg&0
x1);
147 int ibase = 8*(FE_index - (
int)(jTT/4) -1);
148 pData[ibase] = TCCid & 0xFF;
149 pData[ibase+6] = NTT_max;
150 pData[ibase+6] |= ((nsamples & 0x1)<<7);
151 pData[ibase+7] |= ((nsamples & 0xE)>>1);
153 if (
debug_)
cout <<
"pData[8*FE_index + ival*2+1] = " << hex << (
int)pData[8*FE_index + ival*2+1] << endl;
154 if (
debug_)
cout <<
"ttflag ttflag<<1 " << hex << ttflag <<
" " << hex << (ttflag<<1) << endl;
155 if (
debug_)
cout <<
"fg&0x1 " << hex << (fg&0x1) << endl;
156 if (
debug_)
cout <<
"sum " << hex << ( (ttflag<<1) + (fg&0x1) ) << endl;
157 if (ival %2 == 1) pData[8*FE_index + ival*2+1] |= 0x60;
158 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