130 map<int, vector<Word64> > map_data;
133 int ts[3] = {0, 0, 0};
136 vector<Word64> words;
147 for (DetDigis::const_iterator it = detDigis.begin(); it != detDigis.end(); ++it) {
152 for (
int is=0; is<dataframe.
size(); ++is) ts[is] = dataframe.
sample(is).
adc();
160 ix = detId.
six() % 2;
161 iy = detId.
siy() % 2;
162 if (ix == 1 && iy == 1)
164 else if (ix == 0 && iy == 1)
166 else if (ix == 1 && iy == 0)
168 else if (ix == 0 && iy == 0)
171 ix = (1 + detId.
six()) / 2;
172 iy = (1 + detId.
siy()) / 2;
174 kchip = ix + (iy-1)*20 - 1;
175 else if (detId.
zside() == 1 && detId.
plane() == 2)
176 kchip = ix + (iy-1)*20 + 399;
177 else if (detId.
zside() == -1 && detId.
plane() == 1)
178 kchip = ix + (iy-1)*20 + 799;
179 else if (detId.
zside() == -1 && detId.
plane() == 2)
180 kchip = ix + (iy-1)*20 + 1199;
182 if (
debug_)
cout<<
"Si : "<<detId.
zside()<<
" "<<detId.
plane()<<
" "<<detId.
six()<<
" "<<detId.
siy()<<
" "<<detId.
strip()<<
" ("<<kchip<<
","<<pace<<
") "<<ts[2]<<
" "<<ts[1]<<
" "<<ts[0]<<endl;
188 map_data[kchip].push_back(word);
192 map<int, vector<Word64> >::const_iterator kit;
193 for (kit=map_data.begin(); kit!=map_data.end(); ++kit) {
195 if (
debug_)
cout<<
"KCHIP : "<<kit->first<<endl;
202 words.push_back(word);
204 const vector<Word64> &
data = kit->second;
205 for (
unsigned int id=0;
id<data.size(); ++
id) {
207 words.push_back(data[
id]);
212 int dataSize = (words.size() + 8) *
sizeof(
Word64);
215 vector<Word64> DCCwords;
217 word1 = (dataSize <<
sDEL);
219 DCCwords.push_back(word);
223 DCCwords.push_back(word);
227 DCCwords.push_back(word);
231 DCCwords.push_back(word);
235 DCCwords.push_back(word);
239 DCCwords.push_back(word);
242 fedRawData.
resize(dataSize);
251 for (
unsigned int i=0;
i<DCCwords.size(); ++
i) {
258 for (
unsigned int i=0;
i<words.size(); ++
i) {
const ESDetId & id() const
static void set(unsigned char *trailer, int evt_lgth, int crc, int evt_stat, int tts, bool T=false)
Set all fields in the trailer.
void resize(size_t newsize)
unsigned short compute_crc(unsigned char *buffer, unsigned int bufSize)
const ESSample & sample(int i) const
char data[epos_bytes_allocation]
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
int adc() const
get the ADC sample (singed 16 bits)