New versions of GDC and CDH raw data headers. Some CDH getters are added
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALCalibData.cxx
CommitLineData
f565d89d 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
16/* $Id$ */
17
63b315c5 18//_________________________________________________________________________
19///*-- Author: Yves Schutz (SUBATECH)
20// : Aleksei Pavlinov (WSU); Jun 30, 2006 - ALICE numbering scheme
f565d89d 21///////////////////////////////////////////////////////////////////////////////
22// //
23// class for EMCAL calibration //
24// //
25///////////////////////////////////////////////////////////////////////////////
26
27#include "AliEMCALCalibData.h"
28
29ClassImp(AliEMCALCalibData)
30
31//________________________________________________________________
32AliEMCALCalibData::AliEMCALCalibData()
33{
34 // Default constructor
35 Reset();
36}
37
38//________________________________________________________________
39AliEMCALCalibData::AliEMCALCalibData(const char* name)
40{
41 // Constructor
42 TString namst = "Calib_";
43 namst += name;
44 SetName(namst.Data());
45 SetTitle(namst.Data());
46 Reset();
47}
48
49//________________________________________________________________
50AliEMCALCalibData::AliEMCALCalibData(const AliEMCALCalibData& calibda) :
51 TNamed(calibda)
52{
53 // copy constructor
54 SetName(calibda.GetName());
55 SetTitle(calibda.GetName());
56 Reset();
57
58 Int_t nSMod = 12;
59 Int_t nCol = 48;
60 Int_t nRow = 24;
beb28b95 61 Int_t nRow2 = 12; //Modules 11 and 12 are half modules
f565d89d 62
63 for(Int_t supermodule=0; supermodule<nSMod; supermodule++) {
64 if(supermodule > 10)
beb28b95 65 nRow = nRow2;
f565d89d 66 for(Int_t column=0; column<nCol; column++) {
67 for(Int_t row=0; row<nRow; row++) {
68 fADCchannel[supermodule][column][row] =
69 calibda.GetADCchannel(supermodule,column,row);
70 fADCpedestal[supermodule][column][row] =
71 calibda.GetADCpedestal(supermodule,column,row);
72 }
73 }
74 }
75}
76
77
78//________________________________________________________________
79AliEMCALCalibData &AliEMCALCalibData::operator =(const AliEMCALCalibData& calibda)
80{
81 // assignment operator
82 SetName(calibda.GetName());
83 SetTitle(calibda.GetName());
84 Reset();
85
86 Int_t nSMod = 12;
87 Int_t nCol = 48;
88 Int_t nRow = 24;
beb28b95 89 Int_t nRow2 = 12; //Modules 11 and 12 are half modules
f565d89d 90
91 for(Int_t supermodule=0; supermodule<nSMod; supermodule++) {
92 if(supermodule > 10)
beb28b95 93 nRow = nRow2;
f565d89d 94 for(Int_t column=0; column<nCol; column++) {
95 for(Int_t row=0; row<nRow; row++) {
96 fADCchannel[supermodule][column][row] =
97 calibda.GetADCchannel(supermodule,column,row);
98 fADCpedestal[supermodule][column][row] =
99 calibda.GetADCpedestal(supermodule,column,row);
100 }
101 }
102 }
103 return *this;
104}
105
106//________________________________________________________________
107AliEMCALCalibData::~AliEMCALCalibData()
108{
109 // Destructor
110}
111
112//________________________________________________________________
113void AliEMCALCalibData::Reset()
114{
115 // Set all pedestals to 0 and all ADC channels widths to 1
116 memset(fADCchannel ,1,12*48*24*sizeof(Float_t));
117 memset(fADCpedestal,0,12*48*24*sizeof(Float_t));
118}
119
120//________________________________________________________________
121void AliEMCALCalibData::Print(Option_t *option) const
122{
123 // Print tables of pedestals and ADC channels widths
124
125 Int_t nSMod = 12;
126 Int_t nCol = 48;
127 Int_t nRow = 24;
beb28b95 128 Int_t nRow2 = 12; //Modules 11 and 12 are half modules
f565d89d 129 if (strstr(option,"ped")) {
130 printf("\n ---- Pedestal values ----\n\n");
131 for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
132 if(supermodule > 10)
beb28b95 133 nRow = nRow2;
f565d89d 134 printf("============== Supermodule %d\n",supermodule+1);
135 for (Int_t column=0; column<nCol; column++){
136 for (Int_t row=0; row<nRow; row++){
137 printf("%4.1f",fADCpedestal[supermodule][column][row]);
138 }
139 printf("\n");
140 }
141 }
142 }
143
144
145 if (strstr(option,"gain")) {
146 printf("\n ---- ADC channel values ----\n\n");
147 for (Int_t supermodule=0; supermodule<nSMod; supermodule++){
148 if(supermodule > 10)
beb28b95 149 nRow = nRow2;
f565d89d 150 printf("============== Supermodule %d\n",supermodule+1);
151 for (Int_t column=0; column<nCol; column++){
152 for (Int_t row=0; row<nRow; row++){
153 printf("%4.1f",fADCchannel[supermodule][column][row]);
154 }
155 printf("\n");
156 }
157 }
158 }
159}
160
161//________________________________________________________________
162Float_t AliEMCALCalibData::GetADCchannel(Int_t supermodule, Int_t column, Int_t row) const
163{
164 // Set ADC channel witdth values
63b315c5 165 // All indexes start from 0!
166 // Supermodule, column,raw should follow the ALICE convention:
167 // supermodule 0:11, column 0:47, row 0:23
f565d89d 168
63b315c5 169 return fADCchannel[supermodule][column][row];
f565d89d 170}
171
172//________________________________________________________________
173Float_t AliEMCALCalibData::GetADCpedestal(Int_t supermodule, Int_t column, Int_t row) const
174{
175 // Get ADC pedestal values
63b315c5 176 return fADCpedestal[supermodule][column][row];
f565d89d 177}
178
179//________________________________________________________________
180void AliEMCALCalibData::SetADCchannel(Int_t supermodule, Int_t column, Int_t row, Float_t value)
181{
182 // Set ADC channel width values
63b315c5 183 fADCchannel[supermodule][column][row] = value;
f565d89d 184}
185
186//________________________________________________________________
187void AliEMCALCalibData::SetADCpedestal(Int_t supermodule, Int_t column, Int_t row, Float_t value)
188{
189 // Set ADC pedestal values
63b315c5 190 fADCpedestal[supermodule][column][row] = value;
f565d89d 191}