attempt to address new coverity reports for AliCalo stuff and QA checker
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALCalibTimeDepCorrection.h
CommitLineData
d81e6423 1#ifndef ALIEMCALCALIBTIMEDEPCORRECTION_H
2#define ALIEMCALCALIBTIMEDEPCORRECTION_H
3
4/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
6
7/* $Id: $ */
8
9#include <TObject.h>
2f17a269 10#include <TObjArray.h>
0c5b726e 11#include <TArrayF.h>
d81e6423 12#include "AliEMCALGeoParams.h"
13class TString;
61917ab3 14class TTree;
d81e6423 15
16/*
61917ab3 17 Objects of this class contain info on time-dependent corrections
d81e6423 18*/
19
61917ab3 20// ******* internal class definition *************
21// 1 SuperModule's worth of info
22class AliEMCALSuperModuleCalibTimeDepCorrection : public TObject {
23 public:
2f17a269 24 AliEMCALSuperModuleCalibTimeDepCorrection(const int smNum=0) : TObject(), // just init values
25 fSuperModuleNum(smNum)
61917ab3 26 {
27 for (int icol=0; icol<AliEMCALGeoParams::fgkEMCALCols; icol++) {
28 for (int irow=0; irow<AliEMCALGeoParams::fgkEMCALRows; irow++) {
29 fCorrection[icol][irow].Reset();
30 }
31 }
32 }
33
34 public:
2f17a269 35 void SetSuperModuleNum(Int_t i) { fSuperModuleNum = i;}; //
36 Int_t GetSuperModuleNum() const { return fSuperModuleNum;}; //
37 TArrayF * GetCorrection(int icol, int irow)
38 { return &fCorrection[icol][irow]; };
39
40 private:
61917ab3 41 Int_t fSuperModuleNum;
42 TArrayF fCorrection[AliEMCALGeoParams::fgkEMCALCols][AliEMCALGeoParams::fgkEMCALRows];
43
2f17a269 44 ClassDef(AliEMCALSuperModuleCalibTimeDepCorrection, 2) // help class
61917ab3 45};
46// ******* end of internal class definition *************
47
d81e6423 48class AliEMCALCalibTimeDepCorrection : public TObject {
61917ab3 49 public:
2f17a269 50 AliEMCALCalibTimeDepCorrection(const int nSM = AliEMCALGeoParams::fgkEMCALModules);
d81e6423 51
52 // interface methods; getting the whole struct should be more efficient though
716fca62 53 void InitCorrection(Int_t nSM, Int_t nBins, Float_t val=1.0); // assign a certain value to all
d81e6423 54 // use the methods below with caution: take care that your argument ranges are valid
55 void SetCorrection(Int_t smIndex, Int_t iCol, Int_t iRow, Int_t iBin, Float_t val=1.0); // assign a certain value to a given bin
56 Float_t GetCorrection(Int_t smIndex, Int_t iCol, Int_t iRow, Int_t iBin) const; // assign a certain value to a given bin
57
d81e6423 58 // Read and Write txt I/O methods are normally not used, but are useful for
59 // filling the object before it is saved in OCDB
61917ab3 60 void ReadTextInfo(Int_t nSM, const TString &txtFileName, Bool_t swapSides=kFALSE); // info file is for nSm=1 to 12 SuperModules
61 void WriteTextInfo(const TString &txtFileName, Bool_t swapSides=kFALSE); // info file is for nSm=1 to 12 SuperModules
62 void ReadRootInfo(const TString &rootFileName, Bool_t swapSides=kFALSE); // info file is for nSm=1 to 12 SuperModules
63 void ReadTreeInfo(TTree *treeGlob, TTree *treeCorr, Bool_t swapSides=kFALSE); // info file is for nSm=1 to 12 SuperModules
64 void WriteRootInfo(const TString &rootFileName, Bool_t swapSides=kFALSE); // info file is for nSm=1 to 12 SuperModules
d81e6423 65
66 virtual ~AliEMCALCalibTimeDepCorrection();
67
d81e6423 68 // pointer to stored info.
69 Int_t GetNSuperModule() const { return fNSuperModule; };
2f17a269 70
d81e6423 71 // - via the index in the stored array:
2f17a269 72 virtual AliEMCALSuperModuleCalibTimeDepCorrection * GetSuperModuleCalibTimeDepCorrectionId(Int_t smIndex) const
73 { return (AliEMCALSuperModuleCalibTimeDepCorrection*) fSuperModuleData[smIndex]; };
74
d81e6423 75 // - or via the actual SM number
2f17a269 76 virtual AliEMCALSuperModuleCalibTimeDepCorrection * GetSuperModuleCalibTimeDepCorrectionNum(Int_t smNum) const;
d81e6423 77
220ed45a 78 void SetStartTime(UInt_t ui) { fStartTime = ui; } //
79 void SetNTimeBins(Int_t i) { fNTimeBins = i; } //
80 void SetTimeBinSize(Int_t i) { fTimeBinSize = i; } //
81
82 Int_t GetStartTime() const { return fStartTime; } //
83 Int_t GetNTimeBins() const { return fNTimeBins; } //
84 Int_t GetTimeBinSize() const { return fTimeBinSize; } //
85
61917ab3 86 static Int_t GetMaxTimeBins() { return fgkMaxTimeBins; }
87
d81e6423 88protected:
89
90 Int_t fNSuperModule; // Number of supermodules.
2f17a269 91 TObjArray fSuperModuleData; // SuperModule data
d81e6423 92
93private:
94
95 AliEMCALCalibTimeDepCorrection(const AliEMCALCalibTimeDepCorrection &);
96 AliEMCALCalibTimeDepCorrection &operator = (const AliEMCALCalibTimeDepCorrection &);
97
220ed45a 98 UInt_t fStartTime; // timestamp for start of run/first bin
99 Int_t fNTimeBins; // how many timestamp bins do we have
100 Int_t fTimeBinSize; // seconds per time-bin
101
61917ab3 102 static const Int_t fgkMaxTimeBins = 50; // we are not going to have more correction time bins than this for a single runnumber..
103
2f17a269 104 ClassDef(AliEMCALCalibTimeDepCorrection, 3) //
d81e6423 105};
106
107#endif