]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/Cal/AliTRDCalROC.cxx
Incrementing the version in AliRunTag
[u/mrichter/AliRoot.git] / TRD / Cal / AliTRDCalROC.cxx
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
18 ///////////////////////////////////////////////////////////////////////////////
19 //                                                                           //
20 //  Calibration base class for a single ROC                                  //
21 //  Contains one UShort_t value per pad                                      //
22 //  However, values are set and get as float, there are stored internally as //
23 //  (UShort_t) value * 10000                                                 //
24 //                                                                           //
25 ///////////////////////////////////////////////////////////////////////////////
26
27 #include "AliTRDCalROC.h"
28
29 ClassImp(AliTRDCalROC)
30
31 //_____________________________________________________________________________
32 AliTRDCalROC::AliTRDCalROC()
33   :TObject()
34   ,fPla(0)
35   ,fCha(0)
36   ,fNrows(0)
37   ,fNcols(0)
38   ,fNchannels(0)
39   ,fData(0)
40 {
41   //
42   // Default constructor
43   //
44
45 }
46
47 //_____________________________________________________________________________
48 AliTRDCalROC::AliTRDCalROC(Int_t p, Int_t c)
49   :TObject()
50   ,fPla(p)
51   ,fCha(c)
52   ,fNrows(0)
53   ,fNcols(144)
54   ,fNchannels(0)
55   ,fData(0)
56 {
57   //
58   // Constructor that initializes a given pad plane type
59   //
60
61   //
62   // The pad plane parameter
63   //
64   switch (p) {
65   case 0:
66     if (c == 2) {
67       // L0C0 type
68       fNrows        =  12;
69     }
70     else {
71       // L0C1 type
72       fNrows        =  16;
73     }
74     break;
75   case 1:
76     if (c == 2) {
77       // L1C0 type
78       fNrows        =  12;
79     }
80     else {
81       // L1C1 type
82       fNrows        =  16;
83     }
84     break;
85   case 2:
86     if (c == 2) {
87       // L2C0 type
88       fNrows        =  12;
89     }
90     else {
91       // L2C1 type
92       fNrows        =  16;
93     }
94     break;
95   case 3:
96     if (c == 2) {
97       // L3C0 type
98       fNrows        =  12;
99     }
100     else {
101       // L3C1 type
102       fNrows        =  16;
103     }
104     break;
105   case 4:
106     if (c == 2) {
107       // L4C0 type
108       fNrows        =  12;
109     }
110     else {
111       // L4C1 type
112       fNrows        =  16;
113     }
114     break;
115   case 5:
116     if (c == 2) {
117       // L5C0 type
118       fNrows        =  12;
119     }
120     else {
121       // L5C1 type
122       fNrows        =  16;
123     }
124     break;
125   };
126
127   fNchannels = fNrows * fNcols;
128   if (fNchannels != 0) {
129     fData = new UShort_t[fNchannels];
130   }
131
132   for (Int_t i=0; i<fNchannels; ++i) {
133     fData[i] = 0;
134   }
135
136 }
137
138 //_____________________________________________________________________________
139 AliTRDCalROC::AliTRDCalROC(const AliTRDCalROC &c)
140   :TObject(c)
141   ,fPla(c.fPla)
142   ,fCha(c.fCha)
143   ,fNrows(c.fNrows)
144   ,fNcols(c.fNcols)
145   ,fNchannels(c.fNchannels)
146   ,fData(0)
147 {
148   //
149   // AliTRDCalROC copy constructor
150   //
151
152   Int_t iBin = 0;
153
154   if (((AliTRDCalROC &) c).fData) delete [] ((AliTRDCalROC &) c).fData;
155   ((AliTRDCalROC &) c).fData = new UShort_t[fNchannels];
156   for (iBin = 0; iBin < fNchannels; iBin++) {
157     ((AliTRDCalROC &) c).fData[iBin] = fData[iBin];
158   }
159
160 }
161
162 //_____________________________________________________________________________
163 AliTRDCalROC::~AliTRDCalROC()
164 {
165   //
166   // AliTRDCalROC destructor
167   //
168
169   if (fData) {
170     delete [] fData;
171     fData = 0;
172   }
173
174 }
175
176 //_____________________________________________________________________________
177 AliTRDCalROC &AliTRDCalROC::operator=(const AliTRDCalROC &c)
178 {
179   //
180   // Assignment operator
181   //
182
183   if (this != &c) ((AliTRDCalROC &) c).Copy(*this);
184   return *this;
185
186 }
187
188 //_____________________________________________________________________________
189 void AliTRDCalROC::Copy(TObject &c) const
190 {
191   //
192   // Copy function
193   //
194
195   ((AliTRDCalROC &) c).fPla          = fPla;
196   ((AliTRDCalROC &) c).fCha          = fCha;
197
198   ((AliTRDCalROC &) c).fNrows        = fNrows;
199   ((AliTRDCalROC &) c).fNcols        = fNcols;
200
201   Int_t iBin = 0;
202
203   ((AliTRDCalROC &) c).fNchannels = fNchannels;
204
205   if (((AliTRDCalROC &) c).fData) delete [] ((AliTRDCalROC &) c).fData;
206   ((AliTRDCalROC &) c).fData = new UShort_t[fNchannels];
207   for (iBin = 0; iBin < fNchannels; iBin++) {
208     ((AliTRDCalROC &) c).fData[iBin] = fData[iBin];
209   }
210
211   TObject::Copy(c);
212
213 }
214
215 //_____________________________________________________________________________
216 void AliTRDCalROC::Scale(Float_t value)
217 {
218   //
219   // Scales all values of this ROC with the provided parameter. Is used if ROC defines
220   // local variations of a global (or per detector defined) parameter
221   //
222
223   for (Int_t iBin = 0; iBin < fNchannels; iBin++) {
224     fData[iBin] = (UShort_t) (value * fData[iBin]);
225   }
226
227 }