correct previous non intended commit, but leaving some new things
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALCalibReference.h
CommitLineData
82d90a2f 1#ifndef ALIEMCALCALIBREFERENCE_H
2#define ALIEMCALCALIBREFERENCE_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"
12class TString;
13class TTree;
14
15/*
16 Objects of this class contain basis for reference 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 the needed static ingredients for c)
24
25// ******* internal class definition *************
26// values per single tower
27class AliEMCALCalibReferenceVal : public TObject {
28
29 public:
30 AliEMCALCalibReferenceVal() : TObject(), // just init values
31 fHighLow(0),
32 fLEDAmp(0),
33 fLEDAmpRMS(0)
34 {
35 }
36
37 void Init() {
38 fHighLow = 0;
39 fLEDAmp = 0;
40 fLEDAmpRMS = 0;
41 return;
42 }
43
44 public:
45 void SetHighLow(Int_t i) { fHighLow = i; }; //
46 Int_t GetHighLow() const { return fHighLow; }; //
47 void SetLEDAmp(Float_t f) { fLEDAmp = f; }; //
48 Float_t GetLEDAmp() const { return fLEDAmp; }; //
49 void SetLEDAmpRMS(Float_t f) { fLEDAmpRMS = f; }; //
50 Float_t GetLEDAmpRMS() const { return fLEDAmpRMS; }; //
51
52 private:
53 Int_t fHighLow; // 0 (low) or 1 (high) gain, used for LEDAmp info
54 Float_t fLEDAmp; // LED amplitude
55 Float_t fLEDAmpRMS; // RMS
56
57 ClassDef(AliEMCALCalibReferenceVal, 1) // help class
58};
59
60// 1 SuperModule's worth of info: info on where the different APDs are
61class AliEMCALSuperModuleCalibReference : public TObject {
62
63 public:
64 AliEMCALSuperModuleCalibReference(const int smNum=0) : TObject(), // just init values
65 fSuperModuleNum(smNum),
66 fReferenceTime(0)
67 {
68 for (int iref=0; iref<AliEMCALGeoParams::fgkEMCALLEDRefs; iref++) {
69 fLEDRefAmp[iref] = 0;
70 fLEDRefAmpRMS[iref] = 0;
71 fLEDRefHighLow[iref] = 0;
72 }
73
74 for (int itemp=0; itemp<AliEMCALGeoParams::fgkEMCALTempSensors; itemp++) {
75 fTemperature[itemp] = 0;
76 fTemperatureRMS[itemp] = 0;
77 }
78
79 for (int icol=0; icol<AliEMCALGeoParams::fgkEMCALCols; icol++) {
80 for (int irow=0; irow<AliEMCALGeoParams::fgkEMCALRows; irow++) {
81 fAPDVal[icol][irow].Init();
82 }
83 }
84 }
85
86 public:
87 // first
88 void SetSuperModuleNum(Int_t i) { fSuperModuleNum = i;}; //
89 Int_t GetSuperModuleNum() const { return fSuperModuleNum;}; //
90 void SetReferenceTime(Int_t i) { fReferenceTime = i;}; //
91 Int_t GetReferenceTime() const { return fReferenceTime;}; //
92
93 // second
94 void SetLEDRefAmp(int iLEDRef, Float_t f) { fLEDRefAmp[iLEDRef] = f;}; //
95 Float_t GetLEDRefAmp(int iLEDRef) const { return fLEDRefAmp[iLEDRef];}; //
96 void SetLEDRefAmpRMS(int iLEDRef, Float_t f) { fLEDRefAmpRMS[iLEDRef] = f;}; //
97 Float_t GetLEDRefAmpRMS(int iLEDRef) const { return fLEDRefAmpRMS[iLEDRef];}; //
98 void SetLEDRefHighLow(int iLEDRef, Int_t i) { fLEDRefHighLow[iLEDRef] = i;}; //
99 Int_t GetLEDRefHighLow(int iLEDRef) const { return fLEDRefHighLow[iLEDRef];}; //
100
101 void SetTemperature(int itemp, Float_t f) { fTemperature[itemp] = f;}; //
102 Float_t GetTemperature(int itemp) const { return fTemperature[itemp];}; //
103 void SetTemperatureRMS(int itemp, Float_t f) { fTemperatureRMS[itemp] = f;}; //
104 Float_t GetTemperatureRMS(int itemp) const { return fTemperatureRMS[itemp];}; //
105
106 // third
107 AliEMCALCalibReferenceVal * GetAPDVal(int icol, int irow)
108 { return &fAPDVal[icol][irow]; };
109
110 private:
111 // first: overall values for the whole SuperModule
112 Int_t fSuperModuleNum; // which SuperModule is this?
113 Int_t fReferenceTime; // t0, unix timestamp
114
115 // second: additional info for LED Reference and SM temperature
116 Float_t fLEDRefAmp[AliEMCALGeoParams::fgkEMCALLEDRefs]; // LED amplitude at t0, low gain equivalent
117 Float_t fLEDRefAmpRMS[AliEMCALGeoParams::fgkEMCALLEDRefs]; // RMS
118 Int_t fLEDRefHighLow[AliEMCALGeoParams::fgkEMCALLEDRefs]; // 0 (low) or 1 (high) gain
119
120 Float_t fTemperature[AliEMCALGeoParams::fgkEMCALTempSensors]; // temperature at t0
121 Float_t fTemperatureRMS[AliEMCALGeoParams::fgkEMCALTempSensors]; // RMS
122
123 // third: individual info for each tower
124 AliEMCALCalibReferenceVal fAPDVal[AliEMCALGeoParams::fgkEMCALCols][AliEMCALGeoParams::fgkEMCALRows]; // at t0
125
126 ClassDef(AliEMCALSuperModuleCalibReference, 1) // help class
127};
128// ******* end of internal class definition *************
129
130class AliEMCALCalibReference : public TObject {
131
132public:
133
134 enum kProblemType {kNoLED=-999};// code in possible problems
135
136 AliEMCALCalibReference(const int nSM = AliEMCALGeoParams::fgkEMCALModules);
137
138 // Read and Write txt I/O methods are normally not used, but are useful for
139 // filling the object before it is saved in OCDB
140 void ReadTextCalibReferenceInfo(Int_t nSM, const TString &txtFileName, Bool_t swapSides=kFALSE); // info file is for nSm=1 to 12 SuperModules
141 void WriteTextCalibReferenceInfo(const TString &txtFileName, Bool_t swapSides=kFALSE); // info file is for nSm=1 to 12 SuperModules
142 void ReadRootCalibReferenceInfo(const TString &rootFileName, Bool_t swapSides=kFALSE); // info file is for nSm=1 to 12 SuperModules
143 void ReadTreeCalibReferenceInfo(TTree *tree, Bool_t swapSides=kFALSE); // info file is for nSm=1 to 12 SuperModules
144 void WriteRootCalibReferenceInfo(const TString &rootFileName, Bool_t swapSides=kFALSE); // info file is for nSm=1 to 12 SuperModules
145
146 virtual ~AliEMCALCalibReference();
147
148 // pointer to stored info.
149 Int_t GetNSuperModule() const { return fNSuperModule; };
150
151 // - via the index in the stored array:
152 virtual AliEMCALSuperModuleCalibReference * GetSuperModuleCalibReferenceId(Int_t smIndex) const
153 { return (AliEMCALSuperModuleCalibReference*) fSuperModuleData[smIndex]; };
154
155 // - or via the actual SM number
156 virtual AliEMCALSuperModuleCalibReference * GetSuperModuleCalibReferenceNum(Int_t smNum) const;
157
158protected:
159
160 Int_t fNSuperModule; // Number of supermodules.
161 TObjArray fSuperModuleData; // SuperModule data
162
163private:
164
165 AliEMCALCalibReference(const AliEMCALCalibReference &);
166 AliEMCALCalibReference &operator = (const AliEMCALCalibReference &);
167
168 ClassDef(AliEMCALCalibReference, 1) //CalibReference data info
169};
170
171#endif