/************************************************************************** * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * * * Author: The ALICE Off-line Project. * * Contributors are mentioned in the code where appropriate. * * * * Permission to use, copy, modify and distribute this software and its * * documentation strictly for non-commercial purposes is hereby granted * * without fee, provided that the above copyright notice appears in all * * copies and that both the copyright notice and this permission notice * * appear in the supporting documentation. The authors make no claims * * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ #include "AliITSCalibrationSPD.h" /////////////////////////////////////////////////////////////////////////// // Calibration class for set:ITS // Specific subdetector implementation for // Silicon pixels // // Modified by D. Elia, G.E. Bruno, H. Tydesjo /////////////////////////////////////////////////////////////////////////// ClassImp(AliITSCalibrationSPD) //______________________________________________________________________ AliITSCalibrationSPD::AliITSCalibrationSPD(): AliITSCalibration(), fNrBad(0), fBadChannels(0){ // constructor 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 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");} 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 ((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; } } } } 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