Release version of ITS code
[u/mrichter/AliRoot.git] / ITS / AliITSetfSDD.cxx
CommitLineData
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//_____________________________________________________________________________
26ClassImp(AliITSetfSDD)
27
28Int_t ppower(Int_t b, Int_t e) {
e8189707 29 Int_t power = 1;
30 for(Int_t i=0; i<e; i++) power *= b;
b0f5e3fc 31 return power;
32}
33
e8189707 34AliITSetfSDD::AliITSetfSDD(Double_t timestep)
b0f5e3fc 35{
36 // sampling time in ns
e8189707 37
38 fSamplingTime = timestep;
39
b0f5e3fc 40 fT0 = 0.;
e8189707 41 fDf = ppower(10,9)/(fkMaxNofSamples*fSamplingTime);
b0f5e3fc 42 fA0 = 9000.;
43
e8189707 44 Int_t i,j;
45 for(i=0; i<fkMaxNofPoles; i++) {
46 fZeroM[i] = 0.;
47 fZeroR[i] = 0.;
48 fZeroI[i] = 0.;
49 fPoleM[i] = 0.;
50 fPoleR[i] = 0.;
51 fPoleI[i] = 0.;
b0f5e3fc 52 }
e8189707 53 fPoleM[0] = 1.;
54 fPoleR[0] = -2100000.;
55 fPoleI[0] = fPoleR[0];
56 fPoleM[1] = 1.;
57 fPoleR[1] = -2100000.;
58 fPoleI[1] = -fPoleR[1];
b0f5e3fc 59
60 // Compute Transfer Function
61
62 Double_t PI = acos(-1.);
e8189707 63 for(i=0; i<=fkMaxNofSamples/2; i++) {
b0f5e3fc 64 Double_t frequency = fDf*i;
65 Double_t VM = fA0;
66 Double_t VA = 0.;
e8189707 67 for(Int_t k=0; k<fkMaxNofPoles; k++) {
68 if(fZeroM[k]) {
69 Double_t VZR = -fZeroR[k];
70 Double_t VZI = frequency - fZeroI[k];
b0f5e3fc 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;
e8189707 75 for(j=1; j<= (Int_t) fZeroM[k]; j++) {
b0f5e3fc 76 VM *= VZM;
77 VA += VZA;
78 if(VA >= PI) VA -= (2.*PI);
79 if(VA <= -PI) VA += (2.*PI);
80 //cout << "VM: " << VM << ", VA: " << VA << endl;
81 }
82 }
83
e8189707 84 if(fPoleM[k]) {
85 Double_t VPR = -fPoleR[k];
86 Double_t VPI = frequency - fPoleI[k];
b0f5e3fc 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;
e8189707 91 for(j=1; j<= (Int_t) fPoleM[k]; j++) {
b0f5e3fc 92 VM /= VPM;
93 VA -= VPA;
94 if(VA >= PI) VA -= (2.*PI);
95 if(VA <= -PI) VA += (2.*PI);
96 //cout << "VM: " << VM << ", VA: " << VA << endl;
97 }
98 }
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;
e8189707 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;
b0f5e3fc 107 if(i) {
e8189707 108 fTfR[fkMaxNofSamples-i] = fTfR[i];
109 fTfI[fkMaxNofSamples-i] = -fTfI[i];
b0f5e3fc 110 }
111 }
112 }
113
114 // Compute Fourier Weights
115
e8189707 116 for(i=0; i<=fkMaxNofSamples/2; i++) {
117 fWR[i] = cos(-2.*PI*i/fkMaxNofSamples);
118 fWI[i] = sin(-2.*PI*i/fkMaxNofSamples);
b0f5e3fc 119 if(i) {
e8189707 120 fWR[fkMaxNofSamples-i] = fWR[i];
121 fWI[fkMaxNofSamples-i] = -fWI[i];
b0f5e3fc 122 }
123 }
124
125}
126
e8189707 127void AliITSetfSDD::PrintElectronics()
b0f5e3fc 128{
b0f5e3fc 129 cout << "Sampling Time " << fSamplingTime << endl;
e8189707 130 cout << "Number of Time Samples " << fkMaxNofSamples << endl;
b0f5e3fc 131 cout << "fT0 " << fT0 << endl;
132 cout << "fDf " << fDf << endl;
133 cout << "fA0 " << fA0 << endl;
134
135 cout << "Zero's and Pole's" << endl;
e8189707 136 cout << "fZeroM " << endl;
137 Int_t i;
138 for(i=0; i<fkMaxNofPoles; i++) cout << fZeroM[i] << endl;
b0f5e3fc 139 cout << "fZero_R " << endl;
e8189707 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;
b0f5e3fc 149
150 cout << "Transfer function" << endl;
151 cout << "Real Part" << endl;
e8189707 152 for(i=0; i<fkMaxNofSamples; i++) cout << fTfR[i] << endl;
b0f5e3fc 153 cout << "Imaginary Part " << endl;
e8189707 154 for(i=0; i<fkMaxNofSamples; i++) cout << fTfI[i] << endl;
b0f5e3fc 155
156 cout << "Fourier Weights" << endl;
157 cout << "Real Part" << endl;
e8189707 158 for(i=0; i<fkMaxNofSamples; i++) cout << fWR[i] << endl;
b0f5e3fc 159 cout << "Imaginary Part " << endl;
e8189707 160 for(i=0; i<fkMaxNofSamples; i++) cout << fWI[i] << endl;
b0f5e3fc 161}
162
163
164
165
166
167
168
169