]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliEMCALCalibTimeDepCorrection.cxx
Update mini-task with big output flag and add current status macros
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALCalibTimeDepCorrection.cxx
index c7b5a9a76a2ed339c8133a6c9f1adba9105a9e0e..fcf71550029fcea894a8e28cc1be3e0488d72337 100644 (file)
@@ -45,7 +45,7 @@ AliEMCALCalibTimeDepCorrection::AliEMCALCalibTimeDepCorrection(const int nSM) :
 }
 
 //____________________________________________________________________________
-void AliEMCALCalibTimeDepCorrection::InitCorrection(Int_t nSM, Int_t nBins, Float_t val=1.0)
+void AliEMCALCalibTimeDepCorrection::InitCorrection(Int_t nSM, Int_t nBins, Float_t val)
 {
   // This methods assumes that you are using SuperModules 0..nSM-1
   fNSuperModule = nSM;
@@ -60,9 +60,12 @@ void AliEMCALCalibTimeDepCorrection::InitCorrection(Int_t nSM, Int_t nBins, Floa
 
   for (Int_t i = 0; i < fNSuperModule; i++) {
     AliEMCALSuperModuleCalibTimeDepCorrection * t = (AliEMCALSuperModuleCalibTimeDepCorrection*) fSuperModuleData[i];
+    iSM = i;
     t->SetSuperModuleNum(iSM); // assume SMs are coming in order
 
     for (Int_t j=0; j<nAPDPerSM; j++) {
+      iCol = j / AliEMCALGeoParams::fgkEMCALRows;
+      iRow = j % AliEMCALGeoParams::fgkEMCALRows;
 
       // set size of TArray
       t->GetCorrection(iCol,iRow)->Set(nCorr);
@@ -119,7 +122,7 @@ void AliEMCALCalibTimeDepCorrection::ReadTextInfo(Int_t nSM, const TString &txtF
     AliEMCALSuperModuleCalibTimeDepCorrection * t = (AliEMCALSuperModuleCalibTimeDepCorrection*) fSuperModuleData[i];
 
     if (!inputFile) {
-      printf("AliEMCALCalibTimeDepCorrection::ReadTextInfo - Error while reading input file; likely EOF..");
+      printf("AliEMCALCalibTimeDepCorrection::ReadTextInfo - Error while reading input file; likely EOF..\n");
       return;
     }
     inputFile >> iSM;
@@ -128,6 +131,14 @@ void AliEMCALCalibTimeDepCorrection::ReadTextInfo(Int_t nSM, const TString &txtF
     for (Int_t j=0; j<nAPDPerSM; j++) {
       inputFile >> iCol >> iRow >> nCorr;
 
+      // check that input values are not out bounds
+      if (iCol<0 || iCol>(AliEMCALGeoParams::fgkEMCALCols-1) ||
+         iRow<0 || iRow>(AliEMCALGeoParams::fgkEMCALRows-1) || 
+         nCorr<0 ) {
+       printf("AliEMCALCalibTimeDepCorrection::ReadTextInfo - Error while reading input file; j %d iCol %d iRow %d nCorr %d\n", j, iCol, iRow, nCorr);
+      return;
+      }
+
       // assume that this info is already swapped and done for this basis?
       if (swapSides) {
        // C side, oriented differently than A side: swap is requested
@@ -293,7 +304,7 @@ void AliEMCALCalibTimeDepCorrection::WriteRootInfo(const TString &rootFileName,
   TTree *treeCorr = new TTree("treeCorr","");
 
   // global part only has one entry
-  treeGlob->Branch("fStartTime", &fStartTime, "fStartTime/I"); // really unsigned int..
+  treeGlob->Branch("fStartTime", &fStartTime, "fStartTime/i"); // unsigned int..
   treeGlob->Branch("fNTimeBins", &fNTimeBins, "fNTimeBins/I");
   treeGlob->Branch("fTimeBinSize", &fTimeBinSize, "fTimeBinSize/I");
   treeGlob->Fill();