]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSCalibrationSPD.cxx
new methods concerning bad chips treatment (G. Bruno)
[u/mrichter/AliRoot.git] / ITS / AliITSCalibrationSPD.cxx
index d59882994574d2b33c3ac74213728de9cbbbc868..fcfe7b3bf8d8bfb0d39ce52197197e3b3c3a33ac 100644 (file)
  * about the suitability of this software for any purpose. It is          *
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
-//////////////////////////////////////////////////////
-//  Calibration class for set:ITS                   //
-//  Specific subdetector implementation for         //
-//  Silicon pixels                                  //
-//  An alternative version "SPDdubna"               //
-//  is also available                               //
-//////////////////////////////////////////////////////
 
 #include "AliITSCalibrationSPD.h"
-
-const Double_t AliITSCalibrationSPD::fgkThreshDefault = 2000.;
-const Double_t AliITSCalibrationSPD::fgkSigmaDefault = 280.;
+///////////////////////////////////////////////////////////////////////////
+//  Calibration class for set:ITS                   
+//  Specific subdetector implementation for         
+//  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) 
+
 //______________________________________________________________________
 AliITSCalibrationSPD::AliITSCalibrationSPD():
 AliITSCalibration(),
@@ -33,32 +40,78 @@ fBaseline(0.0),
 fNoise(0.0),
 fThresh(fgkThreshDefault),
 fSigma(fgkSigmaDefault),
-fDeadPixels(0.01){
+fCouplCol(fgkCouplColDefault),
+fCouplRow(fgkCouplRowDefault),
+fBiasVoltage(fgkBiasVoltageDefault),
+fNrBad(0),
+fBadChannels(0){
   // constructor
 
    SetThresholds(fgkThreshDefault,fgkSigmaDefault);
+   SetCouplingParam(fgkCouplColDefault,fgkCouplRowDefault);
+   SetBiasVoltage(fgkBiasVoltageDefault);
    SetNoiseParam(0.,0.);
    SetDataType("simulated");
-   SetFractionDead();
 }
-//_________________________________________________________________________
-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.
-  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)<fDeadPixels) dead = kTRUE;
-  return dead;
+//____________________________________________________________________________
+void AliITSCalibrationSPD::AddBad(UInt_t col, UInt_t row) {
+  //
+  // add 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) {
+  //
+  // Get column of index-th bad pixel
+  //
+  if (index<fNrBad) {
+    return fBadChannels.At(index*2);
+  }
+  return -1;
+}
+//____________________________________________________________________________
+Int_t AliITSCalibrationSPD::GetBadRowAt(UInt_t index) {
+  //
+  // Get row of index-th bad pixel
+  //
+  if (index<fNrBad) {
+    return fBadChannels.At(index*2+1);
+  }
+  return -1;
+}
+//____________________________________________________________________________
+Bool_t AliITSCalibrationSPD::IsPixelBad(Int_t col, Int_t row) const {
+  //
+  // Check if pixel (col,row) is bad
+  //
+  for (UInt_t i=0; i<fNrBad; i++) { 
+    if (fBadChannels.At(i*2)==col && fBadChannels.At(i*2+1)==row) {
+      return true;
+    }
+  }
+  return false;
+}
+//___________________________________________________________________________
+Int_t  AliITSCalibrationSPD::GetNrBadInColumn(Int_t col) const {
+ //
+ // Count n. of bad in a given column: col. range [0,159]
+ //
+ if(col<0 || col>159) {AliWarning("GetNrBadInColumn: wrong column number"); return -1;}
+ Int_t bad=0;
+ for (UInt_t i=0; i<fNrBad; i++) if (fBadChannels.At(i*2)==col) bad++;
+ return bad;
+}
+//___________________________________________________________________________
+Int_t  AliITSCalibrationSPD::GetNrBadInChip(Int_t chip) const {
+ //
+ // Count n. of bad in a given chip: chip range [0,4]
+ //
+ if(chip<0 || chip>4) {AliWarning("GetNrBadInChip: wrong chip number"); return -1;}
+ Int_t bad=0;
+ for (Int_t col=32*chip; col<32*(chip+1); col++) bad+=GetNrBadInColumn(col);
+ return bad;
 }