1 /**************************************************************************
2 * Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 ///////////////////////////////////////////////////////////////////////////////
20 /// This class provides ITS SSD data handling
22 // Author: Oleksandr Borysov
24 ///////////////////////////////////////////////////////////////////////////////
28 #include <Riostream.h>
29 #include "AliITSHandleDaSSD.h"
35 #include "TObjArray.h"
37 #include "AliITSNoiseSSD.h"
38 #include "AliITSPedestalSSD.h"
39 #include "AliITSBadChannelsSSD.h"
40 #include "AliITSRawStreamSSD.h"
41 #include "AliRawReaderDate.h"
42 #include "AliITSRawStreamSSD.h"
43 #include "AliITSChannelDaSSD.h"
46 ClassImp(AliITSHandleDaSSD)
51 const Int_t AliITSHandleDaSSD::fgkNumberOfSSDModules = 1698; // Number of SSD modules in ITS
52 const Int_t AliITSHandleDaSSD::fgkNumberOfSSDModulesPerDdl = 108; // Number of SSD modules in DDL
53 const Int_t AliITSHandleDaSSD::fgkNumberOfSSDModulesPerSlot = 12; // Number of SSD modules in Slot
54 const Int_t AliITSHandleDaSSD::fgkNumberOfSSDSlotsPerDDL = 9; // Number of SSD slots per DDL
55 const Int_t AliITSHandleDaSSD::fgkNumberOfSSDDDLs = 16; // Number of SSD modules in Slot
56 const Float_t AliITSHandleDaSSD::fgkPedestalThresholdFactor = 3.0; // Defalt value for fPedestalThresholdFactor
57 const Float_t AliITSHandleDaSSD::fgkCmThresholdFactor = 3.0; // Defalt value for fCmThresholdFactor
59 const UInt_t AliITSHandleDaSSD::fgkZsBitMask = 0x0000003F; // Bit mask for FEROM ZS
60 const UInt_t AliITSHandleDaSSD::fgkOffSetBitMask = 0x000003FF; // Bit mask for FEROM Offset correction
61 const UInt_t AliITSHandleDaSSD::fgkBadChannelMask = 0x00000001; // Mask to suppress the channel from the bad channel list
62 const Int_t AliITSHandleDaSSD::fgkAdcPerDBlock = 6; // FEROM configuration file constant
64 //______________________________________________________________________________
65 AliITSHandleDaSSD::AliITSHandleDaSSD() :
66 fRawDataFileName(NULL),
73 fStaticBadChannelsMap(NULL),
77 fPedestalThresholdFactor(fgkPedestalThresholdFactor),
78 fCmThresholdFactor(fgkCmThresholdFactor),
80 fOffsetDefault(INT_MAX),
83 // Default constructor
87 //______________________________________________________________________________
88 AliITSHandleDaSSD::AliITSHandleDaSSD(Char_t *rdfname) :
89 fRawDataFileName(NULL),
96 fStaticBadChannelsMap(NULL),
100 fPedestalThresholdFactor(fgkPedestalThresholdFactor) ,
101 fCmThresholdFactor(fgkCmThresholdFactor),
103 fOffsetDefault(INT_MAX),
106 if (!Init(rdfname)) AliError("AliITSHandleDaSSD::AliITSHandleDaSSD() initialization error!");
110 //______________________________________________________________________________
111 AliITSHandleDaSSD::AliITSHandleDaSSD(const AliITSHandleDaSSD& ssdadldc) :
113 fRawDataFileName(ssdadldc.fRawDataFileName),
114 fNumberOfModules(ssdadldc.fNumberOfModules),
116 fModIndProcessed(ssdadldc.fModIndProcessed),
117 fModIndRead(ssdadldc.fModIndRead),
119 fNumberOfEvents(ssdadldc.fNumberOfEvents),
120 fStaticBadChannelsMap(ssdadldc.fStaticBadChannelsMap),
121 fDDLModuleMap(ssdadldc.fDDLModuleMap),
122 fLdcId(ssdadldc.fLdcId),
123 fRunId(ssdadldc.fRunId),
124 fPedestalThresholdFactor(ssdadldc.fPedestalThresholdFactor),
125 fCmThresholdFactor(ssdadldc.fCmThresholdFactor),
126 fZsDefault(ssdadldc.fZsDefault),
127 fOffsetDefault(ssdadldc.fOffsetDefault),
128 fZsFactor(ssdadldc.fZsFactor)
131 if ((ssdadldc.fNumberOfModules > 0) && (ssdadldc.fModules)) {
132 fModules = new (nothrow) AliITSModuleDaSSD* [ssdadldc.fNumberOfModules];
134 for (Int_t modind = 0; modind < ssdadldc.fNumberOfModules; modind++) {
135 if (ssdadldc.fModules[modind]) {
136 fModules[modind] = new AliITSModuleDaSSD(*(ssdadldc.fModules[modind]));
137 if (!fModules[modind]) {
138 AliError("AliITSHandleDaSSD: Error copy constructor");
139 for (Int_t i = (modind - 1); i >= 0; i--) delete fModules[modind];
144 } else fModules[modind] = NULL;
147 AliError(Form("AliITSHandleDaSSD: Error allocating memory for %i AliITSModulesDaSSD* objects!", ssdadldc.fNumberOfModules));
148 fNumberOfModules = 0;
155 //______________________________________________________________________________
156 AliITSHandleDaSSD& AliITSHandleDaSSD::operator = (const AliITSHandleDaSSD& ssdadldc)
158 // assignment operator
159 if (this == &ssdadldc) return *this;
161 for (Int_t i = 0; i < fNumberOfModules; i++) if (fModules[i]) delete fModules[i];
165 if (fModIndex) { delete [] fModIndex; fModIndex = NULL; }
166 if ((ssdadldc.fNumberOfModules > 0) && (ssdadldc.fModules)) {
167 fModules = new (nothrow) AliITSModuleDaSSD* [ssdadldc.fNumberOfModules];
169 for (Int_t modind = 0; modind < ssdadldc.fNumberOfModules; modind++) {
170 if (ssdadldc.fModules[modind]) {
171 fModules[modind] = new AliITSModuleDaSSD(*(ssdadldc.fModules[modind]));
172 if (!fModules[modind]) {
173 AliError("AliITSHandleDaSSD: Error assignment operator");
174 for (Int_t i = (modind - 1); i >= 0; i--) delete fModules[modind];
179 } else fModules[modind] = NULL;
182 AliError(Form("AliITSHandleDaSSD: Error allocating memory for %i AliITSModulesDaSSD* objects!", ssdadldc.fNumberOfModules));
183 fNumberOfModules = 0;
191 //______________________________________________________________________________
192 AliITSHandleDaSSD::~AliITSHandleDaSSD()
194 // Default destructor
197 for (Int_t i = 0; i < fNumberOfModules; i++)
199 if (fModules[i]) delete fModules[i];
203 if (fModIndex) delete [] fModIndex;
204 if (fStaticBadChannelsMap) { fStaticBadChannelsMap->Delete(); delete fStaticBadChannelsMap; }
205 if (fDDLModuleMap) delete [] fDDLModuleMap;
210 //______________________________________________________________________________
211 void AliITSHandleDaSSD::Reset()
213 // Delete array of AliITSModuleDaSSD* objects.
215 for (Int_t i = 0; i < fNumberOfModules; i++) if (fModules[i]) delete fModules[i];
219 if (fModIndex) { delete [] fModIndex; fModIndex = NULL; }
221 if (fStaticBadChannelsMap) {
222 fStaticBadChannelsMap->Delete();
223 delete fStaticBadChannelsMap;
224 fStaticBadChannelsMap = NULL;
226 if (fDDLModuleMap) { delete [] fDDLModuleMap; fDDLModuleMap = NULL; }
228 fRawDataFileName = NULL;
229 fModIndProcessed = fModIndRead = 0;
232 fPedestalThresholdFactor = fgkPedestalThresholdFactor;
233 fCmThresholdFactor = fgkCmThresholdFactor;
238 //______________________________________________________________________________
239 Bool_t AliITSHandleDaSSD::Init(Char_t *rdfname)
241 // Read raw data file and set initial and configuration parameters
242 Long_t physeventind = 0, strn = 0, nofstripsev, nofstrips = 0;
243 Int_t nofeqipmentev, nofeqipment = 0, eqn = 0;
244 AliRawReaderDate *rawreaderdate = NULL;
245 UChar_t *data = NULL;
246 Long_t datasize = 0, eqbelsize = 1;
248 rawreaderdate = new AliRawReaderDate(rdfname, 0);
249 if (!(rawreaderdate->GetAttributes() || rawreaderdate->GetEventId())) {
250 AliError(Form("AliITSHandleDaSSD: Error reading raw data file %s by RawReaderDate", rdfname));
254 if (rawreaderdate->NextEvent()) {
255 fRunId = rawreaderdate->GetRunNumber();
256 rawreaderdate->RewindEvents();
257 } else { MakeZombie(); return kFALSE; }
258 if (fModules) Reset();
259 rawreaderdate->SelectEvents(-1);
260 rawreaderdate->Select("ITSSSD");
262 while (rawreaderdate->NextEvent()) {
263 if ((rawreaderdate->GetType() != PHYSICS_EVENT) && (rawreaderdate->GetType() != CALIBRATION_EVENT)) continue;
266 while (rawreaderdate->ReadNextData(data)) {
267 fLdcId = rawreaderdate->GetLDCId();
269 datasize = rawreaderdate->GetDataSize();
270 eqbelsize = rawreaderdate->GetEquipmentElementSize();
271 if ( datasize % eqbelsize ) {
272 AliError(Form("AliITSHandleDaSSD: Error Init(%s): event data size %i is not an integer of equipment data size %i",
273 rdfname, datasize, eqbelsize));
277 nofstripsev += (Int_t) (datasize / eqbelsize);
279 if (physeventind++) {
280 if (nofstrips != nofstripsev) AliWarning(Form("AliITSHandleDaSSD: number of strips varies from event to event, ev = %i, %i",
281 physeventind, nofstripsev));
282 if (nofeqipment != nofeqipmentev) AliWarning("AliITSHandleDaSSD: number of DDLs varies from event to event");
284 nofstrips = nofstripsev;
285 nofeqipment = nofeqipmentev;
286 if (strn < nofstrips) strn = nofstrips;
287 if (eqn < nofeqipment) eqn = nofeqipment;
289 delete rawreaderdate;
290 if ((physeventind > 0) && (strn > 0))
292 fNumberOfEvents = physeventind;
293 fRawDataFileName = rdfname;
294 fModIndex = new (nothrow) Int_t [fgkNumberOfSSDModulesPerDdl * eqn];
296 for (Int_t i = 0; i < fgkNumberOfSSDModulesPerDdl * eqn; i++) fModIndex[i] = -1;
297 else AliWarning(Form("AliITSHandleDaSSD: Error Init(%s): Index array for %i modules was not created",
298 rdfname, fgkNumberOfSSDModulesPerDdl * eqn));
299 if (SetNumberOfModules(fgkNumberOfSSDModulesPerDdl * eqn)) {
300 TString str = TString::Format("Max number of equipment: %i, max number of channels: %i\n", eqn, strn);
301 DumpInitData(str.Data());
311 //______________________________________________________________________________
312 AliITSModuleDaSSD* AliITSHandleDaSSD::GetModule (const UChar_t ddlID, const UChar_t ad, const UChar_t adc) const
314 // Retrieve AliITSModuleDaSSD object from the array
315 if (!fModules) return NULL;
316 for (Int_t i = 0; i < fNumberOfModules; i++) {
318 if ( (fModules[i]->GetDdlId() == ddlID)
319 && (fModules[i]->GetAD() == ad)
320 && (fModules[i]->GetADC() == adc))
328 Int_t AliITSHandleDaSSD::GetModuleIndex (const UChar_t ddlID, const UChar_t ad, const UChar_t adc) const
330 // Retrieve the position of AliITSModuleDaSSD object in the array
331 if (!fModules) return -1;
332 for (Int_t i = 0; i < fNumberOfModules; i++) {
334 if ( (fModules[i]->GetDdlId() == ddlID)
335 && (fModules[i]->GetAD() == ad)
336 && (fModules[i]->GetADC() == adc))
345 //______________________________________________________________________________
346 AliITSChannelDaSSD* AliITSHandleDaSSD::GetStrip (const UChar_t ddlID, const UChar_t ad, const UChar_t adc, const UShort_t stripID) const
348 // Retrieve AliITSChannalDaSSD object from the array
349 for (Int_t modind = 0; modind < fNumberOfModules; modind++) {
350 if ( (fModules[modind]->GetDdlId() == ddlID)
351 && (fModules[modind]->GetAD() == ad)
352 && (fModules[modind]->GetADC() == adc) )
354 return fModules[modind]->GetStrip(stripID);
357 AliError(Form("AliITSHandleDaSSD: Error GetStrip (%i, %i, %i, %i), strip not found, returns NULL!",
358 ddlID, ad, adc, stripID));
364 //______________________________________________________________________________
365 Bool_t AliITSHandleDaSSD::SetModule(AliITSModuleDaSSD *const module, const Int_t index)
367 // Assign array element with AliITSModuleDaSSD object
368 if ((index < fNumberOfModules) && (index >= 0))
370 if (fModules[index]) delete fModules[index];
371 fModules[index] = module;
379 //______________________________________________________________________________
380 Bool_t AliITSHandleDaSSD::SetNumberOfModules (const Int_t numberofmodules)
382 // Allocates memory for AliITSModuleDaSSD objects
383 if (numberofmodules > fgkNumberOfSSDModules)
384 AliWarning(Form("AliITSHandleDaSSD: the number of modules %i you use exceeds the maximum %i for ALICE ITS SSD",
385 numberofmodules, fgkNumberOfSSDModules));
387 for (Int_t i = 0; i < fNumberOfModules; i++) if (fModules[i]) delete fModules[i];
391 fModules = new (nothrow) AliITSModuleDaSSD* [numberofmodules];
393 fNumberOfModules = numberofmodules;
394 memset(fModules, 0, sizeof(AliITSModuleDaSSD*) * numberofmodules);
397 AliError(Form("AliITSHandleDaSSD: Error allocating memory for %i AliITSModulesDaSSD* objects!", numberofmodules));
398 fNumberOfModules = 0;
406 //______________________________________________________________________________
407 Bool_t AliITSHandleDaSSD::ReadStaticBadChannelsMap(const Char_t *filename)
409 // Reads Static Bad Channels Map from the file
412 AliWarning("No file name is specified for Static Bad Channels Map!");
415 bcfile = new TFile(filename, "READ");
416 if (bcfile->IsZombie()) {
417 AliWarning(Form("Error reading file %s with Static Bad Channels Map!", filename));
420 bcfile->GetObject("BadChannels;1", fStaticBadChannelsMap);
421 if (!fStaticBadChannelsMap) {
422 AliWarning("Error fStaticBadChannelsMap == NULL!");
434 Bool_t AliITSHandleDaSSD::ReadDDLModuleMap(const Char_t *filename)
436 // Reads the SSD DDL Map from the file
438 AliRawReaderDate *rwr = NULL;
439 AliITSRawStreamSSD *rsm = NULL;
441 if (fDDLModuleMap) { delete [] fDDLModuleMap; fDDLModuleMap = NULL;}
442 fDDLModuleMap = new (nothrow) Int_t [fgkNumberOfSSDDDLs * fgkNumberOfSSDModulesPerDdl];
443 if (!fDDLModuleMap) {
444 AliWarning("Error allocation memory for DDL Map!");
448 AliWarning("No file name is specified for SSD DDL Map, using the one from AliITSRawStreamSSD!");
449 rwr = new AliRawReaderDate(event);
450 rsm = new AliITSRawStreamSSD(rwr);
451 rsm->Setv11HybridDDLMapping();
452 for (Int_t ddli = 0; ddli < fgkNumberOfSSDDDLs; ddli++)
453 for (Int_t mi = 0; mi < fgkNumberOfSSDModulesPerDdl; mi++)
454 fDDLModuleMap[(ddli * fgkNumberOfSSDModulesPerDdl + mi)] = rsm->GetModuleNumber(ddli, mi);
459 ddlmfile.open(filename, ios::in);
460 if (!ddlmfile.is_open()) {
461 AliWarning(Form("Error reading file %s with SSD DDL Map!", filename));
462 if (fDDLModuleMap) { delete [] fDDLModuleMap; fDDLModuleMap = NULL;}
466 while((!ddlmfile.eof()) && (ind < (fgkNumberOfSSDDDLs * fgkNumberOfSSDModulesPerDdl))) {
467 ddlmfile >> fDDLModuleMap[ind++];
468 if (ddlmfile.fail()) AliError(Form("Error extracting number from the DDL map file %s, ind: ", filename, ind));
470 if (ind != (fgkNumberOfSSDDDLs * fgkNumberOfSSDModulesPerDdl))
471 AliWarning(Form("Only %i (< %i) entries were read from DDL Map!", ind, (fgkNumberOfSSDDDLs * fgkNumberOfSSDModulesPerDdl)));
478 //______________________________________________________________________________
479 Int_t AliITSHandleDaSSD::ReadCalibrationDataFile (char* fileName, const Long_t eventsnumber)
481 // Reads raw data from file
482 if (!Init(fileName)){
483 AliError("AliITSHandleDaSSD: Error ReadCalibrationDataFile");
486 fNumberOfEvents = eventsnumber;
487 return ReadModuleRawData (fNumberOfModules);
492 //______________________________________________________________________________
493 Int_t AliITSHandleDaSSD::ReadModuleRawData (const Int_t modulesnumber)
495 // Reads raw data from file
496 AliRawReader *rawreaderdate = NULL;
497 AliITSRawStreamSSD *stream = NULL;
498 AliITSModuleDaSSD *module;
499 AliITSChannelDaSSD *strip;
501 Int_t nofeqipmentev, equipid, prequipid;
503 if (!(rawreaderdate = new AliRawReaderDate(fRawDataFileName, 0))) return 0;
505 AliError("AliITSHandleDaSSD: Error ReadModuleRawData: no structure was allocated for data");
508 if (!fDDLModuleMap) if (!ReadDDLModuleMap()) AliWarning("DDL map is not defined, ModuleID will be set to 0!");
509 stream = new AliITSRawStreamSSD(rawreaderdate);
510 stream->Setv11HybridDDLMapping();
511 rawreaderdate->SelectEvents(-1);
513 while (rawreaderdate->NextEvent()) {
514 if ((rawreaderdate->GetType() != PHYSICS_EVENT) && (rawreaderdate->GetType() != CALIBRATION_EVENT)) continue;
517 while (stream->Next()) {
518 equipid = rawreaderdate->GetEquipmentId();
519 if ((equipid != prequipid) && (prequipid >= 0)) nofeqipmentev += 1;
521 Int_t equiptype = rawreaderdate->GetEquipmentType();
522 UChar_t ddlID = (UChar_t)rawreaderdate->GetDDLID();
523 UChar_t ad = stream->GetAD();
524 UChar_t adc = stream->GetADC();
525 UShort_t stripID = stream->GetSideFlag() ? AliITSChannelDaSSD::GetMaxStripIdConst() - stream->GetStrip() : stream->GetStrip();
526 Short_t signal = stream->GetSignal();
528 Int_t indpos = (nofeqipmentev * fgkNumberOfSSDModulesPerDdl)
529 + ((ad - 1) * fgkNumberOfSSDModulesPerSlot) + (adc < 6 ? adc : (adc - 2));
530 Int_t modpos = fModIndex[indpos];
531 if (((modpos > 0) && (modpos < fModIndRead)) || ((modpos < 0) && (modind == modulesnumber))) continue;
532 if ((modpos < 0) && (modind < modulesnumber)) {
533 module = new AliITSModuleDaSSD(AliITSModuleDaSSD::GetStripsPerModuleConst());
535 if (fDDLModuleMap) mddli = RetrieveModuleId(ddlID, ad, adc);
537 if (!module->SetModuleIdData (ddlID, ad, adc, mddli)) return 0;
538 module->SetModuleRorcId (equipid, equiptype);
539 module->SetCMFeromEventsNumber(fNumberOfEvents);
540 modpos = fModIndRead + modind;
542 fModules[modpos] = module;
543 fModIndex[indpos] = modpos;
545 if (stripID < AliITSModuleDaSSD::GetStripsPerModuleConst()) {
546 if (!(strip = fModules[modpos]->GetStrip(stripID))) {
547 strip = new AliITSChannelDaSSD(stripID, fNumberOfEvents);
548 fModules[modpos]->SetStrip(strip, stripID);
550 strip->SetSignal(eventind, signal);
551 } else fModules[modpos]->SetCMFerom(signal, (stripID - AliITSModuleDaSSD::GetStripsPerModuleConst()), eventind);
553 if (++eventind > fNumberOfEvents) break;
556 delete rawreaderdate;
557 if (modind) cout << "The memory was allocated for " << modind << " modules." << endl;
558 fModIndRead += modind;
559 if (modind < modulesnumber) RelocateModules();
565 //______________________________________________________________________________
566 Bool_t AliITSHandleDaSSD::RelocateModules()
568 // Relocate memory for AliITSModuleDaSSD object array
570 AliITSModuleDaSSD **marray = NULL;
571 for (Int_t modind = 0; modind < fNumberOfModules; modind++)
572 if (fModules[modind]) nm += 1;
573 if (nm == fNumberOfModules) return kTRUE;
574 marray = new (nothrow) AliITSModuleDaSSD* [nm];
576 AliError(Form("AliITSHandleDaSSD: Error relocating memory for %i AliITSModuleDaSSD* objects!", nm));
580 for (Int_t modind = 0; modind < fNumberOfModules; modind++)
581 if (fModules[modind]) marray[nm++] = fModules[modind];
584 fNumberOfModules = fModIndRead = nm;
590 //______________________________________________________________________________
591 Bool_t AliITSHandleDaSSD::AddFeromCm(AliITSModuleDaSSD *const module)
592 // Restore the original signal value adding CM calculated and subtracted in ferom
594 AliITSChannelDaSSD *strip;
595 Short_t *signal, *cmferom;
597 if (!module) return kFALSE;
598 for (Int_t chipind = 0; chipind < AliITSModuleDaSSD::GetChipsPerModuleConst(); chipind++) {
599 if (!(cmferom = module->GetCMFerom(chipind))) {
600 AliWarning(Form("AliITSHandleDaSSD: There is no Ferom CM values for chip %i, module %i!", chipind, module->GetModuleId()));
603 for (Int_t strind = (chipind * AliITSModuleDaSSD::GetStripsPerChip());
604 strind < ((chipind + 1) * AliITSModuleDaSSD::GetStripsPerChip()); strind++) {
605 if (!(strip = module->GetStrip(strind))) continue;
606 if (!(signal = strip->GetSignal())) continue;
607 // if (strip->GetEventsNumber() != module->GetEventsNumber()) return kFALSE;
609 for (Long_t ev = 0; ev < strip->GetEventsNumber(); ev++) {
610 if (SignalOutOfRange(signal[ev]) || SignalOutOfRange(cmferom[ev])) ovev += 1;
612 Short_t signal1 = signal[ev] + cmferom[ev];
613 strip->SetSignal(ev, signal1);
623 //______________________________________________________________________________
624 Bool_t AliITSHandleDaSSD::CalculatePedestal(AliITSModuleDaSSD *const module)
626 // Calculates Pedestal
627 AliITSChannelDaSSD *strip;
628 Float_t pedestal, noise;
631 if (!module) return kFALSE;
632 for (Int_t strind = 0; strind < module->GetNumberOfStrips(); strind++) {
633 if (!(strip = module->GetStrip(strind))) continue;
634 if (!(signal = strip->GetSignal())) {
635 AliError(Form("AliITSHandleDaSSD: Error CalculatePedestal(): there are no events data for module[%i] strip[%i]->GetSignal()",
636 module->GetModuleId(), strind));
639 //************* pedestal first pass ****************
642 for (ev = 0; ev < strip->GetEventsNumber(); ev++)
643 if (SignalOutOfRange(signal[ev])) ovev += 1;
644 else pedestal = ((ev - ovev)) ? pedestal + (signal[ev] - pedestal) / static_cast<Float_t>(ev - ovev + 1) : signal[ev];
645 if (ev == ovev) pedestal = AliITSChannelDaSSD::GetUndefinedValue();
646 strip->SetPedestal(pedestal);
647 //************* noise *******************************
648 Double_t nsum = 0.0L;
650 for (ev = 0; ev < strip->GetEventsNumber(); ev++) {
651 if (SignalOutOfRange(signal[ev])) ovev += 1;
652 else nsum += pow((signal[ev] - strip->GetPedestal()), 2);
654 if ((n = strip->GetEventsNumber() - ovev - 1) > 0) noise = sqrt(nsum / (Float_t)(n));
655 else noise = AliITSChannelDaSSD::GetUndefinedValue();
656 strip->SetNoise(noise);
657 //************* pedestal second pass ****************
660 for (ev = 0; ev < strip->GetEventsNumber(); ev++)
661 if ( SignalOutOfRange(signal[ev])
662 || TMath::Abs(signal[ev] - strip->GetPedestal()) > (fPedestalThresholdFactor * strip->GetNoise())) ovev += 1;
663 else pedestal = ((ev - ovev)) ? pedestal + (signal[ev] - pedestal) / static_cast<Float_t>(ev - ovev + 1) : signal[ev];
664 if (ev == ovev) pedestal = AliITSChannelDaSSD::GetUndefinedValue();
665 strip->SetPedestal(pedestal);
666 strip->SetOverflowNumber(ovev);
672 //______________________________________________________________________________
673 Bool_t AliITSHandleDaSSD::CalculateNoise(AliITSModuleDaSSD *const module)
676 AliITSChannelDaSSD *strip;
680 if (!module) return kFALSE;
681 for (Int_t strind = 0; strind < module->GetNumberOfStrips(); strind++) {
682 if (!(strip = module->GetStrip(strind))) continue;
683 if (!(signal = strip->GetSignal())) {
684 strip->SetNoise(AliITSChannelDaSSD::GetUndefinedValue());
685 AliError(Form("AliITSHandleDaSSD: Error CalculateNoise(): there are no events data for module[%i] strip[%i]->GetSignal()",
686 module->GetModuleId(), strind));
689 Double_t nsum = 0.0L;
691 for (Long_t ev = 0; ev < strip->GetEventsNumber(); ev++) {
692 if (SignalOutOfRange(signal[ev])) ovev += 1;
693 else nsum += pow((signal[ev] - strip->GetPedestal()), 2);
695 if ((n = strip->GetEventsNumber() - ovev - 1) > 0) noise = sqrt(nsum / (Float_t)(n));
696 else noise = AliITSChannelDaSSD::GetUndefinedValue();
697 strip->SetNoise(noise);
704 //______________________________________________________________________________
705 Bool_t AliITSHandleDaSSD::CalculateNoiseCM(AliITSModuleDaSSD *const module)
707 // Calculates Noise with CM correction
708 AliITSChannelDaSSD *strip = NULL;
712 if (!CalculateCM(module)) {
713 AliError("Error: AliITSHandleDaSSD::CalculateCM() returned kFALSE");
716 for (Int_t strind = 0; strind < module->GetNumberOfStrips(); strind++) {
717 if (!(strip = module->GetStrip(strind))) continue; //return kFALSE;
718 if (!(signal = strip->GetSignal())) {
719 strip->SetNoiseCM(AliITSChannelDaSSD::GetUndefinedValue());
720 AliError(Form("SSDDAModule: Error CalculateNoiseWithoutCM(): there are no events data for module[%i] strip[%i]->GetSignal()",
721 module->GetModuleId(), strind));
722 continue; //return kFALSE;
724 Int_t chipind = strind / AliITSModuleDaSSD::GetStripsPerChip();
725 Double_t nsum = 0.0L;
727 for (Long_t ev = 0; ev < strip->GetEventsNumber(); ev++) {
728 if (SignalOutOfRange(signal[ev])) ovev += 1;
729 else nsum += pow((signal[ev] - strip->GetPedestal() - module->GetCM(chipind, ev)), 2);
731 if ((n = strip->GetEventsNumber() - ovev - 1) > 0) noise = sqrt(nsum / (Float_t)(n));
732 else noise = AliITSChannelDaSSD::GetUndefinedValue();
733 strip->SetNoiseCM(noise);
740 //______________________________________________________________________________
741 Bool_t AliITSHandleDaSSD::CalculateCM(AliITSModuleDaSSD *const module)
744 AliITSChannelDaSSD *strip = NULL;
748 module->SetNumberOfChips(AliITSModuleDaSSD::GetChipsPerModuleConst());
749 for (Int_t chipind = 0; chipind < module->GetNumberOfChips(); chipind++) {
750 stripind = chipind * module->GetStripsPerChip();
751 module->GetCM()[chipind].Set(fNumberOfEvents);
752 module->GetCM()[chipind].Reset(0.0f);
753 for (Long_t ev = 0; ev < fNumberOfEvents; ev++) {
754 // calculate firs approximation of CM.
757 for (Int_t strind = stripind; strind < (stripind + AliITSModuleDaSSD::GetStripsPerChip()); strind++) {
758 if (!(strip = module->GetStrip(strind))) continue; //return kFALSE;
759 if (!(signal = strip->GetSignal())) {
760 AliError(Form("AliITSHandleDaSSD: Error CalculateCM: there are no events data for module[%i] strip[%i]->GetSignal()",
761 module->GetModuleId(), strind));
764 if ((signal[ev] >= AliITSChannelDaSSD::GetOverflowConst()) ||
765 (strip->GetPedestal() == AliITSChannelDaSSD::GetUndefinedValue())) ovstr += 1;
766 else cm0 += (signal[ev] - strip->GetPedestal());
768 if ((n = AliITSModuleDaSSD::GetStripsPerChip() - ovstr)) cm0 /= (Float_t)(n);
769 else { module->SetCM(0.0f, chipind, ev); continue; }
770 // calculate avarage (cm - (signal - pedestal)) over the chip
771 Double_t cmsigma = 0.0L;
773 for (Int_t strind = stripind; strind < (stripind + AliITSModuleDaSSD::GetStripsPerChip()); strind++) {
774 if (!(strip = module->GetStrip(strind))) continue;
775 if (!(signal = strip->GetSignal())) {
776 AliError(Form("AliITSHandleDaSSD: Error CalculateCM: there are no events data for module[%i] strip[%i]->GetSignal()\n",
777 module->GetModuleId(), strind));
780 if ((signal[ev] >= AliITSChannelDaSSD::GetOverflowConst()) ||
781 (strip->GetPedestal() == AliITSChannelDaSSD::GetUndefinedValue())) ovstr += 1;
782 else cmsigma += pow((cm0 - (signal[ev] - strip->GetPedestal())), 2);
784 if ((n = AliITSModuleDaSSD::GetStripsPerChip() - ovstr)) cmsigma = sqrt(cmsigma / (Float_t)(n));
785 else { module->SetCM(0.0f, chipind, ev); continue; }
786 // calculate cm with threshold
787 Double_t cmsum = 0.0L;
789 for (Int_t strind = stripind; strind < (stripind + AliITSModuleDaSSD::GetStripsPerChip()); strind++) {
790 if (!(strip = module->GetStrip(strind))) continue;
791 signal = strip->GetSignal();
792 if ( (signal[ev] >= AliITSChannelDaSSD::GetOverflowConst())
793 || (strip->GetPedestal() == AliITSChannelDaSSD::GetUndefinedValue())
794 || (TMath::Abs(cm0 - (signal[ev] - strip->GetPedestal())) > (fCmThresholdFactor * cmsigma)) ) ovstr += 1;
795 else cmsum += (signal[ev] - strip->GetPedestal());
797 if ((n = AliITSModuleDaSSD::GetStripsPerChip() - ovstr)) cmsum /= (Float_t)(n);
799 if (!module->SetCM(cmsum, chipind, ev));
806 //______________________________________________________________________________
807 Bool_t AliITSHandleDaSSD::ProcessRawData(const Int_t nmread)
809 // Performs calculation of calibration parameters (pedestal, noise, ...)
811 if (nmread <= 0) return kFALSE;
812 if (!fModules) return kFALSE;
813 while ((nm = ReadModuleRawData(nmread)) > 0) {
814 cout << "Processing next " << nm << " modules;" << endl;
815 for (Int_t modind = fModIndProcessed; modind < fModIndRead; modind++) {
816 if (!fModules[modind]) {
817 AliError(Form("AliITSHandleDaSSD: Error ProcessRawData(): No AliITSModuleDaSSD object with index %i is allocated in AliITSHandleDaSSD\n",
821 AddFeromCm(fModules[modind]);
822 CalculatePedestal(fModules[modind]);
823 CalculateNoise(fModules[modind]);
824 CalculateNoiseCM(fModules[modind]);
829 fModIndProcessed = fModIndRead;
830 cout << fModIndProcessed << " - done" << endl;
836 //______________________________________________________________________________
837 Short_t AliITSHandleDaSSD::RetrieveModuleId(const UChar_t ddlID, const UChar_t ad, const UChar_t adc) const
839 // Retrieve ModuleId from the DDL map which is defined in AliITSRawStreamSSD class
840 if (!fDDLModuleMap) return 0;
841 Int_t mddli = ((ad - 1) * fgkNumberOfSSDModulesPerSlot) + (adc < 6 ? adc : (adc - 2));
842 if ((ddlID < fgkNumberOfSSDDDLs) && (mddli < fgkNumberOfSSDModulesPerDdl)) {
843 mddli = fDDLModuleMap[ddlID * fgkNumberOfSSDModulesPerDdl + mddli];
846 AliWarning(Form("Module index = %d or ddlID = %d is out of range 0 is rturned", ddlID, mddli));
849 if (mddli > SHRT_MAX) return SHRT_MAX;
850 else return (Short_t)mddli;
855 //______________________________________________________________________________
856 TObjArray* AliITSHandleDaSSD::GetCalibrationSSDLDC() const
858 // Fill in the array for OCDB
860 TObject *modcalibobj;
861 if (!fModules) return NULL;
862 ldcc = new TObjArray(fNumberOfModules, 0);
863 for (Int_t i = 0; i < fNumberOfModules; i++) {
868 modcalibobj = dynamic_cast<TObject*>(fModules[i]->GetCalibrationNoise());
869 ldcc->AddAt(modcalibobj, i);
876 //______________________________________________________________________________
877 Bool_t AliITSHandleDaSSD::SaveCalibrationSSDLDC(Char_t*& dafname) const
879 // Save Calibration data locally
880 TObjArray *ldcn, *ldcp, *ldcbc;
881 TObject *modobjn, *modobjp, *modobjbc;
883 TString dadatafilename("");
884 if (!fModules) return kFALSE;
885 ldcn = new TObjArray(fNumberOfModules, 0);
886 ldcn->SetName("Noise");
887 ldcp = new TObjArray(fNumberOfModules, 0);
888 ldcp->SetName("Pedestal");
889 ldcbc = new TObjArray(fNumberOfModules, 0);
890 ldcbc->SetName("BadChannels");
891 for (Int_t i = 0; i < fNumberOfModules; i++) {
896 modobjn = dynamic_cast<TObject*>(fModules[i]->GetCalibrationNoise());
897 modobjp = dynamic_cast<TObject*>(fModules[i]->GetCalibrationPedestal());
898 modobjbc = dynamic_cast<TObject*>(fModules[i]->GetCalibrationBadChannels());
899 ldcn->AddAt(modobjn, i);
900 ldcp->AddAt(modobjp, i);
901 ldcbc->AddAt(modobjbc, i);
906 if (dafname) dadatafilename.Form("%s/", dafname);
907 dadatafilename += TString::Format("ITSSSDda_%i.root", fLdcId);
908 tmpfname = new Char_t[dadatafilename.Length()+1];
909 dafname = strcpy(tmpfname, dadatafilename.Data());
910 TFile *fileRun = new TFile (dadatafilename.Data(),"RECREATE");
911 if (fileRun->IsZombie()) {
912 AliError(Form("AliITSHandleDaSSD: SaveCalibrationSSDLDC() error open file %s", dadatafilename.Data()));
920 fileRun->WriteTObject(ldcn);
921 fileRun->WriteTObject(ldcp);
922 if (fStaticBadChannelsMap) fileRun->WriteTObject(fStaticBadChannelsMap);
923 else fileRun->WriteTObject(ldcbc);
935 //______________________________________________________________________________
936 Bool_t AliITSHandleDaSSD::DumpModInfo(const Float_t meannosethreshold) const
938 // Dump calibration parameters
939 AliITSModuleDaSSD *mod;
940 AliITSChannelDaSSD *strip;
942 cout << "SSDDALDC::DumpModInfo(): Error, no modules are allocated!" << endl;
945 cout << "Modules with MeanNoise > " << meannosethreshold << endl;
946 for (Int_t i = 0; i < fNumberOfModules; i++) {
947 if (!(mod = fModules[i])) continue;
948 Float_t maxnoise = 0.0f, meannoise = 0.0f, maxped = 0.0f;
949 Int_t maxstrind = 0, novfstr = 0;
950 for (Int_t strind = 0; strind < mod->GetNumberOfStrips(); strind++) {
951 if (!(strip = mod->GetStrip(strind))) {novfstr++; continue; }
952 if (strip->GetNoiseCM() >= AliITSChannelDaSSD::GetUndefinedValue() ) {novfstr++; continue; }
953 if (maxnoise < strip->GetNoiseCM()) {
954 maxnoise = strip->GetNoiseCM();
957 meannoise = (strind - novfstr) ? meannoise + (strip->GetNoiseCM() - meannoise) / static_cast<Float_t>(strind - novfstr + 1)
958 : strip->GetNoiseCM();
959 if (TMath::Abs(maxped) < TMath::Abs(strip->GetPedestal())) maxped = strip->GetPedestal();
961 if (meannoise > meannosethreshold)
962 cout << "Mod: " << i << "; DDl: " << (int)mod->GetDdlId() << "; AD: " << (int)mod->GetAD()
963 << "; ADC: " << (int)mod->GetADC() << "; MaxPed = " << maxped
964 << "; MeanNoise = " << meannoise
965 << "; NOfStrips = " << (mod->GetNumberOfStrips() - novfstr) << endl;
972 //______________________________________________________________________________
973 Bool_t AliITSHandleDaSSD::PrintModCalibrationData(const UChar_t ddlID, const UChar_t ad, const UChar_t adc, const Char_t *fname) const
975 // Print Module calibration data whether in file on in cout
976 AliITSChannelDaSSD *strip;
979 if (!fname) { outputfile = &cout; }
981 datafile.open(fname, ios::out);
982 if (datafile.fail()) return kFALSE;
983 outputfile = dynamic_cast<ostream*>(&datafile);
985 *outputfile << "DDL = " << (int)ddlID << "; AD = " << (int)ad << "; ADC = " << (int)adc << endl;
986 for (Int_t strind = 0; strind < AliITSModuleDaSSD::GetStripsPerModuleConst(); strind++) {
987 if ( (strip = GetStrip(ddlID, ad, adc, strind)) ) {
988 *outputfile << "Str = " << strind << "; ped = " << strip->GetPedestal()
989 << "; noise = " << strip->GetNoiseCM() << endl;
993 if (datafile.is_open()) datafile.close();
999 //______________________________________________________________________________
1000 void AliITSHandleDaSSD::DumpInitData(const Char_t *str) const
1002 // Print general information retrieved from raw data file
1003 cout << "Raw data file: " << fRawDataFileName << endl
1004 << "LDC: " << (Int_t)fLdcId << "; RunId: " << fRunId << endl
1005 << "Number of physics events: " << fNumberOfEvents << endl
1010 //______________________________________________________________________________
1011 Bool_t AliITSHandleDaSSD::AllocateSimulatedModules(const Int_t copymodind)
1013 // Used to allocate simulated modules to test the performance
1014 AliITSModuleDaSSD *module;
1015 UChar_t ad, adc, ddlID;
1016 ad = adc = ddlID = 0;
1017 if (!(fModules[copymodind])) return kFALSE;
1018 for (Int_t modind = 0; modind < fNumberOfModules; modind++) {
1019 if (!fModules[modind]) {
1020 module = new AliITSModuleDaSSD(AliITSModuleDaSSD::GetStripsPerModuleConst());
1021 if ((adc < 5) || ((adc > 7) && (adc < 13)) ) adc += 1;
1022 else if (adc == 5) adc = 8;
1023 else if (adc == 13) {
1025 if (ad < 8) ad += 1;
1031 if (!module->SetModuleIdData (ddlID, ad, adc, modind)) return kFALSE;
1032 fModules[modind] = module;
1033 for (Int_t strind = 0; strind < module->GetNumberOfStrips(); strind++) {
1034 AliITSChannelDaSSD *cstrip = fModules[copymodind]->GetStrip(strind);
1035 Long_t eventsnumber = cstrip->GetEventsNumber();
1036 AliITSChannelDaSSD *strip = new AliITSChannelDaSSD(strind, eventsnumber);
1037 for (Long_t evind = 0; evind < eventsnumber; evind++) {
1038 Short_t sign = *cstrip->GetSignal(evind);
1039 if (!strip->SetSignal(evind, sign)) AliError(Form("AliITSHandleDaSSD: Copy events error! mod = %i, str = %i", modind, strind));
1041 module->SetStrip(strip, strind);
1045 ddlID = fModules[modind]->GetDdlId();
1046 ad = fModules[modind]->GetAD();
1047 adc = fModules[modind]->GetADC();
1050 for (UShort_t modind = 0; modind < fNumberOfModules; modind++) fModules[modind]->SetModuleId(modind + 1080);
1056 //___________________________________________________________________________________________
1057 Bool_t AliITSHandleDaSSD::AdDataPresent(const Int_t ddl, const Int_t ad) const
1059 // Check if there are calibration data for given ddl and slot
1060 for (Int_t modind = 0; modind < fNumberOfModules; modind++)
1061 if ((GetModule(modind)->GetAD() == ad) && (GetModule(modind)->GetDdlId() == ddl)) return kTRUE;
1067 //___________________________________________________________________________________________
1068 Bool_t AliITSHandleDaSSD::SaveEqSlotCalibrationData(const Int_t ddl, const Int_t ad, const Char_t *fname) const
1069 // Saves calibration files for selected equipment (DDL)
1072 Int_t zsml, offsetml;
1073 ULong_t zsth, offset, zsoffset;
1075 AliError("File name must be specified!");
1078 if (!AdDataPresent(ddl, ad)) {
1079 AliError(Form("Error SaveEqSlotCalibrationData(ddl = %i, ad = %i) no data present", ddl, ad));
1082 feefile.open(fname, ios::out);
1083 if (!feefile.is_open()) {
1084 AliError(Form("Can not open the file %s for output!", fname));
1087 for (zsml = 0; fgkZsBitMask >> zsml; zsml++);
1088 for (offsetml = 0; fgkOffSetBitMask >> offsetml; offsetml++);
1089 for (Int_t strind = 0; strind < AliITSModuleDaSSD::GetStripsPerModuleConst(); strind++) {
1090 for (Int_t adcb = 0; adcb < fgkAdcPerDBlock; adcb++) {
1092 for (Int_t j = 0; j < 2; j++) {
1093 Int_t adc = adcb + j * 8;
1094 zsth = ZsThreshold(ddl, ad, adc, strind);
1095 offset = OffsetValue(ddl, ad, adc, strind);
1096 zsoffset = zsoffset | (((zsth << offsetml) | offset) << ((j == 0) ? (offsetml + zsml) : 0));
1098 feefile << "0x" << ConvBase(static_cast<unsigned long>(zsoffset), 16) << endl;
1106 //______________________________________________________________________________
1107 Int_t AliITSHandleDaSSD::ChannelIsBad(const UChar_t ddl, const UChar_t ad, const UChar_t adc, const Int_t strn) const
1109 // Check if the channel is bad
1110 AliITSBadChannelsSSD *badch = NULL;
1112 Int_t strsiden, modn = -1;
1113 if (fStaticBadChannelsMap && fDDLModuleMap) {
1114 modn = RetrieveModuleId(ddl, ad, adc);
1115 if (modn < 0) return -1;
1117 while ((modind < fStaticBadChannelsMap->GetEntriesFast() && (!badch))) {
1118 AliITSBadChannelsSSD *bc = static_cast<AliITSBadChannelsSSD*>(fStaticBadChannelsMap->At(modind++));
1119 if ((bc->GetMod()) == modn) badch = bc;
1122 if (strn < AliITSModuleDaSSD::GetPNStripsPerModule()) {
1123 bcharray = badch->GetBadPChannelsList();
1126 bcharray = badch->GetBadNChannelsList();
1127 strsiden = AliITSChannelDaSSD::GetMaxStripIdConst() - strn;
1129 if (bcharray.GetSize() < AliITSModuleDaSSD::GetPNStripsPerModule()) {
1130 AliWarning(Form("No entry found in bad channels list TArrayI for ddl/ad/adc/str: %i/%i/%i/%i", ddl, ad, adc, strn));
1133 return (bcharray[strsiden] & fgkBadChannelMask);
1135 AliWarning(Form("No entry found in bad channels list for ddl = %i, ad = %i, adc = %i", ddl, ad, adc));
1139 AliError("Error ether bad channels list or DDLMap is not initialized or both, return 0!");
1145 //______________________________________________________________________________
1146 ULong_t AliITSHandleDaSSD::OffsetValue(const AliITSChannelDaSSD *strip,
1147 const UChar_t ddl, const UChar_t ad, const UChar_t adc, const Int_t strn) const
1149 // Calculate the offset value to be upload to FEROM
1151 if (fOffsetDefault < INT_MAX) pedint = fOffsetDefault;
1152 else pedint = TMath::Nint(strip->GetPedestal());
1153 if (pedint > static_cast<Int_t>((fgkOffSetBitMask >> 1))) {
1154 if (!ChannelIsBad(ddl, ad, adc, strn))
1155 AliError(Form("Offset %i, channel(ddl/ad/adc/strip) %i/%i/%i/%i can not be represented with mask %i, Offset = %i",
1156 pedint, ddl, ad, adc, strn, ConvBase(fgkOffSetBitMask, 16).c_str(), fgkOffSetBitMask));
1157 return fgkOffSetBitMask;
1159 if ((-pedint) > static_cast<Int_t>(((fgkOffSetBitMask + 1) >> 1))) {
1160 if (!ChannelIsBad(ddl, ad, adc, strn))
1161 AliError(Form("Offset %i, channel(ddl/ad/adc/strip) %i/%i/%i/%i can not be represented with mask %i, Offset = %i",
1162 pedint, ddl, ad, adc, strn, ConvBase(fgkOffSetBitMask, 16).c_str(), (fgkOffSetBitMask & (~fgkOffSetBitMask >> 1))));
1163 return fgkOffSetBitMask & (~fgkOffSetBitMask >> 1);
1165 return fgkOffSetBitMask & (pedint >= 0 ? pedint : pedint + fgkOffSetBitMask + 1);
1170 //______________________________________________________________________________
1171 ULong_t AliITSHandleDaSSD::OffsetValue(const UChar_t ddl, const UChar_t ad, const UChar_t adc, const Int_t strn) const
1173 // Calculate the offset value to be upload to FEROM
1174 AliITSChannelDaSSD *strip = NULL;
1175 AliITSModuleDaSSD *module = NULL;
1176 if (module = GetModule(ddl, ad, adc)) {
1177 if (strip = module->GetStrip(strn)) return OffsetValue(strip, ddl, ad, adc, strn);
1179 AliWarning(Form("There is no calibration data for ddl = %i, ad = %i, adc = %i, strip = %i, 0 is used!", ddl, ad, adc, strn));
1183 AliWarning(Form("There is no calibration data for ddl = %i, ad = %i, adc = %i, 0 is used!", ddl, ad, adc));
1190 //______________________________________________________________________________
1191 ULong_t AliITSHandleDaSSD::ZsThreshold(AliITSChannelDaSSD *strip) const
1193 // Calculate the value of zero suppression threshold to be upload to FEROM
1195 if (fZsDefault < 0) zs = TMath::Nint(fZsFactor * strip->GetNoiseCM());
1196 else zs = fZsDefault;
1197 return (zs < fgkZsBitMask) ? (zs & fgkZsBitMask) : fgkZsBitMask;
1201 //______________________________________________________________________________
1202 ULong_t AliITSHandleDaSSD::ZsThreshold(const UChar_t ddl, const UChar_t ad, const UChar_t adc, const Int_t strn) const
1204 // Calculate the value of zero suppression threshold to be upload to FEROM, account bad channels list
1205 AliITSChannelDaSSD *strip = NULL;
1206 AliITSModuleDaSSD *module = NULL;
1207 if (ChannelIsBad(ddl, ad, adc, strn)) return fgkZsBitMask;
1208 if (module = GetModule(ddl, ad, adc)) {
1209 if (strip = module->GetStrip(strn)) return ZsThreshold(strip);
1211 AliWarning(Form("There is no calibration data for ddl = %i, ad = %i, adc = %i, strip = %i, 0 is used!", ddl, ad, adc, strn));
1215 AliWarning(Form("There is no calibration data for ddl = %i, ad = %i, adc = %i, 0 is used!", ddl, ad, adc));
1221 //______________________________________________________________________________
1222 string AliITSHandleDaSSD::ConvBase(const unsigned long value, const long base) const
1224 // Converts the unsigned long number into that in another base
1225 string digits = "0123456789ABCDEF";
1227 unsigned long v = value;
1228 if((base < 2) || (base > 16)) {
1229 result = "Error: base out of range.";
1234 result = digits[v % base] + result;
1238 while((v) || (i<8));