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