X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=ITS%2FAliITSCalibrationSPD.cxx;h=917078ca97d68d3382d1019c2cb0454ee8247980;hb=5591748ed1607a6ceb8a36febb7bed8147ca62dd;hp=eb0afb8979f3b0d4cb399df1ce614621ccb81350;hpb=5bfe44ce3c357f2a8aaf552cf58664574d760a8b;p=u%2Fmrichter%2FAliRoot.git diff --git a/ITS/AliITSCalibrationSPD.cxx b/ITS/AliITSCalibrationSPD.cxx index eb0afb8979f..917078ca97d 100644 --- a/ITS/AliITSCalibrationSPD.cxx +++ b/ITS/AliITSCalibrationSPD.cxx @@ -12,6 +12,8 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ +#include "TArrayI.h" +#include "AliITSCalibrationSPD.h" /////////////////////////////////////////////////////////////////////////// // Calibration class for set:ITS @@ -19,123 +21,258 @@ // Silicon pixels // // Modified by D. Elia, G.E. Bruno, H. Tydesjo -// March-April 2006 -// /////////////////////////////////////////////////////////////////////////// -#include "AliITSCalibrationSPD.h" - -const Double_t AliITSCalibrationSPD::fgkThreshDefault = 3000.; -const Double_t AliITSCalibrationSPD::fgkSigmaDefault = 250.; -const Double_t AliITSCalibrationSPD::fgkCouplColDefault = 0.; -const Double_t AliITSCalibrationSPD::fgkCouplRowDefault = 0.047; -const Double_t AliITSCalibrationSPD::fgkBiasVoltageDefault = 18.182; +ClassImp(AliITSCalibrationSPD) -ClassImp(AliITSCalibrationSPD) //______________________________________________________________________ AliITSCalibrationSPD::AliITSCalibrationSPD(): AliITSCalibration(), -fBaseline(0.0), -fNoise(0.0), -fThresh(fgkThreshDefault), -fSigma(fgkSigmaDefault), -fCouplCol(fgkCouplColDefault), -fCouplRow(fgkCouplRowDefault), -fBiasVoltage(fgkBiasVoltageDefault), -nrDead(0), -nrNoisy(0){ +fNrBad(0), +fBadChannels(0){ // constructor - SetThresholds(fgkThreshDefault,fgkSigmaDefault); - SetCouplingParam(fgkCouplColDefault,fgkCouplRowDefault); - SetBiasVoltage(fgkBiasVoltageDefault); - SetNoiseParam(0.,0.); SetDataType("simulated"); + ClearBad(); } -//_________________________________________________________________________ - - -void AliITSCalibrationSPD::AddDead(UInt_t col, UInt_t row) { - fDeadChannels.Set(nrDead*2+2); - fDeadChannels.AddAt(col,nrDead*2); - fDeadChannels.AddAt(row,nrDead*2+1); - nrDead++; +//____________________________________________________________________________ +void AliITSCalibrationSPD::ClearBad() { + // clear all bad pixels (single+chips) + fBadChannels.Reset(); + fNrBad=0; + for (UInt_t chip=0; chip<5; chip++) { + fBadChip[chip]=kFALSE; + } +} +//____________________________________________________________________________ +void AliITSCalibrationSPD::AddBad(UInt_t col, UInt_t row) { + // add single bad pixel + fBadChannels.Set(fNrBad*2+2); + fBadChannels.AddAt(col,fNrBad*2); + fBadChannels.AddAt(row,fNrBad*2+1); + fNrBad++; +} +//____________________________________________________________________________ +void AliITSCalibrationSPD::SetChipBad(UInt_t chip) { + // set full chip bad + if (chip>=5) {AliError("Wrong chip number"); + } + else { + fBadChip[chip]=kTRUE; + } } -Int_t AliITSCalibrationSPD::GetDeadColAt(UInt_t index) { - if (index=5 ) {AliError("Wrong chip number"); + } + else { + fBadChip[chip]=kFALSE; + } +} +//____________________________________________________________________________ +Int_t AliITSCalibrationSPD::GetBadColAt(UInt_t index) const { + // Get column of index-th bad pixel + if ((Int_t)index=0 && index=0) { + Int_t badChipIndex=(index-GetNrBadSingle())/(32*256); + Int_t badChipsFound =0; + for (UInt_t chip=0; chip<5; chip++) { + if (fBadChip[chip]) badChipsFound++; + if (badChipIndex==badChipsFound-1) { + Int_t badPixelIndex=(index-GetNrBadSingle())%(32*256); + col = chip*32 + badPixelIndex/256; + row = badPixelIndex%256; + return; + } + } } } - return false; + AliError(Form("Index %d is out of bounds - nothing done",index)); } - -// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! //___________________________________________________________________________ -// THIS METHOD SHOULD BE DELETED AS SOON AS POSSIBLE!!!!!!!!!!!!!!!!!!!!!!!!! -// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -Bool_t AliITSCalibrationSPD::IsPixelDead(Int_t mod,Int_t ix,Int_t iz) const { - // Returns kTRUE if pixel is dead - // Inputs: - // Int_t mod module number - // Int_t ix x pixel number - // Int_t iz z pixel number - // Outputs: - // none. - // Return: - // kFALSE if pixel is alive, or kTRUE if pixel is dead. - - // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - Double_t fDeadPixels = 0.01; // fix to keep AliITSsimulationSPDdubna alive!!! - // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - - Bool_t dead = kFALSE; - Int_t seed; - static TRandom ran; // don't use gRandom. This must not be a true randome - // sequence. These sequence must be random one and then fully repetable. - - seed = mod*256*256+iz*256+ix; - ran.SetSeed(seed); - if(ran.Rndm(0)4) {AliError("Wrong chip number"); return -1;} + if (fBadChip[chip]) return 32*256; + else { + Int_t bad=0; + for (UInt_t i=0; i159) {AliError("Wrong column number"); return -1;} + if (fBadChip[GetChipIndexFromCol(col)]) return 256; + else { + Int_t bad=0; + for (UInt_t i=0; i159) {AliError("Wrong column number"); return kFALSE;} + Int_t chip = GetChipIndexFromCol(col); + if (fBadChip[chip]) return kTRUE; + for (UInt_t i=0; i=160) {AliWarning("Wrong column number"); return -1;} + return col/32; +} +//______________________________________________________________________ +void AliITSCalibrationSPD::SetNrBad(UInt_t /*nr*/) { + // should not be used anymore !!! + AliError("This method should not be used anymore. Use SetNrBadSingle instead!!!"); +} +//______________________________________________________________________ +void AliITSCalibrationSPD::Streamer(TBuffer &ruub) { + // Stream an object of class AliITSCalibrationSPD. + UInt_t ruus, ruuc; + if (ruub.IsReading()) { + Version_t ruuv = ruub.ReadVersion(&ruus, &ruuc); if (ruuv) { } + AliITSCalibration::Streamer(ruub); + if (ruuv >= 8) { + ruub >> fNrBad; + fBadChannels.Streamer(ruub); + ruub.ReadStaticArray((bool*)fBadChip); + } + else { + Double_t dummy; + ruub >> dummy; + ruub >> dummy; + ruub >> dummy; + ruub >> dummy; + ruub >> dummy; + ruub >> dummy; + ruub >> dummy; + ruub >> fNrBad; + if (ruuv == 7) { + fBadChannels.Streamer(ruub); + ruub.ReadStaticArray((bool*)fBadChip); + } + else { + if (ruuv == 6) { + fBadChannels.Streamer(ruub); + } + else { + TArrayI fBadChannelsV1; + fBadChannelsV1.Streamer(ruub); + fBadChannels.Set(fNrBad*2); + for (UInt_t i=0; i