Definition at line 49 of file ESUnpacker.cc.
References bx_, FEDHeader::bxID(), FEDHeader::check(), FEDTrailer::check(), dac_, FEDRawData::data(), debug_, FEch_, fedId_, FEDTrailer::fragmentLength(), gain_, ESDCCHeaderBlock::getOptoRX0(), ESDCCHeaderBlock::getOptoRX1(), ESDCCHeaderBlock::getOptoRX2(), dqmiolumiharvest::j, 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_, and word2digi().
Referenced by ESRawToDigi::produce().
54 unsigned int nWords = rawData.
size() /
sizeof(
Word64);
58 int head, kPACE[4], kFlag1, kFlag2, kBC, kEC, optoBC, optoEC;
67 bool moreHeaders =
true;
70 FEDHeader ESHeader(reinterpret_cast<const unsigned char*>(header));
71 if (!ESHeader.check()) {
77 fedId_ = ESHeader.sourceID();
78 lv1_ = ESHeader.lvl1ID();
79 bx_ = ESHeader.bxID();
82 LogDebug(
"ESUnpacker") <<
"[ESUnpacker]: FED Header candidate. Is header? " << ESHeader.check();
86 LogDebug(
"ESUnpacker") <<
" WARNING!, this is not a ES Header";
89 moreHeaders = ESHeader.moreHeaders();
103 const Word64* trailer =
reinterpret_cast<const Word64*
>(rawData.
data()) + (nWords - 1);
105 bool moreTrailers =
true;
106 while (moreTrailers) {
108 FEDTrailer ESTrailer(reinterpret_cast<const unsigned char*>(trailer));
109 if (!ESTrailer.check()) {
115 if (ESTrailer.fragmentLength() != nWords) {
117 edm::LogWarning(
"Invalid Data") <<
"Invalid ES data : the length is not correct !";
122 if (ESTrailer.fragmentLength() < 8) {
124 edm::LogWarning(
"Invalid Data") <<
"Invalid ES data : the length is not correct !";
129 slinkCRC = (*trailer >> 2) & 0x1;
131 LogDebug(
"ESUnpacker") <<
"[ESUnpacker]: FED Trailer candidate. Is trailer? " << ESTrailer.check();
132 if (ESTrailer.check())
133 LogDebug(
"ESUnpacker") <<
". Length of the ES event: " << ESTrailer.fragmentLength();
135 LogDebug(
"ESUnpacker") <<
" WARNING!, this is not a ES Trailer";
138 moreTrailers = ESTrailer.moreTrailers();
148 std::vector<int> FEch_status;
149 int dccHeaderCount = 0;
150 int dccLineCount = 0;
151 int dccHead, dccLine;
158 dccHead = (*
word >> 60) &
m4;
161 dccLine = (*
word >> 56) &
m4;
163 if (dccLine != dccLineCount) {
165 edm::LogWarning(
"Invalid Data") <<
"Invalid ES data : DCC header order is not correct !";
170 if (dccLineCount == 1) {
171 dccCRC1_ = (*
word >> 24) &
m1;
172 dccCRC2_ = (*
word >> 25) &
m1;
173 dccCRC3_ = (*
word >> 26) &
m1;
174 }
else if (dccLineCount == 2) {
189 if (dccLineCount == 3) {
198 if (dccLineCount == 4)
200 if (dccLineCount == 5)
202 if (dccLineCount == 6)
204 if (dccLineCount >= 4) {
205 for (
unsigned int j = 0;
j < 12; ++
j) {
206 FEch_[(dccLineCount - 4) * 12 +
j] = (*
word >> (
j * 4)) &
m4;
207 FEch_status.push_back(
FEch_[(dccLineCount - 4) * 12 +
j]);
216 if (dccHeaderCount != 6) {
217 edm::LogWarning(
"Invalid Data") <<
"Invalid ES data : DCC header lines are " << dccHeaderCount;
226 int enableOptoRX[3] = {-1, -1, -1};
227 int NenableOptoRX = 0;
229 enableOptoRX[NenableOptoRX] = 0;
233 enableOptoRX[NenableOptoRX] = 1;
237 enableOptoRX[NenableOptoRX] = 2;
247 head = (*
word >> 60) &
m4;
250 if ((opto == 0 && ESDCCHeader.
getOptoRX0() == 129) || (opto == 1 && ESDCCHeader.
getOptoRX1() == 129) ||
251 (opto == 2 && ESDCCHeader.
getOptoRX2() == 129))
253 }
else if (head == 9) {
254 kid = (*
word >> 2) & 0x07ff;
255 kPACE[0] = (*
word >> 16) &
m1;
256 kPACE[1] = (*
word >> 17) &
m1;
257 kPACE[2] = (*
word >> 18) &
m1;
258 kPACE[3] = (*
word >> 19) &
m1;
259 kFlag2 = (*
word >> 20) &
m4;
260 kFlag1 = (*
word >> 24) &
m8;
273 }
else if (head == 6) {
275 optoEC = (*
word >> 48) &
m8;
277 opto = enableOptoRX[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.
Log< level::Warning, false > LogWarning
unsigned long long Word64