]>
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 ITS SSD data handling | |
21 | /// used by DA. | |
22 | /// | |
23 | /////////////////////////////////////////////////////////////////////////////// | |
24 | ||
25 | #include <Riostream.h> | |
f67db810 | 26 | #include "AliITSHandleDaSSD.h" |
223dda26 | 27 | #include <math.h> |
c4d90345 | 28 | #include <limits.h> |
223dda26 | 29 | #include "event.h" |
30 | #include "TFile.h" | |
c4d90345 | 31 | #include "TString.h" |
223dda26 | 32 | #include "TObjArray.h" |
c4d90345 | 33 | #include "AliLog.h" |
223dda26 | 34 | #include "AliITSNoiseSSD.h" |
c4d90345 | 35 | #include "AliITSRawStreamSSD.h" |
223dda26 | 36 | #include "AliRawReaderDate.h" |
37 | ||
38 | #include "AliITSChannelDaSSD.h" | |
f67db810 | 39 | |
40 | ||
41 | ClassImp(AliITSHandleDaSSD) | |
42 | ||
43 | using namespace std; | |
44 | ||
45 | ||
c4d90345 | 46 | const Int_t AliITSHandleDaSSD::fgkNumberOfSSDModules = 1698; // Number of SSD modules in ITS |
47 | const Int_t AliITSHandleDaSSD::fgkNumberOfSSDModulesPerDdl = 108; // Number of SSD modules in ITS | |
48 | const Float_t AliITSHandleDaSSD::fgkPedestalThresholdFactor = 3.0; // Defalt value for fPedestalThresholdFactor | |
49 | const Float_t AliITSHandleDaSSD::fgkCmThresholdFactor = 3.0; // Defalt value for fCmThresholdFactor | |
50 | ||
51 | //______________________________________________________________________________ | |
f67db810 | 52 | AliITSHandleDaSSD::AliITSHandleDaSSD() : |
c4d90345 | 53 | fRawDataFileName(NULL), |
f67db810 | 54 | fNumberOfModules(0), |
55 | fModules(NULL), | |
c4d90345 | 56 | fModIndProcessed(0), |
57 | fModIndRead(0), | |
58 | fNumberOfEvents(0), | |
f67db810 | 59 | fLdcId(0), |
c4d90345 | 60 | fRunId(0), |
61 | fPedestalThresholdFactor(fgkPedestalThresholdFactor), | |
62 | fCmThresholdFactor(fgkCmThresholdFactor) | |
f67db810 | 63 | { |
223dda26 | 64 | // Default constructor |
f67db810 | 65 | } |
66 | ||
67 | ||
c4d90345 | 68 | //______________________________________________________________________________ |
69 | AliITSHandleDaSSD::AliITSHandleDaSSD(Char_t *rdfname) : | |
70 | fRawDataFileName(NULL), | |
f67db810 | 71 | fNumberOfModules(0), |
72 | fModules(NULL), | |
c4d90345 | 73 | fModIndProcessed(0), |
74 | fModIndRead(0), | |
75 | fNumberOfEvents(0), | |
f67db810 | 76 | fLdcId(0), |
c4d90345 | 77 | fRunId(0), |
78 | fPedestalThresholdFactor(fgkPedestalThresholdFactor) , | |
79 | fCmThresholdFactor(fgkCmThresholdFactor) | |
f67db810 | 80 | { |
c4d90345 | 81 | if (!Init(rdfname)) AliError("AliITSHandleDaSSD::AliITSHandleDaSSD() initialization error!"); |
f67db810 | 82 | } |
83 | ||
84 | ||
c4d90345 | 85 | //______________________________________________________________________________ |
f67db810 | 86 | AliITSHandleDaSSD::AliITSHandleDaSSD(const AliITSHandleDaSSD& ssdadldc) : |
87 | TObject(ssdadldc), | |
c4d90345 | 88 | fRawDataFileName(ssdadldc.fRawDataFileName), |
f67db810 | 89 | fNumberOfModules(ssdadldc.fNumberOfModules), |
90 | fModules(ssdadldc.fModules), | |
c4d90345 | 91 | fModIndProcessed(ssdadldc.fModIndProcessed), |
92 | fModIndRead(ssdadldc.fModIndRead), | |
93 | fNumberOfEvents(ssdadldc.fNumberOfEvents), | |
f67db810 | 94 | fLdcId(ssdadldc.fLdcId), |
c4d90345 | 95 | fRunId(ssdadldc.fRunId), |
96 | fPedestalThresholdFactor(ssdadldc.fPedestalThresholdFactor), | |
97 | fCmThresholdFactor(ssdadldc.fCmThresholdFactor) | |
f67db810 | 98 | { |
99 | // copy constructor | |
100 | ||
c4d90345 | 101 | AliFatal("AliITSHandleDaSSD, copy constructor not implemented"); |
f67db810 | 102 | } |
103 | ||
104 | ||
c4d90345 | 105 | //______________________________________________________________________________ |
f67db810 | 106 | AliITSHandleDaSSD& AliITSHandleDaSSD::operator = (const AliITSHandleDaSSD& ssdadldc) |
107 | { | |
108 | // assignment operator | |
109 | ||
c4d90345 | 110 | AliFatal("operator =, assignment operator not implemented"); |
f67db810 | 111 | return *this; |
112 | } | |
113 | ||
114 | ||
c4d90345 | 115 | //______________________________________________________________________________ |
f67db810 | 116 | AliITSHandleDaSSD::~AliITSHandleDaSSD() |
223dda26 | 117 | { |
118 | // Default destructor | |
f67db810 | 119 | if (fModules) |
120 | { | |
121 | for (Int_t i = 0; i < fNumberOfModules; i++) | |
122 | { | |
123 | if (fModules[i]) delete fModules[i]; | |
124 | } | |
125 | delete [] fModules; | |
126 | } | |
127 | } | |
128 | ||
129 | ||
130 | ||
c4d90345 | 131 | //______________________________________________________________________________ |
132 | void AliITSHandleDaSSD::Reset() | |
133 | { | |
134 | // Delete array of AliITSModuleDaSSD* objects. | |
135 | if (fModules) { | |
136 | for (Int_t i = 0; i < fNumberOfModules; i++) if (fModules[i]) delete fModules[i]; | |
137 | delete [] fModules; | |
138 | fModules = NULL; | |
139 | } | |
140 | fRawDataFileName = NULL; | |
141 | fModIndProcessed = fModIndRead = 0; | |
142 | fNumberOfEvents = 0; | |
143 | fLdcId = fRunId = 0; | |
144 | fPedestalThresholdFactor = fgkPedestalThresholdFactor; | |
145 | fCmThresholdFactor = fgkCmThresholdFactor; | |
146 | } | |
147 | ||
148 | ||
149 | ||
150 | //______________________________________________________________________________ | |
151 | Bool_t AliITSHandleDaSSD::Init(Char_t *rdfname, const Char_t *configfname) | |
152 | { | |
153 | // Read raw data file and set initial and configuration parameters | |
154 | Long_t physeventind = 0, strn = 0, nofstripsev, nofstrips = 0; | |
155 | Int_t nofeqipmentev, nofeqipment = 0, eqn = 0; | |
156 | AliRawReaderDate *rawreaderdate = NULL; | |
157 | UChar_t *data = NULL; | |
158 | Long_t datasize = 0, eqbelsize = 1; | |
159 | ||
160 | if (configfname) ReadConfigurationFile(configfname); | |
161 | rawreaderdate = new AliRawReaderDate(rdfname, 0); | |
162 | if (!(rawreaderdate->GetAttributes() || rawreaderdate->GetEventId())) { | |
163 | AliError(Form("AliITSHandleDaSSD: Error reading raw data file %s by RawReaderDate", rdfname)); | |
164 | MakeZombie(); | |
165 | return kFALSE; | |
166 | } | |
167 | if (rawreaderdate->NextEvent()) { | |
168 | fLdcId = rawreaderdate->GetLDCId(); | |
169 | fRunId = rawreaderdate->GetRunNumber(); | |
170 | rawreaderdate->RewindEvents(); | |
171 | } else { MakeZombie(); return kFALSE; } | |
172 | if (fModules) Reset(); | |
173 | rawreaderdate->SelectEvents(-1); | |
174 | nofstrips = 0; | |
175 | while (rawreaderdate->NextEvent()) { | |
176 | if ((rawreaderdate->GetType() != PHYSICS_EVENT) && (rawreaderdate->GetType() != CALIBRATION_EVENT)) continue; | |
177 | nofstripsev = 0; | |
178 | nofeqipmentev = 0; | |
179 | while (rawreaderdate->ReadNextData(data)) { | |
180 | nofeqipmentev += 1; | |
181 | datasize = rawreaderdate->GetDataSize(); | |
182 | eqbelsize = rawreaderdate->GetEquipmentElementSize(); | |
183 | if ( (datasize % eqbelsize) || (eqbelsize != sizeof(long32)) ) { | |
184 | AliError(Form("AliITSHandleDaSSD: Error Init(%s): event data size %i is not an integer of equipment data size %i", | |
185 | rdfname, datasize, eqbelsize)); | |
186 | MakeZombie(); | |
187 | return kFALSE; | |
188 | } | |
189 | nofstripsev += (Int_t) (datasize / eqbelsize); | |
190 | } | |
191 | if (physeventind++) { | |
192 | if (nofstrips != nofstripsev) AliWarning("AliITSHandleDaSSD: number of strips varies from event to evnt"); | |
193 | if (nofeqipment != nofeqipmentev) AliWarning("AliITSHandleDaSSD: number of DDLs varies from event to evnt"); | |
194 | } | |
195 | nofstrips = nofstripsev; | |
196 | nofeqipment = nofeqipmentev; | |
197 | if (strn < nofstrips) strn = nofstrips; | |
198 | if (eqn < nofeqipment) eqn = nofeqipment; | |
199 | } | |
200 | delete rawreaderdate; | |
201 | if ((physeventind > 0) && (strn > 0)) | |
202 | { | |
203 | fNumberOfEvents = physeventind; | |
204 | fRawDataFileName = rdfname; | |
205 | if (SetNumberOfModules(fgkNumberOfSSDModules)) { | |
206 | TString str = Form("Max number of equipment: %i, max number of channels: %i\n", eqn, strn); | |
207 | DumpInitData(str.Data()); | |
208 | return kTRUE; | |
209 | } | |
210 | } | |
211 | MakeZombie(); | |
212 | return kFALSE; | |
213 | } | |
214 | ||
215 | ||
216 | //______________________________________________________________________________ | |
217 | Bool_t AliITSHandleDaSSD::ReadConfigurationFile(const Char_t *configfname) | |
218 | const { | |
219 | // Dowload configuration parameters from configuration file or database | |
220 | return kFALSE; | |
221 | } | |
222 | ||
223 | ||
224 | ||
225 | //______________________________________________________________________________ | |
f67db810 | 226 | AliITSModuleDaSSD* AliITSHandleDaSSD::GetModule (const UChar_t ddlID, const UChar_t ad, const UChar_t adc) const |
227 | { | |
223dda26 | 228 | // Retrieve AliITSModuleDaSSD object from the array |
f67db810 | 229 | if (!fModules) return NULL; |
230 | for (Int_t i = 0; i < fNumberOfModules; i++) { | |
231 | if (fModules[i]) { | |
232 | if ( (fModules[i]->GetDdlId() == ddlID) | |
233 | && (fModules[i]->GetAD() == ad) | |
234 | && (fModules[i]->GetADC() == adc)) | |
235 | return fModules[i]; | |
236 | } | |
237 | } | |
238 | return NULL; | |
239 | } | |
240 | ||
241 | ||
c4d90345 | 242 | Int_t AliITSHandleDaSSD::GetModuleIndex (const UChar_t ddlID, const UChar_t ad, const UChar_t adc) const |
243 | { | |
244 | // Retrieve the position of AliITSModuleDaSSD object in the array | |
245 | if (!fModules) return -1; | |
246 | for (Int_t i = 0; i < fNumberOfModules; i++) { | |
247 | if (fModules[i]) { | |
248 | if ( (fModules[i]->GetDdlId() == ddlID) | |
249 | && (fModules[i]->GetAD() == ad) | |
250 | && (fModules[i]->GetADC() == adc)) | |
251 | return i; | |
252 | } | |
253 | } | |
254 | return -1; | |
255 | } | |
256 | ||
257 | ||
f67db810 | 258 | |
c4d90345 | 259 | //______________________________________________________________________________ |
f67db810 | 260 | AliITSChannelDaSSD* AliITSHandleDaSSD::GetStrip (const UChar_t ddlID, const UChar_t ad, const UChar_t adc, const UShort_t stripID) const |
261 | { | |
223dda26 | 262 | // Retrieve AliITSChannalDaSSD object from the array |
f67db810 | 263 | for (Int_t modind = 0; modind < fNumberOfModules; modind++) { |
264 | if ( (fModules[modind]->GetDdlId() == ddlID) | |
265 | && (fModules[modind]->GetAD() == ad) | |
266 | && (fModules[modind]->GetADC() == adc) ) | |
267 | { | |
268 | return fModules[modind]->GetStrip(stripID); | |
269 | } | |
270 | } | |
c4d90345 | 271 | AliError(Form("AliITSHandleDaSSD: Error GetStrip (%i, %i, %i, %i), strip not found, returns NULL!", |
272 | ddlID, ad, adc, stripID)); | |
f67db810 | 273 | return NULL; |
274 | } | |
275 | ||
276 | ||
277 | ||
c4d90345 | 278 | //______________________________________________________________________________ |
f67db810 | 279 | Bool_t AliITSHandleDaSSD::SetModule(AliITSModuleDaSSD *const module, const Int_t index) |
280 | { | |
223dda26 | 281 | // Assign array element with AliITSModuleDaSSD object |
f67db810 | 282 | if ((index < fNumberOfModules) && (index >= 0)) |
283 | { | |
284 | if (fModules[index]) delete fModules[index]; | |
285 | fModules[index] = module; | |
286 | return kTRUE; | |
287 | } | |
288 | else return kFALSE; | |
289 | } | |
290 | ||
291 | ||
c4d90345 | 292 | |
293 | //______________________________________________________________________________ | |
f67db810 | 294 | Bool_t AliITSHandleDaSSD::SetNumberOfModules (const Int_t numberofmodules) |
295 | { | |
223dda26 | 296 | // Allocates memory for AliITSModuleDaSSD objects |
297 | if (numberofmodules > fgkNumberOfSSDModules) | |
c4d90345 | 298 | AliWarning(Form("AliITSHandleDaSSD: the number of modules %i you use exceeds the maximum %i for ALICE ITS SSD", |
299 | numberofmodules, fgkNumberOfSSDModules)); | |
300 | if (fModules) { | |
301 | for (Int_t i = 0; i < fNumberOfModules; i++) if (fModules[i]) delete fModules[i]; | |
302 | delete [] fModules; | |
303 | fModules = NULL; | |
304 | } | |
223dda26 | 305 | fModules = new (nothrow) AliITSModuleDaSSD* [numberofmodules]; |
306 | if (fModules) { | |
307 | fNumberOfModules = numberofmodules; | |
308 | memset(fModules, 0, sizeof(AliITSModuleDaSSD*) * numberofmodules); | |
309 | return kTRUE; | |
310 | } else { | |
c4d90345 | 311 | AliError(Form("AliITSHandleDaSSD: Error allocating memory for %i AliITSModulesDaSSD* objects!", numberofmodules)); |
f67db810 | 312 | fNumberOfModules = 0; |
313 | fModules = NULL; | |
223dda26 | 314 | } |
f67db810 | 315 | return kFALSE; |
316 | } | |
317 | ||
318 | ||
c4d90345 | 319 | |
320 | //______________________________________________________________________________ | |
321 | Bool_t AliITSHandleDaSSD::ReadCalibrationDataFile (char* fileName, const Long_t eventsnumber) | |
f67db810 | 322 | { |
223dda26 | 323 | // Reads raw data from file |
c4d90345 | 324 | AliRawReaderDate *rawreaderdate = NULL; |
f67db810 | 325 | AliITSModuleDaSSD *module; |
326 | AliITSChannelDaSSD *strip; | |
327 | Long_t datasize, eventind = 0; | |
328 | Int_t nofstrips, eqbelsize; | |
329 | UShort_t modind; | |
330 | long32 *data; | |
c4d90345 | 331 | UChar_t *databyte; |
332 | if (!Init(fileName)){ | |
333 | AliError("AliITSHandleDaSSD: Error ReadCalibrationDataFile"); | |
f67db810 | 334 | return kFALSE; |
335 | } | |
c4d90345 | 336 | rawreaderdate = new AliRawReaderDate(fileName, 0); |
223dda26 | 337 | rawreaderdate->SelectEvents(-1); |
f67db810 | 338 | while (rawreaderdate->NextEvent()) { |
223dda26 | 339 | if ((rawreaderdate->GetType() != PHYSICS_EVENT) && (rawreaderdate->GetType() != CALIBRATION_EVENT)) continue; |
f67db810 | 340 | fLdcId = rawreaderdate->GetLDCId(); |
341 | fRunId = rawreaderdate->GetRunNumber(); | |
342 | modind = 0; | |
c4d90345 | 343 | while (rawreaderdate->ReadNextData(databyte)) { |
344 | data = reinterpret_cast<long32*>(databyte); | |
f67db810 | 345 | Int_t equipid = rawreaderdate->GetEquipmentId(); // EquipmentID required to access to rorc |
346 | Int_t equiptype = rawreaderdate->GetEquipmentType(); // | |
347 | UChar_t ddlID = (UChar_t)rawreaderdate->GetDDLID(); // GetDDLID(); index of DDL, ITS SSD: 33-48 | |
348 | datasize = rawreaderdate->GetDataSize(); | |
349 | eqbelsize = rawreaderdate->GetEquipmentElementSize(); | |
350 | if ( (datasize % eqbelsize) || (eqbelsize != sizeof(long32)) ) { | |
c4d90345 | 351 | AliError(Form("AliITSHandleDaSSD: Error ReadCalibrationDataFile: event data size %i is not an integer of equipment data size %i", |
352 | datasize, eqbelsize)); | |
f67db810 | 353 | return kFALSE; |
354 | } | |
355 | nofstrips = (Int_t) (datasize / eqbelsize); | |
356 | for (Int_t strind = 0; strind < nofstrips; strind++) { | |
357 | UChar_t ad = (UChar_t) (data[strind] >> 28) & 0x0000000F; // index of AD module 0-9 | |
358 | UChar_t adc = (UChar_t) (data[strind] >> 24) & 0x0000000F; // index of ADC module 0-5, 8-13 | |
359 | UShort_t stripID = (UShort_t)(data[strind] >> 12) & 0x000007FF; // strip number 0-1535 | |
360 | Short_t signal = (Short_t)(data[strind] & 0x00000FFF); | |
361 | signal = (signal > AliITSChannelDaSSD::GetUnderflowConst()) ? (signal - 2 * AliITSChannelDaSSD::GetUnderflowConst()) | |
362 | : signal; | |
363 | if (!(module = GetModule(ddlID, ad, adc))) { | |
364 | module = new AliITSModuleDaSSD(AliITSModuleDaSSD::GetStripsPerModuleConst()); | |
c4d90345 | 365 | if (!module->SetModuleIdData (ddlID, ad, adc, RetrieveModuleId(ddlID, ad, adc))) return kFALSE; |
f67db810 | 366 | module->SetModuleRorcId (equipid, equiptype); |
367 | fModules[modind++] = module; | |
368 | } | |
369 | if (!(strip = module->GetStrip(stripID))) { | |
370 | strip = new AliITSChannelDaSSD(stripID, eventsnumber); | |
371 | module->SetStrip(strip, stripID); | |
372 | } | |
373 | strip->SetSignal(eventind, signal); | |
374 | } | |
375 | if (modind) cout << "The memory was allocated for " << modind << " modules." << endl; | |
376 | } | |
377 | if (++eventind > eventsnumber) break; | |
378 | } | |
379 | delete rawreaderdate; | |
380 | return RelocateModules(); | |
381 | } | |
382 | ||
383 | ||
c4d90345 | 384 | |
385 | //______________________________________________________________________________ | |
386 | Int_t AliITSHandleDaSSD::ReadModuleRawData (const Int_t modulesnumber) | |
387 | { | |
388 | // Reads raw data from file | |
389 | AliRawReaderDate *rawreaderdate = NULL; | |
390 | AliITSModuleDaSSD *module; | |
391 | AliITSChannelDaSSD *strip; | |
392 | Long_t datasize, eventind = 0; | |
393 | Int_t nofstrips, eqbelsize; | |
394 | UShort_t modind; | |
395 | long32 *data; | |
396 | UChar_t *databyte; | |
397 | if (!(rawreaderdate = new AliRawReaderDate(fRawDataFileName, 0))) return 0; | |
398 | if (!fModules) { | |
399 | AliError("AliITSHandleDaSSD: Error ReadModuleRawData: no structure was allocated for data"); | |
400 | return 0; | |
401 | } | |
402 | rawreaderdate->SelectEvents(-1); | |
403 | modind = 0; | |
404 | while (rawreaderdate->NextEvent()) { | |
405 | if ((rawreaderdate->GetType() != PHYSICS_EVENT) && (rawreaderdate->GetType() != CALIBRATION_EVENT)) continue; | |
406 | while (rawreaderdate->ReadNextData(databyte)) { | |
407 | data = reinterpret_cast<long32*>(databyte); | |
408 | Int_t equipid = rawreaderdate->GetEquipmentId(); // EquipmentID required to access to rorc | |
409 | Int_t equiptype = rawreaderdate->GetEquipmentType(); // | |
410 | UChar_t ddlID = (UChar_t)rawreaderdate->GetDDLID(); // GetDDLID(); index of DDL, ITS SSD: 33-48 | |
411 | datasize = rawreaderdate->GetDataSize(); | |
412 | eqbelsize = rawreaderdate->GetEquipmentElementSize(); | |
413 | if ( (datasize % eqbelsize) || (eqbelsize != sizeof(long32)) ) { | |
414 | AliError(Form("AliITSHandleDaSSD: Error ReadCalibrationDataFile: event data size %i is not an integer of equipment data size %i", | |
415 | datasize, eqbelsize)); | |
416 | return kFALSE; | |
417 | } | |
418 | nofstrips = (Int_t) (datasize / eqbelsize); | |
419 | for (Int_t strind = 0; strind < nofstrips; strind++) { | |
420 | UChar_t ad = (UChar_t) (data[strind] >> 28) & 0x0000000F; // index of AD module 0-9 | |
421 | UChar_t adc = (UChar_t) (data[strind] >> 24) & 0x0000000F; // index of ADC module 0-5, 8-13 | |
422 | UShort_t stripID = (UShort_t)(data[strind] >> 12) & 0x000007FF; // strip number 0-1535 | |
423 | Short_t signal = (Short_t)(data[strind] & 0x00000FFF); | |
424 | signal = (signal > AliITSChannelDaSSD::GetUnderflowConst()) ? (signal - 2 * AliITSChannelDaSSD::GetUnderflowConst()) | |
425 | : signal; | |
426 | Int_t modpos = GetModuleIndex(ddlID, ad, adc); | |
427 | if (((modpos > 0) && (modpos < fModIndRead)) || ((modpos < 0) && (modind == modulesnumber))) continue; | |
428 | if ((modpos < 0) && (modind < modulesnumber)) { | |
429 | module = new AliITSModuleDaSSD(AliITSModuleDaSSD::GetStripsPerModuleConst()); | |
430 | if (!module->SetModuleIdData (ddlID, ad, adc, RetrieveModuleId(ddlID, ad, adc))) return 0; | |
431 | module->SetModuleRorcId (equipid, equiptype); | |
432 | modpos = fModIndRead + modind; | |
433 | modind += 1; | |
434 | fModules[modpos] = module; | |
435 | } | |
436 | if (!(strip = fModules[modpos]->GetStrip(stripID))) { | |
437 | strip = new AliITSChannelDaSSD(stripID, fNumberOfEvents); | |
438 | fModules[modpos]->SetStrip(strip, stripID); | |
439 | } | |
440 | strip->SetSignal(eventind, signal); | |
441 | } | |
442 | } | |
443 | if (++eventind > fNumberOfEvents) break; | |
444 | } | |
445 | delete rawreaderdate; | |
446 | if (modind) cout << "The memory was allocated for " << modind << " modules." << endl; | |
447 | fModIndRead += modind; | |
448 | if (modind < modulesnumber) RelocateModules(); | |
449 | return modind; | |
450 | } | |
451 | ||
452 | ||
453 | ||
454 | //______________________________________________________________________________ | |
f67db810 | 455 | Bool_t AliITSHandleDaSSD::RelocateModules() |
223dda26 | 456 | { |
457 | // Relocate memory for AliITSModuleDaSSD object array | |
f67db810 | 458 | Int_t nm = 0; |
223dda26 | 459 | AliITSModuleDaSSD **marray = NULL; |
f67db810 | 460 | for (Int_t modind = 0; modind < fNumberOfModules; modind++) |
461 | if (fModules[modind]) nm += 1; | |
462 | if (nm == fNumberOfModules) return kTRUE; | |
223dda26 | 463 | marray = new (nothrow) AliITSModuleDaSSD* [nm]; |
464 | if (!marray) { | |
c4d90345 | 465 | AliError(Form("AliITSHandleDaSSD: Error relocating memory for %i AliITSModuleDaSSD* objects!", nm)); |
f67db810 | 466 | return kFALSE; |
467 | } | |
468 | nm = 0; | |
469 | for (Int_t modind = 0; modind < fNumberOfModules; modind++) | |
470 | if (fModules[modind]) marray[nm++] = fModules[modind]; | |
471 | delete [] fModules; | |
472 | fModules = marray; | |
c4d90345 | 473 | fNumberOfModules = fModIndRead = nm; |
f67db810 | 474 | return kTRUE; |
475 | } | |
476 | ||
477 | ||
c4d90345 | 478 | |
479 | //______________________________________________________________________________ | |
480 | Bool_t AliITSHandleDaSSD::CalculatePedestal(AliITSModuleDaSSD *const module) | |
f67db810 | 481 | { |
223dda26 | 482 | // Calculates Pedestal |
f67db810 | 483 | AliITSChannelDaSSD *strip; |
c4d90345 | 484 | Float_t pedestal, noise; |
485 | Short_t *signal; | |
486 | Long_t ovev, ev, n; | |
487 | if (!module) return kFALSE; | |
488 | for (Int_t strind = 0; strind < module->GetNumberOfStrips(); strind++) { | |
489 | if (!(strip = module->GetStrip(strind))) continue; | |
490 | if (!(signal = strip->GetSignal())) { | |
491 | AliError(Form("AliITSHandleDaSSD: Error CalculatePedestal(): there are no events data for module[%i] strip[%i]->GetSignal()", | |
492 | module->GetModuleId(), strind)); | |
493 | continue; | |
f67db810 | 494 | } |
c4d90345 | 495 | //************* pedestal first pass **************** |
496 | pedestal = 0.0f; | |
497 | ovev = 0l; | |
498 | for (ev = 0; ev < strip->GetEventsNumber(); ev++) | |
499 | if (SignalOutOfRange(signal[ev])) ovev += 1; | |
500 | else pedestal = ((ev - ovev)) ? pedestal + (signal[ev] - pedestal) / static_cast<Float_t>(ev - ovev + 1) : signal[ev]; | |
501 | if (ev == ovev) pedestal = AliITSChannelDaSSD::GetUndefinedValue(); | |
502 | strip->SetPedestal(pedestal); | |
503 | //************* noise ******************************* | |
504 | Double_t nsum = 0.0L; | |
505 | ovev = 0l; | |
506 | for (ev = 0; ev < strip->GetEventsNumber(); ev++) { | |
507 | if (SignalOutOfRange(signal[ev])) ovev += 1; | |
508 | else nsum += pow((signal[ev] - strip->GetPedestal()), 2); | |
509 | } | |
510 | if ((n = strip->GetEventsNumber() - ovev - 1) > 0) noise = sqrt(nsum / (Float_t)(n)); | |
511 | else noise = AliITSChannelDaSSD::GetUndefinedValue(); | |
512 | strip->SetNoise(noise); | |
513 | //************* pedestal second pass **************** | |
514 | pedestal = 0.0f; | |
515 | ovev = 0l; | |
516 | for (ev = 0; ev < strip->GetEventsNumber(); ev++) | |
517 | if ( SignalOutOfRange(signal[ev]) | |
518 | || TMath::Abs(signal[ev] - strip->GetPedestal()) > (fPedestalThresholdFactor * strip->GetNoise())) ovev += 1; | |
519 | else pedestal = ((ev - ovev)) ? pedestal + (signal[ev] - pedestal) / static_cast<Float_t>(ev - ovev + 1) : signal[ev]; | |
520 | if (ev == ovev) pedestal = AliITSChannelDaSSD::GetUndefinedValue(); | |
521 | strip->SetPedestal(pedestal); | |
522 | strip->SetOverflowNumber(ovev); | |
f67db810 | 523 | } |
524 | return kTRUE; | |
525 | } | |
526 | ||
527 | ||
c4d90345 | 528 | //______________________________________________________________________________ |
529 | Bool_t AliITSHandleDaSSD::CalculateNoise(AliITSModuleDaSSD *const module, const Bool_t CorrectCM) | |
f67db810 | 530 | { |
223dda26 | 531 | // Calculates Noise |
f67db810 | 532 | AliITSChannelDaSSD *strip; |
533 | Short_t *signal; | |
534 | Float_t noise; | |
535 | Long_t ovev, n; | |
c4d90345 | 536 | if (!module) return kFALSE; |
537 | for (Int_t strind = 0; strind < module->GetNumberOfStrips(); strind++) { | |
538 | if (!(strip = module->GetStrip(strind))) continue; | |
539 | if (!(signal = strip->GetSignal())) { | |
540 | strip->SetNoise(AliITSChannelDaSSD::GetUndefinedValue()); | |
541 | AliError(Form("AliITSHandleDaSSD: Error CalculateNoise(): there are no events data for module[%i] strip[%i]->GetSignal()", | |
542 | module->GetModuleId(), strind)); | |
543 | continue; | |
f67db810 | 544 | } |
c4d90345 | 545 | Double_t nsum = 0.0L; |
546 | ovev = 0l; | |
547 | for (Long_t ev = 0; ev < strip->GetEventsNumber(); ev++) { | |
548 | if (SignalOutOfRange(signal[ev])) ovev += 1; | |
549 | else nsum += pow((signal[ev] - strip->GetPedestal()), 2); | |
550 | } | |
551 | if ((n = strip->GetEventsNumber() - ovev - 1) > 0) noise = sqrt(nsum / (Float_t)(n)); | |
552 | else noise = AliITSChannelDaSSD::GetUndefinedValue(); | |
553 | strip->SetNoise(noise); | |
f67db810 | 554 | } |
555 | return kTRUE; | |
556 | } | |
557 | ||
558 | ||
559 | ||
c4d90345 | 560 | //______________________________________________________________________________ |
561 | Bool_t AliITSHandleDaSSD::CalculateNoiseCM(AliITSModuleDaSSD *const module) | |
f67db810 | 562 | { |
c4d90345 | 563 | // Calculates Noise with CM correction |
564 | AliITSChannelDaSSD *strip = NULL; | |
565 | Short_t *signal; | |
566 | Float_t noise; | |
567 | Long_t ovev, n; | |
568 | if (!CalculateCM(module)) { | |
569 | AliError("Error: AliITSHandleDaSSD::CalculateCM() returned kFALSE"); | |
570 | return kFALSE; | |
571 | } | |
572 | for (Int_t strind = 0; strind < module->GetNumberOfStrips(); strind++) { | |
573 | if (!(strip = module->GetStrip(strind))) continue; //return kFALSE; | |
574 | if (!(signal = strip->GetSignal())) { | |
575 | strip->SetNoiseCM(AliITSChannelDaSSD::GetUndefinedValue()); | |
576 | AliError(Form("SSDDAModule: Error CalculateNoiseWithoutCM(): there are no events data for module[%i] strip[%i]->GetSignal()", | |
577 | module->GetModuleId(), strind)); | |
578 | return kFALSE; | |
f67db810 | 579 | } |
c4d90345 | 580 | Int_t chipind = strind / AliITSModuleDaSSD::GetStripsPerChip(); |
581 | Double_t nsum = 0.0L; | |
582 | ovev = 0l; | |
583 | for (Long_t ev = 0; ev < strip->GetEventsNumber(); ev++) { | |
584 | if (SignalOutOfRange(signal[ev])) ovev += 1; | |
585 | else nsum += pow((signal[ev] - strip->GetPedestal() - module->GetCM(chipind, ev)), 2); | |
586 | } | |
587 | if ((n = strip->GetEventsNumber() - ovev - 1) > 0) noise = sqrt(nsum / (Float_t)(n)); | |
588 | else noise = AliITSChannelDaSSD::GetUndefinedValue(); | |
589 | strip->SetNoiseCM(noise); | |
590 | } | |
591 | return kTRUE; | |
f67db810 | 592 | } |
593 | ||
594 | ||
595 | ||
c4d90345 | 596 | //______________________________________________________________________________ |
597 | Bool_t AliITSHandleDaSSD::CalculateCM(AliITSModuleDaSSD *const module) | |
f67db810 | 598 | { |
c4d90345 | 599 | // Calculates CM |
f67db810 | 600 | AliITSChannelDaSSD *strip = NULL; |
c4d90345 | 601 | Short_t *signal; |
602 | Long_t ovstr, n; | |
603 | Int_t stripind; | |
604 | module->SetNumberOfChips(AliITSModuleDaSSD::GetChipsPerModuleConst()); | |
605 | for (Int_t chipind = 0; chipind < module->GetNumberOfChips(); chipind++) { | |
606 | stripind = chipind * module->GetStripsPerChip(); | |
607 | module->GetCm()[chipind].Set(fNumberOfEvents); | |
608 | module->GetCm()[chipind].Reset(0.0f); | |
609 | for (Long_t ev = 0; ev < fNumberOfEvents; ev++) { | |
610 | // calculate firs approximation of CM. | |
611 | Double_t cm0 = 0.0L; | |
612 | ovstr = 0l; | |
613 | for (Int_t strind = stripind; strind < (stripind + AliITSModuleDaSSD::GetStripsPerChip()); strind++) { | |
614 | if (!(strip = module->GetStrip(strind))) continue; //return kFALSE; | |
615 | if (!(signal = strip->GetSignal())) { | |
616 | AliError(Form("AliITSHandleDaSSD: Error CalculateCM: there are no events data for module[%i] strip[%i]->GetSignal()", | |
617 | module->GetModuleId(), strind)); | |
618 | return kFALSE; | |
619 | } | |
620 | if ((signal[ev] >= AliITSChannelDaSSD::GetOverflowConst()) || | |
621 | (strip->GetPedestal() == AliITSChannelDaSSD::GetUndefinedValue())) ovstr += 1; | |
622 | else cm0 += (signal[ev] - strip->GetPedestal()); | |
f67db810 | 623 | } |
c4d90345 | 624 | if ((n = AliITSModuleDaSSD::GetStripsPerChip() - ovstr)) cm0 /= (Float_t)(n); |
625 | else { module->SetCM(0.0f, chipind, ev); continue; } | |
626 | // calculate avarage (cm - (signal - pedestal)) over the chip | |
627 | Double_t cmsigma = 0.0L; | |
628 | ovstr = 0l; | |
629 | for (Int_t strind = stripind; strind < (stripind + AliITSModuleDaSSD::GetStripsPerChip()); strind++) { | |
630 | if (!(strip = module->GetStrip(strind))) continue; | |
631 | if (!(signal = strip->GetSignal())) { | |
632 | AliError(Form("AliITSHandleDaSSD: Error CalculateCM: there are no events data for module[%i] strip[%i]->GetSignal()\n", | |
633 | module->GetModuleId(), strind)); | |
634 | return kFALSE; | |
f67db810 | 635 | } |
c4d90345 | 636 | if ((signal[ev] >= AliITSChannelDaSSD::GetOverflowConst()) || |
637 | (strip->GetPedestal() == AliITSChannelDaSSD::GetUndefinedValue())) ovstr += 1; | |
638 | else cmsigma += pow((cm0 - (signal[ev] - strip->GetPedestal())), 2); | |
f67db810 | 639 | } |
c4d90345 | 640 | if ((n = AliITSModuleDaSSD::GetStripsPerChip() - ovstr)) cmsigma = sqrt(cmsigma / (Float_t)(n)); |
641 | else { module->SetCM(0.0f, chipind, ev); continue; } | |
642 | // calculate cm with threshold | |
643 | Double_t cmsum = 0.0L; | |
644 | ovstr = 0l; | |
645 | for (Int_t strind = stripind; strind < (stripind + AliITSModuleDaSSD::GetStripsPerChip()); strind++) { | |
646 | if (!(strip = module->GetStrip(strind))) continue; | |
647 | signal = strip->GetSignal(); | |
648 | if ( (signal[ev] >= AliITSChannelDaSSD::GetOverflowConst()) | |
649 | || (strip->GetPedestal() == AliITSChannelDaSSD::GetUndefinedValue()) | |
650 | || (TMath::Abs(cm0 - (signal[ev] - strip->GetPedestal())) > (fCmThresholdFactor * cmsigma)) ) ovstr += 1; | |
651 | else cmsum += (signal[ev] - strip->GetPedestal()); | |
652 | } | |
653 | if ((n = AliITSModuleDaSSD::GetStripsPerChip() - ovstr)) cmsum /= (Float_t)(n); | |
654 | else cmsum = 0.0L; | |
655 | if (!module->SetCM(cmsum, chipind, ev)); | |
656 | } | |
657 | } | |
658 | return kTRUE; | |
659 | } | |
660 | ||
661 | ||
662 | //______________________________________________________________________________ | |
663 | Bool_t AliITSHandleDaSSD::ProcessRawData(const Int_t nmread) | |
664 | { | |
665 | // Performs calculation of calibration parameters (pedestal, noise, ...) | |
666 | Int_t nm = 0; | |
667 | if (nmread <= 0) return kFALSE; | |
668 | if (!fModules) return kFALSE; | |
669 | while ((nm = ReadModuleRawData(nmread)) > 0) { | |
670 | cout << "Processing next " << nm << " modules;" << endl; | |
671 | for (Int_t modind = fModIndProcessed; modind < fModIndRead; modind++) { | |
672 | if (!fModules[modind]) { | |
673 | AliError(Form("AliITSHandleDaSSD: Error ProcessRawData(): No AliITSModuleDaSSD object with index %i is allocated in AliITSHandleDaSSD\n", | |
674 | modind)); | |
675 | return kFALSE; | |
f67db810 | 676 | } |
c4d90345 | 677 | CalculatePedestal(fModules[modind]); |
678 | CalculateNoise(fModules[modind]); | |
679 | CalculateNoiseCM(fModules[modind]); | |
f67db810 | 680 | } |
c4d90345 | 681 | DeleteSignal(); |
682 | fModIndProcessed = fModIndRead; | |
683 | cout << fModIndProcessed << " - done" << endl; | |
684 | } | |
685 | return kTRUE; | |
f67db810 | 686 | } |
687 | ||
688 | ||
c4d90345 | 689 | //______________________________________________________________________________ |
690 | Short_t AliITSHandleDaSSD::RetrieveModuleId(const UChar_t ddlID, const UChar_t ad, const UChar_t adc) const | |
691 | { | |
692 | // Retrieve ModuleId from the DDL map which is defined in AliITSRawStreamSSD class | |
693 | Int_t mddli = (ad - 1) * 12 + ((adc<6) ? adc : (adc-2)); | |
694 | if ((ddlID < AliITSRawStreamSSD::kDDLsNumber) && (mddli < AliITSRawStreamSSD::kModulesPerDDL)) { | |
695 | mddli = AliITSRawStreamSSD::GetModuleNumber(ddlID, mddli); | |
696 | if (mddli > SHRT_MAX) return SHRT_MAX; | |
697 | else return (Short_t)mddli; | |
698 | } | |
699 | else { | |
700 | AliWarning(Form("Module index = %d or ddlID = %d is out of range -1 is rturned", ddlID, mddli)); | |
701 | return -1; | |
702 | } | |
703 | } | |
704 | ||
f67db810 | 705 | |
c4d90345 | 706 | |
707 | //______________________________________________________________________________ | |
f67db810 | 708 | TObjArray* AliITSHandleDaSSD::GetCalibrationSSDLDC() const |
223dda26 | 709 | { |
710 | // Fill in the array for OCDB | |
f67db810 | 711 | TObjArray *ldcc; |
c4d90345 | 712 | TObject *modcalibobj; |
f67db810 | 713 | if (!fModules) return NULL; |
714 | ldcc = new TObjArray(fNumberOfModules, 0); | |
715 | for (Int_t i = 0; i < fNumberOfModules; i++) { | |
716 | if (!fModules[i]) { | |
717 | delete ldcc; | |
718 | return NULL; | |
719 | } | |
c4d90345 | 720 | modcalibobj = dynamic_cast<TObject*>(fModules[i]->GetCalibrationSSDModule()); |
721 | ldcc->AddAt(modcalibobj, i); | |
f67db810 | 722 | } |
723 | ldcc->Compress(); | |
724 | return ldcc; | |
725 | } | |
726 | ||
727 | ||
c4d90345 | 728 | //______________________________________________________________________________ |
729 | Bool_t AliITSHandleDaSSD::SaveCalibrationSSDLDC(Char_t*& dafname) const | |
f67db810 | 730 | { |
223dda26 | 731 | // Save Calibration data locally |
f67db810 | 732 | TObjArray *ldcc; |
c4d90345 | 733 | TObject *modcalibobj; |
734 | Char_t *tmpfname; | |
735 | TString dadatafilename(""); | |
f67db810 | 736 | if (!fModules) return kFALSE; |
737 | ldcc = new TObjArray(fNumberOfModules, 0); | |
738 | for (Int_t i = 0; i < fNumberOfModules; i++) { | |
739 | if (!fModules[i]) { | |
740 | delete ldcc; | |
741 | return kFALSE; | |
742 | } | |
c4d90345 | 743 | modcalibobj = dynamic_cast<TObject*>(fModules[i]->GetCalibrationSSDModule()); |
744 | ldcc->AddAt(modcalibobj, i); | |
f67db810 | 745 | } |
746 | ldcc->Compress(); | |
c4d90345 | 747 | if (dafname) dadatafilename = Form("%s/", dafname); |
748 | dadatafilename.Append(Form("ITSSSDda_%i_%i.root", fLdcId, fRunId)); | |
749 | tmpfname = new Char_t[dadatafilename.Length()]; | |
750 | dafname = strcpy(tmpfname, dadatafilename.Data()); | |
751 | TFile *fileRun = new TFile (dadatafilename.Data(),"RECREATE"); | |
f67db810 | 752 | if (fileRun->IsZombie()) { |
c4d90345 | 753 | AliError(Form("AliITSHandleDaSSD: SaveCalibrationSSDLDC() error open file %s", dadatafilename.Data())); |
f67db810 | 754 | ldcc->Delete(); |
755 | delete fileRun; | |
c4d90345 | 756 | delete ldcc; |
f67db810 | 757 | return kFALSE; |
758 | } | |
759 | fileRun->WriteTObject(ldcc); | |
760 | fileRun->Close(); | |
761 | ldcc->Delete(); | |
762 | delete fileRun; | |
c4d90345 | 763 | delete ldcc; |
764 | return kTRUE; | |
765 | } | |
766 | ||
767 | ||
768 | ||
769 | //______________________________________________________________________________ | |
770 | Bool_t AliITSHandleDaSSD::DumpModInfo(const Float_t meannosethreshold) const | |
771 | { | |
772 | // Dump calibration parameters | |
773 | AliITSModuleDaSSD *mod; | |
774 | AliITSChannelDaSSD *strip; | |
775 | if (!fModules) { | |
776 | cout << "SSDDALDC::DumpModInfo(): Error, no modules are allocated!" << endl; | |
777 | return kFALSE; | |
778 | } | |
779 | cout << "Modules with MeanNoise > " << meannosethreshold << endl; | |
780 | for (Int_t i = 0; i < fNumberOfModules; i++) { | |
781 | if (!(mod = fModules[i])) continue; | |
782 | Float_t maxnoise = 0.0f, meannoise = 0.0f; | |
783 | Int_t maxstrind = 0, novfstr = 0; | |
784 | for (Int_t strind = 0; strind < mod->GetNumberOfStrips(); strind++) { | |
785 | if (!(strip = mod->GetStrip(strind))) {novfstr++; continue; } | |
786 | if (strip->GetNoiseCM() >= AliITSChannelDaSSD::GetUndefinedValue() ) {novfstr++; continue; } | |
787 | if (maxnoise < strip->GetNoiseCM()) { | |
788 | maxnoise = strip->GetNoiseCM(); | |
789 | maxstrind = strind; | |
790 | } | |
791 | meannoise = (strind - novfstr) ? meannoise + (strip->GetNoiseCM() - meannoise) / static_cast<Float_t>(strind - novfstr + 1) | |
792 | : strip->GetNoiseCM(); | |
793 | } | |
794 | if (meannoise > meannosethreshold) | |
795 | cout << "Mod: " << i << "; DDl: " << (int)mod->GetDdlId() << "; AD: " << (int)mod->GetAD() | |
796 | << "; ADC: " << (int)mod->GetADC() << "; MeanNoise = " << meannoise | |
797 | << "; NOfStrips = " << (mod->GetNumberOfStrips() - novfstr) << endl; | |
798 | } | |
799 | return kTRUE; | |
800 | } | |
801 | ||
802 | ||
803 | ||
804 | //______________________________________________________________________________ | |
805 | Bool_t AliITSHandleDaSSD::PrintModCalibrationData(const UChar_t ddlID, const UChar_t ad, const UChar_t adc, const Char_t *fname) const | |
806 | { | |
807 | // Print Module calibration data whether in file on in cout | |
808 | AliITSChannelDaSSD *strip; | |
809 | ofstream datafile; | |
810 | ostream *outputfile; | |
811 | if (!fname) { outputfile = &cout; } | |
812 | else { | |
813 | datafile.open(fname, ios::out); | |
814 | if (datafile.fail()) return kFALSE; | |
815 | outputfile = dynamic_cast<ostream*>(&datafile); | |
816 | } | |
817 | *outputfile << "DDL = " << (int)ddlID << "; AD = " << (int)ad << "; ADC = " << (int)adc << endl; | |
818 | for (Int_t strind = 0; strind < AliITSModuleDaSSD::GetStripsPerModuleConst(); strind++) { | |
819 | if (strip = GetStrip(ddlID, ad, adc, strind)) { | |
820 | *outputfile << "Str = " << strind << "; ped = " << strip->GetPedestal() | |
821 | << "; noise = " << strip->GetNoiseCM() << endl; | |
822 | } | |
823 | else continue; | |
824 | } | |
825 | if (datafile.is_open()) datafile.close(); | |
826 | return kTRUE; | |
827 | } | |
828 | ||
829 | ||
830 | ||
831 | void AliITSHandleDaSSD::DumpInitData(const Char_t *str) const | |
832 | { | |
833 | // Print general information retrieve from raw data file | |
834 | cout << "Raw data file: " << fRawDataFileName << endl | |
835 | << "LDC: " << (Int_t)fLdcId << "; RunId: " << fRunId << endl | |
836 | << "Number of physics events: " << fNumberOfEvents << endl | |
837 | << str; | |
838 | } | |
839 | ||
840 | ||
841 | //______________________________________________________________________________ | |
842 | Bool_t AliITSHandleDaSSD::AllocateSimulatedModules(const Int_t copymodind) | |
843 | { | |
844 | // Used to allocate simulated modules to test the performance | |
845 | AliITSModuleDaSSD *module; | |
846 | UChar_t ad, adc, ddlID; | |
847 | ad = adc = ddlID = 0; | |
848 | if (!(fModules[copymodind])) return kFALSE; | |
849 | for (Int_t modind = 0; modind < fNumberOfModules; modind++) { | |
850 | if (!fModules[modind]) { | |
851 | module = new AliITSModuleDaSSD(AliITSModuleDaSSD::GetStripsPerModuleConst()); | |
852 | if ((adc < 5) || ((adc > 7) && (adc < 13)) ) adc += 1; | |
853 | else if (adc == 5) adc = 8; | |
854 | else if (adc == 13) { | |
855 | adc = 0; | |
856 | if (ad < 8) ad += 1; | |
857 | else { | |
858 | ad = 0; | |
859 | ddlID +=1; | |
860 | } | |
861 | } | |
862 | if (!module->SetModuleIdData (ddlID, ad, adc, modind)) return kFALSE; | |
863 | fModules[modind] = module; | |
864 | for (Int_t strind = 0; strind < module->GetNumberOfStrips(); strind++) { | |
865 | AliITSChannelDaSSD *cstrip = fModules[copymodind]->GetStrip(strind); | |
866 | Long_t eventsnumber = cstrip->GetEventsNumber(); | |
867 | AliITSChannelDaSSD *strip = new AliITSChannelDaSSD(strind, eventsnumber); | |
868 | for (Long_t evind = 0; evind < eventsnumber; evind++) { | |
869 | Short_t sign = *cstrip->GetSignal(evind); | |
870 | if (!strip->SetSignal(evind, sign)) AliError(Form("AliITSHandleDaSSD: Copy events error! mod = %i, str = %i", modind, strind)); | |
871 | } | |
872 | module->SetStrip(strip, strind); | |
873 | } | |
874 | } | |
875 | else { | |
876 | ddlID = fModules[modind]->GetDdlId(); | |
877 | ad = fModules[modind]->GetAD(); | |
878 | adc = fModules[modind]->GetADC(); | |
879 | } | |
880 | } | |
881 | for (UShort_t modind = 0; modind < fNumberOfModules; modind++) fModules[modind]->SetModuleId(modind + 1080); | |
f67db810 | 882 | return kTRUE; |
883 | } |