]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Adding extra options to the hit reconstructor component to better control recovery...
authoraszostak <aszostak@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 29 Jan 2009 17:52:56 +0000 (17:52 +0000)
committeraszostak <aszostak@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 29 Jan 2009 17:52:56 +0000 (17:52 +0000)
Fixing logging messages in AliHLTMUONTriggerReconstructor.

HLT/MUON/OnlineAnalysis/AliHLTMUONHitReconstructor.cxx
HLT/MUON/OnlineAnalysis/AliHLTMUONHitReconstructor.h
HLT/MUON/OnlineAnalysis/AliHLTMUONHitReconstructorComponent.cxx
HLT/MUON/OnlineAnalysis/AliHLTMUONHitReconstructorComponent.h
HLT/MUON/OnlineAnalysis/AliHLTMUONTriggerReconstructor.cxx

index b0a9657eba04468c8afc75ec1d922b62e83863af..fe13911ee479dd066a8c853d2d802fdd12749ab0 100644 (file)
@@ -71,7 +71,8 @@ AliHLTMUONHitReconstructor::AliHLTMUONHitReconstructor() :
        fNofBChannel(NULL),
        fNofNBChannel(NULL),
        fNofFiredDetElem(0),
-       fIdToEntry()
+       fIdToEntry(),
+       fRecoveryMode(kDontTryRecover)
 {
        /// Default constructor
        
@@ -132,13 +133,41 @@ void AliHLTMUONHitReconstructor::SetLookUpTable(
 }
 
 
-void AliHLTMUONHitReconstructor::TryRecover(bool value)
+void AliHLTMUONHitReconstructor::TryRecover(ERecoveryMode mode)
 {
        /// Sets if the decoder should enable the error recovery logic.
        
-       fHLTMUONDecoder.TryRecover(value);
-       fHLTMUONDecoder.ExitOnError(not value);
-       fHLTMUONDecoder.GetHandler().WarnOnly(value);
+       // Here we setup the various flags to control exactly how the DDL raw data
+       // decoder will behave and what output is generated during errors.
+       fRecoveryMode = mode;
+       switch (mode)
+       {
+       case kRecoverFull:
+               fHLTMUONDecoder.TryRecover(true);
+               fHLTMUONDecoder.ExitOnError(false);
+               fHLTMUONDecoder.GetHandler().WarnOnly(true);
+               fHLTMUONDecoder.GetHandler().PrintParityErrorAsWarning(true);
+               break;
+       case kRecoverJustSkip:
+               fHLTMUONDecoder.TryRecover(false);
+               fHLTMUONDecoder.ExitOnError(false);
+               fHLTMUONDecoder.GetHandler().WarnOnly(true);
+               fHLTMUONDecoder.GetHandler().PrintParityErrorAsWarning(true);
+               break;
+       case kRecoverFromParityErrorsOnly:
+               fHLTMUONDecoder.TryRecover(false);
+               fHLTMUONDecoder.ExitOnError(false);
+               fHLTMUONDecoder.GetHandler().WarnOnly(false);
+               fHLTMUONDecoder.GetHandler().PrintParityErrorAsWarning(true);
+               break;
+       default:
+               fRecoveryMode = kDontTryRecover;
+               fHLTMUONDecoder.TryRecover(false);
+               fHLTMUONDecoder.ExitOnError(true);
+               fHLTMUONDecoder.GetHandler().WarnOnly(false);
+               fHLTMUONDecoder.GetHandler().PrintParityErrorAsWarning(false);
+               break;
+       }
 }
 
 
@@ -193,16 +222,32 @@ bool AliHLTMUONHitReconstructor::DecodeDDL(const AliHLTUInt32_t* rawData,AliHLTU
  
   if(!fHLTMUONDecoder.Decode(rawData,bufferSize))
   {
-       if (TryRecover())
+       switch (TryRecover())
        {
+       case kRecoverFull:
                HLTWarning("There was a problem with the raw data."
                        " Recovered as much data as possible."
-                       " Will continue processing next event."
+                       " Will continue processing the next event."
                );
-       }
-       else
-       {
-               HLTError("Cannot decode the DDL.");
+               break;
+       case kRecoverJustSkip:
+               HLTWarning("There was a problem with the raw data."
+                       " Skipped corrupted data structures."
+                       " Will continue processing the next event."
+               );
+               break;
+       case kRecoverFromParityErrorsOnly:
+               if (fHLTMUONDecoder.GetHandler().NonParityErrorFound())
+               {
+                       HLTError("Failed to decode the tracker DDL raw data.");
+                       return false;
+               }
+               HLTWarning("Found parity errors in the raw data,"
+                       " but will continue processing."
+               );
+               break;
+       default:
+               HLTError("Failed to decode the tracker DDL raw data.");
                return false;
        }
   }
@@ -818,7 +863,11 @@ AliHLTMUONHitReconstructor::AliHLTMUONRawDecoder::AliHLTMUONRawDecoder() :
        fCharge(0.0),
        fIdManuChannel(0x0),
        fLutEntry(0),
-       fWarnOnly(false)
+       fWarnOnly(false),
+       fSkipParityErrors(false),
+       fDontPrintParityErrors(false),
+       fPrintParityErrorAsWarning(false),
+       fNonParityErrorFound(false)
 {
        // ctor
 }
@@ -842,6 +891,7 @@ void AliHLTMUONHitReconstructor::AliHLTMUONRawDecoder::OnNewBuffer(const void* b
        fDataCount = 1;
        *fNofFiredDetElem = 0;
        fPrevDetElemId = 0 ;
+       fNonParityErrorFound = false;
 };
 
 
@@ -853,17 +903,32 @@ void AliHLTMUONHitReconstructor::AliHLTMUONRawDecoder::OnError(ErrorCode code, c
        /// \param location  A pointer to the location in the raw data buffer
        ///      where the problem was found.
        
+       if (code != kParityError) fNonParityErrorFound = true;
+       if (fDontPrintParityErrors and code == kParityError) return;
+       
        long bytepos = long(location) - long(fBufferStart) + sizeof(AliRawDataHeader);
-       HLTError("There is a problem with decoding the raw data. %s (Error code: %d, at byte %d)",
-               ErrorCodeToMessage(code), code, bytepos
-       );
+       if (fWarnOnly or (fPrintParityErrorAsWarning and code == kParityError))
+       {
+               HLTWarning("There is a problem with decoding the raw data."
+                       " %s (Error code: %d, at byte %d). Trying to recover from corrupt data.",
+                       ErrorCodeToMessage(code), code, bytepos
+               );
+       }
+       else
+       {
+               HLTError("There is a problem with decoding the raw data. %s (Error code: %d, at byte %d)",
+                       ErrorCodeToMessage(code), code, bytepos
+               );
+       }
 };
 
 
-void AliHLTMUONHitReconstructor::AliHLTMUONRawDecoder::OnData(UInt_t dataWord, bool /*parityError*/)
+void AliHLTMUONHitReconstructor::AliHLTMUONRawDecoder::OnData(UInt_t dataWord, bool parityError)
 {
   //function to arrange the decoded Raw Data
 
+  if (fSkipParityErrors and parityError) return;
+
   fIdManuChannel = 0x0;
   fIdManuChannel = (fIdManuChannel|fBusPatchId)<<17;
   fIdManuChannel |= (dataWord >> 12) & 0x1FFFF;
index 222481663fc19d5ab36c1514019d4211a93102c5..c729819422fd240c64844e3fae061ffafd32336a 100644 (file)
@@ -68,12 +68,34 @@ public:
        static AliHLTInt32_t GetkNofDDL() { return fgkNofDDL; }
        static AliHLTInt32_t GetkDDLHeaderSize() { return fgkDDLHeaderSize; }
        
-       /// Returns true if the decoder is set to enable recovery logic if
+       /// The error recovery mode used for TryRecover.
+       enum ERecoveryMode
+       {
+               kDontTryRecover = 0,  /// Will not try recover from errors.
+               kRecoverFull,  /// Try recover from all errors.
+               kRecoverJustSkip,  /// Just skip any corrupt structures.
+               kRecoverFromParityErrorsOnly  /// Recover only from parity errors.
+       };
+       
+       /// Returns the recovery mode used for the TryRecover option.
+       /// This controls if the decoder is set to enable recovery logic if
        /// raw data errors are found.
-       bool TryRecover() const { return fHLTMUONDecoder.TryRecover(); };
+       ERecoveryMode TryRecover() const { return fRecoveryMode; }
+       
+       /// Sets if the decoder should enable the error recovery logic and how.
+       void TryRecover(ERecoveryMode mode);
        
-       /// Sets if the decoder should enable the error recovery logic.
-       void TryRecover(bool value);
+       /// Returns true if ADC digits with parity errors are skipped.
+       bool SkipParityErrors() const { return fHLTMUONDecoder.GetHandler().SkipParityErrors(); }
+       
+       /// Sets the flag indicating if ADC digits with parity errors are skipped.
+       void SkipParityErrors(bool value) { fHLTMUONDecoder.GetHandler().SkipParityErrors(value); }
+       
+       /// Returns true if messages about parity errors are not printed.
+       bool DontPrintParityErrors() const { return fHLTMUONDecoder.GetHandler().DontPrintParityErrors(); }
+       
+       /// Sets the flag indicating if messages about parity errors are not printed.
+       void DontPrintParityErrors(bool value) { fHLTMUONDecoder.GetHandler().DontPrintParityErrors(value); }
 
 private:
 
@@ -137,6 +159,41 @@ private:
                 * warnings rather than error messages.
                 */
                void WarnOnly(bool value) { fWarnOnly = value; }
+               
+               /**
+                * Returns true if ADC digits with parity errors are skipped.
+                */
+               bool SkipParityErrors() const { return fSkipParityErrors; }
+               
+               /**
+                * Sets the flag indicating if ADC digits with parity errors are skipped.
+                */
+               void SkipParityErrors(bool value) { fSkipParityErrors = value; }
+               
+               /**
+                * Returns true if messages about parity errors are not printed.
+                */
+               bool DontPrintParityErrors() const { return fDontPrintParityErrors; }
+               
+               /**
+                * Sets the flag indicating if messages about parity errors are not printed.
+                */
+               void DontPrintParityErrors(bool value) { fDontPrintParityErrors = value; }
+               
+               /**
+                * Returns true if parity error messages are printed as warnings.
+                */
+               bool PrintParityErrorAsWarning() const { return fPrintParityErrorAsWarning; }
+               
+               /**
+                * Sets the flag indicating if parity error messages are printed as warnings.
+                */
+               void PrintParityErrorAsWarning(bool value) { fPrintParityErrorAsWarning = value; }
+               
+               /**
+                * Returns true if a non-parity error was found during the last call to Decode.
+                */
+               bool NonParityErrorFound() const { return fNonParityErrorFound; }
        
        private:
                // Do not allow copying of this class.
@@ -162,6 +219,10 @@ private:
                AliHLTInt32_t fLutEntry;            // i-th entry in lookuptable
                
                bool fWarnOnly;  ///< Flag indicating if the OnError method should generate warnings rather than error messages.
+               bool fSkipParityErrors;  ///< Flag indicating if ADC digits with parity errors should be skipped.
+               bool fDontPrintParityErrors;  ///< Flag for controlling if messages about parity errors should be printed.
+               bool fPrintParityErrorAsWarning;  ///< Flag for controlling if parity error messages are printed as warnings.
+               bool fNonParityErrorFound;  ///< Flag which indicates if a non parity error code was found after a decoding pass.
        };
 
        AliMUONTrackerDDLDecoder<AliHLTMUONRawDecoder> fHLTMUONDecoder; // robust HLTMUON Decoder
@@ -190,6 +251,8 @@ private:
        AliHLTInt32_t fNofFiredDetElem,fMaxFiredPerDetElem[130];  // counter for detector elements that are fired
        const IdManuChannelToEntry* fIdToEntry;   // Mapping between Linenumber to IdManuChannel (The object is not owned by this component).
        
+       ERecoveryMode fRecoveryMode;  ///< The recovery mode for the decoder.
+       
        bool DecodeDDL(const AliHLTUInt32_t* rawData, AliHLTUInt32_t rawDataSize);
        void FindCentralHits(AliHLTInt32_t minPadId, AliHLTInt32_t maxPadId);
        bool FindRecHits();
index 85a4876042a9a466915a2bcd0ed9d2d850502054..d4f87f8fe3ae40fbc6197afc0f10672b5f917b6c 100644 (file)
@@ -177,8 +177,11 @@ int AliHLTMUONHitReconstructorComponent::DoInit(int argc, const char** argv)
        fUseIdealGain = false;
        const char* lutFileName = NULL;
        bool useCDB = false;
-       bool tryRecover = false;
+       typedef AliHLTMUONHitReconstructor HR;
+       HR::ERecoveryMode recoveryMode = HR::kDontTryRecover;
        AliHLTInt32_t dccut = -1;
+       bool skipParityErrors = false;
+       bool dontPrintParityErrors = false;
        
        for (int i = 0; i < argc; i++)
        {
@@ -319,7 +322,47 @@ int AliHLTMUONHitReconstructorComponent::DoInit(int argc, const char** argv)
                
                if (strcmp( argv[i], "-tryrecover" ) == 0)
                {
-                       tryRecover = true;
+                       if (argc > i+1)
+                       {
+                               // There might be an optional parameter so check
+                               // if it is a recognised one. If not then assume it
+                               // is the next argument, so no error message.
+                               if (strcmp(argv[i+1], "full") == 0)
+                               {
+                                       recoveryMode = HR::kRecoverFull;
+                                       i++;
+                               }
+                               else if (strcmp(argv[i+1], "skip") == 0)
+                               {
+                                       recoveryMode = HR::kRecoverJustSkip;
+                                       i++;
+                               }
+                               else if (strcmp(argv[i+1], "parityerrors") == 0)
+                               {
+                                       recoveryMode = HR::kRecoverFromParityErrorsOnly;
+                                       i++;
+                               }
+                               else
+                               {
+                                       recoveryMode = HR::kRecoverFull;
+                               }
+                       }
+                       else
+                       {
+                               recoveryMode = HR::kRecoverFull;
+                       }
+                       continue;
+               }
+               
+               if (strcmp( argv[i], "-skipparityerrors" ) == 0)
+               {
+                       skipParityErrors = true;
+                       continue;
+               }
+               
+               if (strcmp( argv[i], "-dontprintparityerrors" ) == 0)
+               {
+                       dontPrintParityErrors = true;
                        continue;
                }
                
@@ -426,7 +469,9 @@ int AliHLTMUONHitReconstructorComponent::DoInit(int argc, const char** argv)
                HLTDebug("Using DC cut parameter of %d ADC channels.", fHitRec->GetDCCut());
        }
        
-       fHitRec->TryRecover(tryRecover);
+       fHitRec->TryRecover(recoveryMode);
+       fHitRec->SkipParityErrors(skipParityErrors);
+       fHitRec->DontPrintParityErrors(dontPrintParityErrors);
        HLTDebug("dHLT hit reconstruction component is initialized.");
        return 0;
 }
index c1df81375ec15cfc11afc683d669ad251072d762..07aacf77d4fee6eb5513df608b334a452410c040 100644 (file)
@@ -86,9 +86,22 @@ extern "C" struct AliHLTMUONHitRecoLutRow;
  *      This will cause the component to generate warnings when it receives data block
  *      types it does not know how to handle. Without this option the component only
  *      generates debug messages when they are compiled in. <br>
- * \li -tryrecover <br>
+ * \li -tryrecover <i>mode</i> <br>
  *      This is a special option to the raw data decoder to turn on logic which will
  *      try and recover from corrupt raw DDL data. This is off by default. <br>
+ *      The <i>mode</i> is and optional parameter which can be one of the
+ *      following: <br>
+ *         - full  This turns on all recovery logic and the decoder tries is best
+ *             to recover from all data corruption. <br>
+ *         - skip  This will just skip any data structures that are found to be
+ *             corrupt in the raw data, without trying to recover the data inside. <br>
+ *         - parityerrors  Will only continue decoding if parity errors are found
+ *             but the decoder will stop if any other corruption is found. <br>
+ * \li -skipparityerrors <br>
+ *      Skips any ADC digit data words that contain parity errors. <br>
+ * \li -dontprintparityerrors <br>
+ *      If specified then no error or warning messages are printed if any parity
+ *      errors are found in the ADC digit data words. <br>
  * \li -useidealgain <br>
  *      When this option is used then the gain correction parameters are not loaded
  *      from the CDB but ideal linear gain is assumed. <br>
index 7530c1e214d74f69a407c2427d3a7267a808797c..02b291d00543afa3e191498c054a5645dae8da48 100644 (file)
@@ -98,11 +98,12 @@ bool AliHLTMUONTriggerReconstructor::Run(
                {
                        HLTWarning("There was a problem with the raw data."
                                " Recovered as much data as possible."
-                               " Will continue processing next event."
+                               " Will continue processing the next event."
                        );
                }
                else
                {
+                       HLTError("Failed to decode the trigger DDL raw data.");
                        return false;
                }
        }