]>
Commit | Line | Data |
---|---|---|
223dda26 | 1 | /************************************************************************** |
2 | * Copyright(c) 2007-2009, 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 | /// This class provides storage container ITS SSD module callibration data | |
21 | /// used by DA. | |
22 | /// | |
23 | /////////////////////////////////////////////////////////////////////////////// | |
24 | ||
25 | #include "AliITSNoiseSSD.h" | |
f67db810 | 26 | #include "AliITSModuleDaSSD.h" |
c4d90345 | 27 | #include "TString.h" |
28 | #include "AliLog.h" | |
f67db810 | 29 | |
30 | ClassImp(AliITSModuleDaSSD) | |
31 | ||
c4d90345 | 32 | |
33 | const Int_t AliITSModuleDaSSD::fgkStripsPerModule = 1536; // Number of strips per SSD module | |
34 | const Int_t AliITSModuleDaSSD::fgkPNStripsPerModule = 768; // Number of N/P strips per SSD module | |
35 | const Int_t AliITSModuleDaSSD::fgkStripsPerChip = 128; // Number of strips per chip HAL25 | |
36 | const UChar_t AliITSModuleDaSSD::fgkMaxAdNumber = 9; // MAx SSD FEROM AD number | |
37 | const UChar_t AliITSModuleDaSSD::fgkMaxAdcNumber = 13; // MAx SSD FEROM ADC number | |
38 | const Int_t AliITSModuleDaSSD::fgkChipsPerModule = 12; // Number of HAL25 chips per SSD module | |
39 | ||
40 | ||
41 | ||
f67db810 | 42 | using namespace std; |
43 | ||
c4d90345 | 44 | //______________________________________________________________________________ |
f67db810 | 45 | AliITSModuleDaSSD::AliITSModuleDaSSD() : |
46 | fEquipId(0), | |
47 | fEquipType(0), | |
48 | fDdlId(0), | |
49 | fAd(0), | |
50 | fAdc(0), | |
51 | fModuleId(0), | |
52 | fNumberOfStrips(0), | |
53 | fStrips(NULL), | |
c4d90345 | 54 | fNumberOfChips(0), |
55 | fCm(NULL), | |
f67db810 | 56 | fEventsNumber(0) |
57 | { | |
223dda26 | 58 | // Default constructor |
f67db810 | 59 | } |
60 | ||
61 | ||
c4d90345 | 62 | //______________________________________________________________________________ |
f67db810 | 63 | AliITSModuleDaSSD::AliITSModuleDaSSD(const UChar_t ddlID, const UChar_t ad, const UChar_t adc, const UShort_t moduleID) : |
64 | fEquipId(0), | |
65 | fEquipType(0), | |
66 | fDdlId(ddlID), | |
67 | fAd(ad), | |
68 | fAdc(adc), | |
69 | fModuleId(moduleID), | |
70 | fNumberOfStrips(0), | |
71 | fStrips(NULL), | |
c4d90345 | 72 | fNumberOfChips(0), |
73 | fCm(NULL), | |
f67db810 | 74 | fEventsNumber(0) |
75 | { | |
223dda26 | 76 | // Constructor, set module id data |
f67db810 | 77 | } |
78 | ||
79 | ||
80 | ||
c4d90345 | 81 | //______________________________________________________________________________ |
f67db810 | 82 | AliITSModuleDaSSD::AliITSModuleDaSSD(const Int_t numberofstrips) : |
83 | fEquipId(0), | |
84 | fEquipType(0), | |
85 | fDdlId(0), | |
86 | fAd(0), | |
87 | fAdc(0), | |
88 | fModuleId(0), | |
89 | fNumberOfStrips(0), | |
90 | fStrips(NULL), | |
c4d90345 | 91 | fNumberOfChips(0), |
92 | fCm(NULL), | |
f67db810 | 93 | fEventsNumber(0) |
94 | { | |
223dda26 | 95 | // Constructor, allocates memory for AliITSChannelDaSSD* |
f67db810 | 96 | if (numberofstrips != fgkStripsPerModule) |
c4d90345 | 97 | AliWarning(Form("AliITSModuleDaSSD: ALICE ITS SSD Module contains %i strips", fgkStripsPerModule)); |
223dda26 | 98 | fStrips = new (nothrow) AliITSChannelDaSSD* [numberofstrips]; |
99 | if (fStrips) { | |
f67db810 | 100 | fNumberOfStrips = numberofstrips; |
101 | for (Int_t i = 0; i < numberofstrips; i++) fStrips[i]= NULL; | |
223dda26 | 102 | } else { |
c4d90345 | 103 | AliError(Form("AliITSModuleDaSSD: Error allocating memory for %i AliITSChannelDaSSD* objects!", numberofstrips)); |
f67db810 | 104 | fNumberOfStrips = 0; |
105 | fStrips = NULL; | |
223dda26 | 106 | } |
f67db810 | 107 | } |
108 | ||
109 | ||
c4d90345 | 110 | //______________________________________________________________________________ |
f67db810 | 111 | AliITSModuleDaSSD::AliITSModuleDaSSD(const Int_t numberofstrips, const Long_t eventsnumber) : |
112 | fEquipId(0), | |
113 | fEquipType(0), | |
114 | fDdlId(0), | |
115 | fAd(0), | |
116 | fAdc(0), | |
117 | fModuleId(0), | |
118 | fNumberOfStrips(0), | |
119 | fStrips(NULL), | |
c4d90345 | 120 | fNumberOfChips(0), |
121 | fCm(NULL), | |
f67db810 | 122 | fEventsNumber(0) |
123 | { | |
223dda26 | 124 | // Constructor, allocates memory for AliITSChannelDaSSD* and events data |
f67db810 | 125 | if (numberofstrips != fgkStripsPerModule) |
c4d90345 | 126 | AliWarning(Form("AliITSModuleDaSSD: ALICE ITS SSD Module contains %i strips", fgkStripsPerModule)); |
223dda26 | 127 | fStrips = new (nothrow) AliITSChannelDaSSD* [numberofstrips]; |
128 | if (fStrips) { | |
f67db810 | 129 | fNumberOfStrips = numberofstrips; |
223dda26 | 130 | memset(fStrips, 0, numberofstrips * sizeof(AliITSChannelDaSSD*)); |
131 | for (Int_t i = 0; i < fNumberOfStrips; i++) { | |
132 | fStrips[i] = new AliITSChannelDaSSD(i, eventsnumber); | |
c4d90345 | 133 | if (!fStrips[i]) AliError(Form("AliITSModuleDaSSD: Error allocating memory for AliITSChannelDaSSD %i-th object", i)); |
223dda26 | 134 | } |
135 | } else { | |
c4d90345 | 136 | AliError(Form("AliITSModuleDaSSD: Error allocating memory for %i AliITSChannelDaSSD* objects!", numberofstrips)); |
f67db810 | 137 | fNumberOfStrips = 0; |
138 | fStrips = NULL; | |
f67db810 | 139 | } |
140 | } | |
141 | ||
142 | ||
143 | ||
c4d90345 | 144 | //______________________________________________________________________________ |
f67db810 | 145 | AliITSModuleDaSSD::AliITSModuleDaSSD(const AliITSModuleDaSSD& module) : |
146 | TObject(module), | |
147 | fEquipId(module.fEquipId), | |
148 | fEquipType(module.fEquipType), | |
149 | fDdlId(module.fDdlId), | |
150 | fAd(module.fAd), | |
151 | fAdc(module.fAdc), | |
152 | fModuleId(module.fModuleId), | |
153 | fNumberOfStrips(module.fNumberOfStrips), | |
154 | fStrips(module.fStrips), | |
c4d90345 | 155 | fNumberOfChips(module.fNumberOfChips), |
156 | fCm(module.fCm), | |
f67db810 | 157 | fEventsNumber(module.fEventsNumber) |
158 | { | |
223dda26 | 159 | // copy constructor |
f67db810 | 160 | |
c4d90345 | 161 | AliFatal("AliITSModuleDaSSD, copy constructor not implemented"); |
f67db810 | 162 | } |
163 | ||
164 | ||
165 | ||
c4d90345 | 166 | //______________________________________________________________________________ |
f67db810 | 167 | AliITSModuleDaSSD& AliITSModuleDaSSD::operator = (const AliITSModuleDaSSD& module) |
168 | { | |
169 | // assignment operator | |
170 | ||
c4d90345 | 171 | AliFatal("AliITSModuleDaSSD: operator =, assignment operator not implemented"); |
f67db810 | 172 | return *this; |
173 | } | |
174 | ||
175 | ||
176 | ||
c4d90345 | 177 | //______________________________________________________________________________ |
f67db810 | 178 | AliITSModuleDaSSD::~AliITSModuleDaSSD() |
179 | { | |
223dda26 | 180 | // Destructor |
f67db810 | 181 | if (fStrips) |
182 | { | |
183 | for (Long_t i = 0; i < fNumberOfStrips; i++) | |
184 | { | |
185 | if (fStrips[i]) delete fStrips[i]; | |
f67db810 | 186 | } |
187 | delete [] fStrips; | |
188 | } | |
c4d90345 | 189 | if (fCm) delete [] fCm; |
190 | } | |
191 | ||
192 | ||
193 | ||
194 | //______________________________________________________________________________ | |
195 | Bool_t AliITSModuleDaSSD::SetNumberOfStrips(const Int_t numberofstrips) | |
196 | { | |
197 | // Allocates memory for AliITSChannelDaSSD* | |
198 | if (fStrips) { | |
199 | for (Int_t i = 0; i < fNumberOfStrips; i++) if (fStrips[i]) delete fStrips[i]; | |
200 | delete [] fStrips; | |
201 | fStrips = NULL; | |
202 | } | |
203 | if (numberofstrips <= 0) {fNumberOfStrips = 0; return kTRUE; } | |
204 | if (numberofstrips != fgkStripsPerModule) | |
205 | AliWarning(Form("AliITSModuleDaSSD: ALICE ITS SSD Module contains %i strips", fgkStripsPerModule)); | |
206 | fStrips = new (nothrow) AliITSChannelDaSSD* [numberofstrips]; | |
207 | if (fStrips) { | |
208 | fNumberOfStrips = numberofstrips; | |
209 | memset(fStrips, 0, sizeof(AliITSChannelDaSSD*) * numberofstrips); | |
210 | return kTRUE; | |
211 | } else { | |
212 | AliError(Form("AliITSModuleDaSSD: Error allocating memory for %i AliITSChannelDaSSD* objects!", numberofstrips)); | |
213 | fNumberOfStrips = 0; | |
214 | fStrips = NULL; | |
215 | return kFALSE; | |
216 | } | |
f67db810 | 217 | } |
218 | ||
219 | ||
c4d90345 | 220 | //______________________________________________________________________________ |
221 | Bool_t AliITSModuleDaSSD::SetNumberOfChips(const Int_t nchips) | |
222 | { | |
223 | // Allocate nchips TArrayF objects to save Common Mode | |
224 | DeleteCM(); | |
225 | if (nchips <= 0) {fNumberOfChips = 0; return kTRUE; } | |
226 | if (nchips != fgkChipsPerModule) | |
227 | AliWarning(Form("AliITSModuleDaSSD: ALICE ITS SSD Module contains %i HAL25 chips", fgkChipsPerModule)); | |
228 | fCm = new (nothrow) TArrayF [nchips]; | |
229 | if (fCm) { | |
230 | fNumberOfChips = nchips; | |
231 | return kTRUE; | |
232 | } else { | |
233 | AliError(Form("AliITSModuleDaSSD: Error allocating memory for %i TArrayF objects!", nchips)); | |
234 | fNumberOfChips = 0; | |
235 | fCm = NULL; | |
236 | return kFALSE; | |
237 | } | |
238 | } | |
239 | ||
f67db810 | 240 | |
c4d90345 | 241 | //______________________________________________________________________________ |
242 | Bool_t AliITSModuleDaSSD::SetModuleIdData (const UChar_t ddlID, const UChar_t ad, const UChar_t adc, const Short_t moduleID) | |
f67db810 | 243 | { |
223dda26 | 244 | // SetModuleIdData |
f67db810 | 245 | if (ad > fgkMaxAdNumber) { |
c4d90345 | 246 | AliWarning(Form("AliITSModuleDaSSD: Wrong AD number: %i", ad)); |
f67db810 | 247 | return kFALSE; |
248 | } | |
249 | if (adc > fgkMaxAdcNumber || ForbiddenAdcNumber(adc)) { | |
c4d90345 | 250 | AliWarning(Form("AliITSModuleDaSSD: Wrong ADC number: %i", adc)); |
f67db810 | 251 | return kFALSE; |
252 | } | |
253 | fDdlId = ddlID; | |
254 | fAd = ad; | |
255 | fAdc = adc; | |
256 | fModuleId = moduleID; | |
257 | return kTRUE; | |
258 | } | |
259 | ||
260 | ||
c4d90345 | 261 | //______________________________________________________________________________ |
f67db810 | 262 | void AliITSModuleDaSSD::SetModuleFEEId (const UChar_t ddlID, const UChar_t ad, const UChar_t adc) |
263 | { | |
223dda26 | 264 | // Set id data of FEE connected to the Module |
f67db810 | 265 | fDdlId = ddlID; |
266 | fAd = ad; | |
267 | fAdc = adc; | |
268 | } | |
269 | ||
270 | ||
c4d90345 | 271 | //______________________________________________________________________________ |
f67db810 | 272 | void AliITSModuleDaSSD::SetModuleRorcId (const Int_t equipid, const Int_t equiptype) |
273 | { | |
223dda26 | 274 | // Set data to access FEROM registres via DDL |
f67db810 | 275 | fEquipId = equipid; |
276 | fEquipType = equiptype; | |
277 | } | |
278 | ||
279 | ||
c4d90345 | 280 | //______________________________________________________________________________ |
f67db810 | 281 | Bool_t AliITSModuleDaSSD::SetEventsNumber(const Long_t eventsnumber) |
282 | { | |
00e18e8f | 283 | // Allocate the memory for the events data |
f67db810 | 284 | Int_t i; |
285 | if (!fStrips) return kFALSE; | |
00e18e8f | 286 | for (i = 0; i < fNumberOfStrips; i++) { |
287 | if (fStrips[i]) | |
288 | if (!fStrips[i]->SetEvenetsNumber(eventsnumber)) { | |
289 | for (Int_t j = 0; j < i; j++) fStrips[j]->DeleteSignal(); | |
c4d90345 | 290 | AliError(Form("AliITSModuleDaSSD: Error allocating memory for i% events for module %i, strip %i", |
291 | eventsnumber, (Int_t)fModuleId, i)); | |
00e18e8f | 292 | return kFALSE; |
293 | } | |
294 | else | |
295 | if (!(fStrips[i] = new AliITSChannelDaSSD(i, eventsnumber))) { | |
296 | for (Int_t j = 0; j < i; j++) delete fStrips[j]; | |
297 | delete [] fStrips; | |
298 | fNumberOfStrips = 0; | |
299 | fStrips = NULL; | |
c4d90345 | 300 | AliError(Form("AliITSModuleDaSSD: Error allocating memory for strip %i of module %i!", (Int_t)fModuleId, i)); |
00e18e8f | 301 | return kFALSE; |
302 | } | |
303 | } | |
f67db810 | 304 | return kTRUE; |
305 | } | |
306 | ||
307 | ||
308 | ||
c4d90345 | 309 | //______________________________________________________________________________ |
310 | Bool_t AliITSModuleDaSSD::SetCM (const Float_t cm, const Int_t chipn, const Int_t evn) | |
311 | { | |
312 | // Set value of CM for a given chip and event | |
313 | if ((!fCm) || (chipn >= fNumberOfChips)) return kFALSE; | |
314 | if (evn >= fCm[chipn].GetSize()) return kFALSE; | |
315 | else fCm[chipn][evn] = cm; | |
316 | return kTRUE; | |
317 | } | |
318 | ||
319 | ||
320 | ||
321 | //______________________________________________________________________________ | |
322 | Float_t AliITSModuleDaSSD::GetCM(const Int_t chipn, const Long_t evn) const | |
323 | { | |
324 | // Get value of CM for a given chip and event | |
325 | if ((!fCm) || (chipn >= fNumberOfChips)) return 0.0f; | |
326 | if (evn >= fCm[chipn].GetSize()) return 0.0f; | |
327 | else return fCm[chipn][evn]; | |
328 | } | |
329 | ||
330 | ||
331 | ||
332 | //______________________________________________________________________________ | |
f67db810 | 333 | AliITSNoiseSSD* AliITSModuleDaSSD::GetCalibrationSSDModule() const |
334 | { | |
223dda26 | 335 | // Creates the AliITSNoiseSSD objects with callibration data |
f67db810 | 336 | AliITSNoiseSSD *mc; |
c4d90345 | 337 | Float_t noise; |
f67db810 | 338 | if (!fStrips) return NULL; |
339 | mc = new AliITSNoiseSSD(); | |
340 | mc->SetMod(fModuleId); | |
341 | mc->SetNNoiseP(fgkPNStripsPerModule); | |
342 | mc->SetNNoiseN(fgkPNStripsPerModule); | |
343 | for (Int_t i = 0; i < fNumberOfStrips; i++) { | |
c4d90345 | 344 | if (!fStrips[i]) noise = AliITSChannelDaSSD::GetUndefinedValue(); |
345 | else noise = fStrips[i]->GetNoiseCM(); | |
f67db810 | 346 | if (i < fgkPNStripsPerModule) |
c4d90345 | 347 | mc->AddNoiseP(i, noise); |
348 | else mc->AddNoiseN((AliITSChannelDaSSD::GetMaxStripIdConst() - i), noise); | |
f67db810 | 349 | } |
350 | return mc; | |
351 | } |