23 pcounter_ = (base -> GetCounter());
24 debug_ = base -> GetDebug();
25 porbit_number_ = (base -> GetOrbit());
26 plv1_ = (base -> GetLV1());
27 pbx_ = (base -> GetBX());
28 prunnumber_ = (base -> GetRunNumber());
29 doBarrel_ = base -> GetDoBarrel();
30 doEndCap_ = base -> GetDoEndCap();
31 plistDCCId_ = base -> GetListDCCId();
32 doTCC_ = base -> GetDoTCC();
33 doSR_ = base -> GetDoSR();
34 doTower_ = base -> GetDoTower();
42 int orbit_number_ = *porbit_number_;
46 if (debug_)
cout <<
"in BlockFormatter::DigiToRaw run_number orbit_number bx lv1 " << dec << run_number <<
" " <<
47 orbit_number_ <<
" " << bx <<
" " << lv1 << endl;
49 for (
int idcc=1; idcc <= 54; idcc++) {
57 unsigned char * pData;
58 short int DCC_ERRORS = 0;
60 if (rawdata.
size() == 0) {
62 pData = rawdata.
data();
64 Word64 word = 0x18 + ((FEDid & 0xFFF)<<8)
68 Word64* pw =
reinterpret_cast<Word64*
>(
const_cast<unsigned char*
>(pData));
72 pData = rawdata.
data();
73 pData[11] = DCC_ERRORS & 0xFF;
74 pData[12] = run_number & 0xFF;
75 pData[13] = (run_number >>8) & 0xFF;
76 pData[14] = (run_number >> 16) & 0xFF;
79 for (
int i=16;
i <= 22;
i++) {
83 pData[24] = orbit_number_ & 0xFF;
84 pData[25] = (orbit_number_ >>8) & 0xFF;
85 pData[26] = (orbit_number_ >>16) & 0xFF;
86 pData[27] = (orbit_number_ >>24) & 0xFF;
92 pData[28] = (SR&0x1) + ((ZS&0x1)<<1) + ((TZS&0x1)<<2);
95 for (
int i=0;
i<=4;
i++) {
96 for (
int j=0;
j<7;
j++) {
97 pData[32 +8*
i +
j] = 0;
99 pData[32 +8*
i + 7] = 0x04;
111 cout <<
"Print RawData size " << dec << size << endl;
112 unsigned char* pData = rawdata.
data();
115 for (
int i=0;
i <
n;
i++) {
116 for (
int j=7;
j>=0;
j--) {
117 if (8*
i+
j <= size)
cout << hex << (int)pData[8*
i+
j] <<
" ";
126 map<
int, map<int,int> >* FEDorder ) {
129 for (
int id=0;
id < 36 + 18;
id++) {
130 if ( (! doBarrel_) && (
id >= 9 &&
id <= 44))
continue;
131 if ( (! doEndCap_) && (id <= 8 || id >= 45))
continue;
137 if (
find( (*plistDCCId_).begin(), (*plistDCCId_).end(), (
id+1) ) == (*plistDCCId_).end() )
144 int lastline = rawdata.
size();
145 rawdata.
resize( lastline + 8);
146 unsigned char * pData = rawdata.
data();
147 int event_length = (lastline + 8) / 8;
149 pData[lastline+7] = 0xa0;
151 pData[lastline+4] = event_length & 0xFF;
152 pData[lastline+5] = (event_length >> 8) & 0xFF;
153 pData[lastline+6] = (event_length >> 16) & 0xFF;
154 int event_status = 0;
155 pData[lastline+1] = event_status & 0x0F;
157 pData[lastline] = tts & 0xF0;
161 pData[8] = event_length & 0xFF;
162 pData[9] = (event_length >> 8) & 0xFF;
163 pData[10] = (event_length >> 16) & 0xFF;
167 map<int, map<int,int> >::iterator fen = FEDorder ->
find(FEDid);
169 bool FED_has_data =
true;
170 if (fen == FEDorder->end()) FED_has_data =
false;
171 if (debug_ && (! FED_has_data))
cout <<
" FEDid is not in FEDorder ! " << endl;
172 if ( ! FED_has_data) {
174 for (
int iFE=1; iFE <= 68; iFE++) {
175 int irow = (iFE-1) / 14;
176 int kval = ( (iFE-1) % 14) / 2;
177 if (iFE % 2 ==1) pData[32 + 8*irow + kval] |= ch_status & 0xFF;
178 else pData[32 + 8*irow + kval] |= ((ch_status <<4) & 0xFF);
183 map<int, int>& FEorder = (*fen).second;
185 for (
int iFE=1; iFE <= 68; iFE++) {
186 map<int,int>::iterator fe = FEorder.find(iFE);
188 if (fe == FEorder.end())
190 int irow = (iFE-1) / 14;
191 int kval = ( (iFE-1) % 14) / 2;
192 if (iFE % 2 ==1) pData[32 + 8*irow + kval] |= ch_status & 0xFF;
193 else pData[32 + 8*irow + kval] |= ((ch_status <<4) & 0xFF);
205 for (
int id=0;
id < 36 + 18;
id++) {
213 if (rawdata.
size() > 0)
214 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.
tuple size
Write out results.
static const int MIN_DCCID_EEP