X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=ITS%2FAliITSModuleDaSSD.cxx;h=2b3efb489bf77690d0e391d22d78ac4ee6ff10b9;hb=dd2117a258b9cae733f3123e1031189e3300cd98;hp=3be79ece2c693ed9e73af3c89f36909cb6c32c86;hpb=a69c8ba0de95e8bceca88dff0544fa1a39013c95;p=u%2Fmrichter%2FAliRoot.git diff --git a/ITS/AliITSModuleDaSSD.cxx b/ITS/AliITSModuleDaSSD.cxx index 3be79ece2c6..2b3efb489bf 100644 --- a/ITS/AliITSModuleDaSSD.cxx +++ b/ITS/AliITSModuleDaSSD.cxx @@ -19,10 +19,13 @@ /// /// This class provides storage container ITS SSD module callibration data /// used by DA. -/// +/// +/// Date: 09/07/2009 /////////////////////////////////////////////////////////////////////////////// #include "AliITSNoiseSSD.h" +#include "AliITSPedestalSSD.h" +#include "AliITSBadChannelsSSD.h" #include "AliITSModuleDaSSD.h" #include "TString.h" #include "AliLog.h" @@ -53,6 +56,7 @@ AliITSModuleDaSSD::AliITSModuleDaSSD() : fStrips(NULL), fNumberOfChips(0), fCm(NULL), + fCmFerom(NULL), fEventsNumber(0) { // Default constructor @@ -71,6 +75,7 @@ AliITSModuleDaSSD::AliITSModuleDaSSD(const UChar_t ddlID, const UChar_t ad, cons fStrips(NULL), fNumberOfChips(0), fCm(NULL), + fCmFerom(NULL), fEventsNumber(0) { // Constructor, set module id data @@ -90,9 +95,10 @@ AliITSModuleDaSSD::AliITSModuleDaSSD(const Int_t numberofstrips) : fStrips(NULL), fNumberOfChips(0), fCm(NULL), + fCmFerom(NULL), fEventsNumber(0) { -// Constructor, allocates memory for AliITSChannelDaSSD* +// Constructor, allocates memory for AliITSChannelDaSSD* and TArrayS* array for CM calculated in FEROM if (numberofstrips != fgkStripsPerModule) AliWarning(Form("AliITSModuleDaSSD: ALICE ITS SSD Module contains %i strips", fgkStripsPerModule)); fStrips = new (nothrow) AliITSChannelDaSSD* [numberofstrips]; @@ -119,6 +125,7 @@ AliITSModuleDaSSD::AliITSModuleDaSSD(const Int_t numberofstrips, const Long_t ev fStrips(NULL), fNumberOfChips(0), fCm(NULL), + fCmFerom(NULL), fEventsNumber(0) { // Constructor, allocates memory for AliITSChannelDaSSD* and events data @@ -154,6 +161,7 @@ AliITSModuleDaSSD::AliITSModuleDaSSD(const AliITSModuleDaSSD& module) : fStrips(NULL), fNumberOfChips(module.fNumberOfChips), fCm(NULL), + fCmFerom(NULL), fEventsNumber(module.fEventsNumber) { // copy constructor @@ -187,7 +195,17 @@ AliITSModuleDaSSD::AliITSModuleDaSSD(const AliITSModuleDaSSD& module) : fNumberOfChips = 0; fCm = NULL; } - } + } + + if (module.fCmFerom) { + fCmFerom = new (nothrow) TArrayS [fgkChipsPerModule]; + if (fCmFerom) { + for (Int_t chind = 0; chind < fgkChipsPerModule; chind++) fCmFerom[chind] = module.fCmFerom[chind]; + } else { + AliError(Form("AliITSModuleDaSSD: Error allocating memory for %i TArrayS objects!", fgkChipsPerModule)); + fCmFerom = NULL; + } + } } @@ -197,9 +215,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; @@ -207,7 +227,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; @@ -215,18 +234,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; @@ -244,6 +266,16 @@ AliITSModuleDaSSD& AliITSModuleDaSSD::operator = (const AliITSModuleDaSSD& modul fCm = NULL; } } + if (fCmFerom) { delete [] fCmFerom; fCmFerom = NULL; } + if (module.fCmFerom) { + fCmFerom = new (nothrow) TArrayS [module.fNumberOfChips]; + if (fCmFerom) { + for (Int_t chind = 0; chind < fgkChipsPerModule; chind++) fCmFerom[chind] = module.fCmFerom[chind]; + } else { + AliError(Form("AliITSModuleDaSSD: Error allocating memory for %i TArrayS objects!", fgkChipsPerModule)); + fCmFerom = NULL; + } + } return *this; } @@ -262,6 +294,7 @@ AliITSModuleDaSSD::~AliITSModuleDaSSD() delete [] fStrips; } if (fCm) delete [] fCm; + if (fCmFerom) delete [] fCmFerom; } @@ -359,14 +392,14 @@ Bool_t AliITSModuleDaSSD::SetEventsNumber(const Long_t eventsnumber) Int_t i; if (!fStrips) return kFALSE; for (i = 0; i < fNumberOfStrips; i++) { - if (fStrips[i]) + if (fStrips[i]) { if (!fStrips[i]->SetEvenetsNumber(eventsnumber)) { for (Int_t j = 0; j < i; j++) fStrips[j]->DeleteSignal(); - AliError(Form("AliITSModuleDaSSD: Error allocating memory for i% events for module %i, strip %i", - eventsnumber, (Int_t)fModuleId, i)); + AliError(Form("AliITSModuleDaSSD: Error allocating memory for %ld event for module %d, strip %d",eventsnumber, (Int_t)fModuleId, i)); return kFALSE; } - else + } + else { if (!(fStrips[i] = new AliITSChannelDaSSD(i, eventsnumber))) { for (Int_t j = 0; j < i; j++) delete fStrips[j]; delete [] fStrips; @@ -375,7 +408,9 @@ Bool_t AliITSModuleDaSSD::SetEventsNumber(const Long_t eventsnumber) AliError(Form("AliITSModuleDaSSD: Error allocating memory for strip %i of module %i!", (Int_t)fModuleId, i)); return kFALSE; } - } + } + } + fEventsNumber = eventsnumber; return kTRUE; } @@ -403,24 +438,60 @@ Float_t AliITSModuleDaSSD::GetCM(const Int_t chipn, const Long_t evn) const } +//______________________________________________________________________________ +Bool_t AliITSModuleDaSSD::AllocateCMFeromArray(void) +{ +// Allocates memory for the channels which contains CM calculated in Ferom + if (!fCmFerom) { + fCmFerom = new (nothrow) TArrayS [fgkChipsPerModule]; + if (!fCmFerom) { + AliError(Form("AliITSModuleDaSSD: Error allocating memory for %i TArrayS objects!", fgkChipsPerModule)); + fCmFerom = NULL; + return kFALSE; + } + } + return kTRUE; +} + //______________________________________________________________________________ -AliITSNoiseSSD* AliITSModuleDaSSD::GetCalibrationSSDModule() const +Bool_t AliITSModuleDaSSD::SetCMFeromEventsNumber(const Long_t eventsnumber) { -// 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); +// Allocates memory for the values of CM calculated in Ferom + if (!fCmFerom) return kFALSE; + for (Int_t chipind = 0; chipind < fgkChipsPerModule; chipind++) { + fCmFerom[chipind].Set(eventsnumber); + fCmFerom[chipind].Reset(0); } - return mc; + return kTRUE; +} + +//______________________________________________________________________________ +Bool_t AliITSModuleDaSSD::SetCMFerom (const Short_t cm, const Int_t chipn, const Int_t evn) +{ +// Set value of FeromCM for a given chip and event + if ((!fCmFerom) || (chipn >= fgkChipsPerModule)) return kFALSE; + if (evn >= fCmFerom[chipn].GetSize()) return kFALSE; + else fCmFerom[chipn][evn] = cm; + return kTRUE; +} + + +void AliITSModuleDaSSD::SetCMFerom (Short_t* cm, const Int_t chipn) +// Set value of FeromCM for a given chip +{ + if (!fCmFerom) + if (!AllocateCMFeromArray()) return; + if (chipn < fgkChipsPerModule) fCmFerom[chipn].Set(fCmFerom[chipn].GetSize(), cm); } + + +//______________________________________________________________________________ +Short_t AliITSModuleDaSSD::GetCMFerom(const Int_t chipn, const Long_t evn) const +{ +// Get value of FeromCM for a given chip and event + if ((!fCmFerom) || (chipn >= fgkChipsPerModule)) return 0; + if (evn >= fCmFerom[chipn].GetSize()) return 0; + else return fCmFerom[chipn][evn]; +} +