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