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