Line data Source code
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 AliITSCorrMapSDD;
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 :
29 3378 : virtual Float_t GetBaseline(Int_t anode) const {return fBaseline[anode];}
30 0 : virtual void SetBaseline(Int_t anode,Double_t bas) {fBaseline[anode]=bas;}
31 806 : virtual Float_t GetNoise(Int_t anode) const {return fNoise[anode];}
32 0 : virtual void SetNoise(Int_t anode, Double_t noise) {fNoise[anode]=noise;}
33 :
34 : virtual void GiveCompressParam(Int_t *x) const;
35 :
36 3120 : void SetZSLowThreshold(Int_t iWing, Int_t thr=25){fZSTL[iWing]=thr;}
37 3120 : void SetZSHighThreshold(Int_t iWing, Int_t thr=29){fZSTH[iWing]=thr;}
38 4552 : Int_t GetZSLowThreshold(Int_t iWing) const {return fZSTL[iWing];}
39 392 : Int_t GetZSHighThreshold(Int_t iWing) const {return fZSTH[iWing];}
40 :
41 : void SetNoiseAfterElectronics(Int_t anode,Double_t n=2.38){
42 : // Noise after electronics (ADC units)
43 : // 2.36 for ALICE from beam test measurements 2001
44 798720 : fNoiseAfterEl[anode]=n;}
45 : Float_t GetNoiseAfterElectronics(Int_t anode) const {
46 : // Noise after electronics (ADC units)
47 2572 : return fNoiseAfterEl[anode];}
48 : //void SetDeadChannels(Int_t nchips=0, Int_t nchannels=0);
49 1560 : void SetDeadChannels(Int_t ndead=0){fDeadChannels=ndead; fBadChannels.Set(ndead);}
50 0 : Int_t GetDeadChips() const { return fDeadChips; }
51 0 : Int_t GetDeadChannels() const { return fDeadChannels; }
52 2649938 : Float_t GetChannelGain(Int_t anode) const {return fGain[anode];}
53 0 : virtual void SetGain(Int_t anode,Double_t g){fGain[anode]=g;}
54 :
55 :
56 : Int_t GetWing(Int_t anode) const{
57 0 : if(anode>=fgkChips*fgkChannels) return 1;
58 0 : else return 0;
59 0 : }
60 0 : Int_t GetChipChannel(Int_t anode) const {return anode%fgkChannels;}
61 806 : Int_t GetChip(Int_t anode) const {return anode/fgkChannels;}
62 : Int_t GetAnodeNumber(Int_t iwing, Int_t ichip03, Int_t ichan) const {
63 0 : if(iwing>=2 || ichip03>=4 || ichan>=64) return -1;
64 0 : else return iwing*fgkChips*fgkChannels+ichip03*fgkChannels+ichan;
65 0 : }
66 : Int_t GetAnodeNumber(Int_t ichip07, Int_t ichan) const {
67 0 : if(ichip07>=8 || ichan>=64) return -1;
68 0 : else return ichip07*fgkChannels+ichan;
69 0 : }
70 :
71 : void PrintGains() const;
72 : void Print();
73 0 : virtual void Print(ostream *os) const {AliITSCalibrationSDD::Print(os);}
74 0 : virtual void Print(Option_t *option="") const {AliITSCalibrationSDD::Print(option);}
75 : // not implemented virtual methods (devlared in the mother class
76 : virtual void SetDetParam(Double_t *)
77 0 : {NotImplemented("SetDetParam");}
78 : virtual void GetDetParam(Double_t *) const
79 0 : {NotImplemented("GetDetParam");}
80 : virtual void SetNDetParam(Int_t /* n */)
81 0 : {NotImplemented("SetNDetParam");}
82 : virtual Int_t NDetParam() const
83 0 : {NotImplemented("NDetParam"); return 0;}
84 : virtual void SetSigmaSpread(Double_t, Double_t)
85 0 : {NotImplemented("SetSigmaSpread");}
86 : virtual void SigmaSpread(Double_t & /* p1 */,Double_t & /* p2 */) const
87 0 : {NotImplemented("SigmaSpread");}
88 :
89 : void SetBad() {
90 0 : fIsBad = kTRUE;
91 0 : for(Int_t i=0;i<fgkChips*fgkWings;i++) fIsChipBad[i]=kTRUE;
92 0 : }
93 1846 : virtual Bool_t IsBad() const { return fIsBad; }
94 : void SetChipBad(Int_t nChip) {
95 0 : fIsChipBad[nChip] = kTRUE;
96 0 : }
97 : virtual Bool_t IsChipBad(Int_t nChip) const {
98 9126 : return fIsChipBad[nChip];
99 : }
100 : virtual Bool_t IsWingBad(Int_t nwing) const
101 : {
102 0 : if(nwing<0 || nwing>1) return kFALSE;
103 0 : if(IsChipBad(nwing*4) && IsChipBad(nwing*4+1) && IsChipBad(nwing*4+2) && IsChipBad(nwing*4+3)) return kTRUE;
104 0 : return kFALSE;
105 0 : }
106 :
107 0 : Int_t Wings()const{return fgkWings;}//Total number of SDD wings
108 0 : Int_t Chips() const{return fgkChips;} // Number of chips/module
109 0 : Int_t Channels() const{ return fgkChannels;}//Number of channels/chip
110 1067040 : Int_t NOfAnodes() const {return fgkChannels*fgkChips*fgkWings;}
111 :
112 : virtual void SetBadChannel(Int_t i,Int_t anode);
113 0 : Int_t GetBadChannel(Int_t i) const {return fBadChannels[i];}
114 : Bool_t IsBadChannel(Int_t anode) const{
115 1609320 : if(GetChannelGain(anode)==0) return kTRUE;
116 786840 : else return kFALSE;
117 798720 : }
118 : Float_t GetMapACell(Int_t i,Int_t j) const {
119 0 : if(i<256) return fMapAW0->GetCellContent(i,j);
120 0 : else return fMapAW1->GetCellContent(i-256,j);
121 0 : }
122 : virtual void SetMapA(Int_t wing,AliITSCorrMapSDD* mapA) {
123 0 : if(wing==0) fMapAW0=mapA;
124 0 : else fMapAW1=mapA;
125 0 : }
126 : Float_t GetMapTCell(Int_t i,Int_t j) const {
127 0 : if(i<256) return fMapTW0->GetCellContent(i,j);
128 0 : else return fMapTW1->GetCellContent(i-256,j);
129 0 : }
130 : virtual void SetMapT(Int_t wing,AliITSCorrMapSDD* mapT) {
131 5200 : if(wing==0) fMapTW0=mapT;
132 1040 : else fMapTW1=mapT;
133 2080 : }
134 :
135 : virtual void SetDriftSpeed(Int_t wing, AliITSDriftSpeedArraySDD* arr){
136 5200 : if(wing==0) fDrSpeed0=arr;
137 1040 : else fDrSpeed1=arr;
138 2080 : }
139 :
140 :
141 : virtual Float_t GetDriftSpeedAtAnode(Float_t nAnode) const{
142 3219 : if(fDrSpeed0==0 || fDrSpeed1==0) AliFatal("Drift speed not set\n");
143 1624 : if(nAnode<256) return fDrSpeed0->GetDriftSpeed(0,nAnode);
144 522 : else return fDrSpeed1->GetDriftSpeed(0,nAnode-256);
145 1073 : }
146 :
147 0 : virtual void SetZeroSupp(Bool_t opt=kTRUE) {fZeroSupp=opt;}
148 2276 : virtual Bool_t GetZeroSupp() const {return fZeroSupp;}
149 :
150 0 : virtual void SetAMAt40MHz() {fAMAt20MHz=kFALSE;}
151 0 : virtual void SetAMAt20MHz() {fAMAt20MHz=kTRUE;}
152 862 : virtual Bool_t IsAMAt20MHz() const {return fAMAt20MHz;}
153 :
154 : void GetCorrections(Float_t z, Float_t x, Float_t &devz, Float_t &devx, AliITSsegmentationSDD* seg);
155 : void GetShiftsForSimulation(Float_t z, Float_t x, Float_t &devz, Float_t &devx, AliITSsegmentationSDD* seg);
156 : virtual Float_t GetThresholdAnode(Int_t anode, Double_t nsigma=2.2) const {
157 2572 : return nsigma*fNoiseAfterEl[anode];}
158 :
159 :
160 : protected:
161 :
162 :
163 : // these statis const should be move to AliITSsegmentationSDD
164 : static const Int_t fgkWings = 2; // Number of wings per module
165 : static const Int_t fgkChips = 4; // Number of chips/module
166 : static const Int_t fgkChannels = 64; // Number of channels/chip
167 : static const Float_t fgkTemperatureDefault; // default for fT (Kelvin)
168 : static const Float_t fgkNoiseDefault; // default for fNoise
169 : static const Float_t fgkBaselineDefault; // default for fBaseline
170 : static const Float_t fgkGainDefault; //default for gain
171 :
172 : Bool_t fZeroSupp; // zero suppression
173 : Bool_t fAMAt20MHz; // flag for Analog memory of Pascal at 20 MHz
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 : AliITSCorrMapSDD* fMapAW0; //! map of residuals on anode coord. wing 0
190 : AliITSCorrMapSDD* fMapAW1; //! map of residuals on anode coord. wing 1
191 : AliITSCorrMapSDD* fMapTW0; //! map of residuals on time coord. wing 0
192 : AliITSCorrMapSDD* fMapTW1; //! map of residuals on time coord. wing 1
193 : AliITSDriftSpeedArraySDD* fDrSpeed0; //! drift speed for wing 0
194 : AliITSDriftSpeedArraySDD* fDrSpeed1; //! drift speed for wing 1
195 :
196 : private:
197 : AliITSCalibrationSDD(const AliITSCalibrationSDD &ob); // copy constructor
198 : AliITSCalibrationSDD& operator=(const AliITSCalibrationSDD & /* source */); // ass. op.
199 :
200 :
201 1688 : ClassDef(AliITSCalibrationSDD,17)
202 :
203 : };
204 : #endif
|