]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliEMCALCalibAbs.cxx
Bug fix in the constructor (thanks to A.Marin)
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALCalibAbs.cxx
index b63b9b4f394f9eb71a5754273c9ec5f079429f42..828a125537b6ddd9d7b6a8ff01a9691638d4d252 100644 (file)
@@ -39,6 +39,7 @@ AliEMCALCalibAbs::AliEMCALCalibAbs(const int nSM) :
     fSuperModuleData.Add(new AliEMCALSuperModuleCalibAbs(i));
   }
   fSuperModuleData.Compress(); // compress the TObjArray
+  fSuperModuleData.SetOwner(kTRUE); 
 }
 
 //____________________________________________________________________________
@@ -61,11 +62,11 @@ void AliEMCALCalibAbs::ReadTextCalibAbsInfo(Int_t nSM, const TString &txtFileNam
 
   // list of values to be read
   // first: overall values for the whole SuperModule
-  Int_t iCalibMethod; 
-  Int_t iCalibPass; 
-  Float_t absoluteCalib; 
+  Int_t iCalibMethod = 0
+  Int_t iCalibPass = 0
+  Float_t absoluteCalib = 0
   // third: info for each tower
-  Float_t relativeCalib; // (ADC>GeV relative gain/conversion), value around 1
+  Float_t relativeCalib = 0; // (ADC>GeV relative gain/conversion), value around 1
   // end - all values
 
   Int_t nAPDPerSM = AliEMCALGeoParams::fgkEMCALCols * AliEMCALGeoParams::fgkEMCALRows;
@@ -73,7 +74,7 @@ void AliEMCALCalibAbs::ReadTextCalibAbsInfo(Int_t nSM, const TString &txtFileNam
   for (Int_t i = 0; i < fNSuperModule; i++) {
     AliEMCALSuperModuleCalibAbs * t = (AliEMCALSuperModuleCalibAbs*) fSuperModuleData[i];
     if (!inputFile) {
-      printf("AliEMCALCalibAbs::ReadCalibAbsInfo - Error while reading input file; likely EOF..");
+      printf("AliEMCALCalibAbs::ReadCalibAbsInfo - Error while reading input file; likely EOF..\n");
       return;
     }
     inputFile >> iSM;
@@ -87,8 +88,14 @@ void AliEMCALCalibAbs::ReadTextCalibAbsInfo(Int_t nSM, const TString &txtFileNam
 
     // third: info for each tower
     for (Int_t j=0; j<nAPDPerSM; j++) {
-      inputFile >> iCol >> iRow 
-               >> relativeCalib;
+      inputFile >> iCol >> iRow >> relativeCalib;
+
+      // check that input values are not out bounds
+      if (iCol<0 || iCol>(AliEMCALGeoParams::fgkEMCALCols-1) ||
+         iRow<0 || iRow>(AliEMCALGeoParams::fgkEMCALRows-1) ) {
+       printf("AliEMCALCalibAbs::ReadCalibAbsInfo - Error while reading input file; j %d iCol %d iRow %d\n", j, iCol, iRow);
+      return;
+      }
 
       // assume that this info is already swapped and done for this basis?
       if (swapSides) {
@@ -184,7 +191,7 @@ void AliEMCALCalibAbs::ReadTreeCalibAbsInfo(TTree *tree,
   Int_t iSM = 0; // SuperModule index
   // list of values to be read
   // first: overall values for the whole SuperModule
-  Int_t iCalibMethod; 
+  Int_t iCalibMethod = 0
   Int_t iCalibPass = 0; 
   Float_t absoluteCalib = 0; 
   // third: info for each tower