Fixes for Febr. 2008 run
[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
40 virtual void SetThresholds(Double_t mv, Double_t /* b */){
41 // Min value used in 2D - could be used as a threshold setting
42 fMinVal = mv;}
43 virtual void Thresholds(Double_t & mv, Double_t & /* b */) const
44 {mv = fMinVal;}
f45f6658 45 virtual void GiveCompressParam(Int_t *x,Int_t ian) const;
fcf95fc7 46
f45f6658 47 void SetNoiseAfterElectronics(Int_t anode,Double_t n=2.38){
fcf95fc7 48 // Noise after electronics (ADC units)
49 // 2.36 for ALICE from beam test measurements 2001
f45f6658 50 fNoiseAfterEl[anode]=n;}
4bfbde86 51 Float_t GetNoiseAfterElectronics(Int_t anode) const {
fcf95fc7 52 // Noise after electronics (ADC units)
f45f6658 53 return fNoiseAfterEl[anode];}
54 //void SetDeadChannels(Int_t nchips=0, Int_t nchannels=0);
55 void SetDeadChannels(Int_t ndead=0){fDeadChannels=ndead; fBadChannels.Set(ndead);}
fcf95fc7 56 Int_t GetDeadChips() const { return fDeadChips; }
57 Int_t GetDeadChannels() const { return fDeadChannels; }
4bfbde86 58 Float_t Gain(Int_t wing,Int_t chip,Int_t ch)const
fcf95fc7 59 {return fGain[wing][chip][ch]; }
4952f440 60 Float_t GetChannelGain(Int_t anode) const;
f45f6658 61 virtual void SetGain(Double_t g,Int_t wing,Int_t chip, Int_t ch)
62 {fGain[wing][chip][ch]=g;}
63
4952f440 64 Int_t GetWing(Int_t anode) const{
65 if(anode>=fgkChips*fgkChannels) return 1;
66 else return 0;
67 }
68 Int_t GetChipChannel(Int_t anode) const {return anode%fgkChannels;}
69 Int_t GetChip(Int_t anode) const {
70 Int_t chip=anode/fgkChannels;
71 if(GetWing(anode)==1)chip-=fgkChips;
72 return chip;
73 }
74
fcf95fc7 75 void PrintGains() const;
76 void Print();
77 virtual void Print(ostream *os) const {AliITSCalibrationSDD::Print(os);}
78 virtual void Print(Option_t *option="") const {AliITSCalibrationSDD::Print(option);}
79 // not implemented virtual methods (devlared in the mother class
80 virtual void SetDetParam(Double_t *)
81 {NotImplemented("SetDetParam");}
82 virtual void GetDetParam(Double_t *) const
83 {NotImplemented("GetDetParam");}
84 virtual void SetNDetParam(Int_t /* n */)
85 {NotImplemented("SetNDetParam");}
86 virtual Int_t NDetParam() const
87 {NotImplemented("NDetParam"); return 0;}
88 virtual void SetSigmaSpread(Double_t, Double_t)
89 {NotImplemented("SetSigmaSpread");}
90 virtual void SigmaSpread(Double_t & /* p1 */,Double_t & /* p2 */) const
91 {NotImplemented("SigmaSpread");}
92
93 void SetDead() { fIsDead = kTRUE; };
94 Bool_t IsDead() const { return fIsDead; };
95 Int_t Wings()const{return fgkWings;}//Total number of SDD wings
96 Int_t Chips() const{return fgkChips;} // Number of chips/module
97 Int_t Channels() const{ return fgkChannels;}//Number of channels/chip
f45f6658 98
99 virtual void SetBadChannel(Int_t i,Int_t anode);
100 Int_t GetBadChannel(Int_t i) const {return fBadChannels[i];}
c9a38d3d 101 Bool_t IsBadChannel(Int_t anode) const{
4952f440 102 if(GetChannelGain(anode)==0) return kTRUE;
103 else return kFALSE;
104 }
c9a38d3d 105 void SetUseCorrectionMaps(Bool_t useAnodeMap, Bool_t useDriftMap){
106 fUseACorrMap=useAnodeMap;
107 fUseTCorrMap=useDriftMap;
108 }
028a3709 109 Float_t GetMapACell(Int_t i,Int_t j) const {
110 if(i<256) return fMapAW0->GetCellContent(i,j);
ecdd2482 111 else return fMapAW1->GetCellContent(i-256,j);
028a3709 112 }
113 virtual void SetMapA(Int_t wing,AliITSMapSDD* mapA) {
114 if(wing==0) fMapAW0=mapA;
115 else fMapAW1=mapA;
116 }
117 Float_t GetMapTCell(Int_t i,Int_t j) const {
118 if(i<256) return fMapTW0->GetCellContent(i,j);
ecdd2482 119 else return fMapTW1->GetCellContent(i-256,j);
028a3709 120 }
121 virtual void SetMapT(Int_t wing,AliITSMapSDD* mapT) {
122 if(wing==0) fMapTW0=mapT;
123 else fMapTW1=mapT;
124 }
18da6e54 125
126 virtual void SetDriftSpeed(Int_t wing, AliITSDriftSpeedArraySDD* arr){
127 if(wing==0) fDrSpeed0=arr;
128 else fDrSpeed1=arr;
129 }
5bfe44ce 130
fcf95fc7 131 virtual void SetElectronics(Int_t p1=1) {((AliITSresponseSDD*)fResponse)->SetElectronics(p1);}
132 virtual Int_t GetElectronics() const {return ((AliITSresponseSDD*)fResponse)->Electronics();}
133 virtual void SetMaxAdc(Double_t p1) {((AliITSresponseSDD*)fResponse)->SetMaxAdc(p1);}
4bfbde86 134 virtual Float_t GetMaxAdc() const {return ((AliITSresponseSDD*)fResponse)->MaxAdc();}
fcf95fc7 135 virtual void SetChargeLoss(Double_t p1) {((AliITSresponseSDD*)fResponse)->SetChargeLoss(p1);}
4bfbde86 136 virtual Float_t GetChargeLoss() const {return ((AliITSresponseSDD*)fResponse)->ChargeLoss();}
fcf95fc7 137 virtual void SetDynamicRange(Double_t p1) {((AliITSresponseSDD*)fResponse)->SetDynamicRange(p1);}
4bfbde86 138 virtual Float_t GetDynamicRange() const {return ((AliITSresponseSDD*)fResponse)->DynamicRange();}
4952f440 139
a66a0eb6 140 virtual Float_t GetTimeOffset() const {return ((AliITSresponseSDD*)fResponse)->TimeOffset();}
141 virtual Float_t GetADC2keV() const {return ((AliITSresponseSDD*)fResponse)->ADC2keV();}
18da6e54 142 virtual Float_t GetDriftSpeedAtAnode(Float_t nAnode) const{
143 if(fDrSpeed0==0 || fDrSpeed1==0) AliFatal("Drift speed not set\n");
144 if(nAnode<256) return fDrSpeed0->GetDriftSpeed(0,nAnode);
145 else return fDrSpeed1->GetDriftSpeed(0,nAnode-256);
146 }
fcf95fc7 147 virtual void SetParamOptions(const char *opt1,const char *opt2) {((AliITSresponseSDD*)fResponse)->SetParamOptions(opt1,opt2);}
148 virtual void GetParamOptions(char *opt1,char *opt2) const {((AliITSresponseSDD*)fResponse)->ParamOptions(opt1,opt2);}
149 virtual Bool_t Do10to8() const {return ((AliITSresponseSDD*)fResponse)->Do10to8();}
150 virtual void SetZeroSupp (const char *opt) {((AliITSresponseSDD*)fResponse)->SetZeroSupp(opt);}
151 virtual const char *GetZeroSuppOption() const {return ((AliITSresponseSDD*)fResponse)->ZeroSuppOption();}
152 virtual void SetNSigmaIntegration(Double_t p1) {((AliITSresponseSDD*)fResponse)->SetNSigmaIntegration(p1);}
4bfbde86 153 virtual Float_t GetNSigmaIntegration() const {return ((AliITSresponseSDD*)fResponse)->NSigmaIntegration();}
fcf95fc7 154 virtual void SetNLookUp(Int_t p1) {((AliITSresponseSDD*)fResponse)->SetNLookUp(p1);}
155 virtual Int_t GetGausNLookUp() const {return ((AliITSresponseSDD*)fResponse)->GausNLookUp();}
4bfbde86 156 virtual Float_t GetGausLookUp(Int_t i) const {return ((AliITSresponseSDD*)fResponse)->GausLookUp(i);}
fcf95fc7 157 virtual Int_t Convert8to10(Int_t signal) const {return ((AliITSresponseSDD*)fResponse)->Convert8to10(signal);}
158 virtual void SetJitterError(Double_t jitter=20) {((AliITSresponseSDD*)fResponse)->SetJitterError(jitter);}
4bfbde86 159 virtual Float_t GetJitterError() const {return ((AliITSresponseSDD*)fResponse)->JitterError();}
4952f440 160 virtual Float_t GetDriftPath(Float_t time, Float_t xAnode) const {return time*GetDriftSpeedAtAnode(xAnode);}
c9a38d3d 161 void GetCorrections(Float_t z, Float_t x, Float_t &devz, Float_t &devx, AliITSsegmentationSDD* seg);
404c1c29 162 virtual Float_t GetThresholdAnode(Int_t anode,Int_t nsigma=3) const {
9e4d7193 163 return nsigma*fNoiseAfterEl[anode];}
404c1c29 164
fcf95fc7 165 virtual void SetDo10to8(Bool_t bitcomp=kTRUE) {((AliITSresponseSDD*)fResponse)->SetDo10to8(bitcomp);}
166 protected:
5bfe44ce 167
168
fcf95fc7 169 // these statis const should be move to AliITSsegmentationSDD
170 static const Int_t fgkWings = 2; // Number of wings per module
171 static const Int_t fgkChips = 4; // Number of chips/module
172 static const Int_t fgkChannels = 64; // Number of channels/chip
4bfbde86 173 static const Float_t fgkTemperatureDefault; // default for fT (Kelvin)
174 static const Float_t fgkNoiseDefault; // default for fNoise
175 static const Float_t fgkBaselineDefault; // default for fBaseline
176 static const Float_t fgkMinValDefault; // default for fMinVal
177 static const Float_t fgkGainDefault; //default for gain
c9a38d3d 178
fcf95fc7 179 Int_t fDeadChips; // Number of dead chips
180 Int_t fDeadChannels; // Number of dead channels
4bfbde86 181 Float_t fGain[fgkWings][fgkChips][fgkChannels];//Array for channel gains
182 Float_t fNoise[fgkWings*fgkChips*fgkChannels]; // Noise array
183 Float_t fBaseline[fgkWings*fgkChips*fgkChannels]; // Baseline array
184 Float_t fNoiseAfterEl[fgkWings*fgkChips*fgkChannels]; // Noise after electronics
185 Float_t fMinVal; // Min value used in 2D zero-suppression algo
fcf95fc7 186
f45f6658 187 Bool_t fIsDead; // module is dead or alive ?
188 TArrayI fBadChannels; //Array with bad anodes number (0-512)
c2bd28b6 189
c2bd28b6 190
c9a38d3d 191 Bool_t fUseACorrMap; // flag for the use of correction maps (anode)
192 Bool_t fUseTCorrMap; // flag for the use of correction maps (drift)
193
028a3709 194 AliITSMapSDD* fMapAW0; //! map of residuals on anode coord. wing 0
195 AliITSMapSDD* fMapAW1; //! map of residuals on anode coord. wing 1
196 AliITSMapSDD* fMapTW0; //! map of residuals on time coord. wing 0
197 AliITSMapSDD* fMapTW1; //! map of residuals on time coord. wing 1
18da6e54 198 AliITSDriftSpeedArraySDD* fDrSpeed0; //! drift speed for wing 0
199 AliITSDriftSpeedArraySDD* fDrSpeed1; //! drift speed for wing 1
5bfe44ce 200
fcf95fc7 201 private:
202 AliITSCalibrationSDD(const AliITSCalibrationSDD &ob); // copy constructor
203 AliITSCalibrationSDD& operator=(const AliITSCalibrationSDD & /* source */); // ass. op.
204
205
c9a38d3d 206 ClassDef(AliITSCalibrationSDD,9) // SDD response
fcf95fc7 207
208 };
209#endif