]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/AliEMCALCalibMapAPD.h
Correction of SA track rejection
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALCalibMapAPD.h
1 #ifndef ALIEMCALCALIBMAPAPD_H
2 #define ALIEMCALCALIBMAPAPD_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 #include <cmath>
13 class TString;
14 class TTree;
15
16 /*
17   Objects of this class contain info on APD calibration and map info,
18   such as V30 and other parameters from the tests in Catania/Houston,
19   as well as info on which APD is located where.  
20 */
21
22 // ******* internal class definition *************
23 // values per single APD
24 class AliEMCALCalibMapAPDVal : public TObject {
25
26  public:
27   AliEMCALCalibMapAPDVal() : TObject(), // just init values
28     fHardWareId(0),
29     fAPDNum(0),
30     fV30(0),
31     fBreakDown(0),
32     fDarkCurrent(0) 
33     {
34       Init();
35     }
36   
37   void Init() {
38     fHardWareId = 0;
39     fAPDNum = 0;
40     fV30 = 0;
41     fBreakDown = 0;
42     fDarkCurrent = 0; 
43     for (int i=0; i<3; i++) {
44       fPar[i] = 0;
45       fParErr[i] = 0;
46     }
47     return;
48   }
49   
50  public:
51   void SetHardWareId(Int_t i) { fHardWareId = i; }; //
52   Int_t GetHardWareId() const { return fHardWareId; }; //
53   void SetAPDNum(Int_t i) { fAPDNum = i; }; //
54   Int_t GetAPDNum() const { return fAPDNum; }; //
55   void SetV30(Float_t f) { fV30 = f; }; //
56   Float_t GetV30() const { return fV30; }; // 
57   void SetPar(int ip, Float_t f) { fPar[ip] = f; }; //
58   Float_t GetPar(int ip) const { return fPar[ip]; }; // 
59   void SetParErr(int ip, Float_t f) { fParErr[ip] = f; }; //
60   Float_t GetParErr(int ip) const { return fParErr[ip]; }; // 
61   void SetBreakDown(Int_t i) { fBreakDown = i; }; //
62   Int_t GetBreakDown() const { return fBreakDown; }; //
63   void SetDarkCurrent(Float_t f) { fDarkCurrent = f; }; //
64   Float_t GetDarkCurrent() const { return fDarkCurrent; }; // 
65
66  private:
67   Int_t fHardWareId; // HardWareIndex
68   // info from APD calibrations
69   Int_t fAPDNum;    // assigned APD-PA number; Catania 10000-, Houston: 20000-
70   Float_t fV30;      // Catania/Houston Voltage V30 (V) at T = 25 deg C
71   Float_t fPar[3];   // fit parameters, p0,p1,p2 - for ADC vs bias measurement
72   Float_t fParErr[3]; // error on fit parameters        
73   
74   Int_t fBreakDown; // Hamamatsu Breakdown Voltage (V)  
75   Float_t fDarkCurrent; // Hamamatsu Dark Current (A)   
76   
77   ClassDef(AliEMCALCalibMapAPDVal, 2) // help class
78 }; // AliEMCALCalibAPDVal
79
80 // 1 SuperModule's worth of info: info on where the different APDs are
81 class AliEMCALSuperModuleCalibMapAPD : public TObject {
82  public:
83   AliEMCALSuperModuleCalibMapAPD(const int smNum=0) : TObject(), // just init values
84     fSuperModuleNum(smNum)
85     {
86       for (int icol=0; icol<AliEMCALGeoParams::fgkEMCALCols; icol++) {
87         for (int irow=0; irow<AliEMCALGeoParams::fgkEMCALRows; irow++) {
88           fAPDVal[icol][irow].Init();
89         }
90       }
91     }
92   
93  public:
94   void SetSuperModuleNum(Int_t i) { fSuperModuleNum = i;}; // 
95   Int_t GetSuperModuleNum() const { return fSuperModuleNum;}; // 
96   AliEMCALCalibMapAPDVal * GetAPDVal(int icol, int irow) 
97     { return &fAPDVal[icol][irow]; };
98
99  private:
100   Int_t fSuperModuleNum; // SuperModule index
101   AliEMCALCalibMapAPDVal fAPDVal[AliEMCALGeoParams::fgkEMCALCols][AliEMCALGeoParams::fgkEMCALRows]; // APD calibration info
102   
103   ClassDef(AliEMCALSuperModuleCalibMapAPD, 2) // help class
104 };
105 // ******* end of internal class definition *************    
106     
107 class AliEMCALCalibMapAPD : public TObject {
108
109 public:
110
111   enum kValType {kCalibTemp=25};// 25 deg C used for all APD calibrations
112
113   AliEMCALCalibMapAPD(const int nSM = AliEMCALGeoParams::fgkEMCALModules);
114
115   // Read and Write txt I/O methods are normally not used, but are useful for 
116   // filling the object before it is saved in OCDB 
117   void ReadTextCalibMapAPDInfo(Int_t nSM, const TString &txtFileName, Bool_t swapSides=kFALSE); // info file is for nSm=1 to 12 SuperModules
118   void WriteTextCalibMapAPDInfo(const TString &txtFileName, Bool_t swapSides=kFALSE); // info file is for nSm=1 to 12 SuperModules
119   void ReadRootCalibMapAPDInfo(const TString &rootFileName, Bool_t swapSides=kFALSE); // info file is for nSm=1 to 12 SuperModules
120   void ReadTreeCalibMapAPDInfo(TTree *tree, Bool_t swapSides=kFALSE); // info file is for nSm=1 to 12 SuperModules
121   void WriteRootCalibMapAPDInfo(const TString &rootFileName, Bool_t swapSides=kFALSE); // info file is for nSm=1 to 12 SuperModules
122
123   virtual ~AliEMCALCalibMapAPD();
124
125   // pointer to stored info.
126   Int_t GetNSuperModule() const { return fNSuperModule; }; 
127
128   // on a SuperModule level
129   virtual AliEMCALSuperModuleCalibMapAPD * GetSuperModuleCalibMapAPDId(Int_t smIndex) const
130     { return (AliEMCALSuperModuleCalibMapAPD*) fSuperModuleData[smIndex]; }; // - via the index in the stored array:
131
132   virtual AliEMCALSuperModuleCalibMapAPD * GetSuperModuleCalibMapAPDNum(Int_t smNum) const;   // - or via the actual SM number
133   
134   // method to calculate gain M from fit parameters, and HV value
135   Float_t GetGain(Float_t fitPar[3], Float_t HV) const 
136     { return (fitPar[0] + fitPar[1] * exp(fitPar[2]*HV)); };
137   Float_t GetGain(Float_t fitPar0, Float_t fitPar1, Float_t fitPar2, Float_t HV) const 
138     { return (fitPar0 + fitPar1 * exp(fitPar2*HV)); };
139
140 protected:
141
142   Int_t           fNSuperModule; // Number of supermodules.
143   TObjArray fSuperModuleData; // SuperModule data
144
145 private:
146
147   AliEMCALCalibMapAPD(const AliEMCALCalibMapAPD &);
148   AliEMCALCalibMapAPD &operator = (const AliEMCALCalibMapAPD &);
149
150   ClassDef(AliEMCALCalibMapAPD, 3) //CalibMapAPD data info
151 };
152
153 #endif