Definition at line 53 of file ESUnpacker.cc.
References bx_, FEDHeader::bxID(), FEDTrailer::check(), FEDHeader::check(), dac_, FEDRawData::data(), debug_, FEch_, fedId_, gain_, ESDCCHeaderBlock::getOptoRX0(), ESDCCHeaderBlock::getOptoRX1(), ESDCCHeaderBlock::getOptoRX2(), RecoTauValidation_cfi::header, FEDTrailer::lenght(), LogDebug, lv1_, FEDHeader::lvl1ID(), m1, m12, m16, m32, m4, m6, m8, FEDHeader::moreHeaders(), FEDTrailer::moreTrailers(), optoRX0_, optoRX1_, optoRX2_, orbit_number_, precision_, print(), edm::SortedCollection< T, SORT >::push_back(), runtype_, seqtype_, ESKCHIPBlock::setBC(), ESDCCHeaderBlock::setBX(), ESDCCHeaderBlock::setDAC(), ESDCCHeaderBlock::setDCCErrors(), ESKCHIPBlock::setEC(), ESDCCHeaderBlock::setFEChannelStatus(), ESDCCHeaderBlock::setFedId(), ESKCHIPBlock::setFlag1(), ESKCHIPBlock::setFlag2(), ESDCCHeaderBlock::setGain(), ESKCHIPBlock::setId(), ESDCCHeaderBlock::setLV1(), ESDCCHeaderBlock::setMajorVersion(), ESDCCHeaderBlock::setMinorVersion(), ESKCHIPBlock::setOptoBC(), ESDCCHeaderBlock::setOptoBC0(), ESDCCHeaderBlock::setOptoBC1(), ESDCCHeaderBlock::setOptoBC2(), ESKCHIPBlock::setOptoEC(), ESDCCHeaderBlock::setOptoRX0(), ESDCCHeaderBlock::setOptoRX1(), ESDCCHeaderBlock::setOptoRX2(), ESDCCHeaderBlock::setOrbitNumber(), ESDCCHeaderBlock::setPrecision(), ESDCCHeaderBlock::setRunType(), ESDCCHeaderBlock::setSeqType(), ESDCCHeaderBlock::setTriggerType(), FEDRawData::size(), FEDHeader::sourceID(), trgtype_, vmajor_, vminor_, word2digi(), and globals_cff::x1.
Referenced by ESRawToDigi::produce().
56 if (nWords==0)
return;
58 int head, kPACE[4], kFlag1, kFlag2, kBC, kEC, optoBC, optoEC;
66 bool moreHeaders =
true;
69 FEDHeader ESHeader( reinterpret_cast<const unsigned char*>(header) );
70 if ( !ESHeader.check() ) {
75 fedId_ = ESHeader.sourceID();
76 lv1_ = ESHeader.lvl1ID();
77 bx_ = ESHeader.bxID();
80 LogDebug(
"ESUnpacker") <<
"[ESUnpacker]: FED Header candidate. Is header? "<< ESHeader.check();
83 else LogDebug(
"ESUnpacker")<<
" WARNING!, this is not a ES Header";
86 moreHeaders = ESHeader.moreHeaders();
99 const Word64* trailer =
reinterpret_cast<const Word64*
>(rawData.
data())+(nWords-1); ++trailer;
100 bool moreTrailers =
true;
101 while (moreTrailers) {
103 FEDTrailer ESTrailer(reinterpret_cast<const unsigned char*>(trailer));
104 if ( !ESTrailer.check()) {
109 if ( ESTrailer.lenght() != nWords) {
115 if ( ESTrailer.lenght() < 8) {
121 slinkCRC = (*trailer >> 2 ) & 0
x1;
123 LogDebug(
"ESUnpacker")<<
"[ESUnpacker]: FED Trailer candidate. Is trailer? "<<ESTrailer.check();
124 if (ESTrailer.check())
125 LogDebug(
"ESUnpacker")<<
". Length of the ES event: "<<ESTrailer.lenght();
126 else LogDebug(
"ESUnpacker")<<
" WARNING!, this is not a ES Trailer";
129 moreTrailers = ESTrailer.moreTrailers();
139 std::vector<int> FEch_status;
140 int dccHeaderCount = 0;
141 int dccLineCount = 0;
142 int dccHead, dccLine;
146 for (
const Word64* word=(header+1); word!=(header+dccWords+1); ++word) {
148 dccHead = (*word >> 60) &
m4;
149 if (dccHead == 3) dccHeaderCount++;
150 dccLine = (*word >> 56) &
m4;
152 if (dccLine != dccLineCount) {
158 if (dccLineCount == 1) {
159 dccCRC1_ = (*word >> 24) &
m1;
160 dccCRC2_ = (*word >> 25) &
m1;
161 dccCRC3_ = (*word >> 26) &
m1;
162 }
else if (dccLineCount == 2) {
177 if (dccLineCount == 3) {
186 if (dccLineCount == 4)
optoRX0_ = (*word >> 48) &
m8;
187 if (dccLineCount == 5)
optoRX1_ = (*word >> 48) &
m8;
188 if (dccLineCount == 6)
optoRX2_ = (*word >> 48) &
m8;
189 if (dccLineCount >=4) {
190 for (
unsigned int j=0; j<12; ++j) {
191 FEch_[(dccLineCount-4)*12+j] = (*word >> (j*4)) &
m4;
192 FEch_status.push_back(
FEch_[(dccLineCount-4)*12+j]);
201 if (dccHeaderCount != 6) {
202 edm::LogWarning(
"Invalid Data")<<
"Invalid ES data : DCC header lines are "<<dccHeaderCount;
211 int enableOptoRX[3] = {-1, -1, -1};
212 int NenableOptoRX = 0;
214 enableOptoRX[NenableOptoRX] = 0;
218 enableOptoRX[NenableOptoRX] = 1;
222 enableOptoRX[NenableOptoRX] = 2;
228 for (
const Word64* word=(header+dccWords+1); word!=trailer; ++word) {
231 head = (*word >> 60) &
m4;
236 }
else if (head == 9) {
237 kid = (*word >> 2) & 0x07ff;
238 kPACE[0] = (*word >> 16) &
m1;
239 kPACE[1] = (*word >> 17) &
m1;
240 kPACE[2] = (*word >> 18) &
m1;
241 kPACE[3] = (*word >> 19) &
m1;
242 kFlag2 = (*word >> 20) &
m4;
243 kFlag1 = (*word >> 24) &
m8;
244 kBC = (*word >> 32) &
m16;
245 kEC = (*word >> 48) &
m8;
256 }
else if (head == 6) {
257 optoBC = (*word >> 32) &
m16;
258 optoEC = (*word >> 48) &
m8;
260 opto = enableOptoRX[iopto];
262 else if (opto==1) ESDCCHeader.
setOptoBC1(optoBC);
263 else if (opto==2) ESDCCHeader.
setOptoBC2(optoBC);
264 if (iopto < 2) ++iopto;
void setOptoBC(const int &OptoBC)
void setId(const int &kId)
void push_back(T const &t)
size_t size() const
Lenght of the data buffer in bytes.
void setEC(const int &EC)
void setFlag1(const int &flag1)
void setOptoEC(const int &OptoEC)
void word2digi(int kchip, int kPACE[4], const Word64 &word, ESDigiCollection &digis)
std::string print(const Word64 &word) const
void setFlag2(const int &flag2)
void setBC(const int &BC)
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
unsigned long long Word64