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