+
+
+
+//___________________________________________________________________________________________
+Bool_t AliITSHandleDaSSD::AdDataPresent(const Int_t ddl, const Int_t ad) const
+{
+// Check if there are calibration data for given ddl and slot
+ for (Int_t modind = 0; modind < fNumberOfModules; modind++)
+ if ((GetModule(modind)->GetAD() == ad) && (GetModule(modind)->GetDdlId() == ddl)) return kTRUE;
+ return kFALSE;
+}
+
+
+
+//___________________________________________________________________________________________
+Bool_t AliITSHandleDaSSD::SaveEqSlotCalibrationData(const Int_t ddl, const Int_t ad, const Char_t *fname) const
+// Saves calibration files for selected equipment (DDL)
+{
+ fstream feefile;
+ Int_t zsml, offsetml;
+ ULong_t zsth, offset, zsoffset;
+ if (!fname) {
+ AliError("File name must be specified!");
+ return kFALSE;
+ }
+ if (!AdDataPresent(ddl, ad)) {
+ AliError(Form("Error SaveEqSlotCalibrationData(ddl = %i, ad = %i) no data present", ddl, ad));
+ return kFALSE;
+ }
+ feefile.open(fname, ios::out);
+ if (!feefile.is_open()) {
+ AliError(Form("Can not open the file %s for output!", fname));
+ return kFALSE;
+ }
+ for (zsml = 0; fgkZsBitMask >> zsml; zsml++) ;
+ for (offsetml = 0; fgkOffSetBitMask >> offsetml; offsetml++) ;
+ for (Int_t strind = 0; strind < AliITSModuleDaSSD::GetStripsPerModuleConst(); strind++) {
+ for (Int_t adcb = 0; adcb < fgkAdcPerDBlock; adcb++) {
+ zsoffset = 0x0;
+ for (Int_t j = 0; j < 2; j++) {
+ Int_t adc = adcb + j * 8;
+ zsth = ZsThreshold(ddl, ad, adc, strind);
+ offset = OffsetValue(ddl, ad, adc, strind);
+ zsoffset = zsoffset | (((zsth << offsetml) | offset) << ((j == 0) ? (offsetml + zsml) : 0));
+ }
+ feefile << "0x" << ConvBase(static_cast<unsigned long>(zsoffset), 16) << endl;
+ }
+ }
+ feefile.close();
+ return kTRUE;
+}
+
+
+//______________________________________________________________________________
+Int_t AliITSHandleDaSSD::ChannelIsBad(const UChar_t ddl, const UChar_t ad, const UChar_t adc, const Int_t strn) const
+{
+// Check if the channel is bad
+ AliITSModuleDaSSD *module = NULL;
+ Int_t modn = -1;
+ if (fBadChannelsList && fDDLModuleMap) {
+ modn = RetrieveModuleId(ddl, ad, adc);
+ if (modn < 0) return -1;
+ if (modn < fgkMinSSDModuleId) {
+ AliWarning(Form("Module ddl/ad/adc: %i/%i/%i has number %i which is wrong for SSD module", ddl, ad, adc, strn, modn));
+ return -1;
+ }
+ Short_t modid = modn - fgkMinSSDModuleId;
+ if (strn < AliITSModuleDaSSD::GetPNStripsPerModule())
+ return (fBadChannelsList->GetBadChannelP(modid, strn) & fgkBadChannelMask);
+ else return (fBadChannelsList->GetBadChannelN(modid, (AliITSChannelDaSSD::GetMaxStripIdConst() - strn)) & fgkBadChannelMask);
+ } else {
+ AliError("Error ether bad channels list or DDLMap is not initialized or both, EvaluateIfChannelIsBad(module, strip) is used!");
+ if ((module = GetModule(ddl, ad, adc))) {
+ return (EvaluateIfChannelIsBad(module, strn) & fgkBadChannelMask);
+ } else {
+ AliWarning(Form("There is no calibration data for ddl = %i, ad = %i, adc = %i, 0 is used!", ddl, ad, adc));
+ return 0ul;
+ }
+ return 0;
+ }
+}
+
+
+
+//______________________________________________________________________________
+Int_t AliITSHandleDaSSD::LadderIsOff(const UChar_t ddl, const UChar_t ad, const UChar_t adc) const
+{
+//Checks if the module with given ddl, ad, adc is on the ladder which is in the list of ladders which are off
+ const Int_t nm5 = 500;
+ const Int_t nm6 = 1248;
+ const Int_t nml5a = 12;
+ const Int_t nml5c = 10;
+ const Int_t nml6a = 12;
+ const Int_t nml6c = 13;
+ Int_t modn, ladder, layer, side;
+ AliITSModuleDaSSD *module;
+ if (!(module = GetModule(ddl, ad, adc))) return 0;
+ if ((modn = module->GetModuleId()) <= 0) modn = RetrieveModuleId(ddl, ad, adc);
+ if (modn <= 0) return 0;
+ layer = modn >= nm6 ? 1 : 0; // 6 : 5
+ ladder = (modn - (layer ? nm6 : nm5)) / (layer ? (nml6a + nml6c) : (nml5a + nml5c));
+ if ( ((modn - (layer ? nm6 : nm5)) % (layer ? (nml6a + nml6c) : (nml5a + nml5c))) < (layer ? nml6a : nml5a))
+ side = 0; // A
+ else side = 1; // C
+ ladder += (layer ? 600 : 500);
+ layer += 5;
+ if (side)
+ if (fCLaddersOff.GetSize()) {
+ for(Int_t i = 0; i < fCLaddersOff.GetSize(); i++)
+ if (fCLaddersOff.At(i) == ladder) return fCLaddersOff.At(i);
+ return 0;
+ } else return 0;
+ else
+ if (fALaddersOff.GetSize()) {
+ for(Int_t i = 0; i < fALaddersOff.GetSize(); i++)
+ if (fALaddersOff.At(i) == ladder) return fALaddersOff.At(i);
+ return 0;
+ } else return 0;
+ return 0;
+}
+
+
+
+//______________________________________________________________________________
+ULong_t AliITSHandleDaSSD::OffsetValue(const AliITSChannelDaSSD *strip,
+ const UChar_t ddl, const UChar_t ad, const UChar_t adc, const Int_t strn) const
+{
+// Calculate the offset value to be upload to FEROM
+ Int_t pedint;
+ if (fOffsetDefault < INT_MAX) pedint = fOffsetDefault;
+ else pedint = TMath::Nint(strip->GetPedestal());
+ if (pedint > static_cast<Int_t>((fgkOffSetBitMask >> 1))) {
+ if (!ChannelIsBad(ddl, ad, adc, strn) && !((fMergeBCLists) && (EvaluateIfChannelIsBad(GetModule(ddl, ad, adc), strn))))
+ AliError(Form("Offset %i, channel(ddl/ad/adc/strip) %i/%i/%i/%i can not be represented with mask 0x%s, Offset = %i",
+ pedint, ddl, ad, adc, strn, ConvBase(fgkOffSetBitMask, 16).c_str(), (fgkOffSetBitMask >> 1)));
+ return (fgkOffSetBitMask >> 1);
+ }
+ if ((-pedint) > static_cast<Int_t>(((fgkOffSetBitMask + 1) >> 1))) {
+ if (!ChannelIsBad(ddl, ad, adc, strn) && !((fMergeBCLists) && (EvaluateIfChannelIsBad(GetModule(ddl, ad, adc), strn))))
+ AliError(Form("Offset %i, channel(ddl/ad/adc/strip) %i/%i/%i/%i can not be represented with mask 0x%s, Offset = %i",
+ pedint, ddl, ad, adc, strn, ConvBase(fgkOffSetBitMask, 16).c_str(),
+ ((fgkOffSetBitMask & (~fgkOffSetBitMask >> 1)) - fgkOffSetBitMask - 1)));
+ return fgkOffSetBitMask & (~fgkOffSetBitMask >> 1);
+ }
+ return fgkOffSetBitMask & (pedint >= 0 ? pedint : pedint + fgkOffSetBitMask + 1);
+}
+
+
+
+//______________________________________________________________________________
+ULong_t AliITSHandleDaSSD::OffsetValue(const UChar_t ddl, const UChar_t ad, const UChar_t adc, const Int_t strn) const
+{
+// Calculate the offset value to be upload to FEROM
+ AliITSChannelDaSSD *strip = NULL;
+ AliITSModuleDaSSD *module = NULL;
+ if ((module = GetModule(ddl, ad, adc))) {
+ if ((strip = module->GetStrip(strn))) return OffsetValue(strip, ddl, ad, adc, strn);
+ else {
+ AliWarning(Form("There is no calibration data for ddl = %i, ad = %i, adc = %i, strip = %i, 0 is used!", ddl, ad, adc, strn));
+ return 0ul;
+ }
+ } else {
+ AliWarning(Form("There is no calibration data for ddl = %i, ad = %i, adc = %i, 0 is used!", ddl, ad, adc));
+ return 0ul;
+ }
+}
+
+
+
+//______________________________________________________________________________
+ULong_t AliITSHandleDaSSD::ZsThreshold(AliITSChannelDaSSD *strip) const
+{
+// Calculate the value of zero suppression threshold to be upload to FEROM
+ ULong_t zs;
+ if (fZsDefault < 0) {
+ zs = TMath::Nint(fZsFactor * strip->GetNoiseCM());
+ if (zs < static_cast<ULong_t>(fZsMinimum)) zs = static_cast<ULong_t>(fZsMinimum);
+ }
+ else zs = fZsDefault;
+ return (zs < fgkZsBitMask) ? (zs & fgkZsBitMask) : fgkZsBitMask;
+}
+
+
+//______________________________________________________________________________
+ULong_t AliITSHandleDaSSD::ZsThreshold(const UChar_t ddl, const UChar_t ad, const UChar_t adc, const Int_t strn) const
+{
+// Calculate the value of zero suppression threshold to be upload to FEROM, account bad channels list
+ AliITSChannelDaSSD *strip = NULL;
+ AliITSModuleDaSSD *module = NULL;
+ if (ChannelIsBad(ddl, ad, adc, strn)) return fgkZsBitMask;
+ if (LadderIsOff(ddl, ad, adc)) return fgkZsBitMask;
+ if (fZsDefault > 0) if (static_cast<ULong_t>(fZsDefault) >= fgkZsBitMask) return fgkZsBitMask;
+ if ((module = GetModule(ddl, ad, adc))) {
+ if (fMergeBCLists) if (EvaluateIfChannelIsBad(module, strn)) return fgkZsBitMask;
+ if ((strip = module->GetStrip(strn))) return ZsThreshold(strip);
+ else {
+ AliWarning(Form("There is no calibration data for ddl = %i, ad = %i, adc = %i, strip = %i, 0 is used!", ddl, ad, adc, strn));
+ return 0ul;
+ }
+ } else {
+ AliWarning(Form("There is no calibration data for ddl = %i, ad = %i, adc = %i, 0 is used!", ddl, ad, adc));
+ return 0ul;
+ }
+}
+
+
+//______________________________________________________________________________
+string AliITSHandleDaSSD::ConvBase(const unsigned long value, const long base) const
+{
+// Converts the unsigned long number into that in another base
+ string digits = "0123456789ABCDEF";
+ string result;
+ unsigned long v = value;
+ if((base < 2) || (base > 16)) {
+ result = "Error: base out of range.";
+ }
+ else {
+ int i = 0;
+ do {
+ result = digits[v % base] + result;
+ v /= base;
+ i++;
+ }
+ while((v) || (i<8));
+ }
+ return result;
+}
+
+
+
+//______________________________________________________________________________
+Int_t AliITSHandleDaSSD::CheckOffChips() const
+{
+// Check if the chip, module are off
+ AliITSChannelDaSSD *strip;
+ Int_t offthreshold;
+ Int_t strnd, chipnd, modnd, stroff, chipoff, modoff;
+ offthreshold = TMath::Nint(fZsMinimum/fZsFactor);
+ modnd = modoff = 0;
+ for (Int_t mi = 0; mi < fNumberOfModules; mi++) {
+ if (!fModules[mi]) { modnd++; continue; }
+ if (fModules[mi]->GetModuleId() < 0) continue;
+ if (LadderIsOff(fModules[mi]->GetDdlId(), fModules[mi]->GetAD(), fModules[mi]->GetADC()) ) continue;
+ chipoff = chipnd = 0;
+ for (Int_t chipind = 0; chipind < AliITSModuleDaSSD::GetChipsPerModuleConst(); chipind++) {
+ strnd = stroff = 0;
+ Int_t stripind = chipind * AliITSModuleDaSSD::GetStripsPerChip();
+ for (Int_t strind = stripind; strind < (stripind + AliITSModuleDaSSD::GetStripsPerChip()); strind++) {
+ if (!(strip = fModules[mi]->GetStrip(strind))) { strnd++; continue; }
+ if (strip->GetNoiseCM() < offthreshold ) stroff++;
+ }
+ if (strnd == AliITSModuleDaSSD::GetStripsPerChip()) chipnd++;
+ else if (stroff == AliITSModuleDaSSD::GetStripsPerChip()) chipoff++;
+ else if ((stroff + strnd) == AliITSModuleDaSSD::GetStripsPerChip()) chipoff++;
+ }
+ if ((!chipoff) && (!chipnd)) continue;
+ if (chipnd == AliITSModuleDaSSD::GetChipsPerModuleConst()) {
+ AliInfo(Form("Module: (ddl/ad/adc) %i/%i/%i seems to be off and it is not on the ladders which are off!",
+ fModules[mi]->GetDdlId(), fModules[mi]->GetAD(), fModules[mi]->GetADC()));
+ modnd++;
+ }
+ if (chipoff == AliITSModuleDaSSD::GetChipsPerModuleConst()) {
+ AliInfo(Form("Module (ddl/ad/adc): %i/%i/%i seems to be off and it is not on the ladders which are off!",
+ fModules[mi]->GetDdlId(), fModules[mi]->GetAD(), fModules[mi]->GetADC()));
+ modoff++;
+ }
+ else if ((chipoff + chipnd) == AliITSModuleDaSSD::GetChipsPerModuleConst()) {
+ AliInfo(Form("Module: (ddl/ad/adc): %i/%i/%i seems to be off and it is not on the ladders which are off!",
+ fModules[mi]->GetDdlId(), fModules[mi]->GetAD(), fModules[mi]->GetADC()));
+ modoff++;
+ }
+ else if (chipoff) {
+ AliInfo(Form("Module: (ddl/ad/adc): %i/%i/%i has %i chips which are off!",
+ fModules[mi]->GetDdlId(), fModules[mi]->GetAD(), fModules[mi]->GetADC(), chipoff));
+ modoff++;
+ }
+ }
+ return (modoff + modnd);
+}
+
+
+//______________________________________________________________________________
+Bool_t AliITSHandleDaSSD::CalculatePedNoiseW(AliITSModuleDaSSD *const module)
+{
+// Calculates Pedestal and Noise using Welford algorithm
+ AliITSChannelDaSSD *strip;
+ Double_t pedestal, noise, p0, s0;
+ Short_t *signal;
+ Int_t ovev, n;
+ if (!module) return kFALSE;
+ for (Int_t strind = 0; strind < module->GetNumberOfStrips(); strind++) {
+ if (!(strip = module->GetStrip(strind))) continue;
+ if (!(signal = strip->GetSignal())) {
+ AliError(Form("AliITSHandleDaSSD: Error CalculatePedestal(): there are no events data for module[%i] strip[%i]->GetSignal()",
+ module->GetModuleId(), strind));
+ continue;
+ }
+//************* pedestal and noise first pass ****************
+ pedestal = p0 = noise = 0.0L;
+ ovev = 0;
+ for (Int_t ev = 0; ev < strip->GetEventsNumber(); ev++) {
+ if (SignalOutOfRange(signal[ev])) ovev += 1;
+ else
+ if (!(ev - ovev)) {
+ pedestal = p0 = signal[ev];
+ noise = 0.0L;
+ } else {
+ p0 = pedestal + (signal[ev] - pedestal) / static_cast<Double_t>(ev - ovev + 1);
+ s0 = noise + (signal[ev] - pedestal) * (signal[ev] - p0);
+ pedestal = p0;
+ noise = s0;
+ }
+ }
+ if (strip->GetEventsNumber() == ovev) pedestal = AliITSChannelDaSSD::GetUndefinedValue();
+ strip->SetPedestal(static_cast<Float_t>(pedestal));
+ if ((n = strip->GetEventsNumber() - ovev - 1) > 0)
+ strip->SetNoise( static_cast<Float_t>(sqrt(noise / static_cast<Double_t>(n))) );
+ else {
+ strip->SetNoise(AliITSChannelDaSSD::GetUndefinedValue());
+ continue;
+ }
+//************* Second pass excluds event with |p - s|>f*noise *****************
+ pedestal = p0 = noise = 0.0L;
+ ovev = 0;
+ for (Int_t ev = 0; ev < strip->GetEventsNumber(); ev++) {
+ if ( SignalOutOfRange(signal[ev])
+ || TMath::Abs(signal[ev] - strip->GetPedestal()) > (fPedestalThresholdFactor * strip->GetNoise())) ovev += 1;
+ else
+ if (!(ev - ovev)) {
+ pedestal = p0 = signal[ev];
+ noise = 0.0L;
+ } else {
+ p0 = pedestal + (signal[ev] - pedestal) / static_cast<Double_t>(ev - ovev + 1);
+ s0 = noise + (signal[ev] - pedestal) * (signal[ev] - p0);
+ pedestal = p0;
+ noise = s0;
+ }
+ }
+ if ((n = strip->GetEventsNumber() - ovev - 1) > 0) noise = sqrt(noise / static_cast<Double_t>(n));
+ else noise = AliITSChannelDaSSD::GetUndefinedValue();
+ strip->SetNoise(static_cast<Float_t>(noise));
+ if (strip->GetEventsNumber() == ovev) pedestal = AliITSChannelDaSSD::GetUndefinedValue();
+ strip->SetPedestal(static_cast<Float_t>(pedestal));
+ strip->SetOverflowNumber(ovev);
+ }
+ return kTRUE;
+}
+
+
+//______________________________________________________________________________
+Bool_t AliITSHandleDaSSD::CalculateCMW(AliITSModuleDaSSD *const module)
+{
+// Calculates CM using Welford algorithm
+ AliITSChannelDaSSD *strip = NULL;
+ Short_t *signal;
+ Int_t ovstr, n;
+ Int_t stripind;
+ Double_t cm0, cm1, cmsigma, cms1;
+ module->SetNumberOfChips(AliITSModuleDaSSD::GetChipsPerModuleConst());
+ for (Int_t chipind = 0; chipind < module->GetNumberOfChips(); chipind++) {
+ stripind = chipind * module->GetStripsPerChip();
+ module->GetCM()[chipind].Set(fNumberOfEvents);
+ module->GetCM()[chipind].Reset(0.0f);
+ for (Long_t ev = 0; ev < fNumberOfEvents; ev++) {
+ // calculate firs approximation of CM and SigmaCM.
+ cm0 = cm1 = cmsigma = 0.0L;
+ ovstr = 0;
+ for (Int_t strind = stripind; strind < (stripind + AliITSModuleDaSSD::GetStripsPerChip()); strind++) {
+ if (!(strip = module->GetStrip(strind))) { ovstr += 1; continue; } //return kFALSE;
+ if (!(signal = strip->GetSignal())) { ovstr += 1; continue; } //return kFALSE;
+ if ((SignalOutOfRange(signal[ev])) || (strip->GetPedestal() == AliITSChannelDaSSD::GetUndefinedValue())) ovstr += 1;
+ else {
+ if (!(strind - stripind - ovstr)) {
+ cm0 = cm1 = signal[ev] - strip->GetPedestal();
+ cmsigma = 0.0L;
+ } else {
+ cm1 = cm0 + (signal[ev] - strip->GetPedestal() - cm0) / static_cast<Double_t>(strind - stripind - ovstr + 1);
+ cms1 = cmsigma + (signal[ev] - strip->GetPedestal() - cm0) * (signal[ev] - strip->GetPedestal() - cm1);
+ cm0 = cm1;
+ cmsigma = cms1;
+ } }
+ }
+ if ((n = AliITSModuleDaSSD::GetStripsPerChip() - ovstr - 1) > 0) cmsigma = sqrt(cmsigma / static_cast<Double_t>(n));
+ else {
+ AliWarning(Form("AliITSHandleDaSSD: Too little number of strips have a signal for module:chip:event : [%i]:[%i]:[%i]\n",
+ module->GetModuleId(), chipind, ev));
+ if (!(module->SetCM(0.0f, chipind, ev)))
+ AliError(Form("AliITSHandleDaSSD: Error, module->SetCM(...) returned kFALSE module:chip:event : [%i]:[%i]:[%i]\n",
+ module->GetModuleId(), chipind, ev));
+ continue;
+ }
+ // calculate cm with threshold
+ Double_t cmsum = 0.0L;
+ ovstr = 0;
+ for (Int_t strind = stripind; strind < (stripind + AliITSModuleDaSSD::GetStripsPerChip()); strind++) {
+ if (!(strip = module->GetStrip(strind))) { ovstr += 1; continue; }
+ if (!(signal = strip->GetSignal())) { ovstr += 1; continue; }
+ if ( (SignalOutOfRange(signal[ev])) || (strip->GetPedestal() == AliITSChannelDaSSD::GetUndefinedValue())
+ || (TMath::Abs(cm0 - (signal[ev] - strip->GetPedestal())) > (fCmThresholdFactor * cmsigma)) ) ovstr += 1;
+ else cmsum += (signal[ev] - strip->GetPedestal());
+ }
+ if ((n = AliITSModuleDaSSD::GetStripsPerChip() - ovstr)) cmsum /= (Double_t)(n);
+ else cmsum = 0.0L;
+ if (!(module->SetCM(static_cast<Float_t>(cmsum), chipind, ev)))
+ AliError(Form("AliITSHandleDaSSD: Error, module->SetCM(...) returned kFALSE module:chip:event : [%i]:[%i]:[%i]\n",
+ module->GetModuleId(), chipind, ev));
+ }
+ }
+ return kTRUE;
+}
+
+
+//______________________________________________________________________________
+Bool_t AliITSHandleDaSSD::CalculateNoiseCMW(AliITSModuleDaSSD *const module)
+{
+// Calculates Noise with CM correction
+ AliITSChannelDaSSD *strip = NULL;
+ Short_t *signal;
+ Int_t ovev, n;
+ if (!CalculateCMW(module)) {
+ AliError("Error: AliITSHandleDaSSD::CalculateCMW() returned kFALSE");
+ return kFALSE;
+ }
+ for (Int_t strind = 0; strind < module->GetNumberOfStrips(); strind++) {
+ if (!(strip = module->GetStrip(strind))) continue; //return kFALSE;
+ if (!(signal = strip->GetSignal())) {
+ strip->SetNoiseCM(AliITSChannelDaSSD::GetUndefinedValue());
+ AliError(Form("AliITSHandleDaSSD: Error CalculateNoiseCMW(): there are no events data for module[%i] strip[%i]->GetSignal()",
+ module->GetModuleId(), strind));
+ continue; //return kFALSE;
+ }
+//** To get exactly the same set of events as for pedestal and noise calculation **
+ Double_t pedestal, noise, p0, s0;
+ pedestal = p0 = noise = 0.0L;
+ ovev = 0;
+ for (Int_t ev = 0; ev < strip->GetEventsNumber(); ev++) {
+ if (SignalOutOfRange(signal[ev])) ovev += 1;
+ else
+ if (!(ev - ovev)) {
+ pedestal = p0 = signal[ev];
+ noise = 0.0L;
+ } else {
+ p0 = pedestal + (signal[ev] - pedestal) / static_cast<Double_t>(ev - ovev + 1);
+ s0 = noise + (signal[ev] - pedestal) * (signal[ev] - p0);
+ pedestal = p0;
+ noise = s0;
+ }
+ }
+ if ((n = strip->GetEventsNumber() - ovev - 1) > 0) noise = sqrt(noise / static_cast<Double_t>(n));
+ else {
+ strip->SetNoiseCM(AliITSChannelDaSSD::GetUndefinedValue());
+ continue;
+ }
+//** Calculation of CM corrected noise **
+ Int_t chipind = strind / AliITSModuleDaSSD::GetStripsPerChip();
+ Double_t nsum = 0.0L;
+ ovev = 0;
+ for (Int_t ev = 0; ev < strip->GetEventsNumber(); ev++) {
+ if ( SignalOutOfRange(signal[ev])
+ || TMath::Abs(signal[ev] - pedestal) > (fPedestalThresholdFactor * noise)) ovev += 1;
+ else nsum += pow((signal[ev] - strip->GetPedestal() - module->GetCM(chipind, ev)), 2);
+ }
+ if ((n = strip->GetEventsNumber() - ovev - 1) > 0) noise = sqrt(nsum / static_cast<Double_t>(n));
+ else noise = AliITSChannelDaSSD::GetUndefinedValue();
+ strip->SetNoiseCM(static_cast<Float_t>(noise));
+ }
+ return kTRUE;
+}
+
+
+
+//______________________________________________________________________________
+UChar_t AliITSHandleDaSSD::EvaluateIfChannelIsBad(const AliITSModuleDaSSD *const module, const Int_t stripn) const
+{
+//Applies the bad channel creteria and set the appropriate flags for returned value
+ AliITSChannelDaSSD *strip = 0;
+ UInt_t bcflags = 0;
+ if (fZsDefault >= 0) { if (static_cast<ULong_t>(fZsDefault) >= fgkZsBitMask) bcflags |= 3; }
+ else if (static_cast<ULong_t>(fZsMinimum) >= fgkZsBitMask) bcflags |= 3;
+ if (LadderIsOff(module->GetDdlId(), module->GetAD(), module->GetADC()) ) bcflags |= 3;
+
+ if (!(strip = module->GetStrip(stripn))) bcflags |= 3;
+ else {
+ if (strip->GetNoiseCM() == AliITSChannelDaSSD::GetUndefinedValue()) bcflags |= 8;
+ if (static_cast<ULong_t>(TMath::Nint(fZsFactor * strip->GetNoiseCM())) >= fgkZsBitMask) bcflags |= 8;
+ if (strip->GetNoiseCM() < 1) bcflags |= 16;
+ if (strip->GetPedestal() > ((fgkOffSetBitMask >> 1) - 1)) bcflags |= 4;
+ else if ((-(strip->GetPedestal())) > (fgkOffSetBitMask >> 1)) bcflags |= 4;
+ if (bcflags) bcflags |= 3;
+ }
+ return bcflags;
+}
+