]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSetfSDD.cxx
Release version of ITS code
[u/mrichter/AliRoot.git] / ITS / AliITSetfSDD.cxx
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 ClassImp(AliITSetfSDD)
27
28 Int_t ppower(Int_t b, Int_t e) {
29   Int_t power = 1;
30   for(Int_t i=0; i<e; i++) power *= b;
31   return power;
32 }
33
34 AliITSetfSDD::AliITSetfSDD(Double_t timestep)
35 {
36   // sampling time in ns
37
38   fSamplingTime = timestep;
39
40   fT0 = 0.;
41   fDf = ppower(10,9)/(fkMaxNofSamples*fSamplingTime);
42   fA0 = 9000.;
43
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.;
52   }
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];
59
60    // Compute Transfer Function
61
62   Double_t PI = acos(-1.);
63   for(i=0; i<=fkMaxNofSamples/2; i++) {
64     Double_t frequency = fDf*i;
65     Double_t VM = fA0;
66     Double_t VA = 0.;
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];
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++) {
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
84       if(fPoleM[k]) {
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++) {
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;
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;
107       if(i) {
108         fTfR[fkMaxNofSamples-i] = fTfR[i];
109         fTfI[fkMaxNofSamples-i] = -fTfI[i];
110       }
111     }
112   }
113   
114   // Compute Fourier Weights
115
116   for(i=0; i<=fkMaxNofSamples/2; i++) {
117     fWR[i] = cos(-2.*PI*i/fkMaxNofSamples);
118     fWI[i] = sin(-2.*PI*i/fkMaxNofSamples);
119     if(i) {
120       fWR[fkMaxNofSamples-i] = fWR[i];
121       fWI[fkMaxNofSamples-i] = -fWI[i];
122     }
123   }
124
125 }
126
127 void AliITSetfSDD::PrintElectronics()
128 {
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;
134
135   cout << "Zero's and Pole's" << endl;
136   cout << "fZeroM " << endl;
137   Int_t i;
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;
149
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;
155
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;
161 }
162
163
164
165
166
167
168
169