]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/AliEMCALCalibTimeDepCorrection.h
Fix Coverity
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALCalibTimeDepCorrection.h
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>
10 #include <TObjArray.h>
11 #include <TArrayF.h>
12 #include "AliEMCALGeoParams.h"
13 class TString;
14 class TTree;
15
16 /*
17   Objects of this class contain info on time-dependent corrections
18 */
19
20 // ******* internal class definition *************
21 // 1 SuperModule's worth of info
22 class AliEMCALSuperModuleCalibTimeDepCorrection : public TObject {
23  public:
24   AliEMCALSuperModuleCalibTimeDepCorrection(const int smNum=0) : TObject(), // just init values
25     fSuperModuleNum(smNum)
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:
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:
41   Int_t fSuperModuleNum; // SM id
42   TArrayF fCorrection[AliEMCALGeoParams::fgkEMCALCols][AliEMCALGeoParams::fgkEMCALRows]; // values
43
44   ClassDef(AliEMCALSuperModuleCalibTimeDepCorrection, 2) // help class
45 };
46 // ******* end of internal class definition *************
47
48 class AliEMCALCalibTimeDepCorrection : public TObject {
49  public:
50   AliEMCALCalibTimeDepCorrection(const int nSM = AliEMCALGeoParams::fgkEMCALModules);
51
52   // interface methods; getting the whole struct should be more efficient though
53   void InitCorrection(Int_t nSM, Int_t nBins, Float_t val=1.0); // assign a certain value to all 
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  
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 
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
65
66   virtual ~AliEMCALCalibTimeDepCorrection();
67
68   // pointer to stored info.
69   Int_t GetNSuperModule() const { return fNSuperModule; }; 
70  
71   // - via the index in the stored array:
72   virtual AliEMCALSuperModuleCalibTimeDepCorrection * GetSuperModuleCalibTimeDepCorrectionId(Int_t smIndex) const
73     { return (AliEMCALSuperModuleCalibTimeDepCorrection*) fSuperModuleData[smIndex]; };
74
75   // - or via the actual SM number
76   virtual AliEMCALSuperModuleCalibTimeDepCorrection * GetSuperModuleCalibTimeDepCorrectionNum(Int_t smNum) const;
77
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
86   static Int_t GetMaxTimeBins() { return fgkMaxTimeBins; }
87
88 protected:
89
90   Int_t           fNSuperModule; // Number of supermodules.
91   TObjArray fSuperModuleData; // SuperModule data
92
93 private:
94
95   AliEMCALCalibTimeDepCorrection(const AliEMCALCalibTimeDepCorrection &);
96   AliEMCALCalibTimeDepCorrection &operator = (const AliEMCALCalibTimeDepCorrection &);
97
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
102   static const Int_t fgkMaxTimeBins = 50; // we are not going to have more correction time bins than this for a single runnumber.. 
103
104   ClassDef(AliEMCALCalibTimeDepCorrection, 3) //
105 };
106
107 #endif