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