]>
Commit | Line | Data |
---|---|---|
b0f5e3fc | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
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 | **************************************************************************/ | |
4ae5bbc4 | 15 | |
88cb7938 | 16 | /* $Id$ */ |
b9d0a01d | 17 | |
ee523d3a | 18 | |
4ae5bbc4 | 19 | #include <Riostream.h> |
b0f5e3fc | 20 | #include <TMath.h> |
21 | #include "AliITSetfSDD.h" | |
22 | ||
23 | //////////////////////////////////////////////////////////////////////// | |
24 | // Version: 0 | |
25 | // Written by Piergiorgio Cerello | |
26 | // November 23 1999 | |
ee523d3a | 27 | // Revised to comply with coding conventions: Nov, 21 2003 m.m. |
b0f5e3fc | 28 | //_____________________________________________________________________________ |
b669392e | 29 | |
30 | ||
b0f5e3fc | 31 | ClassImp(AliITSetfSDD) |
32 | ||
ee523d3a | 33 | const Int_t AliITSetfSDD::AliITSetfSDDparam::fgkMaxNofPoles = 5; |
34 | const Int_t AliITSetfSDD::AliITSetfSDDparam::fgkMaxNofSamples = 1024; | |
35 | ||
b0f5e3fc | 36 | Int_t ppower(Int_t b, Int_t e) { |
e8189707 | 37 | Int_t power = 1; |
38 | for(Int_t i=0; i<e; i++) power *= b; | |
b0f5e3fc | 39 | return power; |
40 | } | |
41 | ||
7537d03c | 42 | AliITSetfSDD::AliITSetfSDD(): |
43 | fTimeDelay(0), | |
44 | fSamplingTime(0), | |
45 | fT0(0), | |
46 | fDf(0.), | |
47 | fA0(0.) , | |
48 | fZeroM(0), | |
49 | fZeroR(0), | |
50 | fZeroI(0), | |
51 | fPoleM(0), | |
52 | fPoleR(0), | |
53 | fPoleI(0), | |
54 | fTfR(0), | |
55 | fTfI(0), | |
56 | fWR(0), | |
57 | fWI(0){ | |
ee523d3a | 58 | // Default constructor |
ee523d3a | 59 | } |
60 | ||
7537d03c | 61 | AliITSetfSDD::AliITSetfSDD(Double_t timestep, Int_t amplif): |
62 | fTimeDelay(0), | |
63 | fSamplingTime(0), | |
64 | fT0(0), | |
65 | fDf(0.), | |
66 | fA0(0.) , | |
67 | fZeroM(0), | |
68 | fZeroR(0), | |
69 | fZeroI(0), | |
70 | fPoleM(0), | |
71 | fPoleR(0), | |
72 | fPoleI(0), | |
73 | fTfR(0), | |
74 | fTfI(0), | |
75 | fWR(0), | |
76 | fWI(0) | |
b0f5e3fc | 77 | { |
ee523d3a | 78 | // Standard constructor. sampling time in ns |
e8189707 | 79 | |
ee523d3a | 80 | /* |
81 | cout<<"Number of poles: "<<AliITSetfSDDparam::NumberOfPoles()<<endl; | |
82 | cout<<"Number of samples: "<<AliITSetfSDDparam::NumberOfSamples()<<endl; | |
83 | */ | |
11ad066f | 84 | fTimeDelay = 53.5; |
85 | if(amplif == 2) fTimeDelay = 35.5; | |
e8189707 | 86 | fSamplingTime = timestep; |
87 | ||
b0f5e3fc | 88 | fT0 = 0.; |
ee523d3a | 89 | fDf = ppower(10,9)/(AliITSetfSDDparam::NumberOfSamples()*fSamplingTime); |
b0f5e3fc | 90 | |
e8189707 | 91 | Int_t i,j; |
ee523d3a | 92 | fZeroM = new Double_t[AliITSetfSDDparam::NumberOfPoles()]; |
93 | fZeroR = new Double_t [AliITSetfSDDparam::NumberOfPoles()]; | |
94 | fZeroI = new Double_t [AliITSetfSDDparam::NumberOfPoles()]; | |
95 | fPoleM = new Double_t [AliITSetfSDDparam::NumberOfPoles()]; | |
96 | fPoleR = new Double_t [AliITSetfSDDparam::NumberOfPoles()]; | |
97 | fPoleI = new Double_t [AliITSetfSDDparam::NumberOfPoles()]; | |
98 | fTfR = new Double_t [AliITSetfSDDparam::NumberOfSamples()]; | |
99 | fTfI = new Double_t [AliITSetfSDDparam::NumberOfSamples()]; | |
100 | fWR = new Double_t [AliITSetfSDDparam::NumberOfSamples()]; | |
101 | fWI = new Double_t [AliITSetfSDDparam::NumberOfSamples()]; | |
102 | ||
103 | for(i=0; i<AliITSetfSDDparam::NumberOfPoles(); i++) { | |
e8189707 | 104 | fZeroM[i] = 0.; |
105 | fZeroR[i] = 0.; | |
106 | fZeroI[i] = 0.; | |
107 | fPoleM[i] = 0.; | |
108 | fPoleR[i] = 0.; | |
109 | fPoleI[i] = 0.; | |
b0f5e3fc | 110 | } |
11ad066f | 111 | // Alice |
112 | ||
48058160 | 113 | // PASCAL amplif |
114 | fA0 = 5.53269815e+11; | |
115 | fPoleM[0] = 3.; | |
116 | fPoleR[0] = -8280000.; | |
117 | fPoleI[0] = 0.; | |
118 | ||
119 | if(amplif == 2) { // OLA amplif. | |
120 | fA0 = 24000.; | |
121 | fPoleM[0] = 1.; | |
11ad066f | 122 | fPoleR[0] = -3000000.; |
123 | fPoleI[0] = 4000000.; | |
48058160 | 124 | fPoleM[1] = 1.; |
125 | fPoleR[1] = fPoleR[0]; | |
126 | fPoleI[1] = -fPoleI[0]; | |
127 | } | |
128 | ||
129 | if( amplif == 3 ) { // old PASCAL | |
130 | fA0 = 16500.; // AL: 16500.; // TB: 24000.; // 26000.; // 24000.; // 18000.; | |
131 | fPoleM[0] = 1.; | |
132 | fPoleR[0] = -4140000.; // AL: -4140000.; // TB: -3000000.; // -3750000.; // -3500000; // -3000000.; | |
133 | fPoleI[0] = 0.; // AL: 0.; // TB: 4000000.; // 3750000.; // 3500000.; // 3000000.; | |
134 | fPoleM[1] = 1.; | |
135 | fPoleR[1] = fPoleR[0]; | |
136 | fPoleI[1] = -fPoleI[0]; | |
11ad066f | 137 | } |
b0f5e3fc | 138 | |
48058160 | 139 | //cout << "fA0: " << fA0 << endl; |
140 | //cout << "fTimeDelay: " << fTimeDelay << endl; | |
141 | ||
11ad066f | 142 | // Compute Transfer Function |
b0f5e3fc | 143 | |
ee523d3a | 144 | Double_t pigr = acos(-1.); |
145 | for(i=0; i<=AliITSetfSDDparam::NumberOfSamples()/2; i++) { | |
b0f5e3fc | 146 | Double_t frequency = fDf*i; |
ee523d3a | 147 | Double_t vVM = fA0; |
148 | Double_t vVA = 0.; | |
149 | for(Int_t k=0; k<AliITSetfSDDparam::NumberOfPoles(); k++) { | |
e8189707 | 150 | if(fZeroM[k]) { |
ee523d3a | 151 | Double_t vVZR = -fZeroR[k]; |
152 | Double_t vVZI = frequency - fZeroI[k]; | |
153 | Double_t vVZM = TMath::Sqrt(vVZR*vVZR+vVZI*vVZI); | |
154 | Double_t vVZA = TMath::ATan2(vVZI,vVZR); | |
155 | // cout << "VZM: " << vVZM << ", VZA: " << vVZA << endl; | |
156 | // cout << "VZR: " << vVZR << ", VZI: " << vVZI << endl; | |
e8189707 | 157 | for(j=1; j<= (Int_t) fZeroM[k]; j++) { |
ee523d3a | 158 | vVM *= vVZM; |
159 | vVA += vVZA; | |
160 | if(vVA >= pigr) vVA -= (2.*pigr); | |
161 | if(vVA <= -pigr) vVA += (2.*pigr); | |
162 | //cout << "vVM: " << vVM << ", VA: " << vVA << endl; | |
b0f5e3fc | 163 | } |
164 | } | |
165 | ||
e8189707 | 166 | if(fPoleM[k]) { |
ee523d3a | 167 | Double_t vVPR = -fPoleR[k]; |
168 | Double_t vVPI = frequency - fPoleI[k]; | |
169 | Double_t vVPM = TMath::Sqrt(vVPR*vVPR+vVPI*vVPI); | |
170 | Double_t vVPA = TMath::ATan2(vVPI,vVPR); | |
171 | //cout << "VPM: " << vVPM << ", VPA: " << vVPA << endl; | |
172 | //cout << "VPR: " << vVPR << ", VPI: " << vVPI << endl; | |
e8189707 | 173 | for(j=1; j<= (Int_t) fPoleM[k]; j++) { |
ee523d3a | 174 | vVM /= vVPM; |
175 | vVA -= vVPA; | |
176 | if(vVA >= pigr) vVA -= (2.*pigr); | |
177 | if(vVA <= -pigr) vVA += (2.*pigr); | |
178 | //cout << "VM: " << vVM << ", vVA: " << vVA << endl; | |
b0f5e3fc | 179 | } |
180 | } | |
ee523d3a | 181 | Double_t vVR = vVM*cos(vVA); |
182 | Double_t vVI = vVM*sin(vVA); | |
183 | //cout << "VM: " << vVM << ", VA: " << vVA << endl; | |
184 | //cout << "VR: " << vVR << ", VI: " << vVI << endl; | |
185 | fTfR[i] = vVR*ppower(10,9); | |
186 | fTfI[i] = vVI*ppower(10,9); | |
e8189707 | 187 | //cout << "fTfR[" << i << "] = " << fTfR[i] << endl; |
188 | //cout << "fTfI[" << i << "] = " << fTfI[i] << endl; | |
b0f5e3fc | 189 | if(i) { |
ee523d3a | 190 | fTfR[AliITSetfSDDparam::NumberOfSamples()-i] = fTfR[i]; |
191 | fTfI[AliITSetfSDDparam::NumberOfSamples()-i] = -fTfI[i]; | |
b0f5e3fc | 192 | } |
193 | } | |
194 | } | |
195 | ||
196 | // Compute Fourier Weights | |
197 | ||
ee523d3a | 198 | for(i=0; i<=AliITSetfSDDparam::NumberOfSamples()/2; i++) { |
199 | fWR[i] = cos(-2.*pigr*i/AliITSetfSDDparam::NumberOfSamples()); | |
200 | fWI[i] = sin(-2.*pigr*i/AliITSetfSDDparam::NumberOfSamples()); | |
b0f5e3fc | 201 | if(i) { |
ee523d3a | 202 | fWR[AliITSetfSDDparam::NumberOfSamples()-i] = fWR[i]; |
203 | fWI[AliITSetfSDDparam::NumberOfSamples()-i] = -fWI[i]; | |
b0f5e3fc | 204 | } |
205 | } | |
206 | ||
207 | } | |
208 | ||
ee523d3a | 209 | |
210 | AliITSetfSDD::~AliITSetfSDD(){ | |
211 | // Destructor | |
212 | if(fZeroM) delete []fZeroM; | |
213 | if(fZeroR) delete []fZeroR; | |
214 | if(fZeroI) delete []fZeroI; | |
215 | if(fPoleM) delete []fPoleM; | |
216 | if(fPoleR) delete []fPoleR; | |
217 | if(fPoleI) delete []fPoleI; | |
218 | if(fTfR) delete []fTfR; | |
219 | if(fTfI) delete []fTfI; | |
220 | if(fWR) delete []fWR; | |
221 | if(fWI) delete []fWI; | |
222 | } | |
223 | ||
224 | void AliITSetfSDD::PrintElectronics() const { | |
225 | // Printout of the parameters defining the f.e. electronics | |
226 | ||
11ad066f | 227 | cout << "Time Delay " << fTimeDelay << endl; |
b0f5e3fc | 228 | cout << "Sampling Time " << fSamplingTime << endl; |
ee523d3a | 229 | cout << "Number of Time Samples " << AliITSetfSDDparam::NumberOfSamples() << endl; |
b0f5e3fc | 230 | cout << "fT0 " << fT0 << endl; |
231 | cout << "fDf " << fDf << endl; | |
232 | cout << "fA0 " << fA0 << endl; | |
233 | ||
234 | cout << "Zero's and Pole's" << endl; | |
e8189707 | 235 | cout << "fZeroM " << endl; |
236 | Int_t i; | |
ee523d3a | 237 | for(i=0; i<AliITSetfSDDparam::NumberOfPoles(); i++) cout << fZeroM[i] << endl; |
b0f5e3fc | 238 | cout << "fZero_R " << endl; |
ee523d3a | 239 | for(i=0; i<AliITSetfSDDparam::NumberOfPoles(); i++) cout << fZeroR[i] << endl; |
e8189707 | 240 | cout << "fZeroI " << endl; |
ee523d3a | 241 | for(i=0; i<AliITSetfSDDparam::NumberOfPoles(); i++) cout << fZeroI[i] << endl; |
e8189707 | 242 | cout << "fPoleM " << endl; |
ee523d3a | 243 | for(i=0; i<AliITSetfSDDparam::NumberOfPoles(); i++) cout << fPoleM[i] << endl; |
e8189707 | 244 | cout << "fPoleR " << endl; |
ee523d3a | 245 | for(i=0; i<AliITSetfSDDparam::NumberOfPoles(); i++) cout << fPoleR[i] << endl; |
e8189707 | 246 | cout << "fPoleI " << endl; |
ee523d3a | 247 | for(i=0; i<AliITSetfSDDparam::NumberOfPoles(); i++) cout << fPoleI[i] << endl; |
b0f5e3fc | 248 | |
249 | cout << "Transfer function" << endl; | |
250 | cout << "Real Part" << endl; | |
ee523d3a | 251 | for(i=0; i<AliITSetfSDDparam::NumberOfSamples(); i++) cout << fTfR[i] << endl; |
b0f5e3fc | 252 | cout << "Imaginary Part " << endl; |
ee523d3a | 253 | for(i=0; i<AliITSetfSDDparam::NumberOfSamples(); i++) cout << fTfI[i] << endl; |
b0f5e3fc | 254 | |
255 | cout << "Fourier Weights" << endl; | |
256 | cout << "Real Part" << endl; | |
ee523d3a | 257 | for(i=0; i<AliITSetfSDDparam::NumberOfSamples(); i++) cout << fWR[i] << endl; |
b0f5e3fc | 258 | cout << "Imaginary Part " << endl; |
ee523d3a | 259 | for(i=0; i<AliITSetfSDDparam::NumberOfSamples(); i++) cout << fWI[i] << endl; |
b0f5e3fc | 260 | } |
261 | ||
262 | ||
263 | ||
264 | ||
265 | ||
266 | ||
267 | ||
268 |