}
//____________________________________________________________________________
-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;
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; j<nAPDPerSM; j++) {
+ iCol = j / AliEMCALGeoParams::fgkEMCALRows;
+ iRow = j % AliEMCALGeoParams::fgkEMCALRows;
// set size of TArray
t->GetCorrection(iCol,iRow)->Set(nCorr);
for (Int_t k=0; k<nCorr; k++) {
// add to TArray
- t->GetCorrection(iCol,iRow)->AddAt(Correction, k); // AddAt = SetAt..
+ t->GetCorrection(iCol,iRow)->AddAt(correction, k); // AddAt = SetAt..
}
}
//____________________________________________________________________________
Float_t AliEMCALCalibTimeDepCorrection::GetCorrection(Int_t supModIndex, Int_t iCol, Int_t iRow, Int_t iBin) const
{ // if you call for non-existing data, there may be a crash..
- ((AliEMCALSuperModuleCalibTimeDepCorrection*)fSuperModuleData[supModIndex])->GetCorrection(iCol,iRow)->At(iBin);
+ return ((AliEMCALSuperModuleCalibTimeDepCorrection*)fSuperModuleData[supModIndex])->GetCorrection(iCol,iRow)->At(iBin);
}
//____________________________________________________________________________
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;
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;
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
// set size of TArray
t->GetCorrection(iCol,iRow)->Set(nCorr);
for (Int_t k=0; k<nCorr; k++) {
- inputFile >> Correction;
+ inputFile >> correction;
// add to TArray
- t->GetCorrection(iCol,iRow)->AddAt(Correction, k);
+ t->GetCorrection(iCol,iRow)->AddAt(correction, k);
}
}
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();
//____________________________________________________________________________
AliEMCALSuperModuleCalibTimeDepCorrection * AliEMCALCalibTimeDepCorrection::GetSuperModuleCalibTimeDepCorrectionNum(Int_t supModIndex)const
-{
+{ // getter via index
for (int i=0; i<fNSuperModule; i++) {
AliEMCALSuperModuleCalibTimeDepCorrection * t = (AliEMCALSuperModuleCalibTimeDepCorrection*) fSuperModuleData[i];
if (t->GetSuperModuleNum() == supModIndex) {