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