Si Raw Data Non-zero Suppressed Error Checking (First Implementation)

Author: Nigel

(Thanks to Patrick and Peter for implementation idea etc)

The error detection code is in the following classes:

TPhRawHitFECn0Clean, TPhAbsRawHitFEC, TPhSubEventArray, TPhDataFileEng99, TPhDataObject

The way it works, for now, is via the use of static data members. These data members, initially set via a default file,  can be set directly in the processing macro to give the user the flexiblity to check the errors, report the errors, and take the desired action that the individual user wants. This is a very flexible scheme, that over time when we understand more closely what we really want could be made more eligant.

For every possible error, the following set of data members exist.

Bool_t f<ErrorName>DoCheck                                        // if TRUE do check
Int_t f<ErrorName>MaxErrorsToReport                          // Maximum number of error messages to display (to std err)
Int_t f<ErrorName>ReportCount                                     // Current count of times error occured
Bool_t f<ErrorName>FlagError                                       // if TRUE then flag that the error occured, i.e. object has static fError variable set
EErrorAction f<ErrorName>Action                                 //   defines action to occur given error occured.

The choices of action are

kNoErrorNoAction                                             // Default value of fError in each object                         
kContinue                                                           // Continue processing
kStopProcFunction                                             // If member function called to implement check, stop proccesing function and return
kStopProcObject                                               // Stop processing this object and reurn   
kStopProcEvent                                              // Stop processing this event
kStopAllProc                                                     // Stop processing althogether, critical error.

In this scheme each object, knows what to do on errors detected on things it knows about. Preserving, as much as can, object encapsulation.
Each object has a fError variable(of type EErrorAction), that is reset before check comenses, and records the highest level action that happened during the objects check. Then the higher level object can just ask the object if it had an error, and take the appropriate action, depending on what the object suggests.

The scheme implemented is the following

    When the TPhRawHitFECn0Clean objects are read in and unpacked, the error checking is performed, according to the set values of the static error data members in TPhRawHitFECn0Clean and TPhAbsRawHitFECs.
    TPhSubEventArray, then asks each FEC object read in, what the objects suggested error action is and takes it. Then the TPhSubEventArray object performs its check on the number of FEC's etc read in from data, and sets its fError variable appropriately.
    TPhDataFileEng99, then asks  TPhSubEventArray what its suggestion error action is and takes it. 

 

And example macro, is given in the macros area of phat called RawSiDataQualityExample.C

The way you change the error setup is, at the beginning of your macro, you do

    TPh<ErrorClassName>::f<ErrorName>DoCheck =kTRUE;
    TPh<ErrorClassName>:::f<ErrorName>MaxErrorsToReport=10;                         
    TPh<ErrorClassName>::f<ErrorName>ReportCount=0;
    TPh<ErrorClassName>::f<ErrorName>FlagError=kTRUE;
    TPh<ErrorClassName>::f<ErrorName>Action=kStopProcEvent;  

eg:    If you did not want to display any errors, for "MDCParity" Error, you would type

        TPhRawHitFECn0Clean::fMDCParityMaxErrorsToReport=0;

    The default error values, and errors checked are at the beginning of the cxx file for the particular class, or in a separate include (.h) file.

 

An additional feature, is that you can at the end of processing see the counts of each specific error by typing

    printf("%d \n",TPh<ErrorClassName>::f<ErrorName>ReportCount)

 

There exists a macro in Phat/macros directory called turnoff_det_dep_error.C (run by typing .x turnoff_det_dep_error.C()) that turns off the errors that depend on having the detector and fec detector instantiated.