JeffersonLab / japan

Just Another Parity ANalyzer
7 stars 13 forks source link

ROCID_t and BankID_t unsigned but often assigned -1 or compared to -1 #60

Closed wdconinc closed 5 years ago

wdconinc commented 5 years ago

Environment: (where does this bug occur, have you tried other environments)

Steps to reproduce: (give a step by step account of how to trigger the bug)

The typedefs ROCID_t and BankID_t in QwTypes.h (https://github.com/JeffersonLab/japan/blob/e7330171fac66540b9b2df8b70c1d39dc198f203/Analysis/include/QwTypes.h#L16) are defined as UInt_t and ULong64_t, but often assigned as -1. E.g.

$ grep fCurrentROC Analysis/src/*
Analysis/src/VQwSubsystem.cc:  fCurrentROC_ID    = -1;
Analysis/src/VQwSubsystem.cc:    fCurrentROC_ID    = roc_id;
Analysis/src/VQwSubsystem.cc:    fCurrentROC_ID    = -1;
Analysis/src/VQwSubsystem.cc:  if (fCurrentROC_ID != -1) {
Analysis/src/VQwSubsystem.cc:    stat = RegisterROCNumber(fCurrentROC_ID, bank_id);
Analysis/src/VQwSubsystem.cc:    fCurrentROC_ID  = -1;
Analysis/src/VQwSubsystem.cc:  if (fCurrentROC_ID != -1){
Analysis/src/VQwSubsystem.cc:    Int_t roc_index = FindIndex(fROC_IDs, fCurrentROC_ID);
Analysis/src/VQwSubsystem.cc:    fCurrentROC_ID  = -1;

Not sure if this is well-defined or desirable... It does generate a fair number of compiler warnings.

paulmking commented 5 years ago

Resolved on develop by pull #78