]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSetfSDD.cxx
New ITS code replacing the old structure and simulations 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
16/*
17$Log$
18Revision 1.1.2.2 2000/06/12 18:09:36 barbera
19fixed posible compilation errors on HP unix
20
21Revision 1.1.2.1 2000/01/12 20:21:30 nilsen
22missed AliITSetfSDD files ealier
23
24$Name$
25$Author$
26$Id$
27*/
28
29#include <iostream.h>
30#include <TMath.h>
31#include "AliITSetfSDD.h"
32
33////////////////////////////////////////////////////////////////////////
34// Version: 0
35// Written by Piergiorgio Cerello
36// November 23 1999
37//
38// AliITSmapSDD is the map of SDDs.
39//
40//Begin_Html
41/*
42<img src="picts/ITS/AliITShit_Class_Diagram.gif">
43</pre>
44<br clear=left>
45<font size=+2 color=red>
46<p>This show the relasionships between the ITS hit class and the rest of Aliroot.
47</font>
48<pre>
49*/
50//End_Htm
51//extern Int_t power(Int_t b, Int_t e);
52
53//_____________________________________________________________________________
54ClassImp(AliITSetfSDD)
55
56Int_t ppower(Int_t b, Int_t e) {
57 Int_t power = 1,i;
58 for(i=0; i<e; i++) power *= b;
59 return power;
60}
61
62AliITSetfSDD::AliITSetfSDD(Double_t timeclock)
63{
64 // sampling time in ns
65 fSamplingTime = 1000./timeclock;
66 fT0 = 0.;
67 fDf = ppower(10,9)/(fMaxNofSamples*fSamplingTime);
68 fA0 = 9000.;
69
70 Int_t i,j,k;
71 for(i=0; i<fMaxNofPoles; i++) {
72 fZero_M[i] = 0.;
73 fZero_R[i] = 0.;
74 fZero_I[i] = 0.;
75 fPole_M[i] = 0.;
76 fPole_R[i] = 0.;
77 fPole_I[i] = 0.;
78 }
79 fPole_M[0] = 1.;
80 fPole_R[0] = -2100000.;
81 fPole_I[0] = fPole_R[0];
82 fPole_M[1] = 1.;
83 fPole_R[1] = -2100000.;
84 fPole_I[1] = -fPole_R[1];
85
86 // Compute Transfer Function
87
88 Double_t PI = acos(-1.);
89 for(i=0; i<=fMaxNofSamples/2; i++) {
90 Double_t frequency = fDf*i;
91 Double_t VM = fA0;
92 Double_t VA = 0.;
93 for(k=0; k<fMaxNofPoles; k++) {
94 if(fZero_M[k]) {
95 Double_t VZR = -fZero_R[k];
96 Double_t VZI = frequency - fZero_I[k];
97 Double_t VZM = TMath::Sqrt(VZR*VZR+VZI*VZI);
98 Double_t VZA = TMath::ATan2(VZI,VZR);
99 // cout << "VZM: " << VZM << ", VZA: " << VZA << endl;
100 // cout << "VZR: " << VZR << ", VZI: " << VZI << endl;
101 for(j=1; j<= (Int_t) fZero_M[k]; j++) {
102 VM *= VZM;
103 VA += VZA;
104 if(VA >= PI) VA -= (2.*PI);
105 if(VA <= -PI) VA += (2.*PI);
106 //cout << "VM: " << VM << ", VA: " << VA << endl;
107 }
108 }
109
110 if(fPole_M[k]) {
111 Double_t VPR = -fPole_R[k];
112 Double_t VPI = frequency - fPole_I[k];
113 Double_t VPM = TMath::Sqrt(VPR*VPR+VPI*VPI);
114 Double_t VPA = TMath::ATan2(VPI,VPR);
115 //cout << "VPM: " << VPM << ", VPA: " << VPA << endl;
116 //cout << "VPR: " << VPR << ", VPI: " << VPI << endl;
117 for(j=1; j<= (Int_t) fPole_M[k]; j++) {
118 VM /= VPM;
119 VA -= VPA;
120 if(VA >= PI) VA -= (2.*PI);
121 if(VA <= -PI) VA += (2.*PI);
122 //cout << "VM: " << VM << ", VA: " << VA << endl;
123 }
124 }
125 Double_t VR = VM*cos(VA);
126 Double_t VI = VM*sin(VA);
127 //cout << "VM: " << VM << ", VA: " << VA << endl;
128 //cout << "VR: " << VR << ", VI: " << VI << endl;
129 fTf_R[i] = VR*ppower(10,9);
130 fTf_I[i] = VI*ppower(10,9);
131 //cout << "fTf_R[" << i << "] = " << fTf_R[i] << endl;
132 //cout << "fTf_I[" << i << "] = " << fTf_I[i] << endl;
133 if(i) {
134 fTf_R[fMaxNofSamples-i] = fTf_R[i];
135 fTf_I[fMaxNofSamples-i] = -fTf_I[i];
136 }
137 }
138 }
139
140 // Compute Fourier Weights
141
142 for(i=0; i<=fMaxNofSamples/2; i++) {
143 fW_R[i] = cos(-2.*PI*i/fMaxNofSamples);
144 fW_I[i] = sin(-2.*PI*i/fMaxNofSamples);
145 if(i) {
146 fW_R[fMaxNofSamples-i] = fW_R[i];
147 fW_I[fMaxNofSamples-i] = -fW_I[i];
148 }
149 }
150
151}
152
153void AliITSetfSDD::Print()
154{
155 Int_t i;
156 cout << "Sampling Time " << fSamplingTime << endl;
157 cout << "Number of Time Samples " << fMaxNofSamples << endl;
158 cout << "fT0 " << fT0 << endl;
159 cout << "fDf " << fDf << endl;
160 cout << "fA0 " << fA0 << endl;
161
162 cout << "Zero's and Pole's" << endl;
163 cout << "fZero_M " << endl;
164 for(i=0; i<fMaxNofPoles; i++) cout << fZero_M[i] << endl;
165 cout << "fZero_R " << endl;
166 for(i=0; i<fMaxNofPoles; i++) cout << fZero_R[i] << endl;
167 cout << "fZero_I " << endl;
168 for(i=0; i<fMaxNofPoles; i++) cout << fZero_I[i] << endl;
169 cout << "fPole_M " << endl;
170 for(i=0; i<fMaxNofPoles; i++) cout << fPole_M[i] << endl;
171 cout << "fPole_R " << endl;
172 for(i=0; i<fMaxNofPoles; i++) cout << fPole_R[i] << endl;
173 cout << "fPole_I " << endl;
174 for(i=0; i<fMaxNofPoles; i++) cout << fPole_I[i] << endl;
175
176 cout << "Transfer function" << endl;
177 cout << "Real Part" << endl;
178 for(i=0; i<fMaxNofSamples; i++) cout << fTf_R[i] << endl;
179 cout << "Imaginary Part " << endl;
180 for(i=0; i<fMaxNofSamples; i++) cout << fTf_I[i] << endl;
181
182 cout << "Fourier Weights" << endl;
183 cout << "Real Part" << endl;
184 for(i=0; i<fMaxNofSamples; i++) cout << fW_R[i] << endl;
185 cout << "Imaginary Part " << endl;
186 for(i=0; i<fMaxNofSamples; i++) cout << fW_I[i] << endl;
187}
188
189
190
191
192
193
194
195