]>
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 | |
4ae5bbc4 | 18 | #include <Riostream.h> |
b0f5e3fc | 19 | #include <TMath.h> |
11ad066f | 20 | #include <TString.h> |
b0f5e3fc | 21 | #include "AliITSetfSDD.h" |
22 | ||
23 | //////////////////////////////////////////////////////////////////////// | |
24 | // Version: 0 | |
25 | // Written by Piergiorgio Cerello | |
26 | // November 23 1999 | |
27 | // | |
b0f5e3fc | 28 | //_____________________________________________________________________________ |
b669392e | 29 | |
30 | ||
b0f5e3fc | 31 | ClassImp(AliITSetfSDD) |
32 | ||
33 | Int_t ppower(Int_t b, Int_t e) { | |
e8189707 | 34 | Int_t power = 1; |
35 | for(Int_t i=0; i<e; i++) power *= b; | |
b0f5e3fc | 36 | return power; |
37 | } | |
38 | ||
11ad066f | 39 | AliITSetfSDD::AliITSetfSDD(Double_t timestep, Int_t amplif) |
b0f5e3fc | 40 | { |
41 | // sampling time in ns | |
e8189707 | 42 | |
11ad066f | 43 | fTimeDelay = 53.5; |
44 | if(amplif == 2) fTimeDelay = 35.5; | |
e8189707 | 45 | fSamplingTime = timestep; |
46 | ||
b0f5e3fc | 47 | fT0 = 0.; |
b669392e | 48 | fDf = ppower(10,9)/(kMaxNofSamples*fSamplingTime); |
b0f5e3fc | 49 | |
e8189707 | 50 | Int_t i,j; |
b669392e | 51 | for(i=0; i<kMaxNofPoles; i++) { |
e8189707 | 52 | fZeroM[i] = 0.; |
53 | fZeroR[i] = 0.; | |
54 | fZeroI[i] = 0.; | |
55 | fPoleM[i] = 0.; | |
56 | fPoleR[i] = 0.; | |
57 | fPoleI[i] = 0.; | |
b0f5e3fc | 58 | } |
11ad066f | 59 | // Alice |
60 | ||
48058160 | 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.; | |
11ad066f | 70 | fPoleR[0] = -3000000.; |
71 | fPoleI[0] = 4000000.; | |
48058160 | 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]; | |
11ad066f | 85 | } |
b0f5e3fc | 86 | |
48058160 | 87 | //cout << "fA0: " << fA0 << endl; |
88 | //cout << "fTimeDelay: " << fTimeDelay << endl; | |
89 | ||
11ad066f | 90 | // Compute Transfer Function |
b0f5e3fc | 91 | |
92 | Double_t PI = acos(-1.); | |
b669392e | 93 | for(i=0; i<=kMaxNofSamples/2; i++) { |
b0f5e3fc | 94 | Double_t frequency = fDf*i; |
95 | Double_t VM = fA0; | |
96 | Double_t VA = 0.; | |
b669392e | 97 | for(Int_t k=0; k<kMaxNofPoles; k++) { |
e8189707 | 98 | if(fZeroM[k]) { |
99 | Double_t VZR = -fZeroR[k]; | |
100 | Double_t VZI = frequency - fZeroI[k]; | |
b0f5e3fc | 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; | |
e8189707 | 105 | for(j=1; j<= (Int_t) fZeroM[k]; j++) { |
b0f5e3fc | 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 | ||
e8189707 | 114 | if(fPoleM[k]) { |
115 | Double_t VPR = -fPoleR[k]; | |
116 | Double_t VPI = frequency - fPoleI[k]; | |
b0f5e3fc | 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; | |
e8189707 | 121 | for(j=1; j<= (Int_t) fPoleM[k]; j++) { |
b0f5e3fc | 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; | |
e8189707 | 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; | |
b0f5e3fc | 137 | if(i) { |
b669392e | 138 | fTfR[kMaxNofSamples-i] = fTfR[i]; |
139 | fTfI[kMaxNofSamples-i] = -fTfI[i]; | |
b0f5e3fc | 140 | } |
141 | } | |
142 | } | |
143 | ||
144 | // Compute Fourier Weights | |
145 | ||
b669392e | 146 | for(i=0; i<=kMaxNofSamples/2; i++) { |
147 | fWR[i] = cos(-2.*PI*i/kMaxNofSamples); | |
148 | fWI[i] = sin(-2.*PI*i/kMaxNofSamples); | |
b0f5e3fc | 149 | if(i) { |
b669392e | 150 | fWR[kMaxNofSamples-i] = fWR[i]; |
151 | fWI[kMaxNofSamples-i] = -fWI[i]; | |
b0f5e3fc | 152 | } |
153 | } | |
154 | ||
155 | } | |
156 | ||
e8189707 | 157 | void AliITSetfSDD::PrintElectronics() |
b0f5e3fc | 158 | { |
11ad066f | 159 | cout << "Time Delay " << fTimeDelay << endl; |
b0f5e3fc | 160 | cout << "Sampling Time " << fSamplingTime << endl; |
b669392e | 161 | cout << "Number of Time Samples " << kMaxNofSamples << endl; |
b0f5e3fc | 162 | cout << "fT0 " << fT0 << endl; |
163 | cout << "fDf " << fDf << endl; | |
164 | cout << "fA0 " << fA0 << endl; | |
165 | ||
166 | cout << "Zero's and Pole's" << endl; | |
e8189707 | 167 | cout << "fZeroM " << endl; |
168 | Int_t i; | |
b669392e | 169 | for(i=0; i<kMaxNofPoles; i++) cout << fZeroM[i] << endl; |
b0f5e3fc | 170 | cout << "fZero_R " << endl; |
b669392e | 171 | for(i=0; i<kMaxNofPoles; i++) cout << fZeroR[i] << endl; |
e8189707 | 172 | cout << "fZeroI " << endl; |
b669392e | 173 | for(i=0; i<kMaxNofPoles; i++) cout << fZeroI[i] << endl; |
e8189707 | 174 | cout << "fPoleM " << endl; |
b669392e | 175 | for(i=0; i<kMaxNofPoles; i++) cout << fPoleM[i] << endl; |
e8189707 | 176 | cout << "fPoleR " << endl; |
b669392e | 177 | for(i=0; i<kMaxNofPoles; i++) cout << fPoleR[i] << endl; |
e8189707 | 178 | cout << "fPoleI " << endl; |
b669392e | 179 | for(i=0; i<kMaxNofPoles; i++) cout << fPoleI[i] << endl; |
b0f5e3fc | 180 | |
181 | cout << "Transfer function" << endl; | |
182 | cout << "Real Part" << endl; | |
b669392e | 183 | for(i=0; i<kMaxNofSamples; i++) cout << fTfR[i] << endl; |
b0f5e3fc | 184 | cout << "Imaginary Part " << endl; |
b669392e | 185 | for(i=0; i<kMaxNofSamples; i++) cout << fTfI[i] << endl; |
b0f5e3fc | 186 | |
187 | cout << "Fourier Weights" << endl; | |
188 | cout << "Real Part" << endl; | |
b669392e | 189 | for(i=0; i<kMaxNofSamples; i++) cout << fWR[i] << endl; |
b0f5e3fc | 190 | cout << "Imaginary Part " << endl; |
b669392e | 191 | for(i=0; i<kMaxNofSamples; i++) cout << fWI[i] << endl; |
b0f5e3fc | 192 | } |
193 | ||
194 | ||
195 | ||
196 | ||
197 | ||
198 | ||
199 | ||
200 |