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 //_____________________________________________________________________________
26 ClassImp(AliITSetfSDD)
28 Int_t ppower(Int_t b, Int_t e) {
30 for(Int_t i=0; i<e; i++) power *= b;
34 AliITSetfSDD::AliITSetfSDD(Double_t timestep)
36 // sampling time in ns
38 fSamplingTime = timestep;
41 fDf = ppower(10,9)/(fkMaxNofSamples*fSamplingTime);
45 for(i=0; i<fkMaxNofPoles; i++) {
54 fPoleR[0] = -2100000.;
55 fPoleI[0] = fPoleR[0];
57 fPoleR[1] = -2100000.;
58 fPoleI[1] = -fPoleR[1];
60 // Compute Transfer Function
62 Double_t PI = acos(-1.);
63 for(i=0; i<=fkMaxNofSamples/2; i++) {
64 Double_t frequency = fDf*i;
67 for(Int_t k=0; k<fkMaxNofPoles; k++) {
69 Double_t VZR = -fZeroR[k];
70 Double_t VZI = frequency - fZeroI[k];
71 Double_t VZM = TMath::Sqrt(VZR*VZR+VZI*VZI);
72 Double_t VZA = TMath::ATan2(VZI,VZR);
73 // cout << "VZM: " << VZM << ", VZA: " << VZA << endl;
74 // cout << "VZR: " << VZR << ", VZI: " << VZI << endl;
75 for(j=1; j<= (Int_t) fZeroM[k]; j++) {
78 if(VA >= PI) VA -= (2.*PI);
79 if(VA <= -PI) VA += (2.*PI);
80 //cout << "VM: " << VM << ", VA: " << VA << endl;
85 Double_t VPR = -fPoleR[k];
86 Double_t VPI = frequency - fPoleI[k];
87 Double_t VPM = TMath::Sqrt(VPR*VPR+VPI*VPI);
88 Double_t VPA = TMath::ATan2(VPI,VPR);
89 //cout << "VPM: " << VPM << ", VPA: " << VPA << endl;
90 //cout << "VPR: " << VPR << ", VPI: " << VPI << endl;
91 for(j=1; j<= (Int_t) fPoleM[k]; j++) {
94 if(VA >= PI) VA -= (2.*PI);
95 if(VA <= -PI) VA += (2.*PI);
96 //cout << "VM: " << VM << ", VA: " << VA << endl;
99 Double_t VR = VM*cos(VA);
100 Double_t VI = VM*sin(VA);
101 //cout << "VM: " << VM << ", VA: " << VA << endl;
102 //cout << "VR: " << VR << ", VI: " << VI << endl;
103 fTfR[i] = VR*ppower(10,9);
104 fTfI[i] = VI*ppower(10,9);
105 //cout << "fTfR[" << i << "] = " << fTfR[i] << endl;
106 //cout << "fTfI[" << i << "] = " << fTfI[i] << endl;
108 fTfR[fkMaxNofSamples-i] = fTfR[i];
109 fTfI[fkMaxNofSamples-i] = -fTfI[i];
114 // Compute Fourier Weights
116 for(i=0; i<=fkMaxNofSamples/2; i++) {
117 fWR[i] = cos(-2.*PI*i/fkMaxNofSamples);
118 fWI[i] = sin(-2.*PI*i/fkMaxNofSamples);
120 fWR[fkMaxNofSamples-i] = fWR[i];
121 fWI[fkMaxNofSamples-i] = -fWI[i];
127 void AliITSetfSDD::PrintElectronics()
129 cout << "Sampling Time " << fSamplingTime << endl;
130 cout << "Number of Time Samples " << fkMaxNofSamples << endl;
131 cout << "fT0 " << fT0 << endl;
132 cout << "fDf " << fDf << endl;
133 cout << "fA0 " << fA0 << endl;
135 cout << "Zero's and Pole's" << endl;
136 cout << "fZeroM " << endl;
138 for(i=0; i<fkMaxNofPoles; i++) cout << fZeroM[i] << endl;
139 cout << "fZero_R " << endl;
140 for(i=0; i<fkMaxNofPoles; i++) cout << fZeroR[i] << endl;
141 cout << "fZeroI " << endl;
142 for(i=0; i<fkMaxNofPoles; i++) cout << fZeroI[i] << endl;
143 cout << "fPoleM " << endl;
144 for(i=0; i<fkMaxNofPoles; i++) cout << fPoleM[i] << endl;
145 cout << "fPoleR " << endl;
146 for(i=0; i<fkMaxNofPoles; i++) cout << fPoleR[i] << endl;
147 cout << "fPoleI " << endl;
148 for(i=0; i<fkMaxNofPoles; i++) cout << fPoleI[i] << endl;
150 cout << "Transfer function" << endl;
151 cout << "Real Part" << endl;
152 for(i=0; i<fkMaxNofSamples; i++) cout << fTfR[i] << endl;
153 cout << "Imaginary Part " << endl;
154 for(i=0; i<fkMaxNofSamples; i++) cout << fTfI[i] << endl;
156 cout << "Fourier Weights" << endl;
157 cout << "Real Part" << endl;
158 for(i=0; i<fkMaxNofSamples; i++) cout << fWR[i] << endl;
159 cout << "Imaginary Part " << endl;
160 for(i=0; i<fkMaxNofSamples; i++) cout << fWI[i] << endl;