]>
Commit | Line | Data |
---|---|---|
b0f5e3fc | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
2aea926d | 3 | * * |
b0f5e3fc | 4 | * Author: The ALICE Off-line Project. * |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
1ca7869b | 16 | #include <TString.h> |
2aea926d | 17 | #include <TRandom.h> |
1ca7869b | 18 | |
b0f5e3fc | 19 | #include "AliITSresponseSDD.h" |
b0f5e3fc | 20 | |
b0f5e3fc | 21 | |
22 | //___________________________________________ | |
23 | ClassImp(AliITSresponseSDD) | |
24 | ||
25 | AliITSresponseSDD::AliITSresponseSDD() | |
26 | { | |
27 | // constructor | |
2aea926d | 28 | // fModules = 520; |
29 | // fChips = 4; | |
30 | // fChannels = 64; | |
31 | SetDeadChannels(); | |
b0f5e3fc | 32 | SetMaxAdc(); |
33 | SetDiffCoeff(); | |
b0f5e3fc | 34 | SetDriftSpeed(); |
e8189707 | 35 | SetNSigmaIntegration(); |
7551c5b2 | 36 | SetNLookUp(); |
b0f5e3fc | 37 | // SetClock(); |
38 | SetNoiseParam(); | |
7551c5b2 | 39 | SetNoiseAfterElectronics(); |
40 | SetElectronics(); | |
41 | SetDynamicRange(); | |
42 | SetChargeLoss(); | |
b0f5e3fc | 43 | SetMinVal(); |
44 | SetParamOptions(); | |
45 | SetZeroSupp(); | |
46 | SetDataType(); | |
47 | SetFilenames(); | |
48 | SetOutputOption(); | |
fa1750f9 | 49 | SetDo10to8(); |
f49604ec | 50 | // set the default zero suppression parameters |
51 | fCPar[0]=0; | |
52 | fCPar[1]=0; | |
2aea926d | 53 | fCPar[2]=(Int_t)(fBaseline + 2.*fNoiseAfterEl + 0.2); |
54 | fCPar[3]=(Int_t)(fBaseline + 2.*fNoiseAfterEl + 0.2); | |
f49604ec | 55 | fCPar[4]=0; |
56 | fCPar[5]=0; | |
57 | fCPar[6]=0; | |
58 | fCPar[7]=0; | |
b0f5e3fc | 59 | } |
f49604ec | 60 | |
03898a57 | 61 | AliITSresponseSDD::~AliITSresponseSDD() { |
b0f5e3fc | 62 | |
03898a57 | 63 | if(fGaus) delete fGaus; |
b0f5e3fc | 64 | |
b0f5e3fc | 65 | } |
66 | ||
67 | void AliITSresponseSDD::SetCompressParam(Int_t cp[8]) | |
68 | { | |
69 | // set compression param | |
e8189707 | 70 | |
b0f5e3fc | 71 | Int_t i; |
e8189707 | 72 | for (i=0; i<8; i++) { |
b0f5e3fc | 73 | fCPar[i]=cp[i]; |
74 | //printf("\n CompressPar %d %d \n",i,fCPar[i]); | |
75 | ||
76 | } | |
77 | } | |
78 | void AliITSresponseSDD::GiveCompressParam(Int_t cp[8]) | |
79 | { | |
80 | // give compression param | |
e8189707 | 81 | |
b0f5e3fc | 82 | Int_t i; |
e8189707 | 83 | for (i=0; i<8; i++) { |
b0f5e3fc | 84 | cp[i]=fCPar[i]; |
85 | } | |
86 | } | |
7551c5b2 | 87 | |
2aea926d | 88 | void AliITSresponseSDD::SetDeadChannels(Int_t nmod, Int_t nchip, Int_t nchan) { |
89 | ||
90 | for(Int_t m=0; m<fModules; m++) | |
91 | for(Int_t n=0; n<fChips; n++) | |
92 | for(Int_t p=0; p<fChannels; p++) | |
93 | fGain[m][n][p] = 1.; | |
94 | ||
95 | if(nmod < 0 || nmod > fModules) { cout << "Wrong number of dead modules: " << nmod << endl; return; } | |
96 | Int_t nmax = (fModules-nmod)*fChips; | |
97 | if(nchip < 0 || nchip > nmax) { cout << "Wrong number of dead chips: " << nchip << endl; return; } | |
98 | nmax = ((fModules - nmod)*fChips - nchip)*fChannels; | |
99 | if(nchan < 0 || nchan > nmax) { cout << "Wrong number of dead channels: " << nchan << endl; return; } | |
100 | ||
101 | TRandom *gran = new TRandom(); | |
102 | ||
103 | // cout << "modules" << endl; | |
b2611466 | 104 | Int_t * mod = new Int_t [nmod]; |
f7cd275e | 105 | Int_t i; //loop variable |
106 | for(i=0;i<nmod;i++) { | |
2aea926d | 107 | mod[i] = (Int_t) (1.+fModules*gran->Uniform()); |
108 | cout << i+1 << ": Dead module nr: " << mod[i] << endl; | |
109 | for(Int_t n=0; n<fChips; n++) | |
110 | for(Int_t p=0; p<fChannels; p++) | |
111 | fGain[mod[i]-1][n][p] = 0.; | |
112 | } | |
113 | ||
114 | // cout << "chips" << endl; | |
b2611466 | 115 | Int_t * chip = new Int_t[nchip]; |
116 | Int_t * chip_mod = new Int_t[nchip]; | |
f7cd275e | 117 | i=0; |
2aea926d | 118 | while(i<nchip) { |
119 | Int_t module = (Int_t) (fModules*gran->Uniform() + 1.); | |
120 | if(module <=0 || module > fModules) cout << "Wrong module: " << module << endl; | |
121 | Int_t flag_mod = 0; | |
122 | for(Int_t k=0;k<nmod;k++) if(module == mod[k]) flag_mod = 1; | |
123 | if(flag_mod == 1) continue; | |
124 | Int_t chi = (Int_t) (fChips*gran->Uniform() + 1.); | |
125 | if(chi <=0 || chi > fChips) cout << "Wrong chip: " << chi << endl; | |
126 | i++; | |
127 | chip[i-1] = chi; | |
128 | chip_mod[i-1] = module; | |
129 | for(Int_t m=0; m<fChannels; m++) fGain[module-1][chi-1][m] = 0.; | |
130 | cout << i << ": Dead chip nr. " << chip[i-1] << " in module nr: " << chip_mod[i-1] << endl; | |
131 | } | |
132 | ||
133 | // cout << "channels" << endl; | |
b2611466 | 134 | Int_t * channel = new Int_t[nchan]; |
135 | Int_t * channel_chip = new Int_t[nchan]; | |
136 | Int_t * channel_mod = new Int_t[nchan]; | |
2aea926d | 137 | i=0; |
138 | while(i<nchan) { | |
f7cd275e | 139 | Int_t k; //loop variable |
2aea926d | 140 | Int_t module = (Int_t) (fModules*gran->Uniform() + 1.); |
141 | if(module <=0 || module > fModules) cout << "Wrong module: " << module << endl; | |
142 | Int_t flag_mod = 0; | |
f7cd275e | 143 | for(k=0;k<nmod;k++) if(module == mod[k]) flag_mod = 1; |
2aea926d | 144 | if(flag_mod == 1) continue; |
145 | Int_t chipp = (Int_t) (fChips*gran->Uniform() + 1.); | |
146 | if(chipp <=0 || chipp > fChips) cout << "Wrong chip: " << chipp << endl; | |
147 | Int_t flag_chip = 0; | |
f7cd275e | 148 | for(k=0;k<nchip;k++) if(chipp == chip[k] && module == chip_mod[k]) flag_chip = 1; |
2aea926d | 149 | if(flag_chip == 1) continue; |
150 | i++; | |
151 | channel[i-1] = (Int_t) (fChannels*gran->Uniform() + 1.); | |
152 | if(channel[i-1] <=0 || channel[i-1] > fChannels) cout << "Wrong channel: " << channel[i-1] << endl; | |
153 | channel_chip[i-1] = chipp; | |
154 | channel_mod[i-1] = module; | |
155 | fGain[module-1][chipp-1][channel[i-1]-1] = 0.; | |
156 | cout << i << ": Dead channel nr. " << channel[i-1] << " in chip nr. " << channel_chip[i-1] << " in module nr: " << channel_mod[i-1] << endl; | |
157 | } | |
158 | ||
2aea926d | 159 | delete [] mod; |
160 | delete [] chip; | |
161 | delete [] chip_mod; | |
162 | delete [] channel; | |
163 | delete [] channel_mod; | |
164 | delete [] channel_chip; | |
2aea926d | 165 | } |
166 | ||
167 | void AliITSresponseSDD::PrintGains() | |
168 | { | |
169 | // Print SDD electronic gains | |
170 | for(Int_t t=0; t<fModules;t++) | |
171 | for(Int_t u=0; u<fChips;u++) | |
172 | for(Int_t v=0; v<fChannels;v++) | |
173 | cout << "Gain for Module: " << t+1 << ", Chip " << u+1 << ", Channel " << v+1 << " = " << fGain[t][u][v] << endl; | |
174 | ||
175 | } | |
176 | ||
7551c5b2 | 177 | void AliITSresponseSDD::Print() |
178 | { | |
179 | // Print SDD response Parameters | |
180 | ||
181 | cout << "**************************************************" << endl; | |
182 | cout << " Silicon Drift Detector Response Parameters " << endl; | |
183 | cout << "**************************************************" << endl; | |
184 | cout << "Diffusion Coefficients: " << fDiffCoeff << ", " << fDiffCoeff1 << endl; | |
185 | ||
186 | cout << "Hardware compression parameters: " << endl; | |
187 | for(Int_t i=0; i<8; i++) cout << "fCPar[" << i << "] = " << fCPar[i] << endl; | |
188 | cout << "Noise before electronics (arbitrary units): " << fNoise << endl; | |
189 | cout << "Baseline (ADC units): " << fBaseline << endl; | |
190 | cout << "Noise after electronics (ADC units): " << fNoiseAfterEl << endl; | |
191 | ||
192 | cout << "Dynamic Range: " << fDynamicRange << endl; | |
193 | cout << "Charge Loss: " << fChargeLoss << endl; | |
194 | cout << "Temperature: " << fTemperature << endl; | |
195 | cout << "Drift Speed: " << fDriftSpeed << endl; | |
196 | cout << "Electronics (1=PASCAL, 2=OLA): " << fElectronics << endl; | |
197 | ||
198 | cout << "N. of Sigma for signal integration: " << fNsigmas << endl; | |
199 | cout << "N. of bins in lookup table: " << fNcomps << endl; | |
200 | ||
201 | cout << "Max. ADC Value: " << fMaxAdc << endl; | |
202 | cout << "Min. Value: " << fMinVal << endl; | |
203 | ||
2aea926d | 204 | cout << "**************************************************" << endl; |
205 | cout << " Print Electronics Gains " << endl; | |
7551c5b2 | 206 | cout << "**************************************************" << endl; |
2aea926d | 207 | PrintGains(); |
7551c5b2 | 208 | |
209 | } | |
210 | ||
211 | ||
212 |