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