Skip to content

Commit 9a28bed

Browse files
authored
fix the issue that scaler handler was not checking the ROC ID (#521)
* fix the issue that scaler handler was not checking the ROC ID * decode the end of run scaler event correctly
1 parent 8970c47 commit 9a28bed

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

src/THcScalerEvtHandler.cxx

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,13 +277,45 @@ Int_t THcScalerEvtHandler::AnalyzeBuffer(UInt_t* rdata, Bool_t onlysync)
277277
UInt_t *plast = p+*p; // Index to last word in the bank
278278

279279
ifound=0;
280+
int isPhysicsEvt=0;
280281
while(p<plast) {
281282
p++; // point to header
282283
if (fDebugFile) {
283284
*fDebugFile << "Bank: " << hex << *p << dec << " len: " << *(p-1) << endl;
284285
}
285286
if((*p & 0xff00) == 0x1000) { // Bank Containing banks
286-
p++; // Now pointing to a bank in the bank
287+
if((*p & 0xffff0000) == 0xff500000 || (*p & 0xffff0000) == 0xff580000){ // PEB event and PEB sync event
288+
if (fDebugFile) *fDebugFile << "Find the physics event header: " << hex << *p << endl;
289+
p++;
290+
isPhysicsEvt=1;
291+
continue;
292+
}
293+
294+
if(isPhysicsEvt==1){
295+
int rocid = (*p & 0xfff0000)>>16; // ROC ID
296+
if (fDebugFile) {
297+
*fDebugFile << "Bank: " << hex << *p << dec << " len: " << *(p-1) << " ROC ID: "<< rocid << endl;
298+
}
299+
300+
if(fRocSet.find(rocid)!=fRocSet.end()) {
301+
if (fDebugFile) {
302+
*fDebugFile << "Searching for Data Block Bank" << endl;
303+
}
304+
p++;// Now pointing to a bank in the bank
305+
}
306+
else {
307+
p = p+*(p-1); // Skip to next bank
308+
if (fDebugFile) {
309+
*fDebugFile << "Wrong ROC ID, skip to the next bank" << endl;
310+
}
311+
}
312+
}
313+
else{
314+
if (fDebugFile) {
315+
*fDebugFile << "Not a physics event" << endl;
316+
}
317+
p++;
318+
}
287319
} else if (((*p & 0xff00) == 0x100) && (*p != 0xC0000100)) {
288320
// Bank containing integers. Look for scalers
289321
// This is either ROC bank containing integers or

0 commit comments

Comments
 (0)