]>
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 | #include <Riostream.h> | |
19 | #include <TMath.h> | |
20 | #include <TString.h> | |
21 | #include "AliITSetfSDD.h" | |
22 | ||
23 | //////////////////////////////////////////////////////////////////////// | |
24 | // Version: 0 | |
25 | // Written by Piergiorgio Cerello | |
26 | // November 23 1999 | |
27 | // | |
28 | //_____________________________________________________________________________ | |
29 | ||
30 | ||
31 | ClassImp(AliITSetfSDD) | |
32 | ||
33 | Int_t ppower(Int_t b, Int_t e) { | |
34 | Int_t power = 1; | |
35 | for(Int_t i=0; i<e; i++) power *= b; | |
36 | return power; | |
37 | } | |
38 | ||
39 | AliITSetfSDD::AliITSetfSDD(Double_t timestep, Int_t amplif) | |
40 | { | |
41 | // sampling time in ns | |
42 | ||
43 | fTimeDelay = 53.5; | |
44 | if(amplif == 2) fTimeDelay = 35.5; | |
45 | fSamplingTime = timestep; | |
46 | ||
47 | fT0 = 0.; | |
48 | fDf = ppower(10,9)/(kMaxNofSamples*fSamplingTime); | |
49 | ||
50 | Int_t i,j; | |
51 | for(i=0; i<kMaxNofPoles; i++) { | |
52 | fZeroM[i] = 0.; | |
53 | fZeroR[i] = 0.; | |
54 | fZeroI[i] = 0.; | |
55 | fPoleM[i] = 0.; | |
56 | fPoleR[i] = 0.; | |
57 | fPoleI[i] = 0.; | |
58 | } | |
59 | // Alice | |
60 | ||
61 | // PASCAL amplif | |
62 | fA0 = 5.53269815e+11; | |
63 | fPoleM[0] = 3.; | |
64 | fPoleR[0] = -8280000.; | |
65 | fPoleI[0] = 0.; | |
66 | ||
67 | if(amplif == 2) { // OLA amplif. | |
68 | fA0 = 24000.; | |
69 | fPoleM[0] = 1.; | |
70 | fPoleR[0] = -3000000.; | |
71 | fPoleI[0] = 4000000.; | |
72 | fPoleM[1] = 1.; | |
73 | fPoleR[1] = fPoleR[0]; | |
74 | fPoleI[1] = -fPoleI[0]; | |
75 | } | |
76 | ||
77 | if( amplif == 3 ) { // old PASCAL | |
78 | fA0 = 16500.; // AL: 16500.; // TB: 24000.; // 26000.; // 24000.; // 18000.; | |
79 | fPoleM[0] = 1.; | |
80 | fPoleR[0] = -4140000.; // AL: -4140000.; // TB: -3000000.; // -3750000.; // -3500000; // -3000000.; | |
81 | fPoleI[0] = 0.; // AL: 0.; // TB: 4000000.; // 3750000.; // 3500000.; // 3000000.; | |
82 | fPoleM[1] = 1.; | |
83 | fPoleR[1] = fPoleR[0]; | |
84 | fPoleI[1] = -fPoleI[0]; | |
85 | } | |
86 | ||
87 | //cout << "fA0: " << fA0 << endl; | |
88 | //cout << "fTimeDelay: " << fTimeDelay << endl; | |
89 | ||
90 | // Compute Transfer Function | |
91 | ||
92 | Double_t PI = acos(-1.); | |
93 | for(i=0; i<=kMaxNofSamples/2; i++) { | |
94 | Double_t frequency = fDf*i; | |
95 | Double_t VM = fA0; | |
96 | Double_t VA = 0.; | |
97 | for(Int_t k=0; k<kMaxNofPoles; k++) { | |
98 | if(fZeroM[k]) { | |
99 | Double_t VZR = -fZeroR[k]; | |
100 | Double_t VZI = frequency - fZeroI[k]; | |
101 | Double_t VZM = TMath::Sqrt(VZR*VZR+VZI*VZI); | |
102 | Double_t VZA = TMath::ATan2(VZI,VZR); | |
103 | // cout << "VZM: " << VZM << ", VZA: " << VZA << endl; | |
104 | // cout << "VZR: " << VZR << ", VZI: " << VZI << endl; | |
105 | for(j=1; j<= (Int_t) fZeroM[k]; j++) { | |
106 | VM *= VZM; | |
107 | VA += VZA; | |
108 | if(VA >= PI) VA -= (2.*PI); | |
109 | if(VA <= -PI) VA += (2.*PI); | |
110 | //cout << "VM: " << VM << ", VA: " << VA << endl; | |
111 | } | |
112 | } | |
113 | ||
114 | if(fPoleM[k]) { | |
115 | Double_t VPR = -fPoleR[k]; | |
116 | Double_t VPI = frequency - fPoleI[k]; | |
117 | Double_t VPM = TMath::Sqrt(VPR*VPR+VPI*VPI); | |
118 | Double_t VPA = TMath::ATan2(VPI,VPR); | |
119 | //cout << "VPM: " << VPM << ", VPA: " << VPA << endl; | |
120 | //cout << "VPR: " << VPR << ", VPI: " << VPI << endl; | |
121 | for(j=1; j<= (Int_t) fPoleM[k]; j++) { | |
122 | VM /= VPM; | |
123 | VA -= VPA; | |
124 | if(VA >= PI) VA -= (2.*PI); | |
125 | if(VA <= -PI) VA += (2.*PI); | |
126 | //cout << "VM: " << VM << ", VA: " << VA << endl; | |
127 | } | |
128 | } | |
129 | Double_t VR = VM*cos(VA); | |
130 | Double_t VI = VM*sin(VA); | |
131 | //cout << "VM: " << VM << ", VA: " << VA << endl; | |
132 | //cout << "VR: " << VR << ", VI: " << VI << endl; | |
133 | fTfR[i] = VR*ppower(10,9); | |
134 | fTfI[i] = VI*ppower(10,9); | |
135 | //cout << "fTfR[" << i << "] = " << fTfR[i] << endl; | |
136 | //cout << "fTfI[" << i << "] = " << fTfI[i] << endl; | |
137 | if(i) { | |
138 | fTfR[kMaxNofSamples-i] = fTfR[i]; | |
139 | fTfI[kMaxNofSamples-i] = -fTfI[i]; | |
140 | } | |
141 | } | |
142 | } | |
143 | ||
144 | // Compute Fourier Weights | |
145 | ||
146 | for(i=0; i<=kMaxNofSamples/2; i++) { | |
147 | fWR[i] = cos(-2.*PI*i/kMaxNofSamples); | |
148 | fWI[i] = sin(-2.*PI*i/kMaxNofSamples); | |
149 | if(i) { | |
150 | fWR[kMaxNofSamples-i] = fWR[i]; | |
151 | fWI[kMaxNofSamples-i] = -fWI[i]; | |
152 | } | |
153 | } | |
154 | ||
155 | } | |
156 | ||
157 | void AliITSetfSDD::PrintElectronics() | |
158 | { | |
159 | cout << "Time Delay " << fTimeDelay << endl; | |
160 | cout << "Sampling Time " << fSamplingTime << endl; | |
161 | cout << "Number of Time Samples " << kMaxNofSamples << endl; | |
162 | cout << "fT0 " << fT0 << endl; | |
163 | cout << "fDf " << fDf << endl; | |
164 | cout << "fA0 " << fA0 << endl; | |
165 | ||
166 | cout << "Zero's and Pole's" << endl; | |
167 | cout << "fZeroM " << endl; | |
168 | Int_t i; | |
169 | for(i=0; i<kMaxNofPoles; i++) cout << fZeroM[i] << endl; | |
170 | cout << "fZero_R " << endl; | |
171 | for(i=0; i<kMaxNofPoles; i++) cout << fZeroR[i] << endl; | |
172 | cout << "fZeroI " << endl; | |
173 | for(i=0; i<kMaxNofPoles; i++) cout << fZeroI[i] << endl; | |
174 | cout << "fPoleM " << endl; | |
175 | for(i=0; i<kMaxNofPoles; i++) cout << fPoleM[i] << endl; | |
176 | cout << "fPoleR " << endl; | |
177 | for(i=0; i<kMaxNofPoles; i++) cout << fPoleR[i] << endl; | |
178 | cout << "fPoleI " << endl; | |
179 | for(i=0; i<kMaxNofPoles; i++) cout << fPoleI[i] << endl; | |
180 | ||
181 | cout << "Transfer function" << endl; | |
182 | cout << "Real Part" << endl; | |
183 | for(i=0; i<kMaxNofSamples; i++) cout << fTfR[i] << endl; | |
184 | cout << "Imaginary Part " << endl; | |
185 | for(i=0; i<kMaxNofSamples; i++) cout << fTfI[i] << endl; | |
186 | ||
187 | cout << "Fourier Weights" << endl; | |
188 | cout << "Real Part" << endl; | |
189 | for(i=0; i<kMaxNofSamples; i++) cout << fWR[i] << endl; | |
190 | cout << "Imaginary Part " << endl; | |
191 | for(i=0; i<kMaxNofSamples; i++) cout << fWI[i] << endl; | |
192 | } | |
193 | ||
194 | ||
195 | ||
196 | ||
197 | ||
198 | ||
199 | ||
200 |