]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSresponseSDD.h
New SDD code for much improved SDigit handling. Also bug fix made in the
[u/mrichter/AliRoot.git] / ITS / AliITSresponseSDD.h
1 #ifndef ALIITSRESPONSESDD_H
2 #define ALIITSRESPONSESDD_H
3
4 #include "TArrayF.h"
5 #include <TString.h>
6 #include <iostream.h>
7 #include "AliITSresponse.h"
8
9 // response for SDD
10
11 class AliITSresponseSDD :
12   public AliITSresponse {
13 public:
14   //
15   // Configuration methods
16   //
17   
18   AliITSresponseSDD();
19   AliITSresponseSDD(const char *dataType);
20   
21   virtual ~AliITSresponseSDD();
22
23   void SetElectronics(Int_t p1=1) {
24     // Electronics: Pascal (1) or OLA (2)
25     fElectronics=p1;
26   }
27   
28   Int_t Electronics() {
29     // Electronics: 1 = Pascal; 2 = OLA
30     return fElectronics;
31   }
32   
33   void    SetMaxAdc(Float_t p1=1024.) {
34     // Adc-count saturation value
35     fMaxAdc=p1;
36   }
37   Float_t MaxAdc()  {
38     // Get maximum Adc-count value
39     return fMaxAdc;
40   }                       
41   
42   void    SetChargeLoss(Float_t p1=0.0) {
43     // Set Linear Charge Loss Steepness  // 0.01 for 20%
44     fChargeLoss=p1;
45   }
46   Float_t ChargeLoss()  {
47     // Get Charge Loss Coefficient
48     return fChargeLoss;
49   }                       
50   
51   void    SetDynamicRange(Float_t p1=132.) {
52     // Set Dynamic Range
53     fDynamicRange=p1;
54   }
55   Float_t DynamicRange()  {
56     // Get Dynamic Range
57     return fDynamicRange;
58   }                       
59   
60   void    SetDiffCoeff(Float_t p1=3.23,Float_t p2=30.) {
61     // Diffusion coefficients
62     fDiffCoeff=p1;
63     fDiffCoeff1=p2;
64   }
65   void DiffCoeff(Float_t&diff,Float_t&diff1) {
66     // Get diffusion coefficients
67     diff = fDiffCoeff;
68     diff1 = fDiffCoeff1;
69   } 
70   
71   void    SetDriftSpeed(Float_t p1=7.3) {
72     // Drift velocity
73     fDriftSpeed=p1;
74   }
75   Float_t DriftSpeed() {
76     // drift speed
77     return fDriftSpeed;
78   } 
79   
80   void    SetTemperature(Float_t p1=23.) {
81     // Temperature
82     fTemperature=p1;
83   }
84   Float_t Temperature() {
85     // Get temperature
86     return fTemperature;
87   } 
88   
89   void    SetDataType(const char *data="simulated") {
90     // Type of data - real or simulated
91     fDataType=data;
92   }
93   const char  *DataType() const {
94     // Get data type
95     return fDataType.Data();
96   } 
97   
98   void SetParamOptions(const char *opt1="same",const char *opt2="same"){
99     // Parameters: "same" or read from "file" 
100     fParam1=opt1; fParam2=opt2;
101   }
102   void   ParamOptions(char *opt1,char *opt2) {
103     // options
104     strcpy(opt1,fParam1.Data()); strcpy(opt2,fParam2.Data());
105   }
106   
107   void  SetNoiseParam(Float_t n=0., Float_t b=20.){
108     // Noise and baseline  // 8.3 for ALICE with beam test measurements
109     fNoise=n; fBaseline=b;
110   }   
111   void  SetNoiseAfterElectronics(Float_t n=0.){
112     // Noise after electronics (ADC units) // 1.6 for ALICE from beam test measurements
113     fNoiseAfterEl=n;
114   }   
115   void  GetNoiseParam(Float_t &n, Float_t &b) {
116     // get noise param
117     n=fNoise; b=fBaseline;
118   }  
119   Float_t  GetNoiseAfterElectronics(){
120     // Noise after electronics (ADC units)
121     return fNoiseAfterEl;
122   }   
123
124   void  SetDo10to8(Bool_t bitcomp=kTRUE) {
125     // set the option for 10 to 8 bit compression
126     fBitComp = bitcomp;
127   }
128
129   Bool_t Do10to8() {
130     // get 10 to 8 compression option
131     return fBitComp;
132   }   
133   
134   void    SetZeroSupp (const char *opt="1D") {
135     // Zero-suppression option - could be 1D, 2D or non-ZS 
136     fOption=opt;
137   }
138   const char *ZeroSuppOption() const {
139     // Get zero-suppression option
140     return fOption.Data();
141   }
142   void  SetMinVal(Int_t mv=4) {
143     // Min value used in 2D - could be used as a threshold setting
144     fMinVal = mv;
145   }
146   Int_t  MinVal() {
147     // min val
148     return fMinVal;
149   }
150   
151   void   SetFilenames(const char *f1="",const char *f2="",const char *f3="") {
152     // Set filenames - input, output, parameters ....
153     fFileName1=f1; fFileName2=f2; fFileName3=f3;
154   }
155   void   Filenames(char *input,char *baseline,char *param) {
156     // Filenames
157    strcpy(input,fFileName1.Data());  strcpy(baseline,fFileName2.Data());  
158    strcpy(param,fFileName3.Data());
159   }     
160   
161   
162   void  SetOutputOption(Bool_t write=kFALSE) {
163     // set output option
164     fWrite = write;
165   }
166   Bool_t OutputOption()  {
167     // output option
168     return fWrite;
169   }
170   // 
171   // Compression parameters
172   void  SetCompressParam(Int_t cp[8]); 
173   void  GiveCompressParam(Int_t *x);
174   
175   //  
176   // Detector type response methods
177   void    SetNSigmaIntegration(Float_t p1=3.) {
178     // Set number of sigmas over which cluster disintegration is performed
179     fNsigmas=p1;
180   }
181   Float_t NSigmaIntegration() {
182     // Get number of sigmas over which cluster disintegration is performed
183     return fNsigmas;
184   }
185   void SetNLookUp(Int_t p1=121) {
186     // Set number of sigmas over which cluster disintegration is performed
187     fNcomps=p1;
188     fGaus = new TArrayF(fNcomps+1);
189     for(Int_t i=0; i<=fNcomps; i++) {
190       Float_t x = -fNsigmas + (2.*i*fNsigmas)/(fNcomps-1);
191       (*fGaus)[i] = exp(-((x*x)/2));
192  //     cout << "fGaus[" << i << "]: " << fGaus->At(i) << endl;
193     }
194   }
195     // Get number of intervals in which the gaussian lookup table is divided
196   Int_t GausNLookUp() {return fNcomps;}
197   
198   Float_t IntPH(Float_t eloss) {
199     // Pulse height from scored quantity (eloss)
200     return 0.;
201   }
202   Float_t IntXZ(AliITSsegmentation *) {
203     // Charge disintegration 
204     return 0.;
205   }
206   Float_t GausLookUp(Int_t i) {
207     if(i<0 || i>=fNcomps) return 0.;
208     return fGaus->At(i);
209   }
210   void SetDeadChannels(Int_t nmodules=0, Int_t nchips=0, Int_t nchannels=0);
211
212   Int_t GetDeadModules() { return fDeadModules; }
213   Int_t GetDeadChips() { return fDeadChips; }
214   Int_t GetDeadChannels() { return fDeadChannels; }
215   Float_t Gain( Int_t mod, Int_t chip, Int_t ch) 
216     { return fGain[mod][chip][ch]; }
217
218   // these functions should be move to AliITSsegmentationSDD
219   const Int_t Modules() const { return fModules; }     // Total number of SDD modules
220   const Int_t Chips() const { return fChips; }         // Number of chips/module
221   const Int_t Channels() const { return fChannels; }    // Number of channels/chip
222   //********
223   
224   void    PrintGains();
225   void    Print();
226
227
228 private:
229
230   AliITSresponseSDD(const AliITSresponseSDD &source); // copy constructor
231   AliITSresponseSDD& operator=(const AliITSresponseSDD &source); // ass. op.
232     
233 protected:
234   // these statis const should be move to AliITSsegmentationSDD
235   static const Int_t fModules = 520;     // Total number of SDD modules
236   static const Int_t fChips = 4;        // Number of chips/module
237   static const Int_t fChannels = 64;    // Number of channels/chip
238   //*******
239   
240   Int_t fDeadModules;                                   // Total number of dead SDD modules
241   Int_t fDeadChips;                                     // Number of dead chips
242   Int_t fDeadChannels;                                  // Number of dead channels
243   Float_t   fGain[fModules][fChips][fChannels];   // Array for channel gains
244
245   Int_t     fCPar[8];        // Hardware compression parameters
246   Float_t   fNoise;          // Noise
247   Float_t   fBaseline;       // Baseline
248   Float_t   fNoiseAfterEl;   // Noise after electronics
249   Float_t   fDynamicRange;   // Set Dynamic Range 
250   Float_t   fChargeLoss;     // Set Linear Coefficient for Charge Loss 
251   Float_t   fTemperature;    // Temperature 
252   Float_t   fDriftSpeed;     // Drift velocity
253   Int_t     fElectronics;    // Electronics
254   
255   Float_t    fMaxAdc;        // Adc saturation value
256   Float_t    fDiffCoeff;     // Diffusion Coefficient (scaling the time)
257   Float_t    fDiffCoeff1;    // Diffusion Coefficient (constant term)
258   Float_t    fNsigmas;       // Number of sigmas over which charge disintegration 
259                              // is performed 
260   TArrayF   *fGaus;          // Gaussian lookup table for signal generation
261   Int_t      fNcomps;        // Number of samplings along the gaussian
262   
263   Int_t      fMinVal;        // Min value used in 2D zero-suppression algo
264   
265   Bool_t     fWrite;         // Write option for the compression algorithms
266   Bool_t     fBitComp;       // 10 to 8 bit compression option
267
268   TString    fOption;        // Zero-suppresion option (1D, 2D or none)
269   TString    fParam1;        // Read baselines from file option
270   TString    fParam2;        // Read compression algo thresholds from file 
271   
272   TString         fDataType;         // data type - real or simulated
273   TString         fFileName1;        // input keys : run, module #
274   TString         fFileName2;        // baseline & noise val or output coded                                                 // signal or monitored bgr.
275   TString         fFileName3;        // param values or output coded signal 
276   
277   ClassDef(AliITSresponseSDD,2) // SDD response 
278     
279     };
280 #endif
281
282
283
284
285
286
287