/************************************************************************** * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * * * Author: The ALICE Off-line Project. * * Contributors are mentioned in the code where appropriate. * * * * Permission to use, copy, modify and distribute this software and its * * documentation strictly for non-commercial purposes is hereby granted * * without fee, provided that the above copyright notice appears in all * * copies and that both the copyright notice and this permission notice * * appear in the supporting documentation. The authors make no claims * * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ /* $Id: $ */ // Objects of this class contain info on APD bias settings/voltages // #include #include #include #include "AliEMCALCalibTimeDepCorrection.h" using namespace std; ClassImp(AliEMCALCalibTimeDepCorrection) //____________________________________________________________________________ AliEMCALCalibTimeDepCorrection::AliEMCALCalibTimeDepCorrection() : fNSuperModule(0), fSuperModuleData(0), fStartTime(0), fNTimeBins(0), fTimeBinSize(0) { //Default constructor. } //____________________________________________________________________________ void AliEMCALCalibTimeDepCorrection::InitCorrection(Int_t nSM, Int_t nBins, Float_t val=1.0) { // This methods assumes that you are using SuperModules 0..nSM-1 fNSuperModule = nSM; if (fSuperModuleData) delete [] fSuperModuleData; fSuperModuleData = new AliEMCALSuperModuleCalibTimeDepCorrection[fNSuperModule]; Int_t iSM = 0; // SuperModule index Int_t iCol = 0; Int_t iRow = 0; Int_t nCorr = nBins; Float_t Correction = val; Int_t nAPDPerSM = AliEMCALGeoParams::fgkEMCALCols * AliEMCALGeoParams::fgkEMCALRows; for (Int_t i = 0; i < fNSuperModule; i++) { AliEMCALSuperModuleCalibTimeDepCorrection &t = fSuperModuleData[i]; t.fSuperModuleNum = iSM; // assume SMs are coming in order for (Int_t j=0; j> iSM; t.fSuperModuleNum = iSM; for (Int_t j=0; j> iCol >> iRow >> nCorr; // assume that this info is already swapped and done for this basis? if (swapSides) { // C side, oriented differently than A side: swap is requested iCol = AliEMCALGeoParams::fgkEMCALCols-1 - iCol; iRow = AliEMCALGeoParams::fgkEMCALRows-1 - iRow; } // set size of TArray t.fCorrection[iCol][iRow].Set(nCorr); for (Int_t k=0; k> Correction; // add to TArray t.fCorrection[iCol][iRow].AddAt(Correction, k); } } } // i, SuperModule inputFile.close(); return; } //____________________________________________________________________________ void AliEMCALCalibTimeDepCorrection::WriteCalibTimeDepCorrectionInfo(const TString &txtFileName, Bool_t swapSides) { // write data to txt file. ; coordinates given on SuperModule basis std::ofstream outputFile(txtFileName.Data()); if (!outputFile) { printf("AliEMCALCalibTimeDepCorrection::WriteCalibTimeDepCorrectionInfo - Cannot open the APD output file %s\n", txtFileName.Data()); return; } Int_t iCol = 0; Int_t iRow = 0; Int_t nCorr = 0; Int_t nAPDPerSM = AliEMCALGeoParams::fgkEMCALCols * AliEMCALGeoParams::fgkEMCALRows; for (Int_t i = 0; i < fNSuperModule; i++) { AliEMCALSuperModuleCalibTimeDepCorrection &t = fSuperModuleData[i]; outputFile << t.fSuperModuleNum << endl; for (Int_t j=0; j