1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 #include "AliITSetfSDD.h"
20 ////////////////////////////////////////////////////////////////////////
22 // Written by Piergiorgio Cerello
25 //_____________________________________________________________________________
28 ClassImp(AliITSetfSDD)
30 Int_t ppower(Int_t b, Int_t e) {
32 for(Int_t i=0; i<e; i++) power *= b;
36 AliITSetfSDD::AliITSetfSDD(Double_t timestep)
38 // sampling time in ns
40 fSamplingTime = timestep;
43 fDf = ppower(10,9)/(kMaxNofSamples*fSamplingTime);
47 for(i=0; i<kMaxNofPoles; i++) {
56 fPoleR[0] = -2100000.;
57 fPoleI[0] = fPoleR[0];
59 fPoleR[1] = -2100000.;
60 fPoleI[1] = -fPoleR[1];
62 // Compute Transfer Function
64 Double_t PI = acos(-1.);
65 for(i=0; i<=kMaxNofSamples/2; i++) {
66 Double_t frequency = fDf*i;
69 for(Int_t k=0; k<kMaxNofPoles; 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++) {
80 if(VA >= PI) VA -= (2.*PI);
81 if(VA <= -PI) VA += (2.*PI);
82 //cout << "VM: " << VM << ", VA: " << VA << endl;
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++) {
96 if(VA >= PI) VA -= (2.*PI);
97 if(VA <= -PI) VA += (2.*PI);
98 //cout << "VM: " << VM << ", VA: " << VA << endl;
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;
110 fTfR[kMaxNofSamples-i] = fTfR[i];
111 fTfI[kMaxNofSamples-i] = -fTfI[i];
116 // Compute Fourier Weights
118 for(i=0; i<=kMaxNofSamples/2; i++) {
119 fWR[i] = cos(-2.*PI*i/kMaxNofSamples);
120 fWI[i] = sin(-2.*PI*i/kMaxNofSamples);
122 fWR[kMaxNofSamples-i] = fWR[i];
123 fWI[kMaxNofSamples-i] = -fWI[i];
129 void AliITSetfSDD::PrintElectronics()
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;
137 cout << "Zero's and Pole's" << endl;
138 cout << "fZeroM " << endl;
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;
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;
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;