@@ -127,7 +127,7 @@ bool CruRawReader::processHBFs(int datasizealreadyread, bool verbose)
127127 int counthalfcru = 0 ;
128128 mHBFoffset32 = 0 ;
129129
130- while ((mHBFoffset32 < ((mTotalHBFPayLoad ) / 4 ))) {// the blank event of eeeeee at the end
130+ while ((mHBFoffset32 < ((mTotalHBFPayLoad ) / 4 ))) { // the blank event of eeeeee at the end
131131 if (mVerbose ) {
132132 LOG (info) << " Looping over cruheaders in HBF, loop count " << counthalfcru << " current offset is" << mHBFoffset32 << " total payload is " << mTotalHBFPayLoad / 4 << " raw :" << mTotalHBFPayLoad ;
133133 }
@@ -143,17 +143,19 @@ bool CruRawReader::processHBFs(int datasizealreadyread, bool verbose)
143143 case 1 :
144144 LOG (info) << " all good parsing half cru" ;
145145 break ;
146- default : return true ;
146+ default :
147+ return true ;
147148 }
148149 }
149- // take care of the case where there is an "empty" rdh containing all 0xeeeeeeee as payload.
150- if (mTotalHBFPayLoad / 4 - mHBFoffset32 == 8 && mHBFPayload [mHBFoffset32 + 7 ] == o2::trd::constants::CRUPADDING32 ){
151- mHBFoffset32 += 8 ;
152- }
150+ // take care of the case where there is an "empty" rdh containing all 0xeeeeeeee as payload.
151+ if (mTotalHBFPayLoad / 4 - mHBFoffset32 == 8 && mHBFPayload [mHBFoffset32 + 7 ] == o2::trd::constants::CRUPADDING32 ) {
152+ mHBFoffset32 += 8 ;
153+ }
153154 counthalfcru++;
154- if (counthalfcru==1 )break ;
155+ if (counthalfcru == 1 )
156+ break ;
155157 } // loop of halfcru's while there is still data in the heart beat frame.
156- if (totaldataread> 0 ) {
158+ if (totaldataread > 0 ) {
157159 mDatareadfromhbf = totaldataread;
158160 }
159161 return true ; // totaldataread;
@@ -198,28 +200,39 @@ int CruRawReader::processHalfCRU(int cruhbfstartoffset)
198200 mCurrentHalfCRULinkLengths .end (),
199201 decltype (mCurrentHalfCRULinkLengths )::value_type (0 ));
200202 mTotalHalfCRUDataLength = mTotalHalfCRUDataLength256 * 32 ; // convert to bytes.
201-
202- if (mDataVerbose ){
203- if (mTotalHalfCRUDataLength !=mTotalHBFPayLoad ){
203+ // check for cru errors :
204+ if (mHeaderVerbose ) {
205+ int linkerrorcounter = 0 ;
206+ LOG (info) << " link errors" ;
207+ for (auto & linkerror : mCurrentHalfCRULinkErrorFlags ) {
208+ if (linkerror != 0 )
209+ LOG (info) << " E link error FEEID:" << mFEEID << " CRUID:" << mCRUID << " Endpoint:" << mCRUEndpoint
210+ << " on linkcount:" << linkerrorcounter++ << " errorval:0x" << std::hex << linkerror;
211+ }
212+ LOG (info) << " link errors end" ;
213+ }
214+ if (mDataVerbose ) {
215+ if (mTotalHalfCRUDataLength != mTotalHBFPayLoad ) {
204216 LOG (info) << " mTotalHalfCRUDataLength ?!= mTotalHBFPayLoad " << mTotalHalfCRUDataLength << " ?!=" << mTotalHBFPayLoad ;
205217 }
206218 }
219+
207220 std::array<uint32_t , 1024 >::iterator currentlinkstart = mHBFPayload .begin () + cruhbfstartoffset;
208- /* LOG(info) << "CRU dump begin ************************** ";
209- for(int z=0;z<15;++z){
221+ /* LOG(info) << "CRU dump begin ************************** ";
222+ for(int z=0;z<15;++z){
210223 LOG(info) << "link " << z << " length : " << mCurrentHalfCRULinkLengths[z]*8;
211- }
212- int linkzcount=0;
213- uint64_t linkzsum=0;
214- for(int di=0;di<mTotalHalfCRUDataLength;++di){
224+ }
225+ int linkzcount=0;
226+ uint64_t linkzsum=0;
227+ for(int di=0;di<mTotalHalfCRUDataLength;++di){
215228 LOG(info) << "di:" << di << " " << std::hex << mHBFPayload[di+8];
216229 if(di == cruhbfstartoffset) LOG(info) << "start there ^^^^^";
217230 if(di == mCurrentHalfCRULinkLengths[linkzcount]*8+linkzsum) {LOG(info) << "end of link "<< linkzcount; linkzsum+=mCurrentHalfCRULinkLengths[linkzcount]*8;linkzcount++;}
218- }
219- for(int di=mTotalHalfCRUDataLength; di < mTotalHalfCRUDataLength+16;++di){
231+ }
232+ for(int di=mTotalHalfCRUDataLength; di < mTotalHalfCRUDataLength+16;++di){
220233 LOG(info) << "**di:" << di << " " << std::hex << mHBFPayload[di];
221- }
222- LOG(info) << "CRU dump end ***************";*/
234+ }
235+ LOG(info) << "CRU dump end ***************";*/
223236 std::array<uint32_t , 1024 >::iterator linkstart, linkend;
224237 int dataoffsetstart32 = sizeof (mCurrentHalfCRUHeader ) / 4 + cruhbfstartoffset; // in uint32
225238 // CHECK 1 does rdh endpoint match cru header end point.
@@ -267,8 +280,9 @@ int CruRawReader::processHalfCRU(int cruhbfstartoffset)
267280 FeeParam::unpackORI (oriindex, side, stack, layer, halfchamberside);
268281 int currentdetector = stack * constants::NLAYER + layer + supermodule * constants::NLAYER * constants::NSTACK ;
269282 if (mVerbose ) {
270- LOG (info) << " ******* LINK # " << currentlinkindex << " and starting at " << mHBFoffset32 << " unpackORI(" << oriindex << " ," << side << " ," << stack << " ," << layer << " ," << halfchamberside << " ) and an FEEID:" << std::hex << mFEEID << " det:" << std::dec << currentdetector;
283+ LOG (info) << " ******* LINK # " << currentlinkindex << " and starting at " << mHBFoffset32 << " unpackORI(" << oriindex << " ," << side << " ," << stack << " ," << layer << " ," << halfchamberside << " ) and an FEEID:" << std::hex << mFEEID << " det:" << std::dec << currentdetector;
271284 }
285+ LOG (info) << " ******* LINK # " << currentlinkindex << " an FEEID:" << std::hex << mFEEID << " det:" << std::dec << currentdetector << " Error Flags : " << mCurrentHalfCRULinkErrorFlags [currentlinkindex];
272286 // tracklet first then digit ??
273287 // tracklets end with tracklet end marker(0x10001000 0x10001000), digits end with digit endmarker (0x0 0x0)
274288 if (linkstart != linkend) { // if link is not empty
@@ -280,7 +294,7 @@ int CruRawReader::processHalfCRU(int cruhbfstartoffset)
280294 LOG (info) << " trackletwordsread:" << trackletwordsread << " mem copy with offset of : " << cruhbfstartoffset << " parsing with linkstart: " << linkstart << " ending at : " << linkend;
281295 }
282296 linkstart += trackletwordsread;
283- // now we have a tracklethcheader and a digithcheader.
297+ // now we have a tracklethcheader and a digithcheader.
284298 mHBFoffset32 += trackletwordsread;
285299 mTotalTrackletsFound += mTrackletsParser .getTrackletsFound ();
286300 digitwordsread = 0 ;
0 commit comments