Definition at line 53 of file ESUnpacker.cc.
References bx_, FEDHeader::bxID(), FEDTrailer::check(), FEDHeader::check(), gather_cfg::cout, dac_, FEDRawData::data(), debug_, FEch_, fedId_, gain_, ESDCCHeaderBlock::getOptoRX0(), ESDCCHeaderBlock::getOptoRX1(), ESDCCHeaderBlock::getOptoRX2(), j, FEDTrailer::lenght(), 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(), and ESUnpackerWorker::work().
56 if (nWords==0)
return;
58 int head, kPACE[4], kFlag1, kFlag2, kBC, kEC, optoBC, optoEC;
65 const Word64* header =
reinterpret_cast<const Word64*
>(rawData.
data()); --header;
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 std::cout<<
"[ESUnpacker]: FED Header candidate. Is header? "<< ESHeader.check();
83 else std::cout<<
" WARNING!, this is not a ES Header"<<std::endl;
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 ) & 0x1;
123 std::cout<<
"[ESUnpacker]: FED Trailer candidate. Is trailer? "<<ESTrailer.check();
124 if (ESTrailer.check())
125 std::cout<<
". Length of the ES event: "<<ESTrailer.lenght()<<std::endl;
126 else std::cout<<
" WARNING!, this is not a ES Trailer"<<std::endl;
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;
214 for (
const Word64* word=(header+dccWords+1); word!=trailer; ++word) {
217 head = (*word >> 60) &
m4;
222 }
else if (head == 9) {
223 kid = (*word >> 2) & 0x07ff;
224 kPACE[0] = (*word >> 16) &
m1;
225 kPACE[1] = (*word >> 17) &
m1;
226 kPACE[2] = (*word >> 18) &
m1;
227 kPACE[3] = (*word >> 19) &
m1;
228 kFlag2 = (*word >> 20) &
m4;
229 kFlag1 = (*word >> 24) &
m8;
230 kBC = (*word >> 32) &
m16;
231 kEC = (*word >> 48) &
m8;
242 }
else if (head == 6) {
243 optoBC = (*word >> 32) &
m16;
244 optoEC = (*word >> 48) &
m8;
246 else if (opto==1) ESDCCHeader.
setOptoBC1(optoBC);
247 else if (opto==2) ESDCCHeader.
setOptoBC2(optoBC);
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.