Reconstruction with measused calibration
[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"
f45f6658 11#include "TArrayI.h"
fcf95fc7 12
028a3709 13class AliITSMapSDD;
18da6e54 14class AliITSDriftSpeedArraySDD;
fcf95fc7 15class AliITSresponseSDD;
16///////////////////////////////////////////////////////
17// Response for SDD //
18///////////////////////////////////////////////////////
19
20class AliITSCalibrationSDD : public AliITSCalibration {
21 public:
22 //
23 // Configuration methods
24 //
25 AliITSCalibrationSDD();
26 AliITSCalibrationSDD(const char *dataType);
028a3709 27 virtual ~AliITSCalibrationSDD();
f45f6658 28 virtual void SetNoiseParam(Double_t /*n*/, Double_t /*b*/){
29 NotImplemented("SetNoiseParam");}
fcf95fc7 30
f45f6658 31 virtual void GetNoiseParam(Double_t &/*n*/, Double_t &/*b*/) const {
32 NotImplemented("GetNoiseParam");}
33
4bfbde86 34 virtual Float_t GetBaseline(Int_t anode) const {return fBaseline[anode];}
f45f6658 35 virtual void SetBaseline(Int_t anode,Double_t bas) {fBaseline[anode]=bas;}
4bfbde86 36 virtual Float_t GetNoise(Int_t anode) const {return fNoise[anode];}
f45f6658 37 virtual void SetNoise(Int_t anode, Double_t noise) {fNoise[anode]=noise;}
fcf95fc7 38
39 virtual void SetThresholds(Double_t mv, Double_t /* b */){
40 // Min value used in 2D - could be used as a threshold setting
41 fMinVal = mv;}
42 virtual void Thresholds(Double_t & mv, Double_t & /* b */) const
43 {mv = fMinVal;}
f45f6658 44 virtual void GiveCompressParam(Int_t *x,Int_t ian) const;
fcf95fc7 45
f45f6658 46 void SetNoiseAfterElectronics(Int_t anode,Double_t n=2.38){
fcf95fc7 47 // Noise after electronics (ADC units)
48 // 2.36 for ALICE from beam test measurements 2001
f45f6658 49 fNoiseAfterEl[anode]=n;}
4bfbde86 50 Float_t GetNoiseAfterElectronics(Int_t anode) const {
fcf95fc7 51 // Noise after electronics (ADC units)
f45f6658 52 return fNoiseAfterEl[anode];}
53 //void SetDeadChannels(Int_t nchips=0, Int_t nchannels=0);
54 void SetDeadChannels(Int_t ndead=0){fDeadChannels=ndead; fBadChannels.Set(ndead);}
fcf95fc7 55 Int_t GetDeadChips() const { return fDeadChips; }
56 Int_t GetDeadChannels() const { return fDeadChannels; }
4bfbde86 57 Float_t Gain(Int_t wing,Int_t chip,Int_t ch)const
fcf95fc7 58 {return fGain[wing][chip][ch]; }
4952f440 59 Float_t GetChannelGain(Int_t anode) const;
f45f6658 60 virtual void SetGain(Double_t g,Int_t wing,Int_t chip, Int_t ch)
61 {fGain[wing][chip][ch]=g;}
62
4952f440 63 Int_t GetWing(Int_t anode) const{
64 if(anode>=fgkChips*fgkChannels) return 1;
65 else return 0;
66 }
67 Int_t GetChipChannel(Int_t anode) const {return anode%fgkChannels;}
68 Int_t GetChip(Int_t anode) const {
69 Int_t chip=anode/fgkChannels;
70 if(GetWing(anode)==1)chip-=fgkChips;
71 return chip;
72 }
73
fcf95fc7 74 void PrintGains() const;
75 void Print();
76 virtual void Print(ostream *os) const {AliITSCalibrationSDD::Print(os);}
77 virtual void Print(Option_t *option="") const {AliITSCalibrationSDD::Print(option);}
78 // not implemented virtual methods (devlared in the mother class
79 virtual void SetDetParam(Double_t *)
80 {NotImplemented("SetDetParam");}
81 virtual void GetDetParam(Double_t *) const
82 {NotImplemented("GetDetParam");}
83 virtual void SetNDetParam(Int_t /* n */)
84 {NotImplemented("SetNDetParam");}
85 virtual Int_t NDetParam() const
86 {NotImplemented("NDetParam"); return 0;}
87 virtual void SetSigmaSpread(Double_t, Double_t)
88 {NotImplemented("SetSigmaSpread");}
89 virtual void SigmaSpread(Double_t & /* p1 */,Double_t & /* p2 */) const
90 {NotImplemented("SigmaSpread");}
91
92 void SetDead() { fIsDead = kTRUE; };
93 Bool_t IsDead() const { return fIsDead; };
94 Int_t Wings()const{return fgkWings;}//Total number of SDD wings
95 Int_t Chips() const{return fgkChips;} // Number of chips/module
96 Int_t Channels() const{ return fgkChannels;}//Number of channels/chip
f45f6658 97
98 virtual void SetBadChannel(Int_t i,Int_t anode);
99 Int_t GetBadChannel(Int_t i) const {return fBadChannels[i];}
4952f440 100 Bool_t IsBadChannel(Int_t anode){
101 if(GetChannelGain(anode)==0) return kTRUE;
102 else return kFALSE;
103 }
028a3709 104 Float_t GetMapACell(Int_t i,Int_t j) const {
105 if(i<256) return fMapAW0->GetCellContent(i,j);
ecdd2482 106 else return fMapAW1->GetCellContent(i-256,j);
028a3709 107 }
108 virtual void SetMapA(Int_t wing,AliITSMapSDD* mapA) {
109 if(wing==0) fMapAW0=mapA;
110 else fMapAW1=mapA;
111 }
112 Float_t GetMapTCell(Int_t i,Int_t j) const {
113 if(i<256) return fMapTW0->GetCellContent(i,j);
ecdd2482 114 else return fMapTW1->GetCellContent(i-256,j);
028a3709 115 }
116 virtual void SetMapT(Int_t wing,AliITSMapSDD* mapT) {
117 if(wing==0) fMapTW0=mapT;
118 else fMapTW1=mapT;
119 }
03ecfe88 120 static Int_t GetMapTimeNBin() {return fgkMapTimeNBin;}
18da6e54 121
122 virtual void SetDriftSpeed(Int_t wing, AliITSDriftSpeedArraySDD* arr){
123 if(wing==0) fDrSpeed0=arr;
124 else fDrSpeed1=arr;
125 }
5bfe44ce 126
fcf95fc7 127 virtual void SetElectronics(Int_t p1=1) {((AliITSresponseSDD*)fResponse)->SetElectronics(p1);}
128 virtual Int_t GetElectronics() const {return ((AliITSresponseSDD*)fResponse)->Electronics();}
129 virtual void SetMaxAdc(Double_t p1) {((AliITSresponseSDD*)fResponse)->SetMaxAdc(p1);}
4bfbde86 130 virtual Float_t GetMaxAdc() const {return ((AliITSresponseSDD*)fResponse)->MaxAdc();}
fcf95fc7 131 virtual void SetChargeLoss(Double_t p1) {((AliITSresponseSDD*)fResponse)->SetChargeLoss(p1);}
4bfbde86 132 virtual Float_t GetChargeLoss() const {return ((AliITSresponseSDD*)fResponse)->ChargeLoss();}
fcf95fc7 133 virtual void SetDynamicRange(Double_t p1) {((AliITSresponseSDD*)fResponse)->SetDynamicRange(p1);}
4bfbde86 134 virtual Float_t GetDynamicRange() const {return ((AliITSresponseSDD*)fResponse)->DynamicRange();}
4952f440 135
a66a0eb6 136 virtual Float_t GetTimeOffset() const {return ((AliITSresponseSDD*)fResponse)->TimeOffset();}
137 virtual Float_t GetADC2keV() const {return ((AliITSresponseSDD*)fResponse)->ADC2keV();}
18da6e54 138 virtual Float_t GetDriftSpeedAtAnode(Float_t nAnode) const{
139 if(fDrSpeed0==0 || fDrSpeed1==0) AliFatal("Drift speed not set\n");
140 if(nAnode<256) return fDrSpeed0->GetDriftSpeed(0,nAnode);
141 else return fDrSpeed1->GetDriftSpeed(0,nAnode-256);
142 }
fcf95fc7 143 virtual void SetParamOptions(const char *opt1,const char *opt2) {((AliITSresponseSDD*)fResponse)->SetParamOptions(opt1,opt2);}
144 virtual void GetParamOptions(char *opt1,char *opt2) const {((AliITSresponseSDD*)fResponse)->ParamOptions(opt1,opt2);}
145 virtual Bool_t Do10to8() const {return ((AliITSresponseSDD*)fResponse)->Do10to8();}
146 virtual void SetZeroSupp (const char *opt) {((AliITSresponseSDD*)fResponse)->SetZeroSupp(opt);}
147 virtual const char *GetZeroSuppOption() const {return ((AliITSresponseSDD*)fResponse)->ZeroSuppOption();}
148 virtual void SetNSigmaIntegration(Double_t p1) {((AliITSresponseSDD*)fResponse)->SetNSigmaIntegration(p1);}
4bfbde86 149 virtual Float_t GetNSigmaIntegration() const {return ((AliITSresponseSDD*)fResponse)->NSigmaIntegration();}
fcf95fc7 150 virtual void SetNLookUp(Int_t p1) {((AliITSresponseSDD*)fResponse)->SetNLookUp(p1);}
151 virtual Int_t GetGausNLookUp() const {return ((AliITSresponseSDD*)fResponse)->GausNLookUp();}
4bfbde86 152 virtual Float_t GetGausLookUp(Int_t i) const {return ((AliITSresponseSDD*)fResponse)->GausLookUp(i);}
fcf95fc7 153 virtual Int_t Convert8to10(Int_t signal) const {return ((AliITSresponseSDD*)fResponse)->Convert8to10(signal);}
154 virtual void SetJitterError(Double_t jitter=20) {((AliITSresponseSDD*)fResponse)->SetJitterError(jitter);}
4bfbde86 155 virtual Float_t GetJitterError() const {return ((AliITSresponseSDD*)fResponse)->JitterError();}
4952f440 156 virtual Float_t GetDriftPath(Float_t time, Float_t xAnode) const {return time*GetDriftSpeedAtAnode(xAnode);}
404c1c29 157 virtual Float_t GetThresholdAnode(Int_t anode,Int_t nsigma=3) const {
9e4d7193 158 return nsigma*fNoiseAfterEl[anode];}
404c1c29 159
fcf95fc7 160 virtual void SetDo10to8(Bool_t bitcomp=kTRUE) {((AliITSresponseSDD*)fResponse)->SetDo10to8(bitcomp);}
161 protected:
5bfe44ce 162
163
fcf95fc7 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
4bfbde86 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 fgkMinValDefault; // default for fMinVal
172 static const Float_t fgkGainDefault; //default for gain
5bfe44ce 173 static const Int_t fgkMapTimeNBin = 72; //map granularity along drift direction
fcf95fc7 174 Int_t fDeadChips; // Number of dead chips
175 Int_t fDeadChannels; // Number of dead channels
4bfbde86 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 Float_t fMinVal; // Min value used in 2D zero-suppression algo
fcf95fc7 181
f45f6658 182 Bool_t fIsDead; // module is dead or alive ?
183 TArrayI fBadChannels; //Array with bad anodes number (0-512)
c2bd28b6 184
c2bd28b6 185
028a3709 186 AliITSMapSDD* fMapAW0; //! map of residuals on anode coord. wing 0
187 AliITSMapSDD* fMapAW1; //! map of residuals on anode coord. wing 1
188 AliITSMapSDD* fMapTW0; //! map of residuals on time coord. wing 0
189 AliITSMapSDD* fMapTW1; //! map of residuals on time coord. wing 1
18da6e54 190 AliITSDriftSpeedArraySDD* fDrSpeed0; //! drift speed for wing 0
191 AliITSDriftSpeedArraySDD* fDrSpeed1; //! drift speed for wing 1
5bfe44ce 192
fcf95fc7 193 private:
194 AliITSCalibrationSDD(const AliITSCalibrationSDD &ob); // copy constructor
195 AliITSCalibrationSDD& operator=(const AliITSCalibrationSDD & /* source */); // ass. op.
196
197
18da6e54 198 ClassDef(AliITSCalibrationSDD,8) // SDD response
fcf95fc7 199
200 };
201#endif