LCOV - code coverage report
Current view: top level - HLT/CALO - AliHLTCaloSanityInspector.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 65 1.5 %
Date: 2016-06-14 17:26:59 Functions: 1 9 11.1 %

          Line data    Source code
       1             : // $Id: AliHLTPHOSSanityInspector.cxx 35107 2009-09-30 01:45:06Z phille $
       2             : 
       3             : /**************************************************************************
       4             :  * This file is property of and copyright by the ALICE HLT Project        * 
       5             :  * All rights reserved.                                                   *
       6             :  *                                                                        *
       7             :  * Primary Authors: Oystein Djuvsland                                     *
       8             :  *                                                                        *
       9             :  * Permission to use, copy, modify and distribute this software and its   *
      10             :  * documentation strictly for non-commercial purposes is hereby granted   *
      11             :  * without fee, provided that the above copyright notice appears in all   *
      12             :  * copies and that both the copyright notice and this permission notice   *
      13             :  * appear in the supporting documentation. The authors make no claims     *
      14             :  * about the suitability of this software for any purpose. It is          * 
      15             :  * provided "as is" without express or implied warranty.                  *
      16             :  **************************************************************************/
      17             : 
      18             : /** 
      19             :  * @file   AliHLTCaloSanityInspector.cxx
      20             :  * @author Oystein Djuvsland
      21             :  * @date 
      22             :  * @brief  Sanity inspector for Calo HLT 
      23             :  */
      24             : 
      25             : // see header file for class documentation
      26             : // or
      27             : // refer to README to build package
      28             : // or
      29             : // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
      30             : 
      31             : #include "AliHLTCaloSanityInspector.h"
      32             : #include "Rtypes.h"
      33             : 
      34           6 : ClassImp(AliHLTCaloSanityInspector);
      35             : 
      36             : 
      37             : AliHLTCaloSanityInspector::AliHLTCaloSanityInspector() : 
      38             :   //  AliHLTCaloBase(),
      39           0 :   fMaxDifference(120)
      40           0 : {
      41             :   //See header file for documentation
      42           0 : }
      43             : 
      44             : 
      45             : AliHLTCaloSanityInspector::~AliHLTCaloSanityInspector()
      46           0 : {
      47             :   //See header file for documentation
      48           0 : }
      49             : 
      50             : 
      51             : 
      52             : Int_t  
      53             : AliHLTCaloSanityInspector::CheckInsanity(const UInt_t* data, const Int_t N) const
      54             : {
      55             :    //See header file for documentation
      56             : 
      57           0 :   for(Int_t i = 1; i < N; i++)
      58             :     {
      59           0 :       if((((Int_t)data[i] - (Int_t)data[i-1]) > fMaxDifference) || (((Int_t)data[i-1] - (Int_t)data[i]) > fMaxDifference))
      60           0 :         return 1;
      61             :     }
      62           0 :   return 0;
      63           0 : }
      64             : 
      65             : /*
      66             : Int_t
      67             : AliHLTCaloSanityInspector::CheckInsanity(Int_t* data, Int_t N)
      68             : {
      69             :    //See header file for documentation
      70             :   for(Int_t i = 1; i < N; i++)
      71             :   {
      72             :     if((((Int_t)data[i] - (Int_t)data[i-1]) > fMaxDifference) || (((Int_t)data[i-1] - (Int_t)data[i]) > fMaxDifference))
      73             :       return 1;
      74             :   }
      75             :   return 0;
      76             : }
      77             : */
      78             : 
      79             : 
      80             : Int_t 
      81             : AliHLTCaloSanityInspector::CheckAndHealInsanity(UInt_t* data, Int_t N)
      82             :   //
      83             : {
      84             :    //See header file for documentation
      85             : 
      86             :   Int_t crazyness = 0;
      87             : 
      88           0 :   if(N > 3)
      89             :     {
      90             :       //Require a stable start 
      91           0 :       if((((Int_t)data[0] - (Int_t)data[1]) > fMaxDifference) || (((Int_t)data[1] - (Int_t)data[0]) > fMaxDifference))
      92           0 :         return -1;
      93           0 :       if((((Int_t)data[1] - (Int_t)data[2]) > fMaxDifference) || (((Int_t)data[2] - (Int_t)data[1]) > fMaxDifference))
      94           0 :         return -1;
      95             : 
      96             : 
      97           0 :       for(Int_t i = 2; i < N - 3; i++)
      98             :         {
      99           0 :           if((((Int_t)data[i] - (Int_t)data[i+1]) > fMaxDifference) || (((Int_t)data[i+1] - (Int_t)data[i]) > fMaxDifference))
     100             :             {
     101             :               i++;
     102           0 :               if((((Int_t)data[i] -(Int_t)data[i+1]) > fMaxDifference) || (((Int_t)data[i+1] - (Int_t)data[i]) > fMaxDifference))
     103             :                 {
     104             :                   i++;
     105           0 :                   if((((Int_t)data[i] - (Int_t)data[i+1]) > fMaxDifference) || (((Int_t)data[i+1] - (Int_t)data[i]) > fMaxDifference))
     106             :                     {
     107           0 :                       return -2;  //Too crazy
     108             :                     }
     109           0 :                   data[i-1] = ((Int_t)data[i] + (Int_t)data[i-2])/2;
     110           0 :                   crazyness++;
     111             :                 }
     112             :               else 
     113           0 :                 return -3;    //Two spikes in a row? 
     114           0 :             }
     115             :         }
     116             :       
     117             :       
     118             :       
     119           0 :       if((((Int_t)data[N - 3] -(Int_t) data[N - 2]) > fMaxDifference) || 
     120           0 :          (((Int_t)data[N - 2] - (Int_t)data[N - 3]) > fMaxDifference))
     121             :         {
     122           0 :           if((((Int_t)data[N - 2] - (Int_t)data[N - 1]) > fMaxDifference) || 
     123           0 :              (((Int_t)data[N - 1] - (Int_t)data[N - 2]) > fMaxDifference))
     124             :             {
     125           0 :               data[N - 2] = ((Int_t)data[N - 3] +  (Int_t)data[N - 1])/2;
     126           0 :               return crazyness++;
     127             :             }
     128           0 :           return -4;
     129             : 
     130             :         }
     131             :       
     132           0 :       if((((Int_t)data[N - 2] - (Int_t)data[N - 1]) > fMaxDifference) || 
     133           0 :          (((Int_t)data[N - 1] - (Int_t)data[N - 2]) > fMaxDifference))
     134             :         {
     135             :           //      (Int_t)data[N - 3] = (Int_t)data[N - 4] -(Int_t) data[N - 5] + (Int_t)data[N-4];
     136           0 :           data[N - 1] = data[N - 2];
     137           0 :           return crazyness++;
     138             :         }
     139             :       
     140             :     }
     141             :   
     142           0 :   return crazyness;
     143             :   
     144           0 : }
     145             : 
     146             : 
     147             : 
     148             : Int_t 
     149             : AliHLTCaloSanityInspector::CheckAndHealInsanity(Int_t* data, Int_t N)
     150             : {
     151             :    //See header file for documentation
     152             : 
     153             :   Int_t crazyness = 0;
     154             : 
     155           0 :   if(N > 3)
     156             :     {
     157           0 :       if((((Int_t)data[0] - (Int_t)data[1]) > fMaxDifference) || (((Int_t)data[1] - (Int_t)data[0]) > fMaxDifference))
     158           0 :         return -1;
     159           0 :       if((((Int_t)data[1] - (Int_t)data[2]) > fMaxDifference) || (((Int_t)data[2] - (Int_t)data[1]) > fMaxDifference))
     160           0 :         return -1;
     161             : 
     162             : 
     163           0 :       for(Int_t i = 2; i < N - 3; i++)
     164             :         {
     165           0 :           if((((Int_t)data[i] - (Int_t)data[i+1]) > fMaxDifference) || (((Int_t)data[i+1] - (Int_t)data[i]) > fMaxDifference))
     166             :             {
     167             :               i++;
     168           0 :               if((((Int_t)data[i] -(Int_t)data[i+1]) > fMaxDifference) || (((Int_t)data[i+1] - (Int_t)data[i]) > fMaxDifference))
     169             :                 {
     170             :                   i++;
     171           0 :                   if((((Int_t)data[i] - (Int_t)data[i+1]) > fMaxDifference) || (((Int_t)data[i+1] - (Int_t)data[i]) > fMaxDifference))
     172             :                     {
     173           0 :                       return -2;  //Too crazy
     174             :                     }
     175           0 :                   data[i-1] = ((Int_t)data[i] + (Int_t)data[i-2])/2;
     176           0 :                   crazyness++;
     177             :                 }
     178             :               else 
     179           0 :                 return -3;    //Two spikes in a row? 
     180           0 :             }
     181             :         }
     182             :       
     183             :       
     184             :       
     185           0 :       if((((Int_t)data[N - 3] -(Int_t) data[N - 2]) > fMaxDifference) || 
     186           0 :          (((Int_t)data[N - 2] - (Int_t)data[N - 3]) > fMaxDifference))
     187             :         {
     188           0 :           if((((Int_t)data[N - 2] - (Int_t)data[N - 1]) > fMaxDifference) || 
     189           0 :              (((Int_t)data[N - 1] - (Int_t)data[N - 2]) > fMaxDifference))
     190             :             {
     191           0 :               data[N - 2] = ((Int_t)data[N - 3] +  (Int_t)data[N - 1])/2;
     192           0 :               return crazyness++;
     193             :             }
     194           0 :           return -4;
     195             : 
     196             :         }
     197             :       
     198           0 :       if((((Int_t)data[N - 2] - (Int_t)data[N - 1]) > fMaxDifference) || 
     199           0 :          (((Int_t)data[N - 1] - (Int_t)data[N - 2]) > fMaxDifference))
     200             :         {
     201             :           //      (Int_t)data[N - 3] = (Int_t)data[N - 4] -(Int_t) data[N - 5] + (Int_t)data[N-4];
     202           0 :           data[N - 1] = data[N - 2];
     203           0 :           return crazyness++;
     204             :         }
     205             :       
     206             :     }
     207             :   
     208           0 :   return crazyness;
     209             :   
     210           0 : }

Generated by: LCOV version 1.11