Warning corrected.
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALCalibMapAPD.h
CommitLineData
d81e6423 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>
2f17a269 10#include <TObjArray.h>
d81e6423 11#include "AliEMCALGeoParams.h"
12#include <cmath>
13class TString;
61917ab3 14class TTree;
d81e6423 15
16/*
61917ab3 17 Objects of this class contain info on APD calibration and map info
d81e6423 18*/
19
61917ab3 20// ******* internal class definition *************
21// values per single APD
22class 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:
2f17a269 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:
61917ab3 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
2f17a269 75 ClassDef(AliEMCALCalibMapAPDVal, 2) // help class
61917ab3 76}; // AliEMCALCalibAPDVal
77
78// 1 SuperModule's worth of info: info on where the different APDs are
79class AliEMCALSuperModuleCalibMapAPD : public TObject {
80 public:
2f17a269 81 AliEMCALSuperModuleCalibMapAPD(const int smNum=0) : TObject(), // just init values
82 fSuperModuleNum(smNum)
61917ab3 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:
2f17a269 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:
61917ab3 98 Int_t fSuperModuleNum;
99 AliEMCALCalibMapAPDVal fAPDVal[AliEMCALGeoParams::fgkEMCALCols][AliEMCALGeoParams::fgkEMCALRows];
100
2f17a269 101 ClassDef(AliEMCALSuperModuleCalibMapAPD, 2) // help class
61917ab3 102};
103// ******* end of internal class definition *************
104
d81e6423 105class AliEMCALCalibMapAPD : public TObject {
106
107public:
108
109 enum kValType {kCalibTemp=25};// 25 deg C used for all APD calibrations
110
2f17a269 111 AliEMCALCalibMapAPD(const int nSM = AliEMCALGeoParams::fgkEMCALModules);
d81e6423 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
61917ab3 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
d81e6423 120
121 virtual ~AliEMCALCalibMapAPD();
122
d81e6423 123 // pointer to stored info.
d81e6423 124 Int_t GetNSuperModule() const { return fNSuperModule; };
d81e6423 125
126 // - via the index in the stored array:
2f17a269 127 virtual AliEMCALSuperModuleCalibMapAPD * GetSuperModuleCalibMapAPDId(Int_t smIndex) const
128 { return (AliEMCALSuperModuleCalibMapAPD*) fSuperModuleData[smIndex]; };
129
d81e6423 130 // - or via the actual SM number
2f17a269 131 virtual AliEMCALSuperModuleCalibMapAPD * GetSuperModuleCalibMapAPDNum(Int_t smNum) const;
d81e6423 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
139protected:
140
141 Int_t fNSuperModule; // Number of supermodules.
2f17a269 142 TObjArray fSuperModuleData; // SuperModule data
d81e6423 143
144private:
145
146 AliEMCALCalibMapAPD(const AliEMCALCalibMapAPD &);
147 AliEMCALCalibMapAPD &operator = (const AliEMCALCalibMapAPD &);
148
2f17a269 149 ClassDef(AliEMCALCalibMapAPD, 3) //CalibMapAPD data info
d81e6423 150};
151
152#endif