coverity
authorphille <phille@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 18 May 2011 10:04:17 +0000 (10:04 +0000)
committerphille <phille@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 18 May 2011 10:04:17 +0000 (10:04 +0000)
EMCAL/AliCaloConstants.h
EMCAL/AliCaloRawAnalyzerPeakFinder.cxx
HLT/EMCAL/AliHLTEMCALMapper.cxx

index ac3d077..00537f4 100644 (file)
@@ -66,6 +66,7 @@ namespace CaloConstants
   namespace EMCALConstants
   {
     const int MAXHWADDR = 3279;
+    const int MAXCHANNELS = 1408;
     const double ECENTRALHIT = 0.845678; //Percentage of total enegry contain in a single tower for a central hit  
     const int NZROWSMOD      =  24;   // Number of rows per module
     const int NXCOLUMNSMOD   =  48;   // Number of columns per module 
index 19675ea..8d62701 100644 (file)
@@ -40,6 +40,7 @@
 using namespace std;
 
 
+
 ClassImp( AliCaloRawAnalyzerPeakFinder )
 
 
index 00d2369..7b03a11 100644 (file)
@@ -26,6 +26,7 @@ using EMCAL::NMODULES;
 using EMCAL::NRCUSPERMODULE;
 using EMCAL::NRCUSPERSECTOR;
 using EMCAL::MAXHWADDR;
+using EMCAL::MAXCHANNELS; 
 
 AliHLTEMCALMapper::AliHLTEMCALMapper(const unsigned long specification ) : AliHLTCaloMapper(specification, "EMCAL")
 {
@@ -82,21 +83,29 @@ AliHLTEMCALMapper::InitAltroMapping(const unsigned long specification )
              fHw2geomapPtr[i].fZRow = 0;
              fHw2geomapPtr[i].fGain = 0;
            }
-         for(int i=0; i<nChannels; i ++)
+         // MAXCHANNELS
+         if( nChannels <= MAXCHANNELS )
            {
-             res = fscanf(fp, "%d %d %d %d\n", &tmpHwaddr, &tmpXCol, &tmpZRow,  &tmpGain);
-             
-             if(tmpGain < 2)
+             for(int i=0; i<nChannels; i ++)
                {
-                 if( tmpHwaddr <= MAXHWADDR  )
+                 res = fscanf(fp, "%d %d %d %d\n", &tmpHwaddr, &tmpXCol, &tmpZRow,  &tmpGain);
+                 
+                 if(tmpGain < 2)
                    {
-                     fHw2geomapPtr[tmpHwaddr].fXCol   = (char)tmpXCol;
-                     fHw2geomapPtr[tmpHwaddr].fZRow   = (char)tmpZRow;
-                     fHw2geomapPtr[tmpHwaddr].fGain  =  (char)tmpGain;
-                   }
-               } 
+                     if( tmpHwaddr <= MAXHWADDR  )
+                       {
+                         fHw2geomapPtr[tmpHwaddr].fXCol   = (char)tmpXCol;
+                         fHw2geomapPtr[tmpHwaddr].fZRow   = (char)tmpZRow;
+                         fHw2geomapPtr[tmpHwaddr].fGain  =  (char)tmpGain;
+                       }
+                   } 
+               }
+             fIsInitializedMapping = true;       
+           }
+         else
+           {
+             fIsInitializedMapping = false;       
            }
-         fIsInitializedMapping = true;   
          fclose(fp);
        }
       else