add protection against truncated events + coverity - Rachid
[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/*
ab962f7b 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.
d81e6423 20*/
21
61917ab3 22// ******* internal class definition *************
23// values per single APD
24class 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:
2f17a269 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:
61917ab3 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
2f17a269 77 ClassDef(AliEMCALCalibMapAPDVal, 2) // help class
61917ab3 78}; // AliEMCALCalibAPDVal
79
80// 1 SuperModule's worth of info: info on where the different APDs are
81class AliEMCALSuperModuleCalibMapAPD : public TObject {
82 public:
2f17a269 83 AliEMCALSuperModuleCalibMapAPD(const int smNum=0) : TObject(), // just init values
84 fSuperModuleNum(smNum)
61917ab3 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:
2f17a269 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:
ab962f7b 100 Int_t fSuperModuleNum; // SuperModule index
101 AliEMCALCalibMapAPDVal fAPDVal[AliEMCALGeoParams::fgkEMCALCols][AliEMCALGeoParams::fgkEMCALRows]; // APD calibration info
61917ab3 102
2f17a269 103 ClassDef(AliEMCALSuperModuleCalibMapAPD, 2) // help class
61917ab3 104};
105// ******* end of internal class definition *************
106
d81e6423 107class AliEMCALCalibMapAPD : public TObject {
108
109public:
110
111 enum kValType {kCalibTemp=25};// 25 deg C used for all APD calibrations
112
2f17a269 113 AliEMCALCalibMapAPD(const int nSM = AliEMCALGeoParams::fgkEMCALModules);
d81e6423 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
61917ab3 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
d81e6423 122
123 virtual ~AliEMCALCalibMapAPD();
124
d81e6423 125 // pointer to stored info.
d81e6423 126 Int_t GetNSuperModule() const { return fNSuperModule; };
d81e6423 127
ab962f7b 128 // on a SuperModule level
2f17a269 129 virtual AliEMCALSuperModuleCalibMapAPD * GetSuperModuleCalibMapAPDId(Int_t smIndex) const
ab962f7b 130 { return (AliEMCALSuperModuleCalibMapAPD*) fSuperModuleData[smIndex]; }; // - via the index in the stored array:
d81e6423 131
ab962f7b 132 virtual AliEMCALSuperModuleCalibMapAPD * GetSuperModuleCalibMapAPDNum(Int_t smNum) const; // - or via the actual SM number
133
d81e6423 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
140protected:
141
142 Int_t fNSuperModule; // Number of supermodules.
2f17a269 143 TObjArray fSuperModuleData; // SuperModule data
d81e6423 144
145private:
146
147 AliEMCALCalibMapAPD(const AliEMCALCalibMapAPD &);
148 AliEMCALCalibMapAPD &operator = (const AliEMCALCalibMapAPD &);
149
2f17a269 150 ClassDef(AliEMCALCalibMapAPD, 3) //CalibMapAPD data info
d81e6423 151};
152
153#endif