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