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