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 <AliTRDfeeParam.h>
17 #include "AliTRDCalOnlineGainTableROC.h"
18 #include "AliTRDCalOnlineGainTable.h"
20 //////////////////////////////////////////////////////////////////////////////////////////////
22 // Data structure to store gaintables of the online calibration in the OCDB
23 // consisting of three classes:
24 // AliTRDCalOnlineGainTable
25 // AliTRDCalOnlineGainTableROC
26 // AliTRDCalOnlineGainTableMCM
28 // AliTRDCalOnlineGainTable is the main class from which all stored data can be accessed.
29 // The two sub-classes AliTRDCalOnlineGainTableROC and AliTRDCalOnlineGainTableMCM
30 // contain the gaintables on ROC level and on the MCM level respectively.
32 // The online calibration is used to compensate gain deviations on the pad level.
33 // For the offline reconstruction the online calibration has to be undone.
34 // The corresponding gain correction factor that was used by the online gain filter can be accessed
35 // via the functions AliTRDCalOnlineGainTable::GetGainCorrectionFactor(Int_t det, Int_t row, Int_t col)
36 // and AliTRDCalOnlineGainTable::GetGainCorrectionFactor(Int_t sector, Int_t stack, Int_t layer, Int_t row, Int_t col).
38 // AliTRDCalOnlineGainTableROC is a class to allocate MCM Gain Tables
39 // and to access all stored calibration values from the ROC level by indicating row and col
41 //////////////////////////////////////////////////////////////////////////////////////////////
43 ClassImp(AliTRDCalOnlineGainTableROC);
45 //_____________________________________________________________________________
46 AliTRDCalOnlineGainTableROC::AliTRDCalOnlineGainTableROC()
53 for (int i=0; i<128; i++) {
54 fMCMGainTables[i] = 0;
58 //_____________________________________________________________________________
59 AliTRDCalOnlineGainTableROC::AliTRDCalOnlineGainTableROC(const AliTRDCalOnlineGainTableROC& other)
66 for (int i=0; i<128; i++) {
67 if (other.GetGainTableMCM(i)) {
68 fMCMGainTables[i] = new AliTRDCalOnlineGainTableMCM( *(other.GetGainTableMCM(i)) );
70 fMCMGainTables[i] = 0;
76 //_____________________________________________________________________________
77 AliTRDCalOnlineGainTableROC& AliTRDCalOnlineGainTableROC::operator=(const AliTRDCalOnlineGainTableROC& other)
80 // assignment operator
83 for (int i=0; i<128; i++) {
85 if (fMCMGainTables[i]) {
86 delete fMCMGainTables[i];
89 if (other.GetGainTableMCM(i)) {
90 fMCMGainTables[i] = new AliTRDCalOnlineGainTableMCM( *(other.GetGainTableMCM(i)) );
92 fMCMGainTables[i] = 0;
100 //_____________________________________________________________________________
101 AliTRDCalOnlineGainTableROC::~AliTRDCalOnlineGainTableROC()
107 for (int i=0; i<128; i++) {
108 if (fMCMGainTables[i]) {
109 delete fMCMGainTables[i];
115 //_____________________________________________________________________________
116 Float_t AliTRDCalOnlineGainTableROC::GetGainCorrectionFactor(Int_t row, Int_t col)
119 // chooses ROB/MCM/channel from row/col
120 // returns the Gain Correction Factor of the given channel
123 AliTRDfeeParam * para = AliTRDfeeParam::Instance();
125 Int_t rob = para->GetROBfromPad(row,col);
126 Int_t mcm = para->GetMCMfromPad(row,col);
127 Int_t channel =19-(col%18);
129 AliTRDCalOnlineGainTableMCM* gtbl=GetGainTableMCM(rob,mcm);
132 return gtbl->GetGainCorrectionFactor(channel);
134 return AliTRDCalOnlineGainTable::UnDef;
139 //_____________________________________________________________________________
140 Short_t AliTRDCalOnlineGainTableROC::GetAdcdac(Int_t row, Int_t col)
143 // chooses ROB/MCM/channel from row/col
144 // returns the ADC's reference voltage of the given MCM
147 AliTRDfeeParam * para = AliTRDfeeParam::Instance();
149 Int_t rob = para->GetROBfromPad(row,col);
150 Int_t mcm = para->GetMCMfromPad(row,col);
152 AliTRDCalOnlineGainTableMCM* gtbl=GetGainTableMCM(rob,mcm);
155 return gtbl->GetAdcdac();
162 //_____________________________________________________________________________
163 Float_t AliTRDCalOnlineGainTableROC::GetMCMGain(Int_t row, Int_t col)
166 // chooses ROB/MCM/channel from row/col
167 // returns the Gain Factor which would lead to a Correction Factor of 1.0 within the given MCM
170 AliTRDfeeParam * para = AliTRDfeeParam::Instance();
172 Int_t rob = para->GetROBfromPad(row,col);
173 Int_t mcm = para->GetMCMfromPad(row,col);
175 AliTRDCalOnlineGainTableMCM* gtbl=GetGainTableMCM(rob,mcm);
178 return gtbl->GetMCMGain();
180 return AliTRDCalOnlineGainTable::UnDef;
185 //_____________________________________________________________________________
186 Short_t AliTRDCalOnlineGainTableROC::GetFGAN(Int_t row, Int_t col)
189 // chooses ROB/MCM/channel from row/col
190 // returns the Gain Correction Filter Factor of the given channel
193 AliTRDfeeParam * para = AliTRDfeeParam::Instance();
195 Int_t rob = para->GetROBfromPad(row,col);
196 Int_t mcm = para->GetMCMfromPad(row,col);
197 Int_t channel =19-(col%18);
199 AliTRDCalOnlineGainTableMCM* gtbl=GetGainTableMCM(rob,mcm);
202 return gtbl->GetFGAN(channel);
209 //_____________________________________________________________________________
210 Short_t AliTRDCalOnlineGainTableROC::GetFGFN(Int_t row, Int_t col)
213 // chooses ROB/MCM/channel from row/col
214 // returns the Gain Correction Filter Additive of the given channel
217 AliTRDfeeParam * para = AliTRDfeeParam::Instance();
219 Int_t rob = para->GetROBfromPad(row,col);
220 Int_t mcm = para->GetMCMfromPad(row,col);
221 Int_t channel =19-(col%18);
223 AliTRDCalOnlineGainTableMCM* gtbl=GetGainTableMCM(rob,mcm);
226 return gtbl->GetFGFN(channel);
233 //_____________________________________________________________________________
234 void AliTRDCalOnlineGainTableROC::AllocateGainTableMCM(Int_t rob, Int_t mcm)
237 // allocates a Gain Table for the given MCM
240 Int_t index = rob*16 + mcm;
242 if (fMCMGainTables[index]) {
243 delete fMCMGainTables[index];
246 fMCMGainTables[index] = new AliTRDCalOnlineGainTableMCM;