]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSetfSDD.cxx
Set PASCAL parameters to ALICE conditions
[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 <TString.h>
19 #include "AliITSetfSDD.h"
20
21 ////////////////////////////////////////////////////////////////////////
22 // Version: 0
23 // Written by Piergiorgio Cerello
24 // November 23 1999
25 //
26 //_____________________________________________________________________________
27
28
29 ClassImp(AliITSetfSDD)
30
31 Int_t ppower(Int_t b, Int_t e) {
32   Int_t power = 1;
33   for(Int_t i=0; i<e; i++) power *= b;
34   return power;
35 }
36
37 AliITSetfSDD::AliITSetfSDD(Double_t timestep, Int_t amplif)
38 {
39   // sampling time in ns
40
41   fTimeDelay = 53.5;
42   if(amplif == 2) fTimeDelay = 35.5;
43   fSamplingTime = timestep;
44
45   fT0 = 0.;
46   fDf = ppower(10,9)/(kMaxNofSamples*fSamplingTime);
47   fA0 = 16500.; // AL: 16500.;  // TB: 24000.; // 26000.; // 24000.; // 18000.; 
48
49   if(amplif == 2) fA0 = 24000.;
50   cout << "fA0: " << fA0 << endl;
51   cout << "fTimeDelay: " << fTimeDelay << endl;
52   Int_t i,j;
53   for(i=0; i<kMaxNofPoles; i++) {
54     fZeroM[i] = 0.;
55     fZeroR[i] = 0.;
56     fZeroI[i] = 0.;
57     fPoleM[i] = 0.;
58     fPoleR[i] = 0.;
59     fPoleI[i] = 0.;
60   }
61   // Alice
62
63   fPoleM[0] = 1.;
64   fPoleR[0] = -4140000.; // AL: -4140000.; // TB: -3000000.; // -3750000.; // -3500000; // -3000000.; 
65   fPoleI[0] = 0.; // AL: 0.; // TB: 4000000.; // 3750000.; // 3500000.; // 3000000.; 
66   if(amplif == 2) {
67     fPoleR[0] = -3000000.;
68     fPoleI[0] = 4000000.;
69   }
70   fPoleM[1] = 1.;
71   fPoleR[1] = fPoleR[0];
72   fPoleI[1] = -fPoleI[0]; 
73
74   // Compute Transfer Function
75
76   Double_t PI = acos(-1.);
77   for(i=0; i<=kMaxNofSamples/2; i++) {
78     Double_t frequency = fDf*i;
79     Double_t VM = fA0;
80     Double_t VA = 0.;
81     for(Int_t k=0; k<kMaxNofPoles; k++) {
82       if(fZeroM[k]) {
83         Double_t VZR = -fZeroR[k];
84         Double_t VZI = frequency - fZeroI[k];
85         Double_t VZM = TMath::Sqrt(VZR*VZR+VZI*VZI);
86         Double_t VZA = TMath::ATan2(VZI,VZR);
87         //      cout << "VZM: " << VZM << ", VZA: " << VZA << endl;
88         //      cout << "VZR: " << VZR << ", VZI: " << VZI << endl;
89         for(j=1; j<= (Int_t) fZeroM[k]; j++) {
90           VM *= VZM;
91           VA += VZA;
92           if(VA >= PI) VA -= (2.*PI);
93           if(VA <= -PI) VA += (2.*PI);
94           //cout << "VM: " << VM << ", VA: " << VA << endl;
95         }
96       }
97
98       if(fPoleM[k]) {
99         Double_t VPR = -fPoleR[k];
100         Double_t VPI = frequency - fPoleI[k];
101         Double_t VPM = TMath::Sqrt(VPR*VPR+VPI*VPI);
102         Double_t VPA = TMath::ATan2(VPI,VPR);
103         //cout << "VPM: " << VPM << ", VPA: " << VPA << endl;
104         //cout << "VPR: " << VPR << ", VPI: " << VPI << endl;
105         for(j=1; j<= (Int_t) fPoleM[k]; j++) {
106           VM /= VPM;
107           VA -= VPA;
108           if(VA >= PI) VA -= (2.*PI);
109           if(VA <= -PI) VA += (2.*PI);
110           //cout << "VM: " << VM << ", VA: " << VA << endl;
111         }
112       }
113       Double_t VR = VM*cos(VA);
114       Double_t VI = VM*sin(VA);
115       //cout << "VM: " << VM << ", VA: " << VA << endl;
116       //cout << "VR: " << VR << ", VI: " << VI << endl;
117       fTfR[i] = VR*ppower(10,9);
118       fTfI[i] = VI*ppower(10,9);
119       //cout << "fTfR[" << i << "] = " << fTfR[i] << endl;
120       //cout << "fTfI[" << i << "] = " << fTfI[i] << endl;
121       if(i) {
122         fTfR[kMaxNofSamples-i] = fTfR[i];
123         fTfI[kMaxNofSamples-i] = -fTfI[i];
124       }
125     }
126   }
127   
128   // Compute Fourier Weights
129
130   for(i=0; i<=kMaxNofSamples/2; i++) {
131     fWR[i] = cos(-2.*PI*i/kMaxNofSamples);
132     fWI[i] = sin(-2.*PI*i/kMaxNofSamples);
133     if(i) {
134       fWR[kMaxNofSamples-i] = fWR[i];
135       fWI[kMaxNofSamples-i] = -fWI[i];
136     }
137   }
138
139 }
140
141 void AliITSetfSDD::PrintElectronics()
142 {
143   cout << "Time Delay " << fTimeDelay << endl;
144   cout << "Sampling Time " << fSamplingTime << endl;
145   cout << "Number of Time Samples " << kMaxNofSamples << endl;
146   cout << "fT0 " << fT0 << endl;
147   cout << "fDf " << fDf << endl;
148   cout << "fA0 " << fA0 << endl;
149
150   cout << "Zero's and Pole's" << endl;
151   cout << "fZeroM " << endl;
152   Int_t i;
153   for(i=0; i<kMaxNofPoles; i++) cout << fZeroM[i] << endl;
154   cout << "fZero_R " << endl;
155   for(i=0; i<kMaxNofPoles; i++) cout << fZeroR[i] << endl;
156   cout << "fZeroI " << endl;
157   for(i=0; i<kMaxNofPoles; i++) cout << fZeroI[i] << endl;
158   cout << "fPoleM " << endl;
159   for(i=0; i<kMaxNofPoles; i++) cout << fPoleM[i] << endl;
160   cout << "fPoleR " << endl;
161   for(i=0; i<kMaxNofPoles; i++) cout << fPoleR[i] << endl;
162   cout << "fPoleI " << endl;
163   for(i=0; i<kMaxNofPoles; i++) cout << fPoleI[i] << endl;
164
165   cout << "Transfer function" << endl;
166   cout << "Real Part" << endl;
167   for(i=0; i<kMaxNofSamples; i++) cout << fTfR[i] << endl;
168   cout << "Imaginary Part " << endl;
169   for(i=0; i<kMaxNofSamples; i++) cout << fTfI[i] << endl;
170
171   cout << "Fourier Weights" << endl;
172   cout << "Real Part" << endl;
173   for(i=0; i<kMaxNofSamples; i++) cout << fWR[i] << endl;
174   cout << "Imaginary Part " << endl;
175   for(i=0; i<kMaxNofSamples; i++) cout << fWI[i] << endl;
176 }
177
178
179
180
181
182
183
184