]>
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 | #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 | // | |
25 | //_____________________________________________________________________________ | |
26 | ||
27 | ||
28 | ClassImp(AliITSetfSDD) | |
29 | ||
30 | Int_t ppower(Int_t b, Int_t e) { | |
31 | Int_t power = 1; | |
32 | for(Int_t i=0; i<e; i++) power *= b; | |
33 | return power; | |
34 | } | |
35 | ||
36 | AliITSetfSDD::AliITSetfSDD(Double_t timestep) | |
37 | { | |
38 | // sampling time in ns | |
39 | ||
40 | fSamplingTime = timestep; | |
41 | ||
42 | fT0 = 0.; | |
43 | fDf = ppower(10,9)/(kMaxNofSamples*fSamplingTime); | |
44 | fA0 = 9000.; | |
45 | ||
46 | Int_t i,j; | |
47 | for(i=0; i<kMaxNofPoles; i++) { | |
48 | fZeroM[i] = 0.; | |
49 | fZeroR[i] = 0.; | |
50 | fZeroI[i] = 0.; | |
51 | fPoleM[i] = 0.; | |
52 | fPoleR[i] = 0.; | |
53 | fPoleI[i] = 0.; | |
54 | } | |
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]; | |
61 | ||
62 | // Compute Transfer Function | |
63 | ||
64 | Double_t PI = acos(-1.); | |
65 | for(i=0; i<=kMaxNofSamples/2; i++) { | |
66 | Double_t frequency = fDf*i; | |
67 | Double_t VM = fA0; | |
68 | Double_t VA = 0.; | |
69 | for(Int_t k=0; k<kMaxNofPoles; k++) { | |
70 | if(fZeroM[k]) { | |
71 | Double_t VZR = -fZeroR[k]; | |
72 | Double_t VZI = frequency - fZeroI[k]; | |
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; | |
77 | for(j=1; j<= (Int_t) fZeroM[k]; j++) { | |
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 | ||
86 | if(fPoleM[k]) { | |
87 | Double_t VPR = -fPoleR[k]; | |
88 | Double_t VPI = frequency - fPoleI[k]; | |
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; | |
93 | for(j=1; j<= (Int_t) fPoleM[k]; j++) { | |
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; | |
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; | |
109 | if(i) { | |
110 | fTfR[kMaxNofSamples-i] = fTfR[i]; | |
111 | fTfI[kMaxNofSamples-i] = -fTfI[i]; | |
112 | } | |
113 | } | |
114 | } | |
115 | ||
116 | // Compute Fourier Weights | |
117 | ||
118 | for(i=0; i<=kMaxNofSamples/2; i++) { | |
119 | fWR[i] = cos(-2.*PI*i/kMaxNofSamples); | |
120 | fWI[i] = sin(-2.*PI*i/kMaxNofSamples); | |
121 | if(i) { | |
122 | fWR[kMaxNofSamples-i] = fWR[i]; | |
123 | fWI[kMaxNofSamples-i] = -fWI[i]; | |
124 | } | |
125 | } | |
126 | ||
127 | } | |
128 | ||
129 | void AliITSetfSDD::PrintElectronics() | |
130 | { | |
131 | cout << "Sampling Time " << fSamplingTime << endl; | |
132 | cout << "Number of Time Samples " << kMaxNofSamples << endl; | |
133 | cout << "fT0 " << fT0 << endl; | |
134 | cout << "fDf " << fDf << endl; | |
135 | cout << "fA0 " << fA0 << endl; | |
136 | ||
137 | cout << "Zero's and Pole's" << endl; | |
138 | cout << "fZeroM " << endl; | |
139 | Int_t i; | |
140 | for(i=0; i<kMaxNofPoles; i++) cout << fZeroM[i] << endl; | |
141 | cout << "fZero_R " << endl; | |
142 | for(i=0; i<kMaxNofPoles; i++) cout << fZeroR[i] << endl; | |
143 | cout << "fZeroI " << endl; | |
144 | for(i=0; i<kMaxNofPoles; i++) cout << fZeroI[i] << endl; | |
145 | cout << "fPoleM " << endl; | |
146 | for(i=0; i<kMaxNofPoles; i++) cout << fPoleM[i] << endl; | |
147 | cout << "fPoleR " << endl; | |
148 | for(i=0; i<kMaxNofPoles; i++) cout << fPoleR[i] << endl; | |
149 | cout << "fPoleI " << endl; | |
150 | for(i=0; i<kMaxNofPoles; i++) cout << fPoleI[i] << endl; | |
151 | ||
152 | cout << "Transfer function" << endl; | |
153 | cout << "Real Part" << endl; | |
154 | for(i=0; i<kMaxNofSamples; i++) cout << fTfR[i] << endl; | |
155 | cout << "Imaginary Part " << endl; | |
156 | for(i=0; i<kMaxNofSamples; i++) cout << fTfI[i] << endl; | |
157 | ||
158 | cout << "Fourier Weights" << endl; | |
159 | cout << "Real Part" << endl; | |
160 | for(i=0; i<kMaxNofSamples; i++) cout << fWR[i] << endl; | |
161 | cout << "Imaginary Part " << endl; | |
162 | for(i=0; i<kMaxNofSamples; i++) cout << fWI[i] << endl; | |
163 | } | |
164 | ||
165 | ||
166 | ||
167 | ||
168 | ||
169 | ||
170 | ||
171 |