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