35 if (
debug_)
cout <<
"in BlockFormatter::DigiToRaw run_number orbit_number bx lv1 " <<
dec << run_number <<
" " <<
38 for (
int idcc=1; idcc <= 54; idcc++) {
46 unsigned char * pData;
47 short int DCC_ERRORS = 0;
49 if (rawdata.
size() == 0) {
51 pData = rawdata.
data();
53 Word64 word = 0x18 + ((FEDid & 0xFFF)<<8)
57 Word64* pw =
reinterpret_cast<Word64*
>(
const_cast<unsigned char*
>(pData));
61 pData = rawdata.
data();
62 pData[11] = DCC_ERRORS & 0xFF;
63 pData[12] = run_number & 0xFF;
64 pData[13] = (run_number >>8) & 0xFF;
65 pData[14] = (run_number >> 16) & 0xFF;
68 for (
int i=16;
i <= 22;
i++) {
81 pData[28] = (SR&0x1) + ((ZS&0
x1)<<1) + ((TZS&0x1)<<2);
84 for (
int i=0;
i<=4;
i++) {
85 for (
int j=0; j<7; j++) {
86 pData[32 +8*
i + j] = 0;
88 pData[32 +8*
i + 7] = 0x04;
100 cout <<
"Print RawData size " <<
dec << size << endl;
101 unsigned char* pData = rawdata.
data();
104 for (
int i=0;
i <
n;
i++) {
105 for (
int j=7; j>=0; j--) {
106 if (8*
i+j <= size)
cout << hex << (
int)pData[8*
i+j] <<
" ";
115 map<
int, map<int,int> >* FEDorder ) {
118 for (
int id=0;
id < 36 + 18;
id++) {
119 if ( (!
doBarrel_) && (
id >= 9 &&
id <= 44))
continue;
120 if ( (!
doEndCap_) && (id <= 8 || id >= 45))
continue;
126 if (
find( (*plistDCCId_).begin(), (*plistDCCId_).end(), (
id+1) ) == (*plistDCCId_).end() )
133 int lastline = rawdata.
size();
134 rawdata.
resize( lastline + 8);
135 unsigned char * pData = rawdata.
data();
136 int event_length = (lastline + 8) / 8;
138 pData[lastline+7] = 0xa0;
140 pData[lastline+4] = event_length & 0xFF;
141 pData[lastline+5] = (event_length >> 8) & 0xFF;
142 pData[lastline+6] = (event_length >> 16) & 0xFF;
143 int event_status = 0;
144 pData[lastline+1] = event_status & 0x0F;
146 pData[lastline] = tts & 0xF0;
150 pData[8] = event_length & 0xFF;
151 pData[9] = (event_length >> 8) & 0xFF;
152 pData[10] = (event_length >> 16) & 0xFF;
156 map<int, map<int,int> >::iterator fen = FEDorder ->
find(FEDid);
158 bool FED_has_data =
true;
159 if (fen == FEDorder->end()) FED_has_data =
false;
160 if (
debug_ && (! FED_has_data))
cout <<
" FEDid is not in FEDorder ! " << endl;
161 if ( ! FED_has_data) {
163 for (
int iFE=1; iFE <= 68; iFE++) {
164 int irow = (iFE-1) / 14;
165 int kval = ( (iFE-1) % 14) / 2;
166 if (iFE % 2 ==1) pData[32 + 8*irow + kval] |= ch_status & 0xFF;
167 else pData[32 + 8*irow + kval] |= ((ch_status <<4) & 0xFF);
172 map<int, int>& FEorder = (*fen).second;
174 for (
int iFE=1; iFE <= 68; iFE++) {
175 map<int,int>::iterator fe = FEorder.find(iFE);
177 if (fe == FEorder.end())
179 int irow = (iFE-1) / 14;
180 int kval = ( (iFE-1) % 14) / 2;
181 if (iFE % 2 ==1) pData[32 + 8*irow + kval] |= ch_status & 0xFF;
182 else pData[32 + 8*irow + kval] |= ((ch_status <<4) & 0xFF);
194 for (
int id=0;
id < 36 + 18;
id++) {
202 if (rawdata.
size() > 0)
203 cout <<
"Size of FED id " <<
dec << FEDid <<
" is : " <<
dec << rawdata.
size() << endl;
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
size_t size() const
Lenght of the data buffer in bytes.
void resize(size_t newsize)
static const int MAX_DCCID_EBP
static const int MIN_DCCID_EBM
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
static const int MIN_DCCID_EEP