]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/AliEMCALCalibAbs.h
protect against invoking MC Handler for AOD
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALCalibAbs.h
1 #ifndef ALIEMCALCALIBABS_H
2 #define ALIEMCALCALIBABS_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 "AliEMCALGeoParams.h"
12 class TString;
13 class TTree;
14
15 /*
16   Objects of this class contain basis for absolute calibrations
17 */
18
19 // total calibration factor is a product of
20 // a) overall calibration factor [fAbsoluteGain]
21 // b) individual gain factor per tower [fRelativeGain]
22 // c) time-dependent correction
23 // In this class we store a), b) and the needed static ingredients for c)
24
25 // ******* internal class definition *************
26 // values per single tower
27 class AliEMCALCalibAbsVal : public TObject {
28
29  public:
30   AliEMCALCalibAbsVal() : TObject(), // just init values
31     fRelativeGain(0),
32     fHighLowRatio(0),
33     fHighLow(0),
34     fLEDAmp(0),
35     fLEDAmpRMS(0)
36     {
37     }
38   
39   void Init() {
40     fRelativeGain = 0;
41     fHighLowRatio = 0;
42     fHighLow = 0;
43     fLEDAmp = 0;
44     fLEDAmpRMS = 0;
45     return;
46   }
47
48  public:
49   void SetRelativeGain(Float_t f) { fRelativeGain = f; }; //
50   Float_t GetRelativeGain() const { return fRelativeGain; }; //
51   void SetHighLowRatio(Float_t f) { fHighLowRatio = f; }; //
52   Float_t GetHighLowRatio() const { return fHighLowRatio; }; //
53   void SetHighLow(Int_t i) { fHighLow = i; }; //
54   Int_t GetHighLow() const { return fHighLow; }; //
55   void SetLEDAmp(Float_t f) { fLEDAmp = f; }; //
56   Float_t GetLEDAmp() const { return fLEDAmp; }; //
57   void SetLEDAmpRMS(Float_t f) { fLEDAmpRMS = f; }; //
58   Float_t GetLEDAmpRMS() const { return fLEDAmpRMS; }; //
59
60  private:
61   Float_t fRelativeGain; // (ADC>GeV relative gain/conversion), value around 1
62   Float_t fHighLowRatio; // value around 16 or so
63   Int_t fHighLow; // 0 (low) or 1 (high) gain, used for LEDAmp info
64   Float_t fLEDAmp; // LED amplitude
65   Float_t fLEDAmpRMS; // RMS
66
67   ClassDef(AliEMCALCalibAbsVal, 2) // help class
68 };
69
70 // 1 SuperModule's worth of info: info on where the different APDs are
71 class AliEMCALSuperModuleCalibAbs : public TObject {
72
73  public:
74   AliEMCALSuperModuleCalibAbs(const int smNum=0) : TObject(), // just init values
75     fSuperModuleNum(smNum),
76     fCalibMethod(0),
77     fCalibPass(0),
78     fCalibTime(0),
79     fAbsoluteGain(0)
80     {
81       for (int iref=0; iref<AliEMCALGeoParams::fgkEMCALLEDRefs; iref++) {
82         fLEDRefAmp[iref] = 0;
83         fLEDRefAmpRMS[iref] = 0;
84         fLEDRefHighLowRatio[iref] = 0;
85         fLEDRefHighLow[iref] = 0;
86       }
87
88       for (int itemp=0; itemp<AliEMCALGeoParams::fgkEMCALTempSensors; itemp++) {
89         fTemperature[itemp] = 0;
90         fTemperatureRMS[itemp] = 0;
91       }
92
93       for (int icol=0; icol<AliEMCALGeoParams::fgkEMCALCols; icol++) {
94         for (int irow=0; irow<AliEMCALGeoParams::fgkEMCALRows; irow++) {
95           fAPDVal[icol][irow].Init();
96         }
97       }
98     }
99
100  public:
101   // first
102   void SetSuperModuleNum(Int_t i) { fSuperModuleNum = i;}; // 
103   Int_t GetSuperModuleNum() const { return fSuperModuleNum;}; // 
104   void SetCalibMethod(Int_t i) { fCalibMethod = i;}; // 
105   Int_t GetCalibMethod() const { return fCalibMethod;}; // 
106   void SetCalibPass(Int_t i) { fCalibPass = i;}; // 
107   Int_t GetCalibPass() const { return fCalibPass;}; // 
108   void SetCalibTime(Int_t i) { fCalibTime = i;}; // 
109   Int_t GetCalibTime() const { return fCalibTime;}; // 
110   void SetAbsoluteGain(Float_t f) { fAbsoluteGain = f;}; // 
111   Float_t GetAbsoluteGain() const { return fAbsoluteGain;}; // 
112
113   // second
114   void SetLEDRefAmp(int iLEDRef, Float_t f) { fLEDRefAmp[iLEDRef] = f;}; // 
115   Float_t GetLEDRefAmp(int iLEDRef) const { return fLEDRefAmp[iLEDRef];}; // 
116   void SetLEDRefAmpRMS(int iLEDRef, Float_t f) { fLEDRefAmpRMS[iLEDRef] = f;}; // 
117   Float_t GetLEDRefAmpRMS(int iLEDRef) const { return fLEDRefAmpRMS[iLEDRef];}; // 
118   void SetLEDRefHighLowRatio(int iLEDRef, Float_t f) { fLEDRefHighLowRatio[iLEDRef] = f;}; // 
119   Float_t GetLEDRefHighLowRatio(int iLEDRef) const { return fLEDRefHighLowRatio[iLEDRef];}; // 
120   void SetLEDRefHighLow(int iLEDRef, Int_t i) { fLEDRefHighLow[iLEDRef] = i;}; // 
121   Int_t GetLEDRefHighLow(int iLEDRef) const { return fLEDRefHighLow[iLEDRef];}; // 
122
123   void SetTemperature(int itemp, Float_t f) { fTemperature[itemp] = f;}; // 
124   Float_t GetTemperature(int itemp) const { return fTemperature[itemp];}; // 
125   void SetTemperatureRMS(int itemp, Float_t f) { fTemperatureRMS[itemp] = f;}; // 
126   Float_t GetTemperatureRMS(int itemp) const { return fTemperatureRMS[itemp];}; // 
127
128   // third
129   AliEMCALCalibAbsVal * GetAPDVal(int icol, int irow) 
130     { return &fAPDVal[icol][irow]; };
131
132  private:
133   // first: overall values for the whole SuperModule
134   Int_t fSuperModuleNum; // which SuperModule is this?
135   Int_t fCalibMethod; // a la 0=cosmics, 1=pi0, 2=electrons,3=using ecore,
136   Int_t fCalibPass; // which analysis iteration is this.. 1,2,..N
137   Int_t fCalibTime; // t0, unix timestamp
138   Float_t fAbsoluteGain; // (ADC>GeV absolute gain/conversion)
139   
140   // second: additional info for LED Reference and SM temperature
141   Float_t fLEDRefAmp[AliEMCALGeoParams::fgkEMCALLEDRefs]; // LED amplitude at  t0, low gain equivalent
142   Float_t fLEDRefAmpRMS[AliEMCALGeoParams::fgkEMCALLEDRefs]; // RMS
143   Float_t fLEDRefHighLowRatio[AliEMCALGeoParams::fgkEMCALLEDRefs]; // value around 16 or so
144   Int_t fLEDRefHighLow[AliEMCALGeoParams::fgkEMCALLEDRefs]; // 0 (low) or 1 (high) gain
145   
146   Float_t fTemperature[AliEMCALGeoParams::fgkEMCALTempSensors]; // temperature at t0
147   Float_t fTemperatureRMS[AliEMCALGeoParams::fgkEMCALTempSensors]; // RMS
148   
149   // third: individual info for each tower
150   AliEMCALCalibAbsVal fAPDVal[AliEMCALGeoParams::fgkEMCALCols][AliEMCALGeoParams::fgkEMCALRows]; // at t0
151
152   ClassDef(AliEMCALSuperModuleCalibAbs, 2) // help class
153 };
154 // ******* end of internal class definition *************
155
156 class AliEMCALCalibAbs : public TObject {
157
158 public:
159
160   enum kProblemType {kNoLED=-999};// code in possible problems
161
162   AliEMCALCalibAbs(const int nSM = AliEMCALGeoParams::fgkEMCALModules);
163
164   // Read and Write txt I/O methods are normally not used, but are useful for 
165   // filling the object before it is saved in OCDB 
166   void ReadTextCalibAbsInfo(Int_t nSM, const TString &txtFileName, Bool_t swapSides=kFALSE); // info file is for nSm=1 to 12 SuperModules
167   void WriteTextCalibAbsInfo(const TString &txtFileName, Bool_t swapSides=kFALSE); // info file is for nSm=1 to 12 SuperModules
168   void ReadRootCalibAbsInfo(const TString &rootFileName, Bool_t swapSides=kFALSE); // info file is for nSm=1 to 12 SuperModules
169   void ReadTreeCalibAbsInfo(TTree *tree, Bool_t swapSides=kFALSE); // info file is for nSm=1 to 12 SuperModules
170   void WriteRootCalibAbsInfo(const TString &rootFileName, Bool_t swapSides=kFALSE); // info file is for nSm=1 to 12 SuperModules
171
172   virtual ~AliEMCALCalibAbs();
173
174   // pointer to stored info.
175   Int_t GetNSuperModule() const { return fNSuperModule; }; 
176
177   // - via the index in the stored array:
178   virtual AliEMCALSuperModuleCalibAbs * GetSuperModuleCalibAbsId(Int_t smIndex) const
179    { return (AliEMCALSuperModuleCalibAbs*) fSuperModuleData[smIndex]; };
180
181   // - or via the actual SM number
182   virtual AliEMCALSuperModuleCalibAbs * GetSuperModuleCalibAbsNum(Int_t smNum) const;
183
184 protected:
185
186   Int_t           fNSuperModule; // Number of supermodules.
187   TObjArray fSuperModuleData; // SuperModule data
188
189 private:
190
191   AliEMCALCalibAbs(const AliEMCALCalibAbs &);
192   AliEMCALCalibAbs &operator = (const AliEMCALCalibAbs &);
193
194   ClassDef(AliEMCALCalibAbs, 3) //CalibAbs data info
195 };
196
197 #endif