X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=ITS%2FAliITSCalibrationSPD.cxx;h=087be9c3cbd75a733cd974f2b6a041525c84d4f7;hb=652489276a37742d7fc84496ede48c172163e2fb;hp=9d4d869c00429b3c9b49dd61ea94c30a1b8183e5;hpb=6727e2db6c4c01a8fd22c2e8db31c532eaece212;p=u%2Fmrichter%2FAliRoot.git diff --git a/ITS/AliITSCalibrationSPD.cxx b/ITS/AliITSCalibrationSPD.cxx index 9d4d869c004..087be9c3cbd 100644 --- a/ITS/AliITSCalibrationSPD.cxx +++ b/ITS/AliITSCalibrationSPD.cxx @@ -20,78 +20,252 @@ // Silicon pixels // // Modified by D. Elia, G.E. Bruno, H. Tydesjo -// March-April 2006 -// Last mod: H. Tydesjo Oct 2007 -// September 2007: CouplingRowDefault = 0.055 (was 0.047) -// /////////////////////////////////////////////////////////////////////////// -const Double_t AliITSCalibrationSPD::fgkThreshDefault = 3000.; -const Double_t AliITSCalibrationSPD::fgkSigmaDefault = 250.; -const Double_t AliITSCalibrationSPD::fgkCouplColDefault = 0.; -const Double_t AliITSCalibrationSPD::fgkCouplRowDefault = 0.055; -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), fNrBad(0), fBadChannels(0){ // constructor - SetThresholds(fgkThreshDefault,fgkSigmaDefault); - SetCouplingParam(fgkCouplColDefault,fgkCouplRowDefault); - SetBiasVoltage(fgkBiasVoltageDefault); - SetNoiseParam(0.,0.); SetDataType("simulated"); + ClearBad(); +} +//____________________________________________________________________________ +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 bad pixel - // + // add single bad pixel fBadChannels.Set(fNrBad*2+2); fBadChannels.AddAt(col,fNrBad*2); fBadChannels.AddAt(row,fNrBad*2+1); fNrBad++; } //____________________________________________________________________________ -Int_t AliITSCalibrationSPD::GetBadColAt(UInt_t index) { - // +void AliITSCalibrationSPD::SetChipBad(UInt_t chip) { + // set full chip bad + if (chip>=5) {AliError("Wrong chip number");} + fBadChip[chip]=kTRUE; +} +//____________________________________________________________________________ +void AliITSCalibrationSPD::UnSetChipBad(UInt_t chip) { + // unset full chip bad + if (chip>=5) {AliError("Wrong chip number");} + fBadChip[chip]=kFALSE; +} +//____________________________________________________________________________ +Int_t AliITSCalibrationSPD::GetBadColAt(UInt_t index) const { // Get column of index-th bad pixel - // - if (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; + } + } + } + } + AliError(Form("Index %d is out of bounds - nothing done",index)); +} +//___________________________________________________________________________ +Int_t AliITSCalibrationSPD::GetNrBad() const { + // Total number of bad pixels (including bad chips) in a given module + Int_t bad=0; + // single pixels: + bad+=fNrBad; + // whole chips: + for (UInt_t chip=0; chip<5; chip++) { + bad+=fBadChip[chip]*32*256; + } + return bad; +} +//___________________________________________________________________________ +Int_t AliITSCalibrationSPD::GetNrBadInChip(Int_t chip) const { + // Total number of bad pixels (including bad chips) in a given chip: chip range [0,4] + if(chip<0 || chip>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 &R__b) { + // Stream an object of class AliITSCalibrationSPD. + UInt_t R__s, R__c; + if (R__b.IsReading()) { + Version_t R__v = R__b.ReadVersion(&R__s, &R__c); if (R__v) { } + AliITSCalibration::Streamer(R__b); + if (R__v >= 8) { + R__b >> fNrBad; + fBadChannels.Streamer(R__b); + R__b.ReadStaticArray((bool*)fBadChip); + } + else { + Double_t dummy; + R__b >> dummy; + R__b >> dummy; + R__b >> dummy; + R__b >> dummy; + R__b >> dummy; + R__b >> dummy; + R__b >> dummy; + R__b >> fNrBad; + if (R__v == 7) { + fBadChannels.Streamer(R__b); + R__b.ReadStaticArray((bool*)fBadChip); + } + else { + if (R__v == 6) { + fBadChannels.Streamer(R__b); + } + else { + TArrayI fBadChannelsV1; + fBadChannelsV1.Streamer(R__b); + fBadChannels.Set(fNrBad*2); + for (UInt_t i=0; i