]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSCalibrationSPD.cxx
New SPD simulation (Massimo):
[u/mrichter/AliRoot.git] / ITS / AliITSCalibrationSPD.cxx
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  **************************************************************************/
15
16 ///////////////////////////////////////////////////////////////////////////
17 //  Calibration class for set:ITS                   
18 //  Specific subdetector implementation for         
19 //  Silicon pixels                                  
20 //
21 //  Modified by D. Elia, G.E. Bruno, H. Tydesjo
22 //  March-April 2006
23 //
24 ///////////////////////////////////////////////////////////////////////////
25
26 #include "AliITSCalibrationSPD.h"
27
28 const Double_t AliITSCalibrationSPD::fgkThreshDefault = 3000.;
29 const Double_t AliITSCalibrationSPD::fgkSigmaDefault = 250.;
30 const Double_t AliITSCalibrationSPD::fgkCouplColDefault = 0.;
31 const Double_t AliITSCalibrationSPD::fgkCouplRowDefault = 0.047;
32 const Double_t AliITSCalibrationSPD::fgkBiasVoltageDefault = 18.182;
33
34 ClassImp(AliITSCalibrationSPD)  
35 //______________________________________________________________________
36 AliITSCalibrationSPD::AliITSCalibrationSPD():
37 AliITSCalibration(),
38 fBaseline(0.0),
39 fNoise(0.0),
40 fThresh(fgkThreshDefault),
41 fSigma(fgkSigmaDefault),
42 fCouplCol(fgkCouplColDefault),
43 fCouplRow(fgkCouplRowDefault),
44 fBiasVoltage(fgkBiasVoltageDefault),
45 nrDead(0),
46 nrNoisy(0){
47   // constructor
48
49    SetThresholds(fgkThreshDefault,fgkSigmaDefault);
50    SetCouplingParam(fgkCouplColDefault,fgkCouplRowDefault);
51    SetBiasVoltage(fgkBiasVoltageDefault);
52    SetNoiseParam(0.,0.);
53    SetDataType("simulated");
54 }
55 //_________________________________________________________________________
56
57
58 void AliITSCalibrationSPD::AddDead(UInt_t col, UInt_t row) {
59   fDeadChannels.Set(nrDead*2+2);
60   fDeadChannels.AddAt(col,nrDead*2);
61   fDeadChannels.AddAt(row,nrDead*2+1);
62   nrDead++;
63 }
64 Int_t AliITSCalibrationSPD::GetDeadColAt(UInt_t index) {
65   if (index<nrDead) {
66     return fDeadChannels.At(index*2);
67   }
68   return -1;
69 }
70 Int_t AliITSCalibrationSPD::GetDeadRowAt(UInt_t index) {
71   if (index<nrDead) {
72     return fDeadChannels.At(index*2+1);
73   }
74   return -1;
75 }
76 Bool_t AliITSCalibrationSPD::IsPixelDead(Int_t col, Int_t row) const {
77   for (UInt_t i=0; i<nrDead; i++) { 
78     if (fDeadChannels.At(i*2)==col && fDeadChannels.At(i*2+1)==row) {
79       return true;
80     }
81   }
82   return false;
83 }
84
85 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
86 //___________________________________________________________________________
87 // THIS METHOD SHOULD BE DELETED AS SOON AS POSSIBLE!!!!!!!!!!!!!!!!!!!!!!!!!
88 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
89 Bool_t AliITSCalibrationSPD::IsPixelDead(Int_t mod,Int_t ix,Int_t iz) const {
90  // Returns kTRUE if pixel is dead
91   // Inputs:
92   //    Int_t mod      module number
93   //    Int_t ix       x pixel number
94   //    Int_t iz       z pixel number
95   // Outputs:
96   //    none.
97   // Return:
98   //    kFALSE if pixel is alive, or kTRUE if pixel is dead.
99
100   // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
101   Double_t fDeadPixels = 0.01; // fix to keep AliITSsimulationSPDdubna alive!!!
102   // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
103
104   Bool_t  dead = kFALSE;
105   Int_t   seed;
106   static TRandom ran; // don't use gRandom. This must not be a true randome
107   // sequence. These sequence must be random one and then fully repetable.
108
109   seed = mod*256*256+iz*256+ix;
110   ran.SetSeed(seed);
111   if(ran.Rndm(0)<fDeadPixels) dead = kTRUE;
112   return dead;
113 }
114 //____________________________________________________________________________
115
116 void AliITSCalibrationSPD::AddNoisy(UInt_t col, UInt_t row) {
117   fDeadChannels.Set(nrNoisy*2+2);
118   fNoisyChannels.AddAt(col,nrNoisy*2);
119   fNoisyChannels.AddAt(row,nrNoisy*2+1);
120   nrNoisy++;
121 }
122 Int_t AliITSCalibrationSPD::GetNoisyColAt(UInt_t index) {
123   if (index<nrNoisy) {
124     return fNoisyChannels.At(index*2);
125   }
126   return -1;
127 }
128 Int_t AliITSCalibrationSPD::GetNoisyRowAt(UInt_t index) {
129   if (index<nrNoisy) {
130     return fNoisyChannels.At(index*2+1);
131   }
132   return -1;
133 }
134 Bool_t AliITSCalibrationSPD::IsPixelNoisy(Int_t col, Int_t row) const {
135   for (UInt_t i=0; i<nrNoisy; i++) { 
136     if (fNoisyChannels.At(i*2)==col && fNoisyChannels.At(i*2+1)==row) {
137       return true;
138     }
139   }
140   return false;
141 }