Change the name adding PWG4
[u/mrichter/AliRoot.git] / ITS / AliITSCalibrationSPD.cxx
CommitLineData
fcf95fc7 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
5bfe44ce 15
590d15ee 16
fcf95fc7 17
18#include "AliITSCalibrationSPD.h"
19
5bfe44ce 20const Double_t AliITSCalibrationSPD::fgkThreshDefault = 3000.;
21const Double_t AliITSCalibrationSPD::fgkSigmaDefault = 250.;
22const Double_t AliITSCalibrationSPD::fgkCouplColDefault = 0.;
23const Double_t AliITSCalibrationSPD::fgkCouplRowDefault = 0.047;
24const Double_t AliITSCalibrationSPD::fgkBiasVoltageDefault = 18.182;
fcf95fc7 25
26ClassImp(AliITSCalibrationSPD)
590d15ee 27///////////////////////////////////////////////////////////////////////////
28// Calibration class for set:ITS
29// Specific subdetector implementation for
30// Silicon pixels
31//
32// Modified by D. Elia, G.E. Bruno, H. Tydesjo
33// March-April 2006
34//
35///////////////////////////////////////////////////////////////////////////
36
fcf95fc7 37//______________________________________________________________________
38AliITSCalibrationSPD::AliITSCalibrationSPD():
39AliITSCalibration(),
40fBaseline(0.0),
41fNoise(0.0),
42fThresh(fgkThreshDefault),
43fSigma(fgkSigmaDefault),
5bfe44ce 44fCouplCol(fgkCouplColDefault),
45fCouplRow(fgkCouplRowDefault),
46fBiasVoltage(fgkBiasVoltageDefault),
590d15ee 47fNrDead(0),
e56160b8 48fDeadChannels(0),
49fNrNoisy(0),
50fNoisyChannels(0){
fcf95fc7 51 // constructor
52
53 SetThresholds(fgkThreshDefault,fgkSigmaDefault);
5bfe44ce 54 SetCouplingParam(fgkCouplColDefault,fgkCouplRowDefault);
55 SetBiasVoltage(fgkBiasVoltageDefault);
fcf95fc7 56 SetNoiseParam(0.,0.);
57 SetDataType("simulated");
fcf95fc7 58}
59//_________________________________________________________________________
5bfe44ce 60
5bfe44ce 61void AliITSCalibrationSPD::AddDead(UInt_t col, UInt_t row) {
590d15ee 62 //
63 // Add a dead channel to fDeadChannel array
64 //
65 fDeadChannels.Set(fNrDead*2+2);
66 fDeadChannels.AddAt(col,fNrDead*2);
67 fDeadChannels.AddAt(row,fNrDead*2+1);
68 fNrDead++;
5bfe44ce 69}
590d15ee 70//_________________________________________________________________________
5bfe44ce 71Int_t AliITSCalibrationSPD::GetDeadColAt(UInt_t index) {
590d15ee 72 //
73 // Returns column of index-th dead channel
74 //
75 if (index<fNrDead) {
5bfe44ce 76 return fDeadChannels.At(index*2);
77 }
78 return -1;
79}
590d15ee 80//_________________________________________________________________________
5bfe44ce 81Int_t AliITSCalibrationSPD::GetDeadRowAt(UInt_t index) {
590d15ee 82 //
83 // Returns row of index-th dead channel
84 //
85 if (index<fNrDead) {
5bfe44ce 86 return fDeadChannels.At(index*2+1);
87 }
88 return -1;
89}
590d15ee 90//_________________________________________________________________________
5bfe44ce 91Bool_t AliITSCalibrationSPD::IsPixelDead(Int_t col, Int_t row) const {
590d15ee 92 //
93 // Check if pixel (col,row) is dead
94 //
95 for (UInt_t i=0; i<fNrDead; i++) {
5bfe44ce 96 if (fDeadChannels.At(i*2)==col && fDeadChannels.At(i*2+1)==row) {
97 return true;
98 }
99 }
100 return false;
101}
102
103// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
104//___________________________________________________________________________
105// THIS METHOD SHOULD BE DELETED AS SOON AS POSSIBLE!!!!!!!!!!!!!!!!!!!!!!!!!
106// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
fcf95fc7 107Bool_t AliITSCalibrationSPD::IsPixelDead(Int_t mod,Int_t ix,Int_t iz) const {
5bfe44ce 108 // Returns kTRUE if pixel is dead
fcf95fc7 109 // Inputs:
110 // Int_t mod module number
111 // Int_t ix x pixel number
112 // Int_t iz z pixel number
113 // Outputs:
114 // none.
115 // Return:
116 // kFALSE if pixel is alive, or kTRUE if pixel is dead.
5bfe44ce 117
118 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
119 Double_t fDeadPixels = 0.01; // fix to keep AliITSsimulationSPDdubna alive!!!
120 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
121
fcf95fc7 122 Bool_t dead = kFALSE;
123 Int_t seed;
124 static TRandom ran; // don't use gRandom. This must not be a true randome
125 // sequence. These sequence must be random one and then fully repetable.
126
127 seed = mod*256*256+iz*256+ix;
128 ran.SetSeed(seed);
129 if(ran.Rndm(0)<fDeadPixels) dead = kTRUE;
130 return dead;
131}
5bfe44ce 132//____________________________________________________________________________
5bfe44ce 133void AliITSCalibrationSPD::AddNoisy(UInt_t col, UInt_t row) {
590d15ee 134 //
135 // add noisy pixel
136 //
137 fDeadChannels.Set(fNrNoisy*2+2);
138 fNoisyChannels.AddAt(col,fNrNoisy*2);
139 fNoisyChannels.AddAt(row,fNrNoisy*2+1);
140 fNrNoisy++;
5bfe44ce 141}
590d15ee 142//____________________________________________________________________________
5bfe44ce 143Int_t AliITSCalibrationSPD::GetNoisyColAt(UInt_t index) {
590d15ee 144 //
145 // Get column of index-th noisy pixel
146 //
147 if (index<fNrNoisy) {
5bfe44ce 148 return fNoisyChannels.At(index*2);
149 }
150 return -1;
151}
590d15ee 152//____________________________________________________________________________
5bfe44ce 153Int_t AliITSCalibrationSPD::GetNoisyRowAt(UInt_t index) {
590d15ee 154 //
155 // Get row of index-th noisy pixel
156 //
157 if (index<fNrNoisy) {
5bfe44ce 158 return fNoisyChannels.At(index*2+1);
159 }
160 return -1;
161}
590d15ee 162//____________________________________________________________________________
5bfe44ce 163Bool_t AliITSCalibrationSPD::IsPixelNoisy(Int_t col, Int_t row) const {
590d15ee 164 //
165 // Check if pixel (col,row) is noisy
166 //
167 for (UInt_t i=0; i<fNrNoisy; i++) {
5bfe44ce 168 if (fNoisyChannels.At(i*2)==col && fNoisyChannels.At(i*2+1)==row) {
169 return true;
170 }
171 }
172 return false;
173}