]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSCalibrationSDD.h
Adding new files too build system
[u/mrichter/AliRoot.git] / ITS / AliITSCalibrationSDD.h
1 #ifndef ALIITSCALIBRATIONSDD_H
2 #define ALIITSCALIBRATIONSDD_H
3  
4 /* Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice                               */
6  
7 /* $Id$ */
8
9 #include "AliITSCalibration.h"
10 #include "AliITSsegmentationSDD.h"
11 #include "TArrayI.h"
12
13 class AliITSMapSDD;
14 class AliITSDriftSpeedArraySDD;
15
16 ///////////////////////////////////////////////////////
17 //  Response for SDD                                 //
18 ///////////////////////////////////////////////////////
19
20 class AliITSCalibrationSDD : public AliITSCalibration {
21   public:
22     //
23     // Configuration methods
24     //
25     AliITSCalibrationSDD();
26     AliITSCalibrationSDD(const char *dataType);
27     virtual ~AliITSCalibrationSDD();
28     virtual void  SetNoiseParam(Double_t /*n*/, Double_t /*b*/){
29       NotImplemented("SetNoiseParam");}
30  
31     virtual void  GetNoiseParam(Double_t &/*n*/, Double_t &/*b*/) const {
32       NotImplemented("GetNoiseParam");}
33
34     virtual Float_t GetBaseline(Int_t anode) const {return fBaseline[anode];}
35     virtual void SetBaseline(Int_t anode,Double_t bas) {fBaseline[anode]=bas;}
36     virtual Float_t GetNoise(Int_t anode) const {return fNoise[anode];}
37     virtual void SetNoise(Int_t anode, Double_t noise) {fNoise[anode]=noise;}
38
39     virtual void   SetThresholds(Double_t  /* mv */, Double_t /* b */) {
40       NotImplemented("SetThresholds");}
41     virtual void   Thresholds(Double_t &  /* mv */, Double_t & /* b */) const {
42       NotImplemented("Thresholds");}
43     virtual void  GiveCompressParam(Int_t *x) const;
44
45     void SetZSLowThreshold(Int_t iWing, Int_t thr=25){fZSTL[iWing]=thr;}
46     void SetZSHighThreshold(Int_t iWing, Int_t thr=29){fZSTH[iWing]=thr;}
47     Int_t GetZSLowThreshold(Int_t iWing) const {return fZSTL[iWing];}
48     Int_t GetZSHighThreshold(Int_t iWing) const {return fZSTH[iWing];}
49
50     void  SetNoiseAfterElectronics(Int_t anode,Double_t n=2.38){
51         // Noise after electronics (ADC units)
52         // 2.36 for ALICE from beam test measurements 2001
53         fNoiseAfterEl[anode]=n;}
54     Float_t  GetNoiseAfterElectronics(Int_t anode) const {
55         // Noise after electronics (ADC units)
56         return fNoiseAfterEl[anode];} 
57     //void SetDeadChannels(Int_t nchips=0, Int_t nchannels=0);
58     void SetDeadChannels(Int_t ndead=0){fDeadChannels=ndead; fBadChannels.Set(ndead);}
59     Int_t GetDeadChips() const { return fDeadChips; }
60     Int_t GetDeadChannels() const { return fDeadChannels; }
61     Float_t GetChannelGain(Int_t anode) const {return fGain[anode];}
62     virtual void SetGain(Int_t anode,Double_t g){fGain[anode]=g;}
63
64     
65     Int_t GetWing(Int_t anode) const{
66       if(anode>=fgkChips*fgkChannels) return 1;
67       else return 0;
68     }
69     Int_t GetChipChannel(Int_t anode) const {return anode%fgkChannels;}
70     Int_t GetChip(Int_t anode) const {return anode/fgkChannels;}
71     Int_t GetAnodeNumber(Int_t iwing, Int_t ichip03, Int_t ichan) const {
72       if(iwing>=2 || ichip03>=4 || ichan>=64) return -1;
73       else return iwing*fgkChips*fgkChannels+ichip03*fgkChannels+ichan;
74     }
75     Int_t GetAnodeNumber(Int_t ichip07, Int_t ichan) const {
76       if(ichip07>=8 || ichan>=64) return -1;
77       else return ichip07*fgkChannels+ichan;
78     }
79     
80     void    PrintGains() const;
81     void    Print();
82     virtual void Print(ostream *os) const {AliITSCalibrationSDD::Print(os);}
83     virtual void Print(Option_t *option="") const {AliITSCalibrationSDD::Print(option);}
84     // not implemented virtual methods (devlared in the mother class
85     virtual  void   SetDetParam(Double_t *) 
86       {NotImplemented("SetDetParam");}
87     virtual void   GetDetParam(Double_t *) const 
88       {NotImplemented("GetDetParam");}
89     virtual  void   SetNDetParam(Int_t /* n */)
90       {NotImplemented("SetNDetParam");}
91     virtual Int_t  NDetParam() const
92       {NotImplemented("NDetParam"); return 0;}
93     virtual void    SetSigmaSpread(Double_t, Double_t) 
94       {NotImplemented("SetSigmaSpread");}
95     virtual void    SigmaSpread(Double_t & /* p1 */,Double_t & /* p2 */) const 
96       {NotImplemented("SigmaSpread");}
97
98     void   SetBad() { 
99       fIsBad = kTRUE; 
100       for(Int_t i=0;i<fgkChips*fgkWings;i++) fIsChipBad[i]=kTRUE;
101     }
102     virtual Bool_t IsBad() const { return fIsBad; }
103     void   SetChipBad(Int_t nChip) { 
104       fIsChipBad[nChip] = kTRUE; 
105     }
106     virtual Bool_t IsChipBad(Int_t nChip) const { 
107       return fIsChipBad[nChip]; 
108     }
109     Int_t Wings()const{return fgkWings;}//Total number of SDD wings
110     Int_t Chips() const{return fgkChips;} // Number of chips/module
111     Int_t Channels() const{ return fgkChannels;}//Number of channels/chip
112     
113     virtual void SetBadChannel(Int_t i,Int_t anode);
114     Int_t GetBadChannel(Int_t i) const {return fBadChannels[i];}
115     Bool_t IsBadChannel(Int_t anode) const{
116       if(GetChannelGain(anode)==0) return kTRUE;
117       else return kFALSE;
118     }
119     void SetUseCorrectionMaps(Bool_t useAnodeMap, Bool_t useDriftMap){
120       fUseACorrMap=useAnodeMap;
121       fUseTCorrMap=useDriftMap;
122     }
123     Float_t GetMapACell(Int_t i,Int_t j) const {
124       if(i<256) return fMapAW0->GetCellContent(i,j);
125       else return fMapAW1->GetCellContent(i-256,j);
126     }
127     virtual void SetMapA(Int_t wing,AliITSMapSDD* mapA) {
128       if(wing==0) fMapAW0=mapA;
129       else fMapAW1=mapA;
130     } 
131     Float_t GetMapTCell(Int_t i,Int_t j) const {
132       if(i<256) return fMapTW0->GetCellContent(i,j);
133       else return fMapTW1->GetCellContent(i-256,j);
134     }
135     virtual void SetMapT(Int_t wing,AliITSMapSDD* mapT) {
136       if(wing==0) fMapTW0=mapT;
137       else fMapTW1=mapT;
138     } 
139     
140     virtual void SetDriftSpeed(Int_t wing, AliITSDriftSpeedArraySDD* arr){
141       if(wing==0) fDrSpeed0=arr;
142       else fDrSpeed1=arr;
143     }
144
145
146     virtual Float_t GetDriftSpeedAtAnode(Float_t nAnode) const{
147       if(fDrSpeed0==0 || fDrSpeed1==0) AliFatal("Drift speed not set\n");
148       if(nAnode<256) return fDrSpeed0->GetDriftSpeed(0,nAnode);
149       else return fDrSpeed1->GetDriftSpeed(0,nAnode-256);
150     }
151
152     virtual void SetZeroSupp(Bool_t opt=kTRUE) {fZeroSupp=opt;}
153     virtual Bool_t GetZeroSupp() const {return fZeroSupp;}
154
155     virtual Float_t GetDriftPath(Float_t time, Float_t xAnode) const {return time*GetDriftSpeedAtAnode(xAnode);}
156     void GetCorrections(Float_t z, Float_t x, Float_t &devz, Float_t &devx, AliITSsegmentationSDD* seg);
157     virtual Float_t GetThresholdAnode(Int_t anode,Int_t nsigma=3) const {
158       return nsigma*fNoiseAfterEl[anode];}
159
160
161  protected:
162
163
164     // these statis const should be move to AliITSsegmentationSDD
165     static const Int_t fgkWings = 2;     // Number of wings per module
166     static const Int_t fgkChips = 4;        // Number of chips/module
167     static const Int_t fgkChannels = 64;    // Number of channels/chip
168     static const Float_t fgkTemperatureDefault; // default for fT (Kelvin)
169     static const Float_t fgkNoiseDefault; // default for fNoise
170     static const Float_t fgkBaselineDefault; // default for fBaseline
171     static const Float_t fgkGainDefault; //default for gain
172
173     Bool_t fZeroSupp;    // zero suppression
174     Int_t fDeadChips;                     // Number of dead chips
175     Int_t fDeadChannels;                  // Number of dead channels
176     Float_t fGain[fgkWings*fgkChips*fgkChannels];           //Array for channel gains
177     Float_t fNoise[fgkWings*fgkChips*fgkChannels];          // Noise array
178     Float_t fBaseline[fgkWings*fgkChips*fgkChannels];       // Baseline array
179     Float_t fNoiseAfterEl[fgkWings*fgkChips*fgkChannels];   // Noise after electronics
180
181     Int_t   fZSTL[2];     //  Low threshold in 2D zero-suppression (2 hybrids)
182     Int_t   fZSTH[2];     // High threshold in 2D zero-suppression (2 hybrids)
183
184     Bool_t   fIsBad;                         // module is dead or alive ?
185     Bool_t   fIsChipBad[fgkWings*fgkChips];  // chip is dead or alive ?
186     TArrayI  fBadChannels;                   //Array with bad anodes number (0-512) 
187
188     
189     Bool_t fUseACorrMap;    // flag for the use of correction maps (anode)
190     Bool_t fUseTCorrMap;    // flag for the use of correction maps (drift)
191
192     AliITSMapSDD* fMapAW0;     //! map of residuals on anode coord. wing 0
193     AliITSMapSDD* fMapAW1;     //! map of residuals on anode coord. wing 1
194     AliITSMapSDD* fMapTW0;     //! map of residuals on time coord. wing 0
195     AliITSMapSDD* fMapTW1;     //! map of residuals on time coord. wing 1
196     AliITSDriftSpeedArraySDD* fDrSpeed0; //! drift speed for wing 0
197     AliITSDriftSpeedArraySDD* fDrSpeed1; //! drift speed for wing 1
198
199  private:
200     AliITSCalibrationSDD(const AliITSCalibrationSDD &ob); // copy constructor
201     AliITSCalibrationSDD& operator=(const AliITSCalibrationSDD & /* source */); // ass. op.
202
203
204     ClassDef(AliITSCalibrationSDD,12) 
205     
206     };
207 #endif