]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSCalibrationSSD.h
Four overlaps fixed (M. Sitta)
[u/mrichter/AliRoot.git] / ITS / AliITSCalibrationSSD.h
1 #ifndef ALIITSCALIBRATIONSSD_H
2 #define ALIITSCALIBRATIONSSD_H
3 /* Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */ 
5 #include "AliITSCalibration.h"
6 #include "AliITSNoiseSSD.h"
7 #include "AliITSPedestalSSD.h"
8 #include "AliITSGainSSD.h"
9 #include "AliITSBadChannelsSSD.h"
10 #include "AliITSresponseSSD.h"
11 #include "TArrayF.h"
12 #include "TArrayI.h"
13
14 /* $Id$ */
15 //////////////////////////////////////////////
16 // Response class for SSD                   //
17 //                                          //
18 //////////////////////////////////////////////
19 class AliITSCalibrationSSD : public AliITSCalibration {
20
21  public:
22     AliITSCalibrationSSD();
23     AliITSCalibrationSSD(const char *dataType);
24     virtual ~AliITSCalibrationSSD();
25
26     virtual  void   SetNoiseParam(Double_t np, Double_t nn) {
27         // set noise par
28         fNoiseP=np; fNoiseN=nn;
29     }
30
31     virtual void    GetNoiseParam(Double_t &np, Double_t &nn) const {
32         // get noise par
33         np=fNoiseP; nn=fNoiseN;
34     }
35
36     void AddNoiseP(Int_t c, Float_t n) { fNoise->AddNoiseP(c,n);}       
37     TArrayF GetNoiseP() {return fNoise->GetNoiseP(); }
38     Float_t GetNoiseP(Int_t n) {return fNoise->GetNoiseP(n); }
39     void AddNoiseN(Int_t c, Float_t n) { fNoise->AddNoiseN(c,n);}
40     TArrayF GetNoiseN() {return fNoise->GetNoiseN(); }
41     Float_t GetNoiseN(Int_t n) {return fNoise->GetNoiseN(n); }
42     void SetNoise( AliITSNoiseSSD* noise) {fNoise=noise;}
43
44     void AddPedestalP(Int_t c, Float_t n) { fPedestal->AddPedestalP(c,n);}       
45     TArrayF GetPedestalP() {return fPedestal->GetPedestalP(); }
46     Float_t GetPedestalP(Int_t n) {return fPedestal->GetPedestalP(n); }
47     void AddPedestalN(Int_t c, Float_t n) { fPedestal->AddPedestalN(c,n);}
48     TArrayF GetPedestalN() {return fPedestal->GetPedestalN(); }
49     Float_t GetPedestalN(Int_t n) {return fPedestal->GetPedestalN(n); }
50     void SetPedestal( AliITSPedestalSSD* pedestal) {fPedestal=pedestal;}
51
52     void AddGainP(Int_t c, Float_t n) { fGain->AddGainP(c,n);}       
53     TArrayF GetGainP() {return fGain->GetGainP(); }
54     Float_t GetGainP(Int_t n) {return fGain->GetGainP(n); }
55     void AddGainN(Int_t c, Float_t n) { fGain->AddGainN(c,n);}
56     TArrayF GetGainN() {return fGain->GetGainN(); }
57     Float_t GetGainN(Int_t n) {return fGain->GetGainN(n); }
58     void SetGain( AliITSGainSSD* gain) {fGain=gain;}
59
60     void   SetBad() {
61       fIsBad = kTRUE;
62       for(Int_t i=0;i<fgkChipsPerModule;i++) fIsChipBad[i]=kTRUE;
63     }
64     virtual Bool_t IsBad() const { return fIsBad; }
65     void   SetChipBad(Int_t nChip) {
66       fIsChipBad[nChip] = kTRUE;
67     }
68     void FillBadChipMap();
69     virtual Bool_t IsChipBad(Int_t nChip) const {
70       return fIsChipBad[nChip];
71     }
72     Int_t ChipsPerModule() const{return fgkChipsPerModule;} // Number of chips/module
73     Int_t ChannelsPerChip() const{ return fgkChannelsPerChip;}//Number of channels/chip
74
75     TArrayI GetBadPChannelsList() { return fBadChannels->GetBadPChannelsList(); } const
76     TArrayI GetBadNChannelsList() { return fBadChannels->GetBadNChannelsList(); } const
77     void SetBadChannels( AliITSBadChannelsSSD* badchannels) {fBadChannels=badchannels;}
78     Int_t GetBadPChannel(Int_t n) {return fBadChannels->GetBadPChannel(n); }
79     Int_t GetBadNChannel(Int_t n) {return fBadChannels->GetBadNChannel(n); }
80     Bool_t IsPChannelBad(Int_t n) {return fBadChannels->GetBadPChannel(n)&1; }
81     Bool_t IsNChannelBad(Int_t n) {return fBadChannels->GetBadNChannel(n)&1; }
82
83     void SetNoisePThreshold(Int_t threshold) { fNoisePThreshold = threshold;}
84     void AddNoisyPChannel(Int_t c, Int_t n) { fNoisyPChannelsList.AddAt(n,c);}
85     TArrayI GetNoisyPChannelsList() const {return fNoisyPChannelsList; }
86     void SetNoiseNThreshold(Int_t threshold) { fNoiseNThreshold = threshold;}
87     void AddNoisyNChannel(Int_t c, Int_t n) { fNoisyNChannelsList.AddAt(n,c);}
88     TArrayI GetNoisyNChannelsList() const {return fNoisyNChannelsList; }
89
90     void SetNDeadPChannelsList(Int_t n) { fDeadPChannelsList.Set(n); }
91     void AddDeadPChannel(Int_t c, Int_t n) { fDeadPChannelsList.AddAt(n,c);}
92     TArrayI GetDeadPChannelsList() const {return fDeadPChannelsList; }
93     void SetNDeadNChannelsList(Int_t n) { fDeadNChannelsList.Set(n); }
94     void AddDeadNChannel(Int_t c, Int_t n) { fDeadNChannelsList.AddAt(n,c);}
95     TArrayI GetDeadNChannelsList() const {return fDeadNChannelsList; }
96     //
97
98
99     virtual  void   SetNDetParam(Int_t npar) {
100         // set number of param
101         fNPar=npar;
102     }
103     virtual  void   SetDetParam(Double_t *par);
104
105     // Parameters options
106     virtual Int_t   NDetParam() const {
107         // number of param
108         return fNPar;
109     }
110     virtual void    GetDetParam(Double_t *dpar) const; 
111
112     virtual void    SetSigmaSpread(Double_t p1, Double_t p2) {
113         // Set sigmas of the charge spread function: Pside-Nside
114         // square of (microns)
115         fSigmaP=p1; fSigmaN=p2;
116     }
117
118     virtual void    SigmaSpread(Double_t &sP, Double_t &sN) const {
119       // Get sigmas for the charge spread 
120       sP=fSigmaP; sN=fSigmaN;
121     }
122
123     virtual void   SetThresholds(Double_t /* a */, Double_t /* b */)
124       {NotImplemented("SetThresholds");}
125     virtual void   Thresholds(Double_t & /* a */, Double_t & /* b */) const 
126       {NotImplemented("Thresholds");}
127   
128     virtual void SetADCpereV(Double_t a=120./24888.9) {((AliITSresponseSSD*)fResponse)->SetADCpereV(a);}
129     virtual Double_t GetDEvToADC(Double_t eV) const {return ((AliITSresponseSSD*)fResponse)->DEvToADC(eV);}
130     virtual Int_t IEvToADC(Double_t eV) const {return ((AliITSresponseSSD*)fResponse)->IEvToADC(eV);} 
131
132     virtual void SetKeVperADC(Double_t a=86.4/120.0) {((AliITSresponseSSD*)fResponse)->SetKeVperADC(a);}
133     virtual Double_t ADCToKeV(Double_t adc) const {return ((AliITSresponseSSD*)fResponse)->ADCToKeV(adc);}
134
135   virtual Double_t GetCouplingPR() const {return ((AliITSresponseSSD*)fResponse)->GetCouplingPR();}
136   virtual Double_t GetCouplingPL() const {return ((AliITSresponseSSD*)fResponse)->GetCouplingPL();}
137   virtual Double_t GetCouplingNR() const {return ((AliITSresponseSSD*)fResponse)->GetCouplingNR();}
138   virtual Double_t GetCouplingNL() const {return ((AliITSresponseSSD*)fResponse)->GetCouplingNL();}
139   virtual void SetCouplings(Double_t pr, Double_t pl, Double_t nr, Double_t nl) 
140     { ((AliITSresponseSSD*)fResponse)->SetCouplings(pr,pl,nr,nl);}
141
142   virtual Int_t GetZSThreshold() const {return ((AliITSresponseSSD*)fResponse)->GetZSThreshold();}
143   virtual void SetZSThreshold(Int_t zsth) 
144     { ((AliITSresponseSSD*)fResponse)->SetZSThreshold(zsth);}
145
146 protected:
147
148     static const Int_t fgkChipsPerModule  = 12;    // Number of chips/module
149     static const Int_t fgkChannelsPerChip = 128;   // Number of channels/chip
150
151     static const Double_t fgkNoiseNDefault; // default for fNoiseN
152     static const Double_t fgkNoisePDefault; // default for fNoiseP
153     static const Int_t fgkNParDefault; // default for fNPar
154     static const Double_t fgkSigmaPDefault; //default for fSigmaP
155     static const Double_t fgkSigmaNDefault; //default for fSigmaP
156
157     Int_t   fNPar;            // Number of detector param 
158     Double_t *fDetPar;         //[fNPar] Array of parameters
159
160     Double_t fNoiseP;          // Noise on Pside
161     Double_t fNoiseN;          // Noise on Nside
162     Double_t fSigmaP;          // Sigma charge spread on Pside
163     Double_t fSigmaN;          // Sigma charge spread on Nside
164     
165     AliITSNoiseSSD *fNoise;
166     AliITSPedestalSSD *fPedestal;
167     AliITSGainSSD *fGain;
168     AliITSBadChannelsSSD *fBadChannels;
169
170     Bool_t   fIsBad;                         // module is dead or alive ?
171     Bool_t   fIsChipBad[fgkChipsPerModule];  // chip is dead or alive ?
172
173     TArrayF fGainP;           // Gain for P side channels
174     TArrayF fGainN;           // Gain for N side channels
175
176     TArrayF fNoisP;           // Noise for P side channels
177     TArrayF fNoisN;           // Noise for N side channels
178
179     TArrayF fPedP;
180     TArrayF fPedN;
181
182     Float_t fNoisePThreshold;     // need to decide if channel is noisy  
183     TArrayI  fNoisyPChannelsList; // list of P side noisy channels
184     Float_t fNoiseNThreshold;     // need to decide if channel is noisy  
185     TArrayI  fNoisyNChannelsList; // list of N side noisy channels
186
187     TArrayI  fDeadNChannelsList;  // list of P side dead channels
188     TArrayI  fDeadPChannelsList;  // list of N side dead channels
189
190  private:
191     AliITSCalibrationSSD(const AliITSCalibrationSSD &source); // copy constructor
192     AliITSCalibrationSSD& operator=(const AliITSCalibrationSSD &source); // ass. op.
193
194     ClassDef(AliITSCalibrationSSD,3) //Response class for SSD
195 };
196 #endif