X-Git-Url: http://git.uio.no/git/?p=u%2Fmrichter%2FAliRoot.git;a=blobdiff_plain;f=EMCAL%2FAliEMCALCalibTimeDepCorrection.cxx;h=fcf71550029fcea894a8e28cc1be3e0488d72337;hp=ab5ac0514247b333c82fff572a48f9d5aee4a977;hb=1bd2ee2f8ef38e4987101a24d8bb6c3e7c9233ba;hpb=0ce5c45dfeb4fc9e7dbc5a57b66a7a1b06aa2ff8 diff --git a/EMCAL/AliEMCALCalibTimeDepCorrection.cxx b/EMCAL/AliEMCALCalibTimeDepCorrection.cxx index ab5ac051424..fcf71550029 100644 --- a/EMCAL/AliEMCALCalibTimeDepCorrection.cxx +++ b/EMCAL/AliEMCALCalibTimeDepCorrection.cxx @@ -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; @@ -54,21 +54,24 @@ void AliEMCALCalibTimeDepCorrection::InitCorrection(Int_t nSM, Int_t nBins, Floa Int_t iCol = 0; Int_t iRow = 0; Int_t nCorr = nBins; - Float_t Correction = val; + Float_t correction = val; Int_t nAPDPerSM = AliEMCALGeoParams::fgkEMCALCols * AliEMCALGeoParams::fgkEMCALRows; 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; jGetCorrection(iCol,iRow)->Set(nCorr); for (Int_t k=0; kGetCorrection(iCol,iRow)->AddAt(Correction, k); // AddAt = SetAt.. + t->GetCorrection(iCol,iRow)->AddAt(correction, k); // AddAt = SetAt.. } } @@ -108,7 +111,7 @@ void AliEMCALCalibTimeDepCorrection::ReadTextInfo(Int_t nSM, const TString &txtF Int_t iCol = 0; Int_t iRow = 0; Int_t nCorr = 0; - Float_t Correction = 0; + Float_t correction = 0; Int_t nAPDPerSM = AliEMCALGeoParams::fgkEMCALCols * AliEMCALGeoParams::fgkEMCALRows; @@ -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> 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 @@ -138,9 +149,9 @@ void AliEMCALCalibTimeDepCorrection::ReadTextInfo(Int_t nSM, const TString &txtF // set size of TArray t->GetCorrection(iCol,iRow)->Set(nCorr); for (Int_t k=0; k> Correction; + inputFile >> correction; // add to TArray - t->GetCorrection(iCol,iRow)->AddAt(Correction, k); + t->GetCorrection(iCol,iRow)->AddAt(correction, k); } } @@ -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();