1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
16 #include "AliTRDCalOnlineGainTable.h"
18 //////////////////////////////////////////////////////////////////////////////////////////////
20 // Data structure to store gaintables of the online calibration in the OCDB
21 // consisting of three classes:
22 // AliTRDCalOnlineGainTable
23 // AliTRDCalOnlineGainTableROC
24 // AliTRDCalOnlineGainTableMCM
26 // AliTRDCalOnlineGainTable is the main class from which all stored data can be accessed.
27 // The two sub-classes AliTRDCalOnlineGainTableROC and AliTRDCalOnlineGainTableMCM
28 // contain the gaintables on ROC level and on the MCM level respectively.
30 // The online calibration is used to compensate gain deviations on the pad level.
31 // For the offline reconstruction the online calibration has to be undone.
32 // The corresponding gain correction factor that was used by the online gain filter can be accessed
33 // via the functions AliTRDCalOnlineGainTable::GetGainCorrectionFactor(Int_t det, Int_t row, Int_t col)
34 // and AliTRDCalOnlineGainTable::GetGainCorrectionFactor(Int_t sector, Int_t stack, Int_t layer, Int_t row, Int_t col).
36 //////////////////////////////////////////////////////////////////////////////////////////////
38 ClassImp(AliTRDCalOnlineGainTable);
40 const Float_t AliTRDCalOnlineGainTable::UnDef=-999.;
42 //_____________________________________________________________________________
43 AliTRDCalOnlineGainTable::AliTRDCalOnlineGainTable()
50 for (int i=0; i<540; i++) {
51 fROCGainTables[i] = 0;
56 //_____________________________________________________________________________
57 AliTRDCalOnlineGainTable::AliTRDCalOnlineGainTable(const AliTRDCalOnlineGainTable& other)
64 for (int i=0; i<540; i++) {
65 if (other.GetGainTableROC(i)) {
66 fROCGainTables[i] = new AliTRDCalOnlineGainTableROC( *(other.GetGainTableROC(i)) );
68 fROCGainTables[i] = 0;
74 //_____________________________________________________________________________
75 AliTRDCalOnlineGainTable& AliTRDCalOnlineGainTable::operator=(const AliTRDCalOnlineGainTable& other)
78 // assignment operator
81 for (int i=0; i<540; i++) {
83 if (fROCGainTables[i]) {
84 delete fROCGainTables[i];
87 if (other.GetGainTableROC(i)) {
88 fROCGainTables[i] = new AliTRDCalOnlineGainTableROC( *(other.GetGainTableROC(i)) );
90 fROCGainTables[i] = 0;
98 //_____________________________________________________________________________
99 AliTRDCalOnlineGainTable::~AliTRDCalOnlineGainTable()
105 for (int i=0; i<540; i++) {
106 if (fROCGainTables[i]) {
107 delete fROCGainTables[i];
113 //_____________________________________________________________________________
114 Float_t AliTRDCalOnlineGainTable::GetGainCorrectionFactor(Int_t det
119 // returns the Gain Correction Factor of the channel
120 // given by det, row, col
123 AliTRDCalOnlineGainTableROC* gtbl = GetGainTableROC(det);
126 return gtbl->GetGainCorrectionFactor(row,col);
128 return AliTRDCalOnlineGainTable::UnDef;
133 //_____________________________________________________________________________
134 Float_t AliTRDCalOnlineGainTable::GetGainCorrectionFactor(Int_t sector
141 // returns the Gain Correction Factor of the channel
142 // given by sector, stack, layer, row, col
145 return GetGainCorrectionFactor(30*sector + 6*stack + layer, row, col);
148 //_____________________________________________________________________________
149 Short_t AliTRDCalOnlineGainTable::GetAdcdac(Int_t det, Int_t row, Int_t col)
152 // returns the ADC's reference voltage of the channel
153 // given by det, row, col
156 AliTRDCalOnlineGainTableROC* gtbl = GetGainTableROC(det);
159 return gtbl->GetAdcdac(row,col);
166 //_____________________________________________________________________________
167 Short_t AliTRDCalOnlineGainTable::GetAdcdac(Int_t sector, Int_t stack, Int_t layer,
168 Int_t row, Int_t col)
171 // returns the ADC's reference voltage of the channel
172 // given by sector, stack, layer, row, col
175 return GetAdcdac(30*sector + 6*stack + layer, row, col);
178 //_____________________________________________________________________________
179 Float_t AliTRDCalOnlineGainTable::GetMCMGain(Int_t det, Int_t row, Int_t col)
182 // returns the Gain Factor which would lead to a Correction Factor of 1.0
183 // within the MCM given by det, row, col
186 AliTRDCalOnlineGainTableROC* gtbl = GetGainTableROC(det);
189 return gtbl->GetMCMGain(row,col);
191 return AliTRDCalOnlineGainTable::UnDef;
196 //_____________________________________________________________________________
197 Float_t AliTRDCalOnlineGainTable::GetMCMGain(Int_t sector, Int_t stack, Int_t layer,
198 Int_t row, Int_t col)
201 // returns the Gain Factor which would lead to a Correction Factor of 1.0
202 // within the MCM given by sector, stack, layer, row, col
205 return GetMCMGain(30*sector + 6*stack + layer, row, col);
208 //_____________________________________________________________________________
209 Short_t AliTRDCalOnlineGainTable::GetFGAN(Int_t det, Int_t row, Int_t col)
212 // returns the Gain Correction Filter Additive of the channel
213 // given by det, row, col
216 AliTRDCalOnlineGainTableROC* gtbl = GetGainTableROC(det);
219 return gtbl->GetFGAN(row,col);
226 //_____________________________________________________________________________
227 Short_t AliTRDCalOnlineGainTable::GetFGAN(Int_t sector, Int_t stack, Int_t layer,
228 Int_t row, Int_t col)
231 // returns the Gain Correction Filter Additive of the channel
232 // given by sector, stack, layer, row, col
235 return GetFGAN(30*sector + 6*stack + layer, row, col);
238 //_____________________________________________________________________________
239 Short_t AliTRDCalOnlineGainTable::GetFGFN(Int_t det, Int_t row, Int_t col)
242 // returns the Gain Correction Filter Factor of the channel
243 // given by det, row, col
246 AliTRDCalOnlineGainTableROC* gtbl = GetGainTableROC(det);
249 return gtbl->GetFGFN(row,col);
255 //_____________________________________________________________________________
256 Short_t AliTRDCalOnlineGainTable::GetFGFN(Int_t sector, Int_t stack, Int_t layer,
257 Int_t row, Int_t col)
260 // returns the Gain Correction Filter Factor of the channel
261 // given by sector, stack, layer, row, col
264 return GetFGFN(30*sector + 6*stack + layer, row, col);
267 //_____________________________________________________________________________
268 void AliTRDCalOnlineGainTable::AllocateGainTableROC(Int_t det)
271 // allocates a Gain Table for the given detector
274 if (fROCGainTables[det]) {
275 delete fROCGainTables[det];
278 fROCGainTables[det] = new AliTRDCalOnlineGainTableROC;