]>
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 | ||
ee523d3a | 42 | AliITSetfSDD::AliITSetfSDD() { |
43 | // Default constructor | |
44 | fTimeDelay = 0.; | |
45 | fSamplingTime = 0.; | |
46 | fT0 = 0.; | |
47 | fDf = 0.; | |
48 | fA0 = 0.; | |
49 | fZeroM = 0; | |
50 | fZeroR = 0; | |
51 | fPoleM = 0; | |
52 | fPoleR = 0; | |
53 | fPoleI = 0; | |
54 | fTfR = 0; | |
55 | fTfI = 0; | |
56 | fWR = 0; | |
57 | fWI = 0; | |
58 | } | |
59 | ||
11ad066f | 60 | AliITSetfSDD::AliITSetfSDD(Double_t timestep, Int_t amplif) |
b0f5e3fc | 61 | { |
ee523d3a | 62 | // Standard constructor. sampling time in ns |
e8189707 | 63 | |
ee523d3a | 64 | /* |
65 | cout<<"Number of poles: "<<AliITSetfSDDparam::NumberOfPoles()<<endl; | |
66 | cout<<"Number of samples: "<<AliITSetfSDDparam::NumberOfSamples()<<endl; | |
67 | */ | |
11ad066f | 68 | fTimeDelay = 53.5; |
69 | if(amplif == 2) fTimeDelay = 35.5; | |
e8189707 | 70 | fSamplingTime = timestep; |
71 | ||
b0f5e3fc | 72 | fT0 = 0.; |
ee523d3a | 73 | fDf = ppower(10,9)/(AliITSetfSDDparam::NumberOfSamples()*fSamplingTime); |
b0f5e3fc | 74 | |
e8189707 | 75 | Int_t i,j; |
ee523d3a | 76 | fZeroM = new Double_t[AliITSetfSDDparam::NumberOfPoles()]; |
77 | fZeroR = new Double_t [AliITSetfSDDparam::NumberOfPoles()]; | |
78 | fZeroI = new Double_t [AliITSetfSDDparam::NumberOfPoles()]; | |
79 | fPoleM = new Double_t [AliITSetfSDDparam::NumberOfPoles()]; | |
80 | fPoleR = new Double_t [AliITSetfSDDparam::NumberOfPoles()]; | |
81 | fPoleI = new Double_t [AliITSetfSDDparam::NumberOfPoles()]; | |
82 | fTfR = new Double_t [AliITSetfSDDparam::NumberOfSamples()]; | |
83 | fTfI = new Double_t [AliITSetfSDDparam::NumberOfSamples()]; | |
84 | fWR = new Double_t [AliITSetfSDDparam::NumberOfSamples()]; | |
85 | fWI = new Double_t [AliITSetfSDDparam::NumberOfSamples()]; | |
86 | ||
87 | for(i=0; i<AliITSetfSDDparam::NumberOfPoles(); i++) { | |
e8189707 | 88 | fZeroM[i] = 0.; |
89 | fZeroR[i] = 0.; | |
90 | fZeroI[i] = 0.; | |
91 | fPoleM[i] = 0.; | |
92 | fPoleR[i] = 0.; | |
93 | fPoleI[i] = 0.; | |
b0f5e3fc | 94 | } |
11ad066f | 95 | // Alice |
96 | ||
48058160 | 97 | // PASCAL amplif |
98 | fA0 = 5.53269815e+11; | |
99 | fPoleM[0] = 3.; | |
100 | fPoleR[0] = -8280000.; | |
101 | fPoleI[0] = 0.; | |
102 | ||
103 | if(amplif == 2) { // OLA amplif. | |
104 | fA0 = 24000.; | |
105 | fPoleM[0] = 1.; | |
11ad066f | 106 | fPoleR[0] = -3000000.; |
107 | fPoleI[0] = 4000000.; | |
48058160 | 108 | fPoleM[1] = 1.; |
109 | fPoleR[1] = fPoleR[0]; | |
110 | fPoleI[1] = -fPoleI[0]; | |
111 | } | |
112 | ||
113 | if( amplif == 3 ) { // old PASCAL | |
114 | fA0 = 16500.; // AL: 16500.; // TB: 24000.; // 26000.; // 24000.; // 18000.; | |
115 | fPoleM[0] = 1.; | |
116 | fPoleR[0] = -4140000.; // AL: -4140000.; // TB: -3000000.; // -3750000.; // -3500000; // -3000000.; | |
117 | fPoleI[0] = 0.; // AL: 0.; // TB: 4000000.; // 3750000.; // 3500000.; // 3000000.; | |
118 | fPoleM[1] = 1.; | |
119 | fPoleR[1] = fPoleR[0]; | |
120 | fPoleI[1] = -fPoleI[0]; | |
11ad066f | 121 | } |
b0f5e3fc | 122 | |
48058160 | 123 | //cout << "fA0: " << fA0 << endl; |
124 | //cout << "fTimeDelay: " << fTimeDelay << endl; | |
125 | ||
11ad066f | 126 | // Compute Transfer Function |
b0f5e3fc | 127 | |
ee523d3a | 128 | Double_t pigr = acos(-1.); |
129 | for(i=0; i<=AliITSetfSDDparam::NumberOfSamples()/2; i++) { | |
b0f5e3fc | 130 | Double_t frequency = fDf*i; |
ee523d3a | 131 | Double_t vVM = fA0; |
132 | Double_t vVA = 0.; | |
133 | for(Int_t k=0; k<AliITSetfSDDparam::NumberOfPoles(); k++) { | |
e8189707 | 134 | if(fZeroM[k]) { |
ee523d3a | 135 | Double_t vVZR = -fZeroR[k]; |
136 | Double_t vVZI = frequency - fZeroI[k]; | |
137 | Double_t vVZM = TMath::Sqrt(vVZR*vVZR+vVZI*vVZI); | |
138 | Double_t vVZA = TMath::ATan2(vVZI,vVZR); | |
139 | // cout << "VZM: " << vVZM << ", VZA: " << vVZA << endl; | |
140 | // cout << "VZR: " << vVZR << ", VZI: " << vVZI << endl; | |
e8189707 | 141 | for(j=1; j<= (Int_t) fZeroM[k]; j++) { |
ee523d3a | 142 | vVM *= vVZM; |
143 | vVA += vVZA; | |
144 | if(vVA >= pigr) vVA -= (2.*pigr); | |
145 | if(vVA <= -pigr) vVA += (2.*pigr); | |
146 | //cout << "vVM: " << vVM << ", VA: " << vVA << endl; | |
b0f5e3fc | 147 | } |
148 | } | |
149 | ||
e8189707 | 150 | if(fPoleM[k]) { |
ee523d3a | 151 | Double_t vVPR = -fPoleR[k]; |
152 | Double_t vVPI = frequency - fPoleI[k]; | |
153 | Double_t vVPM = TMath::Sqrt(vVPR*vVPR+vVPI*vVPI); | |
154 | Double_t vVPA = TMath::ATan2(vVPI,vVPR); | |
155 | //cout << "VPM: " << vVPM << ", VPA: " << vVPA << endl; | |
156 | //cout << "VPR: " << vVPR << ", VPI: " << vVPI << endl; | |
e8189707 | 157 | for(j=1; j<= (Int_t) fPoleM[k]; j++) { |
ee523d3a | 158 | vVM /= vVPM; |
159 | vVA -= vVPA; | |
160 | if(vVA >= pigr) vVA -= (2.*pigr); | |
161 | if(vVA <= -pigr) vVA += (2.*pigr); | |
162 | //cout << "VM: " << vVM << ", vVA: " << vVA << endl; | |
b0f5e3fc | 163 | } |
164 | } | |
ee523d3a | 165 | Double_t vVR = vVM*cos(vVA); |
166 | Double_t vVI = vVM*sin(vVA); | |
167 | //cout << "VM: " << vVM << ", VA: " << vVA << endl; | |
168 | //cout << "VR: " << vVR << ", VI: " << vVI << endl; | |
169 | fTfR[i] = vVR*ppower(10,9); | |
170 | fTfI[i] = vVI*ppower(10,9); | |
e8189707 | 171 | //cout << "fTfR[" << i << "] = " << fTfR[i] << endl; |
172 | //cout << "fTfI[" << i << "] = " << fTfI[i] << endl; | |
b0f5e3fc | 173 | if(i) { |
ee523d3a | 174 | fTfR[AliITSetfSDDparam::NumberOfSamples()-i] = fTfR[i]; |
175 | fTfI[AliITSetfSDDparam::NumberOfSamples()-i] = -fTfI[i]; | |
b0f5e3fc | 176 | } |
177 | } | |
178 | } | |
179 | ||
180 | // Compute Fourier Weights | |
181 | ||
ee523d3a | 182 | for(i=0; i<=AliITSetfSDDparam::NumberOfSamples()/2; i++) { |
183 | fWR[i] = cos(-2.*pigr*i/AliITSetfSDDparam::NumberOfSamples()); | |
184 | fWI[i] = sin(-2.*pigr*i/AliITSetfSDDparam::NumberOfSamples()); | |
b0f5e3fc | 185 | if(i) { |
ee523d3a | 186 | fWR[AliITSetfSDDparam::NumberOfSamples()-i] = fWR[i]; |
187 | fWI[AliITSetfSDDparam::NumberOfSamples()-i] = -fWI[i]; | |
b0f5e3fc | 188 | } |
189 | } | |
190 | ||
191 | } | |
192 | ||
ee523d3a | 193 | //______________________________________________________________________ |
194 | AliITSetfSDD::AliITSetfSDD(const AliITSetfSDD &obj) : TObject(obj) { | |
195 | // Copy constructor | |
196 | // Copies are not allowed. The method is protected to avoid misuse. | |
197 | Error("AliITSetfSDD","Copy constructor not allowed\n"); | |
198 | } | |
199 | ||
200 | //______________________________________________________________________ | |
201 | AliITSetfSDD& AliITSetfSDD::operator=(const AliITSetfSDD& /* obj */){ | |
202 | // Assignment operator | |
203 | // Assignment is not allowed. The method is protected to avoid misuse. | |
204 | Error("= operator","Assignment operator not allowed\n"); | |
205 | return *this; | |
206 | } | |
207 | ||
208 | AliITSetfSDD::~AliITSetfSDD(){ | |
209 | // Destructor | |
210 | if(fZeroM) delete []fZeroM; | |
211 | if(fZeroR) delete []fZeroR; | |
212 | if(fZeroI) delete []fZeroI; | |
213 | if(fPoleM) delete []fPoleM; | |
214 | if(fPoleR) delete []fPoleR; | |
215 | if(fPoleI) delete []fPoleI; | |
216 | if(fTfR) delete []fTfR; | |
217 | if(fTfI) delete []fTfI; | |
218 | if(fWR) delete []fWR; | |
219 | if(fWI) delete []fWI; | |
220 | } | |
221 | ||
222 | void AliITSetfSDD::PrintElectronics() const { | |
223 | // Printout of the parameters defining the f.e. electronics | |
224 | ||
11ad066f | 225 | cout << "Time Delay " << fTimeDelay << endl; |
b0f5e3fc | 226 | cout << "Sampling Time " << fSamplingTime << endl; |
ee523d3a | 227 | cout << "Number of Time Samples " << AliITSetfSDDparam::NumberOfSamples() << endl; |
b0f5e3fc | 228 | cout << "fT0 " << fT0 << endl; |
229 | cout << "fDf " << fDf << endl; | |
230 | cout << "fA0 " << fA0 << endl; | |
231 | ||
232 | cout << "Zero's and Pole's" << endl; | |
e8189707 | 233 | cout << "fZeroM " << endl; |
234 | Int_t i; | |
ee523d3a | 235 | for(i=0; i<AliITSetfSDDparam::NumberOfPoles(); i++) cout << fZeroM[i] << endl; |
b0f5e3fc | 236 | cout << "fZero_R " << endl; |
ee523d3a | 237 | for(i=0; i<AliITSetfSDDparam::NumberOfPoles(); i++) cout << fZeroR[i] << endl; |
e8189707 | 238 | cout << "fZeroI " << endl; |
ee523d3a | 239 | for(i=0; i<AliITSetfSDDparam::NumberOfPoles(); i++) cout << fZeroI[i] << endl; |
e8189707 | 240 | cout << "fPoleM " << endl; |
ee523d3a | 241 | for(i=0; i<AliITSetfSDDparam::NumberOfPoles(); i++) cout << fPoleM[i] << endl; |
e8189707 | 242 | cout << "fPoleR " << endl; |
ee523d3a | 243 | for(i=0; i<AliITSetfSDDparam::NumberOfPoles(); i++) cout << fPoleR[i] << endl; |
e8189707 | 244 | cout << "fPoleI " << endl; |
ee523d3a | 245 | for(i=0; i<AliITSetfSDDparam::NumberOfPoles(); i++) cout << fPoleI[i] << endl; |
b0f5e3fc | 246 | |
247 | cout << "Transfer function" << endl; | |
248 | cout << "Real Part" << endl; | |
ee523d3a | 249 | for(i=0; i<AliITSetfSDDparam::NumberOfSamples(); i++) cout << fTfR[i] << endl; |
b0f5e3fc | 250 | cout << "Imaginary Part " << endl; |
ee523d3a | 251 | for(i=0; i<AliITSetfSDDparam::NumberOfSamples(); i++) cout << fTfI[i] << endl; |
b0f5e3fc | 252 | |
253 | cout << "Fourier Weights" << endl; | |
254 | cout << "Real Part" << endl; | |
ee523d3a | 255 | for(i=0; i<AliITSetfSDDparam::NumberOfSamples(); i++) cout << fWR[i] << endl; |
b0f5e3fc | 256 | cout << "Imaginary Part " << endl; |
ee523d3a | 257 | for(i=0; i<AliITSetfSDDparam::NumberOfSamples(); i++) cout << fWI[i] << endl; |
b0f5e3fc | 258 | } |
259 | ||
260 | ||
261 | ||
262 | ||
263 | ||
264 | ||
265 | ||
266 |