From 61a57d076c81c2c822a5c57e41204ba99fe470f6 Mon Sep 17 00:00:00 2001 From: masera Date: Fri, 25 Jul 2008 15:13:59 +0000 Subject: [PATCH] Fixes for SSD detector algorithms and preprocessor (Panos) --- ITS/AliITSChannelDaSSD.cxx | 11 +- ITS/AliITSChannelDaSSD.h | 6 +- ITS/AliITSHandleDaSSD.cxx | 472 +++++++++++++++++++++++++--------- ITS/AliITSHandleDaSSD.h | 87 ++++--- ITS/AliITSModuleDaSSD.cxx | 121 +++------ ITS/AliITSModuleDaSSD.h | 8 +- ITS/AliITSPreprocessorSSD.cxx | 24 +- ITS/ITSSSDPEDda.cxx | 97 ++++++- 8 files changed, 540 insertions(+), 286 deletions(-) diff --git a/ITS/AliITSChannelDaSSD.cxx b/ITS/AliITSChannelDaSSD.cxx index 4f81d2359eb..eebe64f0dab 100644 --- a/ITS/AliITSChannelDaSSD.cxx +++ b/ITS/AliITSChannelDaSSD.cxx @@ -35,10 +35,10 @@ using namespace std; const Short_t AliITSChannelDaSSD::fgkMinStripId = 0; // minimum strip id const Short_t AliITSChannelDaSSD::fgkMaxStripId = 1535; // maximum strip id -const Short_t AliITSChannelDaSSD::fgkSignalOverflow = 2047; // ADC overflow value -const Short_t AliITSChannelDaSSD::fgkSignalUnderflow = 2048; // ADC underflow value -const UShort_t AliITSChannelDaSSD::fgkDefaultSignal = 0x7F; // initialization value for fNoise, fPedestal, fSignal[i] -const Float_t AliITSChannelDaSSD::fgkUndefinedValue = 32639.0f; // = 0x7F7F +const Short_t AliITSChannelDaSSD::fgkSignalOverflow = 2047; // ADC overflow value +const Short_t AliITSChannelDaSSD::fgkSignalUnderflow = -2048; // ADC underflow value +const UShort_t AliITSChannelDaSSD::fgkDefaultSignal = 0x7F; // initialization value for fNoise, fPedestal, fSignal[i] +const Float_t AliITSChannelDaSSD::fgkUndefinedValue = 32639.0f; // = 0x7F7F //______________________________________________________________________________ @@ -125,7 +125,8 @@ AliITSChannelDaSSD::AliITSChannelDaSSD(const AliITSChannelDaSSD& strip) : AliITSChannelDaSSD& AliITSChannelDaSSD::operator = (const AliITSChannelDaSSD& strip) { // assignment operator - if (this == &strip) return *this; + if (this == &strip) return *this; + TObject::operator=(strip); if (fSignal) { delete [] fSignal; fSignal = NULL; } fStripId = strip.fStripId; fEventsNumber = strip.fEventsNumber; diff --git a/ITS/AliITSChannelDaSSD.h b/ITS/AliITSChannelDaSSD.h index b2cb149096b..3408ab0ecb6 100644 --- a/ITS/AliITSChannelDaSSD.h +++ b/ITS/AliITSChannelDaSSD.h @@ -29,8 +29,8 @@ class AliITSChannelDaSSD : public TObject { UShort_t GetStripId() const { return fStripId; } Long_t GetEventsNumber() const { return fEventsNumber; } Short_t* GetSignal() const { return fSignal; } - Short_t* GetSignal(const Long_t eventnumber) const - { return (eventnumber < fEventsNumber && fSignal) ? (fSignal+eventnumber) : NULL; } + Short_t GetSignal(const Long_t eventnumber) const + { return (eventnumber < fEventsNumber && fSignal) ? *(fSignal+eventnumber) : fgkDefaultSignal; } Float_t GetPedestal() const { return fPedestal; } Float_t GetNoise() const { return fNoise; } @@ -77,7 +77,7 @@ class AliITSChannelDaSSD : public TObject { Float_t fNoiseCM; // noise with CM correction Long_t fNOverflowEv; // Number of events which exceed the pedestal calculation threshold - ClassDef(AliITSChannelDaSSD, 2) + ClassDef(AliITSChannelDaSSD, 3) }; #endif diff --git a/ITS/AliITSHandleDaSSD.cxx b/ITS/AliITSHandleDaSSD.cxx index a0ca0eab8e3..07bc44c9268 100644 --- a/ITS/AliITSHandleDaSSD.cxx +++ b/ITS/AliITSHandleDaSSD.cxx @@ -20,11 +20,12 @@ /// This class provides ITS SSD data handling /// used by DA. // Author: Oleksandr Borysov -// Date: 19/05/2008 +// Date: 18/07/2008 /////////////////////////////////////////////////////////////////////////////// #include #include +#include #include #include "AliITSHandleDaSSD.h" #include @@ -32,7 +33,6 @@ #include "event.h" #include "TFile.h" #include "TString.h" -#include "TObjArray.h" #include "AliLog.h" #include "AliITSNoiseSSD.h" #include "AliITSPedestalSSD.h" @@ -51,6 +51,7 @@ using namespace std; const Int_t AliITSHandleDaSSD::fgkNumberOfSSDModules = 1698; // Number of SSD modules in ITS const Int_t AliITSHandleDaSSD::fgkNumberOfSSDModulesPerDdl = 108; // Number of SSD modules in DDL const Int_t AliITSHandleDaSSD::fgkNumberOfSSDModulesPerSlot = 12; // Number of SSD modules in Slot +const Short_t AliITSHandleDaSSD::fgkMinSSDModuleId = 500; // Initial SSD modules number const Int_t AliITSHandleDaSSD::fgkNumberOfSSDSlotsPerDDL = 9; // Number of SSD slots per DDL const Int_t AliITSHandleDaSSD::fgkNumberOfSSDDDLs = 16; // Number of SSD modules in Slot const Float_t AliITSHandleDaSSD::fgkPedestalThresholdFactor = 3.0; // Defalt value for fPedestalThresholdFactor @@ -69,15 +70,20 @@ AliITSHandleDaSSD::AliITSHandleDaSSD() : fModIndProcessed(0), fModIndRead(0), fModIndex(NULL), + fEqIndex(0), fNumberOfEvents(0), - fStaticBadChannelsMap(NULL), + fBadChannelsList(NULL), fDDLModuleMap(NULL), + fALaddersOff(0), + fCLaddersOff(0), fLdcId(0), fRunId(0), fPedestalThresholdFactor(fgkPedestalThresholdFactor), fCmThresholdFactor(fgkCmThresholdFactor), fZsDefault(-1), fOffsetDefault(INT_MAX), + fZsMinimum(2), + fMergeBCLists(1), fZsFactor(3.0) { // Default constructor @@ -92,15 +98,20 @@ AliITSHandleDaSSD::AliITSHandleDaSSD(Char_t *rdfname) : fModIndProcessed(0), fModIndRead(0), fModIndex(NULL), + fEqIndex(0), fNumberOfEvents(0), - fStaticBadChannelsMap(NULL), + fBadChannelsList(NULL), fDDLModuleMap(NULL), + fALaddersOff(0), + fCLaddersOff(0), fLdcId(0), fRunId(0), fPedestalThresholdFactor(fgkPedestalThresholdFactor) , fCmThresholdFactor(fgkCmThresholdFactor), fZsDefault(-1), fOffsetDefault(INT_MAX), + fZsMinimum(2), + fMergeBCLists(1), fZsFactor(3.0) { if (!Init(rdfname)) AliError("AliITSHandleDaSSD::AliITSHandleDaSSD() initialization error!"); @@ -116,15 +127,20 @@ AliITSHandleDaSSD::AliITSHandleDaSSD(const AliITSHandleDaSSD& ssdadldc) : fModIndProcessed(ssdadldc.fModIndProcessed), fModIndRead(ssdadldc.fModIndRead), fModIndex(NULL), + fEqIndex(0), fNumberOfEvents(ssdadldc.fNumberOfEvents), - fStaticBadChannelsMap(ssdadldc.fStaticBadChannelsMap), - fDDLModuleMap(ssdadldc.fDDLModuleMap), + fBadChannelsList(NULL), + fDDLModuleMap(NULL), + fALaddersOff(ssdadldc.fALaddersOff), + fCLaddersOff(ssdadldc.fCLaddersOff), fLdcId(ssdadldc.fLdcId), fRunId(ssdadldc.fRunId), fPedestalThresholdFactor(ssdadldc.fPedestalThresholdFactor), fCmThresholdFactor(ssdadldc.fCmThresholdFactor), fZsDefault(ssdadldc.fZsDefault), fOffsetDefault(ssdadldc.fOffsetDefault), + fZsMinimum(ssdadldc.fZsMinimum), + fMergeBCLists(ssdadldc.fMergeBCLists), fZsFactor(ssdadldc.fZsFactor) { // copy constructor @@ -149,6 +165,8 @@ AliITSHandleDaSSD::AliITSHandleDaSSD(const AliITSHandleDaSSD& ssdadldc) : fModules = NULL; } } + if (ssdadldc.fBadChannelsList) AliWarning("fBadChannelsList is not copied by copy constructor, use other methods to init it!"); + if (ssdadldc.fDDLModuleMap) AliWarning("fDDLModuleMap is not copied by copy constructor, use other methods to init it!"); } @@ -157,6 +175,7 @@ AliITSHandleDaSSD& AliITSHandleDaSSD::operator = (const AliITSHandleDaSSD& ssdad { // assignment operator if (this == &ssdadldc) return *this; + TObject::operator=(ssdadldc); if (fModules) { for (Int_t i = 0; i < fNumberOfModules; i++) if (fModules[i]) delete fModules[i]; delete [] fModules; @@ -168,15 +187,15 @@ AliITSHandleDaSSD& AliITSHandleDaSSD::operator = (const AliITSHandleDaSSD& ssdad if (fModules) { for (Int_t modind = 0; modind < ssdadldc.fNumberOfModules; modind++) { if (ssdadldc.fModules[modind]) { - fModules[modind] = new AliITSModuleDaSSD(*(ssdadldc.fModules[modind])); - if (!fModules[modind]) { - AliError("AliITSHandleDaSSD: Error assignment operator"); + fModules[modind] = new AliITSModuleDaSSD(*(ssdadldc.fModules[modind])); + if (!fModules[modind]) { + AliError("AliITSHandleDaSSD: Error assignment operator"); for (Int_t i = (modind - 1); i >= 0; i--) delete fModules[modind]; - delete [] fModules; - fModules = NULL; - break; - } - } else fModules[modind] = NULL; + delete [] fModules; + fModules = NULL; + break; + } + } else fModules[modind] = NULL; } } else { AliError(Form("AliITSHandleDaSSD: Error allocating memory for %i AliITSModulesDaSSD* objects!", ssdadldc.fNumberOfModules)); @@ -184,6 +203,28 @@ AliITSHandleDaSSD& AliITSHandleDaSSD::operator = (const AliITSHandleDaSSD& ssdad fModules = NULL; } } + fRawDataFileName = NULL; + fModIndProcessed = 0; + fModIndRead = 0; + fModIndex = NULL; + fEqIndex = ssdadldc.fEqIndex; + fNumberOfEvents = ssdadldc.fNumberOfEvents; + fLdcId = ssdadldc.fLdcId; + fRunId = ssdadldc.fRunId; + fPedestalThresholdFactor = ssdadldc.fPedestalThresholdFactor; + fCmThresholdFactor = ssdadldc.fCmThresholdFactor; + fZsDefault = ssdadldc.fZsDefault; + fOffsetDefault = ssdadldc.fOffsetDefault; + fZsMinimum = ssdadldc.fZsMinimum; + fMergeBCLists = ssdadldc.fMergeBCLists; + fZsFactor = ssdadldc.fZsFactor; + fALaddersOff = ssdadldc.fALaddersOff; + fCLaddersOff = ssdadldc.fCLaddersOff; + fBadChannelsList = NULL; + fDDLModuleMap = NULL; + fModIndex = NULL; + if (ssdadldc.fBadChannelsList) AliWarning("fBadChannelsList is not copied by assignment operator, use other methods to init it!"); + if (ssdadldc.fDDLModuleMap) AliWarning("fDDLModuleMap is not copied by assignment operator, use other methods to init it!"); return *this; } @@ -201,7 +242,7 @@ AliITSHandleDaSSD::~AliITSHandleDaSSD() delete [] fModules; } if (fModIndex) delete [] fModIndex; - if (fStaticBadChannelsMap) { fStaticBadChannelsMap->Delete(); delete fStaticBadChannelsMap; } + if (fBadChannelsList) delete fBadChannelsList; if (fDDLModuleMap) delete [] fDDLModuleMap; } @@ -218,13 +259,14 @@ void AliITSHandleDaSSD::Reset() } if (fModIndex) { delete [] fModIndex; fModIndex = NULL; } /* - if (fStaticBadChannelsMap) { - fStaticBadChannelsMap->Delete(); - delete fStaticBadChannelsMap; - fStaticBadChannelsMap = NULL; + if (fBadChannelsList) { + delete fBadChannelsList; + fBadChannelsList = NULL; } if (fDDLModuleMap) { delete [] fDDLModuleMap; fDDLModuleMap = NULL; } */ + fALaddersOff.Set(0); + fCLaddersOff.Set(0); fRawDataFileName = NULL; fModIndProcessed = fModIndRead = 0; fNumberOfEvents = 0; @@ -256,6 +298,7 @@ Bool_t AliITSHandleDaSSD::Init(Char_t *rdfname) rawreaderdate->RewindEvents(); } else { MakeZombie(); return kFALSE; } if (fModules) Reset(); + //rawreaderdate->SelectEvents(-1); rawreaderdate->Select("ITSSSD"); nofstrips = 0; while (rawreaderdate->NextEvent()) { @@ -290,6 +333,8 @@ Bool_t AliITSHandleDaSSD::Init(Char_t *rdfname) { fNumberOfEvents = physeventind; fRawDataFileName = rdfname; + fEqIndex.Set(eqn); + fEqIndex.Reset(-1); fModIndex = new (nothrow) Int_t [fgkNumberOfSSDModulesPerDdl * eqn]; if (fModIndex) for (Int_t i = 0; i < fgkNumberOfSSDModulesPerDdl * eqn; i++) fModIndex[i] = -1; @@ -416,9 +461,9 @@ Bool_t AliITSHandleDaSSD::ReadStaticBadChannelsMap(const Char_t *filename) AliWarning(Form("Error reading file %s with Static Bad Channels Map!", filename)); return kFALSE; } - bcfile->GetObject("BadChannels;1", fStaticBadChannelsMap); - if (!fStaticBadChannelsMap) { - AliWarning("Error fStaticBadChannelsMap == NULL!"); + bcfile->GetObject("AliITSBadChannelsSSD;1", fBadChannelsList); + if (!fBadChannelsList) { + AliWarning("Error fBadChannelsList == NULL!"); bcfile->Close(); delete bcfile; return kFALSE; @@ -497,8 +542,9 @@ Int_t AliITSHandleDaSSD::ReadModuleRawData (const Int_t modulesnumber) AliITSModuleDaSSD *module; AliITSChannelDaSSD *strip; Long_t eventind = 0; - Int_t nofeqipmentev, equipid, prequipid; - UShort_t modind; + Int_t nofeqipment, eqind; + Short_t equipid, prequipid; + Short_t modind; if (!(rawreaderdate = new AliRawReaderDate(fRawDataFileName, 0))) return 0; if (!fModules) { AliError("AliITSHandleDaSSD: Error ReadModuleRawData: no structure was allocated for data"); @@ -507,15 +553,20 @@ Int_t AliITSHandleDaSSD::ReadModuleRawData (const Int_t modulesnumber) if (!fDDLModuleMap) if (!ReadDDLModuleMap()) AliWarning("DDL map is not defined, ModuleID will be set to 0!"); stream = new AliITSRawStreamSSD(rawreaderdate); stream->Setv11HybridDDLMapping(); + //rawreaderdate->SelectEvents(-1); + rawreaderdate->Select("ITSSSD"); modind = 0; + nofeqipment = 0; while (rawreaderdate->NextEvent()) { if ((rawreaderdate->GetType() != PHYSICS_EVENT) && (rawreaderdate->GetType() != CALIBRATION_EVENT)) continue; - nofeqipmentev = 0; prequipid = -1; + eqind = -1; while (stream->Next()) { - equipid = rawreaderdate->GetEquipmentId(); - if ((equipid != prequipid) && (prequipid >= 0)) nofeqipmentev += 1; - prequipid = equipid; + equipid = rawreaderdate->GetEquipmentId(); + if ((equipid != prequipid)) { + if ((eqind = GetEqIndex(equipid)) < 0) { fEqIndex.AddAt(equipid, nofeqipment); eqind = nofeqipment++; } + prequipid = equipid; + } Int_t equiptype = rawreaderdate->GetEquipmentType(); UChar_t ddlID = (UChar_t)rawreaderdate->GetDDLID(); UChar_t ad = stream->GetAD(); @@ -523,7 +574,7 @@ Int_t AliITSHandleDaSSD::ReadModuleRawData (const Int_t modulesnumber) UShort_t stripID = stream->GetSideFlag() ? AliITSChannelDaSSD::GetMaxStripIdConst() - stream->GetStrip() : stream->GetStrip(); Short_t signal = stream->GetSignal(); - Int_t indpos = (nofeqipmentev * fgkNumberOfSSDModulesPerDdl) + Int_t indpos = (eqind * fgkNumberOfSSDModulesPerDdl) + ((ad - 1) * fgkNumberOfSSDModulesPerSlot) + (adc < 6 ? adc : (adc - 2)); Int_t modpos = fModIndex[indpos]; if (((modpos > 0) && (modpos < fModIndRead)) || ((modpos < 0) && (modind == modulesnumber))) continue; @@ -532,13 +583,13 @@ Int_t AliITSHandleDaSSD::ReadModuleRawData (const Int_t modulesnumber) Int_t mddli; if (fDDLModuleMap) mddli = RetrieveModuleId(ddlID, ad, adc); else mddli = 0; - if (!module->SetModuleIdData (ddlID, ad, adc, mddli)) return 0; - module->SetModuleRorcId (equipid, equiptype); - module->SetCMFeromEventsNumber(fNumberOfEvents); - modpos = fModIndRead + modind; - modind += 1; - fModules[modpos] = module; - fModIndex[indpos] = modpos; + if (!module->SetModuleIdData (ddlID, ad, adc, mddli)) return 0; + module->SetModuleRorcId (equipid, equiptype); + module->SetCMFeromEventsNumber(fNumberOfEvents); + modpos = fModIndRead + modind; + modind += 1; + fModules[modpos] = module; + fModIndex[indpos] = modpos; } if (stripID < AliITSModuleDaSSD::GetStripsPerModuleConst()) { if (!(strip = fModules[modpos]->GetStrip(stripID))) { @@ -609,7 +660,7 @@ Bool_t AliITSHandleDaSSD::AddFeromCm(AliITSModuleDaSSD *const module) else { Short_t signal1 = signal[ev] + cmferom[ev]; strip->SetSignal(ev, signal1); - } + } } } } @@ -759,8 +810,7 @@ Bool_t AliITSHandleDaSSD::CalculateCM(AliITSModuleDaSSD *const module) module->GetModuleId(), strind)); return kFALSE; } - if ((signal[ev] >= AliITSChannelDaSSD::GetOverflowConst()) || - (strip->GetPedestal() == AliITSChannelDaSSD::GetUndefinedValue())) ovstr += 1; + if ((SignalOutOfRange(signal[ev])) || (strip->GetPedestal() == AliITSChannelDaSSD::GetUndefinedValue())) ovstr += 1; else cm0 += (signal[ev] - strip->GetPedestal()); } if ((n = AliITSModuleDaSSD::GetStripsPerChip() - ovstr)) cm0 /= (Float_t)(n); @@ -775,8 +825,7 @@ Bool_t AliITSHandleDaSSD::CalculateCM(AliITSModuleDaSSD *const module) module->GetModuleId(), strind)); return kFALSE; } - if ((signal[ev] >= AliITSChannelDaSSD::GetOverflowConst()) || - (strip->GetPedestal() == AliITSChannelDaSSD::GetUndefinedValue())) ovstr += 1; + if ((SignalOutOfRange(signal[ev])) || (strip->GetPedestal() == AliITSChannelDaSSD::GetUndefinedValue())) ovstr += 1; else cmsigma += pow((cm0 - (signal[ev] - strip->GetPedestal())), 2); } if ((n = AliITSModuleDaSSD::GetStripsPerChip() - ovstr)) cmsigma = sqrt(cmsigma / (Float_t)(n)); @@ -787,9 +836,8 @@ Bool_t AliITSHandleDaSSD::CalculateCM(AliITSModuleDaSSD *const module) for (Int_t strind = stripind; strind < (stripind + AliITSModuleDaSSD::GetStripsPerChip()); strind++) { if (!(strip = module->GetStrip(strind))) continue; signal = strip->GetSignal(); - if ( (signal[ev] >= AliITSChannelDaSSD::GetOverflowConst()) - || (strip->GetPedestal() == AliITSChannelDaSSD::GetUndefinedValue()) - || (TMath::Abs(cm0 - (signal[ev] - strip->GetPedestal())) > (fCmThresholdFactor * cmsigma)) ) ovstr += 1; + 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 /= (Float_t)(n); @@ -835,7 +883,10 @@ Bool_t AliITSHandleDaSSD::ProcessRawData(const Int_t nmread) Short_t AliITSHandleDaSSD::RetrieveModuleId(const UChar_t ddlID, const UChar_t ad, const UChar_t adc) const { // Retrieve ModuleId from the DDL map which is defined in AliITSRawStreamSSD class - if (!fDDLModuleMap) return 0; + if (!fDDLModuleMap) { + AliError("Error DDLMap is not initialized, return 0!"); + return 0; + } Int_t mddli = ((ad - 1) * fgkNumberOfSSDModulesPerSlot) + (adc < 6 ? adc : (adc - 2)); if ((ddlID < fgkNumberOfSSDDDLs) && (mddli < fgkNumberOfSSDModulesPerDdl)) { mddli = fDDLModuleMap[ddlID * fgkNumberOfSSDModulesPerDdl + mddli]; @@ -851,56 +902,102 @@ Short_t AliITSHandleDaSSD::RetrieveModuleId(const UChar_t ddlID, const UChar_t a //______________________________________________________________________________ -TObjArray* AliITSHandleDaSSD::GetCalibrationSSDLDC() const +AliITSNoiseSSD* AliITSHandleDaSSD::GetCalibrationOCDBNoise() const { // Fill in the array for OCDB - TObjArray *ldcc; - TObject *modcalibobj; + AliITSNoiseSSD *ldcn = NULL; + AliITSModuleDaSSD *module = NULL; + AliITSChannelDaSSD *strip = NULL; + if (!fModules) return NULL; + ldcn = new AliITSNoiseSSD; + if (!ldcn) { + AliError("Error allocation mamory for AliITSBadChannelsSSD object, return NULL!"); + return NULL; + } + for (Int_t i = 0; i < fNumberOfModules; i++) { + if (!(module = fModules[i])) continue; + if (module->GetModuleId() < fgkMinSSDModuleId) continue; + for (Int_t strind = 0; strind < module->GetNumberOfStrips(); strind++) { + if (!(strip = module->GetStrip(strind))) continue; + Short_t modid = module->GetModuleId() - fgkMinSSDModuleId; + if (strip->GetStripId() < AliITSModuleDaSSD::GetPNStripsPerModule() ) + ldcn->AddNoiseP(modid, strip->GetStripId(), strip->GetNoiseCM()); + else + ldcn->AddNoiseN(modid, (AliITSChannelDaSSD::GetMaxStripIdConst() - strip->GetStripId()), strip->GetNoiseCM()); + } + } + return ldcn; +} + + +//______________________________________________________________________________ +AliITSBadChannelsSSD* AliITSHandleDaSSD::GetCalibrationBadChannels() const +{ +// Fill in the TObjArray with the list of bad channels + AliITSBadChannelsSSD *ldcbc = NULL; + AliITSModuleDaSSD *module = NULL; + AliITSChannelDaSSD *strip = NULL; if (!fModules) return NULL; - ldcc = new TObjArray(fNumberOfModules, 0); + ldcbc = new AliITSBadChannelsSSD; + if (!ldcbc) { + AliError("Error allocation mamory for AliITSBadChannelsSSD object, return NULL!"); + return NULL; + } for (Int_t i = 0; i < fNumberOfModules; i++) { - if (!fModules[i]) { - delete ldcc; - return NULL; + if (!(module = fModules[i])) continue; + if (module->GetModuleId() < fgkMinSSDModuleId) continue; + for (Int_t strind = 0; strind < module->GetNumberOfStrips(); strind++) { + if (!(strip = module->GetStrip(strind))) continue; + Short_t modid = module->GetModuleId() - fgkMinSSDModuleId; + if (strip->GetStripId() < AliITSModuleDaSSD::GetPNStripsPerModule() ) + ldcbc->AddBadChannelP(modid, strip->GetStripId(), module->CheckIfBad(strip->GetStripId())); + else + ldcbc->AddBadChannelN(modid, (AliITSChannelDaSSD::GetMaxStripIdConst() - strip->GetStripId()), + module->CheckIfBad(strip->GetStripId())); } - modcalibobj = dynamic_cast(fModules[i]->GetCalibrationNoise()); - ldcc->AddAt(modcalibobj, i); } - ldcc->Compress(); - return ldcc; + return ldcbc; } + //______________________________________________________________________________ -Bool_t AliITSHandleDaSSD::SaveCalibrationSSDLDC(Char_t*& dafname) const +Bool_t AliITSHandleDaSSD::SaveCalibrationSSDLDC(Char_t*& dafname) { // Save Calibration data locally - TObjArray *ldcn, *ldcp, *ldcbc; - TObject *modobjn, *modobjp, *modobjbc; + AliITSBadChannelsSSD *ldcbc = NULL; + AliITSPedestalSSD *ldcp = NULL; + AliITSNoiseSSD *ldcn = NULL; + AliITSModuleDaSSD *module = NULL; + AliITSChannelDaSSD *strip = NULL; Char_t *tmpfname; TString dadatafilename(""); if (!fModules) return kFALSE; - ldcn = new TObjArray(fNumberOfModules, 0); - ldcn->SetName("Noise"); - ldcp = new TObjArray(fNumberOfModules, 0); - ldcp->SetName("Pedestal"); - ldcbc = new TObjArray(fNumberOfModules, 0); - ldcbc->SetName("BadChannels"); + ldcn = new AliITSNoiseSSD; + ldcp = new AliITSPedestalSSD; + ldcbc = new AliITSBadChannelsSSD; + if ((!ldcn) || (!ldcp) || (!ldcp)) { + AliError("Error allocation mamory for calibration objects, return kFALSE!"); + return kFALSE; + } for (Int_t i = 0; i < fNumberOfModules; i++) { - if (!fModules[i]) { - delete ldcn; - return kFALSE; + if (!(module = fModules[i])) continue; + if (module->GetModuleId() < fgkMinSSDModuleId) continue; + for (Int_t strind = 0; strind < module->GetNumberOfStrips(); strind++) { + if (!(strip = module->GetStrip(strind))) continue; + Short_t modid = module->GetModuleId() - fgkMinSSDModuleId; + if (strip->GetStripId() < AliITSModuleDaSSD::GetPNStripsPerModule() ) { + ldcn->AddNoiseP(modid, strip->GetStripId(), strip->GetNoiseCM()); + ldcp->AddPedestalP(modid, strip->GetStripId(), strip->GetPedestal()); + ldcbc->AddBadChannelP(modid, strip->GetStripId(), module->CheckIfBad(strip->GetStripId())); + } else { + ldcn->AddNoiseN(modid, (AliITSChannelDaSSD::GetMaxStripIdConst() - strip->GetStripId()), strip->GetNoiseCM()); + ldcp->AddPedestalN(modid, (AliITSChannelDaSSD::GetMaxStripIdConst() - strip->GetStripId()), strip->GetPedestal()); + ldcbc->AddBadChannelN(modid, (AliITSChannelDaSSD::GetMaxStripIdConst() - strip->GetStripId()), + module->CheckIfBad(strip->GetStripId())); + } } - modobjn = dynamic_cast(fModules[i]->GetCalibrationNoise()); - modobjp = dynamic_cast(fModules[i]->GetCalibrationPedestal()); - modobjbc = dynamic_cast(fModules[i]->GetCalibrationBadChannels()); - ldcn->AddAt(modobjn, i); - ldcp->AddAt(modobjp, i); - ldcbc->AddAt(modobjbc, i); } - ldcn->Compress(); - ldcp->Compress(); - ldcbc->Compress(); if (dafname) dadatafilename.Form("%s/", dafname); dadatafilename += TString::Format("ITSSSDda_%i.root", fLdcId); tmpfname = new Char_t[dadatafilename.Length()+1]; @@ -917,10 +1014,13 @@ Bool_t AliITSHandleDaSSD::SaveCalibrationSSDLDC(Char_t*& dafname) const } fileRun->WriteTObject(ldcn); fileRun->WriteTObject(ldcp); - if (fStaticBadChannelsMap) fileRun->WriteTObject(fStaticBadChannelsMap); + if (fBadChannelsList) + if (fMergeBCLists) { + MergeBadChannels(ldcbc); + fileRun->WriteTObject(ldcbc); + } else fileRun->WriteTObject(fBadChannelsList); else fileRun->WriteTObject(ldcbc); fileRun->Close(); - ldcn->Delete(); delete fileRun; delete ldcn; delete ldcp; @@ -929,6 +1029,45 @@ Bool_t AliITSHandleDaSSD::SaveCalibrationSSDLDC(Char_t*& dafname) const } +//______________________________________________________________________________ +Int_t AliITSHandleDaSSD::MergeBadChannels(AliITSBadChannelsSSD*& bcl) const +{ +// Merges the statick bad channels list with bad channels got upon calibration + AliITSModuleDaSSD *module = 0; + Int_t nmpch = 0, nmnch = 0, ngpch = 0, ngnch = 0; + if (!fBadChannelsList || !bcl) { + AliWarning("Either fBadChannelsList == NULL or bad_channels_list == NULL, there is nothing to merge!"); + return -1; + } + for (Int_t modind = 0; modind < GetNumberOfModules(); modind++) { + if (!(module = fModules[modind])) continue; + if (module->GetModuleId() < fgkMinSSDModuleId) continue; + Short_t modid = module->GetModuleId() - fgkMinSSDModuleId; + for (Int_t strind = 0; strind < AliITSModuleDaSSD::GetPNStripsPerModule(); strind++) { + if ( (!(fBadChannelsList->GetBadChannelP(modid, strind) & fgkBadChannelMask)) + && (bcl->GetBadChannelP(modid, strind) & fgkBadChannelMask) ) + ngpch++; + if ( (!(fBadChannelsList->GetBadChannelN(modid, strind) & fgkBadChannelMask)) + && (bcl->GetBadChannelN(modid, strind) & fgkBadChannelMask) ) + ngnch++; + if ( (!(bcl->GetBadChannelP(modid, strind) & fgkBadChannelMask)) + && (fBadChannelsList->GetBadChannelP(modid, strind) & fgkBadChannelMask) ) { + bcl->AddBadChannelP(modid, strind, fBadChannelsList->GetBadChannelP(modid, strind)); + nmpch++; + } + if ( (!(bcl->GetBadChannelN(modid, strind) & fgkBadChannelMask)) + && (fBadChannelsList->GetBadChannelN(modid, strind) & fgkBadChannelMask) ) { + bcl->AddBadChannelN(modid, strind, fBadChannelsList->GetBadChannelN(modid, strind)); + nmnch++; + } + } + } + AliInfo(Form("Static bad, dynamic good: P%d, N%d", nmpch, nmnch)); + AliInfo(Form("Static good, dynamic bad: P%d, N%d", ngpch, ngnch)); + return (nmnch + nmpch); +} + + //______________________________________________________________________________ Bool_t AliITSHandleDaSSD::DumpModInfo(const Float_t meannosethreshold) const @@ -1033,7 +1172,7 @@ Bool_t AliITSHandleDaSSD::AllocateSimulatedModules(const Int_t copymodind) Long_t eventsnumber = cstrip->GetEventsNumber(); AliITSChannelDaSSD *strip = new AliITSChannelDaSSD(strind, eventsnumber); for (Long_t evind = 0; evind < eventsnumber; evind++) { - Short_t sign = *cstrip->GetSignal(evind); + Short_t sign = cstrip->GetSignal(evind); if (!strip->SetSignal(evind, sign)) AliError(Form("AliITSHandleDaSSD: Copy events error! mod = %i, str = %i", modind, strind)); } module->SetStrip(strip, strind); @@ -1105,46 +1244,71 @@ Bool_t AliITSHandleDaSSD::SaveEqSlotCalibrationData(const Int_t ddl, const Int_t 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 -// AliITSBadChannelsSSD *badch = NULL; - // TArrayI bcharray; - // Int_t strsiden; - Int_t modn = -1; - if (fStaticBadChannelsMap && fDDLModuleMap) { + AliITSModuleDaSSD *module = NULL; + Int_t modn = -1; + if (fBadChannelsList && fDDLModuleMap) { modn = RetrieveModuleId(ddl, ad, adc); - - /* if (modn < 0) return -1; - Int_t modind = 0; - while ((modind < fStaticBadChannelsMap->GetEntriesFast() && (!badch))) { - AliITSBadChannelsSSD *bc = static_cast(fStaticBadChannelsMap->At(modind++)); - if ((bc->GetMod()) == modn) badch = bc; + 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; } - if (badch) { - if (strn < AliITSModuleDaSSD::GetPNStripsPerModule()) { - bcharray = badch->GetBadPChannelsList(); - strsiden = strn; - } else { - bcharray = badch->GetBadNChannelsList(); - strsiden = AliITSChannelDaSSD::GetMaxStripIdConst() - strn; - } - if (bcharray.GetSize() < AliITSModuleDaSSD::GetPNStripsPerModule()) { - AliWarning(Form("No entry found in bad channels list TArrayI for ddl/ad/adc/str: %i/%i/%i/%i", ddl, ad, adc, strn)); - return 0; - } - return (bcharray[strsiden] & fgkBadChannelMask); + 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, AliITSModuleDaSSD::CheckIfBad(str) is used!"); + if (module = GetModule(ddl, ad, adc)) { + return (module->CheckIfBad(strn) & fgkBadChannelMask); } else { - AliWarning(Form("No entry found in bad channels list for ddl = %i, ad = %i, adc = %i", ddl, ad, adc)); - return 0; + AliWarning(Form("There is no calibration data for ddl = %i, ad = %i, adc = %i, 0 is used!", ddl, ad, adc)); + return 0ul; } - } else { - AliError("Error ether bad channels list or DDLMap is not initialized or both, return 0!"); - - */ return 0; } - 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, @@ -1155,15 +1319,16 @@ ULong_t AliITSHandleDaSSD::OffsetValue(const AliITSChannelDaSSD *strip, if (fOffsetDefault < INT_MAX) pedint = fOffsetDefault; else pedint = TMath::Nint(strip->GetPedestal()); if (pedint > static_cast((fgkOffSetBitMask >> 1))) { - if (!ChannelIsBad(ddl, ad, adc, strn)) - AliError(Form("Offset %i, channel(ddl/ad/adc/strip) %i/%i/%i/%i can not be represented with mask %i, Offset = %i", - pedint, ddl, ad, adc, strn, ConvBase(fgkOffSetBitMask, 16).c_str(), fgkOffSetBitMask)); - return fgkOffSetBitMask; + if (!ChannelIsBad(ddl, ad, adc, strn) && !((fMergeBCLists) && (GetModule(ddl, ad, adc)->CheckIfBad(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(((fgkOffSetBitMask + 1) >> 1))) { - if (!ChannelIsBad(ddl, ad, adc, strn)) - AliError(Form("Offset %i, channel(ddl/ad/adc/strip) %i/%i/%i/%i can not be represented with mask %i, Offset = %i", - pedint, ddl, ad, adc, strn, ConvBase(fgkOffSetBitMask, 16).c_str(), (fgkOffSetBitMask & (~fgkOffSetBitMask >> 1)))); + if (!ChannelIsBad(ddl, ad, adc, strn) && !((fMergeBCLists) && (GetModule(ddl, ad, adc)->CheckIfBad(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); @@ -1177,8 +1342,8 @@ ULong_t AliITSHandleDaSSD::OffsetValue(const UChar_t ddl, const UChar_t ad, cons // 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); + 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; @@ -1196,7 +1361,10 @@ 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 (fZsDefault < 0) { + zs = TMath::Nint(fZsFactor * strip->GetNoiseCM()); + if (zs < static_cast(fZsMinimum)) zs = static_cast(fZsMinimum); + } else zs = fZsDefault; return (zs < fgkZsBitMask) ? (zs & fgkZsBitMask) : fgkZsBitMask; } @@ -1208,9 +1376,11 @@ ULong_t AliITSHandleDaSSD::ZsThreshold(const UChar_t ddl, const UChar_t ad, cons // 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 ((module = GetModule(ddl, ad, adc))) { - if ((strip = module->GetStrip(strn))) return ZsThreshold(strip); + if (ChannelIsBad(ddl, ad, adc, strn)) return fgkZsBitMask; + if (LadderIsOff(ddl, ad, adc)) return fgkZsBitMask; + if (module = GetModule(ddl, ad, adc)) { + if (fMergeBCLists) if (module->CheckIfBad(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; @@ -1243,3 +1413,55 @@ string AliITSHandleDaSSD::ConvBase(const unsigned long value, const long base) c } 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); +} diff --git a/ITS/AliITSHandleDaSSD.h b/ITS/AliITSHandleDaSSD.h index 37dfcef100a..49aac469f8f 100644 --- a/ITS/AliITSHandleDaSSD.h +++ b/ITS/AliITSHandleDaSSD.h @@ -8,6 +8,7 @@ #include #include "TObject.h" +#include "TArrayS.h" #include "AliITSModuleDaSSD.h" /////////////////////////////////////////////////////////////////////////////// @@ -15,13 +16,11 @@ /// This class provides ITS SSD data handling /// used by DA. // Author: Oleksandr Borysov -// Date: 19/05/2008 +// Date: 18/07/2008 /////////////////////////////////////////////////////////////////////////////// using namespace std; -class TObjArray; - class AliITSHandleDaSSD : public TObject { public : AliITSHandleDaSSD(); @@ -33,18 +32,30 @@ class AliITSHandleDaSSD : public TObject { virtual Bool_t Init(Char_t *rdfname); Bool_t SetRawFileName (Char_t *rdfname) {return Init(rdfname); } - void SetZsDefaul(Int_t zs) { fZsDefault = zs; } - void SetOffsetDefault(Int_t offs) { fOffsetDefault = offs; } - void SetZsFactor(Float_t zsf) { fZsFactor = zsf; } - void SetPedestalThresholdFactor(Float_t pthf) { fPedestalThresholdFactor = pthf; } - void SetCmThresholdFactor(Float_t cmthf) { fCmThresholdFactor = cmthf; } - - Int_t GetZsDefault() const { return fZsDefault; } - Int_t GetOffsetDefault() const { return fOffsetDefault; } - Float_t GetZsFactor() const { return fZsFactor; } + void SetZsDefaul(const Int_t zs) { fZsDefault = zs; } + void SetOffsetDefault(const Int_t offs) { fOffsetDefault = offs; } + void SetZsMinimum(const Int_t zsm) { fZsMinimum = zsm; } + void SetMergeBCFlag(const Byte_t mbcf) { fMergeBCLists = mbcf; } + void SetZsFactor(const Float_t zsf) { fZsFactor = zsf; } + void SetPedestalThresholdFactor(const Float_t pthf) { fPedestalThresholdFactor = pthf; } + void SetCmThresholdFactor(const Float_t cmthf) { fCmThresholdFactor = cmthf; } + void SetALaddersOff(const Int_t n, const Short_t *allist) { fALaddersOff.Set(n, allist); } + void SetCLaddersOff(const Int_t n, const Short_t *cllist) { fCLaddersOff.Set(n, cllist); } + void SetLaddersOff(const Int_t na, const Short_t *allist, const Int_t nc, const Short_t *cllist) + { SetALaddersOff(na, allist); SetCLaddersOff(nc, cllist); } + + Int_t GetNumberOfEvents() const { return fNumberOfEvents; } + Int_t GetZsDefault() const { return fZsDefault; } + Int_t GetOffsetDefault() const { return fOffsetDefault; } + Float_t GetZsFactor() const { return fZsFactor; } + Int_t GetZsMinimum() const { return fZsMinimum; } + Bool_t GetMergeBCFlag() const { return static_cast(fMergeBCLists); } Float_t GetPedestalThresholdFactor() const { return fPedestalThresholdFactor; } Float_t GetCmThresholdFactor() const { return fCmThresholdFactor; } - + TArrayS GetALaddersOff () const { return fALaddersOff; } + TArrayS GetCLaddersOff () const { return fCLaddersOff; } + Int_t GetEqIndex(const Short_t eq) const { for(Int_t i = 0; i < fEqIndex.GetSize(); i++) if (eq == fEqIndex.At(i)) return i; return -1; } + Int_t GetNumberOfModules() const { return fNumberOfModules; } UInt_t GetLdcId() const { return fLdcId; } UInt_t GetRunId() const { return fRunId; } @@ -52,9 +63,11 @@ class AliITSHandleDaSSD : public TObject { AliITSModuleDaSSD* GetModule (const Int_t index) const {if ((fModules) && (index < fNumberOfModules)) return fModules[index]; else return NULL;} Int_t GetModuleIndex (const UChar_t ddlID, const UChar_t ad, const UChar_t adc) const; - AliITSChannelDaSSD* GetStrip (const UChar_t ddlID, const UChar_t ad, const UChar_t adc, const UShort_t stripID) const; - TObjArray* GetCalibrationSSDLDC() const; - Bool_t SaveCalibrationSSDLDC(Char_t*& dafname) const; + AliITSChannelDaSSD* GetStrip (const UChar_t ddlID, const UChar_t ad, const UChar_t adc, const UShort_t stripID) const; + AliITSNoiseSSD* GetCalibrationOCDBNoise() const; + AliITSBadChannelsSSD* GetCalibrationBadChannels() const; + Bool_t SaveCalibrationSSDLDC(Char_t*& dafname); + Int_t MergeBadChannels(AliITSBadChannelsSSD*& bcl) const; void SetModIndProcessed(Int_t mi) {fModIndProcessed = mi;} void SetModIndRead (Int_t mr) {fModIndRead = mr;} @@ -63,7 +76,7 @@ class AliITSHandleDaSSD : public TObject { virtual Bool_t ReadStaticBadChannelsMap(const Char_t *filename = NULL); virtual Bool_t ReadDDLModuleMap(const Char_t *filename = NULL); Int_t ReadCalibrationDataFile (char* fileName, const Long_t eventsnumber); - Int_t ReadModuleRawData (const Int_t modulesnumber); + virtual Int_t ReadModuleRawData (const Int_t modulesnumber); virtual Bool_t CalculatePedestal(AliITSModuleDaSSD *const module); virtual Bool_t CalculateNoise(AliITSModuleDaSSD *const module); @@ -77,6 +90,7 @@ class AliITSHandleDaSSD : public TObject { Bool_t AdDataPresent(const Int_t ddl, const Int_t ad) const; Int_t DdlToEquipmentId (Int_t ddl) const { return (512 + ddl); } Int_t ChannelIsBad(const UChar_t ddl, const UChar_t ad, const UChar_t adc, const Int_t strn) const; + Int_t LadderIsOff(const UChar_t ddl, const UChar_t ad, const UChar_t adc) const; Bool_t SaveEqSlotCalibrationData(const Int_t ddl, const Int_t ad, const Char_t *fname) const; ULong_t OffsetValue(const AliITSChannelDaSSD *strip, const UChar_t ddl = 0, const UChar_t ad = 0, const UChar_t adc = 0, const Int_t strn = -1) const; @@ -88,6 +102,7 @@ class AliITSHandleDaSSD : public TObject { virtual Short_t RetrieveModuleId(const UChar_t ddlID, const UChar_t ad, const UChar_t adc) const; Bool_t DumpModInfo(const Float_t meannosethreshold) const; Bool_t PrintModCalibrationData(const UChar_t ddlID, const UChar_t ad, const UChar_t adc, const Char_t *fname = NULL) const; + Int_t CheckOffChips() const; void DumpInitData(const Char_t *str = "") const; void DeleteSignalAll() { if (fModules) for (Int_t i = 0; i < fNumberOfModules; i++) if (fModules[i]) fModules[i]->DeleteSignal();} void DeleteSignal() { if (fModules) for (Int_t i = fModIndProcessed; i < fModIndRead; i++) if (fModules[i]) fModules[i]->DeleteSignal();} @@ -102,6 +117,7 @@ class AliITSHandleDaSSD : public TObject { static const Int_t fgkNumberOfSSDModules ; // Number of SSD modules in ITS static const Int_t fgkNumberOfSSDModulesPerDdl; // Number of SSD modules in DDL static const Int_t fgkNumberOfSSDModulesPerSlot; // Number of SSD modules in Slot + static const Short_t fgkMinSSDModuleId; // Initial SSD modules number static const Int_t fgkNumberOfSSDDDLs; // Number of DDLs in SSD static const Int_t fgkNumberOfSSDSlotsPerDDL; // Number of SSD slots per DDL static const Float_t fgkPedestalThresholdFactor; // Defalt value for fPedestalThresholdFactor @@ -112,33 +128,38 @@ class AliITSHandleDaSSD : public TObject { static const UInt_t fgkBadChannelMask; // Mask to suppress the channel from the bad channel list static const Int_t fgkAdcPerDBlock; // FEROM configuration file constant - Char_t *fRawDataFileName; // Name of the file with raw data - Int_t fNumberOfModules; // number of AliITSModuleDaSSD to allocate - AliITSModuleDaSSD **fModules; //[fNumberOfModules] array of pointer on AliITSModuleDaSSD objects (1698 SSD Modules) - Int_t fModIndProcessed; //! index of the last module in fModules array with processed data - Int_t fModIndRead; //! index of the last module in fModules array with adc data present (read) - Int_t *fModIndex; //! index array for fModules - Long_t fNumberOfEvents; // Number of physics or calibration events in raw data file fRawDataFileName - - TObjArray *fStaticBadChannelsMap; // Static bad channels map read from the file - Int_t *fDDLModuleMap; //! DDL map + Char_t *fRawDataFileName; // Name of the file with raw data + Int_t fNumberOfModules; // number of AliITSModuleDaSSD to allocate + AliITSModuleDaSSD **fModules; //[fNumberOfModules] array of pointer on AliITSModuleDaSSD objects (1698 SSD Modules) + Int_t fModIndProcessed; //! index of the last module in fModules array with processed data + Int_t fModIndRead; //! index of the last module in fModules array with adc data present (read) + Int_t *fModIndex; //! index array for fModules + TArrayS fEqIndex; //! index array of equipmnts (DDLs). + Long_t fNumberOfEvents; // Number of physics or calibration events in raw data file fRawDataFileName + + AliITSBadChannelsSSD *fBadChannelsList; //! List of bad channels: static or created on base of calculated noise and pedestal + Int_t *fDDLModuleMap; //! DDL map + TArrayS fALaddersOff; //! Lisst of ladders of side A that are off and should be suppressed + TArrayS fCLaddersOff; //! Lisst of ladders of side C that are off and should be suppressed - UInt_t fLdcId; // LDC number, read from header - UInt_t fRunId; // Run number, read from header + UInt_t fLdcId; // LDC number, read from header + UInt_t fRunId; // Run number, read from header Float_t fPedestalThresholdFactor; // configuration parameter: ThresholdFactor for pedestal calculation Float_t fCmThresholdFactor; // configuration parameter: ThresholdFactor for CM calculation Int_t fZsDefault; // default value for ZS threshold Int_t fOffsetDefault; // default value for offset correction + Int_t fZsMinimum; // minimum value for ZS threshold + Byte_t fMergeBCLists; // Flag, if it is not zero the static bad channels list is merged with dynamic one Float_t fZsFactor; // zs factor 3.0 - + protected : - Bool_t SignalOutOfRange (const Short_t signal) const { return (signal >= AliITSChannelDaSSD::GetOverflowConst()); } + Bool_t SignalOutOfRange (const Short_t signal) const { return ((signal >= AliITSChannelDaSSD::GetOverflowConst()) || + (signal <= AliITSChannelDaSSD::GetUnderflowConst())); } string ConvBase(const unsigned long value, const long base) const; - ClassDef(AliITSHandleDaSSD, 5) + ClassDef(AliITSHandleDaSSD, 6) }; #endif - diff --git a/ITS/AliITSModuleDaSSD.cxx b/ITS/AliITSModuleDaSSD.cxx index 72e5da0685b..380cf8448be 100644 --- a/ITS/AliITSModuleDaSSD.cxx +++ b/ITS/AliITSModuleDaSSD.cxx @@ -19,7 +19,8 @@ /// /// This class provides storage container ITS SSD module callibration data /// used by DA. -/// +/// +/// Date: 18/07/2008 /////////////////////////////////////////////////////////////////////////////// #include "AliITSNoiseSSD.h" @@ -220,7 +221,7 @@ AliITSModuleDaSSD::AliITSModuleDaSSD(const AliITSModuleDaSSD& module) : AliError(Form("AliITSModuleDaSSD: Error allocating memory for %i TArrayS objects!", fgkChipsPerModule)); fCmFerom = NULL; } - } + } } @@ -230,9 +231,11 @@ AliITSModuleDaSSD& AliITSModuleDaSSD::operator = (const AliITSModuleDaSSD& modul { // assignment operator if (this == &module) return *this; + TObject::operator=(module); if (fStrips) { for (Long_t i = 0; i < fNumberOfStrips; i++) if (fStrips[i]) delete fStrips[i]; delete [] fStrips; + fStrips = NULL; } fEquipId = module.fEquipId; fEquipType = module.fEquipType; @@ -240,7 +243,6 @@ AliITSModuleDaSSD& AliITSModuleDaSSD::operator = (const AliITSModuleDaSSD& modul fAd = module.fAd; fAdc = module.fAdc; fModuleId = module.fModuleId; - fNumberOfStrips = module.fNumberOfStrips; fStrips = NULL; fNumberOfChips = module.fNumberOfChips; fCm = NULL; @@ -248,18 +250,21 @@ AliITSModuleDaSSD& AliITSModuleDaSSD::operator = (const AliITSModuleDaSSD& modul if ((module.fNumberOfStrips > 0) && (module.fStrips)) { fStrips = new (nothrow) AliITSChannelDaSSD* [module.fNumberOfStrips]; if (fStrips) { + memset(fStrips, 0, (sizeof(AliITSChannelDaSSD*) * module.fNumberOfStrips)); for (Int_t strind = 0; strind < module.fNumberOfStrips; strind++) { if (module.fStrips[strind]) { - fStrips[strind] = new AliITSChannelDaSSD(*(module.fStrips[strind])); - if (!fStrips[strind]) { - AliError("AliITSModuleDaSSD: Error copy constructor"); + fStrips[strind] = new AliITSChannelDaSSD(*(module.fStrips[strind])); + if (!fStrips[strind]) { + AliError("AliITSModuleDaSSD: Error copy constructor"); for (Int_t i = (strind - 1); i >= 0; i--) delete fStrips[strind]; - delete [] fStrips; - fStrips = NULL; - break; - } - } else fStrips[strind] = NULL; - } + delete [] fStrips; + fStrips = NULL; + fNumberOfStrips = 0; + break; + } + } else fStrips[strind] = NULL; + } + fNumberOfStrips = module.fNumberOfStrips; } else { AliError(Form("AliITSModuleDaSSD: Error allocating memory for %i AliITSChannelDaSSD* objects!", module.fNumberOfStrips)); fNumberOfStrips = 0; @@ -491,85 +496,19 @@ Short_t AliITSModuleDaSSD::GetCMFerom(const Int_t chipn, const Long_t evn) co -//______________________________________________________________________________ -AliITSNoiseSSD* AliITSModuleDaSSD::GetCalibrationNoise() const -{ -// Creates the AliITSNoiseSSD objects with callibration data - AliITSNoiseSSD *mc; - // Float_t noise; - if (!fStrips) return NULL; - mc = new AliITSNoiseSSD(); - - /* - mc->SetMod(fModuleId); - mc->SetNNoiseP(fgkPNStripsPerModule); - mc->SetNNoiseN(fgkPNStripsPerModule); - for (Int_t i = 0; i < fNumberOfStrips; i++) { - if (!fStrips[i]) noise = AliITSChannelDaSSD::GetUndefinedValue(); - else noise = fStrips[i]->GetNoiseCM(); - if (i < fgkPNStripsPerModule) - mc->AddNoiseP(i, noise); - else mc->AddNoiseN((AliITSChannelDaSSD::GetMaxStripIdConst() - i), noise); - } - */ - - return mc; -} - - - -//______________________________________________________________________________ -AliITSPedestalSSD* AliITSModuleDaSSD::GetCalibrationPedestal() const +UChar_t AliITSModuleDaSSD::CheckIfBad(const Int_t stripn) const { -// Creates the AliITSPedestalSSD objects with callibration data - AliITSPedestalSSD *mc; - // Float_t ped; - if (!fStrips) return NULL; - mc = new AliITSPedestalSSD(); - - /* - mc->SetMod(fModuleId); - mc->SetNPedestalP(fgkPNStripsPerModule); - mc->SetNPedestalN(fgkPNStripsPerModule); - for (Int_t i = 0; i < fNumberOfStrips; i++) { - if (!fStrips[i]) ped = AliITSChannelDaSSD::GetUndefinedValue(); - else ped = fStrips[i]->GetPedestal(); - if (i < fgkPNStripsPerModule) - mc->AddPedestalP(i, ped); - else mc->AddPedestalN((AliITSChannelDaSSD::GetMaxStripIdConst() - i), ped); - } - */ - - return mc; -} - - - -//______________________________________________________________________________ -AliITSBadChannelsSSD* AliITSModuleDaSSD::GetCalibrationBadChannels() const -{ -// Creates the AliITSBadChannelsSSD objects with callibration data - AliITSBadChannelsSSD *mc; - Int_t *chlist, nch = 0, nchn = 0, nchp = 0; - if (!fStrips) return NULL; - chlist = new Int_t [GetStripsPerModuleConst()]; - for (Int_t i = 0; i < fNumberOfStrips; i++) { - if (!fStrips[i]) { chlist[nch++] = i; if (i < fgkPNStripsPerModule) nchp++; else nchn++; continue;} - if (fStrips[i]->GetNoiseCM() == AliITSChannelDaSSD::GetUndefinedValue()) - { chlist[nch++] = i; if (i < fgkPNStripsPerModule) nchp++; else nchn++; } - } - mc = new AliITSBadChannelsSSD(); - - /* - mc->SetMod(fModuleId); - if (!nch) return mc; - mc->SetNBadPChannelsList(nchp); - mc->SetNBadNChannelsList(nchn); - for (Int_t i = 0; i < nch; i++) { - if (chlist[i] < fgkPNStripsPerModule) mc->AddBadPChannel(chlist[i], i); - else mc->AddBadNChannel((AliITSChannelDaSSD::GetMaxStripIdConst() - chlist[i]), (i-nchp)); +//Applies the bad channel creteria and set the appropriate flags for returned valie + UInt_t bcflags = 0; + const UInt_t WOffsetMask = 0x000003FF; + if (!fStrips[stripn]) bcflags |= 3; + else { + if (fStrips[stripn]->GetNoiseCM() == AliITSChannelDaSSD::GetUndefinedValue()) bcflags |= 8; + if (fStrips[stripn]->GetNoiseCM() > 20) bcflags |= 8; + if (fStrips[stripn]->GetNoiseCM() < 1) bcflags |= 16; + if (fStrips[stripn]->GetPedestal() > ((WOffsetMask >> 1) - 1)) bcflags |= 4; + else if ((-(fStrips[stripn]->GetPedestal())) > (WOffsetMask >> 1)) bcflags |= 4; + if (bcflags) bcflags |= 3; } - */ - - return mc; + return bcflags; } diff --git a/ITS/AliITSModuleDaSSD.h b/ITS/AliITSModuleDaSSD.h index 80082ea02b1..4f9d2eb6acc 100644 --- a/ITS/AliITSModuleDaSSD.h +++ b/ITS/AliITSModuleDaSSD.h @@ -10,7 +10,7 @@ /// /// This class provides storage container ITS SSD module calibration data /// used by DA. -/// +/// Date: 18/07/2008 /////////////////////////////////////////////////////////////////////////////// #include "TObject.h" @@ -49,9 +49,7 @@ class AliITSModuleDaSSD : public TObject { Int_t GetNumberOfChips() const { return fNumberOfChips; } AliITSChannelDaSSD* GetStrip(const Int_t stripnumber) const { return (fStrips) ? fStrips[stripnumber] : NULL; } - AliITSNoiseSSD* GetCalibrationNoise() const; - AliITSPedestalSSD* GetCalibrationPedestal() const; - AliITSBadChannelsSSD* GetCalibrationBadChannels() const; + UChar_t CheckIfBad(const Int_t stripn) const; Bool_t SetEventsNumber(const Long_t eventsnumber); Bool_t SetNumberOfStrips(const Int_t numberofstrips); Bool_t SetNumberOfChips(const Int_t nchips); @@ -102,7 +100,7 @@ class AliITSModuleDaSSD : public TObject { private: Bool_t ForbiddenAdcNumber (const UChar_t adcn) const { return ((adcn == 6) || (adcn == 7)); } - ClassDef(AliITSModuleDaSSD, 3) + ClassDef(AliITSModuleDaSSD, 4) }; diff --git a/ITS/AliITSPreprocessorSSD.cxx b/ITS/AliITSPreprocessorSSD.cxx index 60d880a54cc..fd579f23cc6 100644 --- a/ITS/AliITSPreprocessorSSD.cxx +++ b/ITS/AliITSPreprocessorSSD.cxx @@ -103,21 +103,21 @@ UInt_t AliITSPreprocessorSSD::Process(TMap* /*dcsAliasMap*/) } AliITSNoiseSSD *cal; - f->GetObject("Noise;1", cal); + f->GetObject("AliITSNoiseSSD;1", cal); if(!cal) { Log("File does not contain expected data for the noise!"); delete list; return 3; } AliITSPedestalSSD *ped; - f->GetObject("Pedestal;1", ped); + f->GetObject("AliITSPedestalSSD;1", ped); if(!ped) { Log("File does not contain expected data for the pedestals!"); delete list; return 5; } AliITSBadChannelsSSD *bad; - f->GetObject("BadChannels;1", bad); + f->GetObject("AliITSBadChannelsSSD;1", bad); if(!bad) { Log("File does not contain expected data for bad channels !"); delete list; @@ -161,23 +161,23 @@ UInt_t AliITSPreprocessorSSD::Process(TMap* /*dcsAliasMap*/) return 7; } // if list - //Now we have to store the final CDB file - AliCDBMetaData metaData; - metaData.SetBeamPeriod(0); - metaData.SetResponsible("Enrico Fragiacomo"); - metaData.SetComment("Fills noise, pedestal and bad channels TObjArray"); - - if(!Store("Calib", "NoiseSSD", (TObject*) &calib, &metaData, 0, 1)) { + //Now we have to store the final CDB file + AliCDBMetaData metaData; + metaData.SetBeamPeriod(0); + metaData.SetResponsible("Enrico Fragiacomo"); + metaData.SetComment("Fills noise, pedestal and bad channels TObjArray"); + + if(!Store("Calib", "NoiseSSD", (TObject *)calib, &metaData, 0, 1)) { Log("no store"); return 1; } - if(!Store("Calib", "BadChannelsSSD", (TObject*) &badch, &metaData, 0, 1)) { + if(!Store("Calib", "BadChannelsSSD", (TObject*)badch, &metaData, 0, 1)) { Log("no store"); return 1; } - if(!StoreReferenceData("Calib","PedestalSSD", (TObject*) &pedel, &metaData)) { + if(!StoreReferenceData("Calib","PedestalSSD", (TObject*)pedel, &metaData)) { Log("no store"); return 1; } diff --git a/ITS/ITSSSDPEDda.cxx b/ITS/ITSSSDPEDda.cxx index a303ce5ecf4..7f7d331d810 100644 --- a/ITS/ITSSSDPEDda.cxx +++ b/ITS/ITSSSDPEDda.cxx @@ -1,24 +1,27 @@ /************************************************************************** -- Contact: Oleksandr_Borysov aborysov@ts.infnf.it -- Link: /afs/infn.it/ts/user/efragiac/public/testCosm3125.001 -- Run Type: +- Contact: Oleksandr_Borysov oborysov@cern.ch +- Link: /afs/cern.ch/user/o/oborysov/public/da/pedestal36186.000.raw, ssddaconfig.txt, ssdddlmap.txt, badchannels.root +- Run Type: PEDESTAL - DA Type: LDC -- Number of events needed: ~500 -- Input Files: raw_data_file_on_LDC, ssddaconfig txt, ssdddlmap.txt, badchannels.root +- Number of events needed: ~200 +- Input Files: raw_data_file_on_LDC, in the daqDetDB: ssddaconfig.txt, ssdddlmap.txt, badchannels.root - Output Files: ./ ./ssddaldc_.root, FXS_name=ITSSSDda_.root local files are persistent over runs: data source - Trigger types used: **************************************************************************/ - + #include #include #include #include +#include +#include #include "TString.h" #include "TFile.h" #include "daqDA.h" #include "AliITSHandleDaSSD.h" + #include "TROOT.h" #include "TPluginManager.h" @@ -29,7 +32,8 @@ struct ConfigStruct { Int_t fNModuleProcess; string fSsdDdlMap; string fBadChannels; - ConfigStruct() : fNModuleProcess(108), fSsdDdlMap(""), fBadChannels("") {} + Bool_t fCheckChipsOff; + ConfigStruct() : fNModuleProcess(108), fSsdDdlMap(""), fBadChannels(""), fCheckChipsOff(kFALSE) {} }; @@ -126,6 +130,7 @@ int main( int argc, char** argv ) status = daqDA_DB_storeFile(feefname.Data(), fcdbsave.Data()); if (status) fprintf(stderr, "Failed to export file %s to the detector db: %d, %s \n", feefname.Data(), status, fcdbsave.Data()); cout << SaveEquipmentCalibrationData(ssddaldc) << " files were uploaded to DetDB!\n"; + if(cfg.fCheckChipsOff) ssddaldc->CheckOffChips(); delete ssddaldc; daqDA_progressReport(100); return 0; @@ -158,14 +163,20 @@ Int_t SaveEquipmentCalibrationData(const AliITSHandleDaSSD *ssddaldc, const Cha Bool_t ReadDAConfigurationFile(const Char_t *configfname, AliITSHandleDaSSD *const ssddaldc, ConfigStruct& cfg) { // Dowload configuration parameters from configuration file or database - const int nkwords = 8; + const int nkwords = 12; char *keywords[nkwords] = {"ZsDefault", "OffsetDefault", "ZsFactor", "PedestalThresholdFactor", "CmThresholdFactor", - "NModulesToProcess", "DDLMapFile", "BadChannelsFile"}; - Int_t tmpint; + "NModulesToProcess", "DDLMapFile", "BadChannelsFile", "ZSMinValue", "MergeBCFlag", + "CheckChipsOff", "OffLadder"}; + Int_t tmpint, laddern; Float_t tmpflt; fstream dfile; + vector allist(0), cllist(0); if (!configfname) { - cerr << "No DA configuration file name is specified, defaul value are used!\n"; + cerr << "No DA configuration file name is specified, Return!\n"; + return kFALSE; + } + if (!ssddaldc) { + cerr << "ssddaldc == 0, DA configuration file will not be read! Return!\n"; return kFALSE; } dfile.open(configfname, ios::in); @@ -243,9 +254,71 @@ Bool_t ReadDAConfigurationFile(const Char_t *configfname, AliITSHandleDaSSD *con cfg.fBadChannels = tmpstr; cout << keystr << ": " << cfg.fBadChannels.c_str() << endl; } break; + case 8: + strline >> tmpint; + if (strline.fail()) cerr << "Failed to read " << keystr << " value from DA configuration file!\n"; + else { + ssddaldc->SetZsMinimum(tmpint); + cout << keystr << ": " << ssddaldc->GetZsMinimum() << endl; + } break; + case 9: + strline >> tmpint; + if (strline.fail()) cerr << "Failed to read " << keystr << " value from DA configuration file!\n"; + else { + ssddaldc->SetMergeBCFlag(static_cast(tmpint)); + cout << keystr << ": " << ssddaldc->GetMergeBCFlag() << endl; + } break; + case 10: + strline >> tmpint; + if (strline.fail()) cerr << "Failed to read " << keystr << " value from DA configuration file!\n"; + else { + cfg.fCheckChipsOff = static_cast(tmpint); + cout << keystr << ": " << cfg.fCheckChipsOff << endl; + } break; + case 11: + char dside; + while (!strline.eof()) { + strline >> tmpstr; + if (strline.fail()) cerr << "Failed to read " << keystr << " value from DA configuration file!\n"; + if (tmpstr.size() == 0) break; + if ((tmpstr.at(0) == '#') ) break; + if ( sscanf(tmpstr.c_str(), "%c%u", &dside, &laddern) < 2 ) { + cerr << "Error reading side and ladder number form the config file: " << tmpstr << "! Continue!\n"; + continue; + } + if ( toupper(dside) == 'A') allist.push_back(laddern); + else if ( toupper(dside) == 'C') cllist.push_back(laddern); + else cerr << "Error! " << dside << " SSD ladder side can be either A or C! Continue!\n"; + } + break; default: cerr << keystr << " is not a key word, no assignment were made!\n"; } - } + } + if (allist.size() == 0 && cllist.size() == 0) return kTRUE; + short *tmparr = 0, si; + vector::iterator it; + if (allist.size() > 0) { + tmparr = new short [allist.size()]; + cout << "Following A side " << (allist.size()>1?"ladders are":"ladder is") << " supposed to be off and will be suppressed :"; + for ( it = allist.begin(), si = 0; it < allist.end(); it++, si++ ) { + tmparr[si] = *it; + cout << " " << tmparr[si]; + } + cout << ";" << endl; + ssddaldc->SetALaddersOff(allist.size(), tmparr); + } + if (tmparr) delete [] tmparr; + if (cllist.size() > 0) { + tmparr = new short [cllist.size()]; + cout << "Following C side " << (cllist.size() > 1 ? "ladders are" : "ladder is") << " supposed to be off and will be suppressed :"; + for ( it = cllist.begin(), si = 0; it < cllist.end(); it++, si++ ) { + tmparr[si] = *it; + cout << " " << tmparr[si]; + } + cout << ";" << endl; + ssddaldc->SetCLaddersOff(cllist.size(), tmparr); + } + if (tmparr) delete [] tmparr; return kTRUE; } -- 2.39.3