]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSetfSDD.cxx
alignment of sensor wrt hybrid is now allowed (fgkSSDModulVerticalDisalignement)...
[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 /* $Id$ */
17
18
19 #include <Riostream.h>
20 #include <TMath.h>
21 #include "AliITSetfSDD.h"
22
23 ////////////////////////////////////////////////////////////////////////
24 // Version: 0
25 // Written by Piergiorgio Cerello
26 // November 23 1999
27 // Revised to comply with coding conventions: Nov, 21 2003 m.m.
28 //_____________________________________________________________________________
29
30
31 ClassImp(AliITSetfSDD)
32
33 const Int_t AliITSetfSDD::AliITSetfSDDparam::fgkMaxNofPoles = 5;
34 const Int_t AliITSetfSDD::AliITSetfSDDparam::fgkMaxNofSamples = 1024;
35
36 Int_t ppower(Int_t b, Int_t e) {
37   Int_t power = 1;
38   for(Int_t i=0; i<e; i++) power *= b;
39   return power;
40 }
41
42 AliITSetfSDD::AliITSetfSDD():
43 fTimeDelay(0),
44 fSamplingTime(0),
45 fT0(0),
46 fDf(0.),
47 fA0(0.) ,
48 fZeroM(0),
49 fZeroR(0),
50 fZeroI(0),
51 fPoleM(0),
52 fPoleR(0),
53 fPoleI(0),
54 fTfR(0),
55 fTfI(0),
56 fWR(0),
57 fWI(0){
58   // Default constructor
59 }
60
61 AliITSetfSDD::AliITSetfSDD(Double_t timestep, Int_t amplif):
62 fTimeDelay(0),
63 fSamplingTime(0),
64 fT0(0),
65 fDf(0.),
66 fA0(0.) ,
67 fZeroM(0),
68 fZeroR(0),
69 fZeroI(0),
70 fPoleM(0),
71 fPoleR(0),
72 fPoleI(0),
73 fTfR(0),
74 fTfI(0),
75 fWR(0),
76 fWI(0)
77 {
78   // Standard constructor. sampling time in ns
79
80   /*
81   cout<<"Number of poles: "<<AliITSetfSDDparam::NumberOfPoles()<<endl;
82   cout<<"Number of samples: "<<AliITSetfSDDparam::NumberOfSamples()<<endl;
83   */
84   fTimeDelay = 53.5;
85   if(amplif == 2) fTimeDelay = 35.5;
86   fSamplingTime = timestep;
87
88   fT0 = 0.;
89   fDf = ppower(10,9)/(AliITSetfSDDparam::NumberOfSamples()*fSamplingTime);
90
91   Int_t i,j;
92   fZeroM = new Double_t[AliITSetfSDDparam::NumberOfPoles()];
93   fZeroR = new Double_t [AliITSetfSDDparam::NumberOfPoles()];
94   fZeroI = new Double_t [AliITSetfSDDparam::NumberOfPoles()];
95   fPoleM = new Double_t [AliITSetfSDDparam::NumberOfPoles()];
96   fPoleR = new Double_t [AliITSetfSDDparam::NumberOfPoles()];
97   fPoleI = new Double_t [AliITSetfSDDparam::NumberOfPoles()];
98   fTfR = new Double_t [AliITSetfSDDparam::NumberOfSamples()];
99   fTfI = new Double_t [AliITSetfSDDparam::NumberOfSamples()];
100   fWR = new Double_t [AliITSetfSDDparam::NumberOfSamples()];
101   fWI = new Double_t [AliITSetfSDDparam::NumberOfSamples()];
102
103   for(i=0; i<AliITSetfSDDparam::NumberOfPoles(); i++) {
104     fZeroM[i] = 0.;
105     fZeroR[i] = 0.;
106     fZeroI[i] = 0.;
107     fPoleM[i] = 0.;
108     fPoleR[i] = 0.;
109     fPoleI[i] = 0.;
110   }
111   // Alice
112
113   // PASCAL amplif
114   fA0 = 5.53269815e+11; 
115   fPoleM[0] = 3.;
116   fPoleR[0] = -8280000.; 
117   fPoleI[0] = 0.; 
118
119   if(amplif == 2) { // OLA amplif.
120     fA0 = 24000.;
121     fPoleM[0] = 1.;
122     fPoleR[0] = -3000000.;
123     fPoleI[0] = 4000000.;
124     fPoleM[1] = 1.;
125     fPoleR[1] = fPoleR[0];
126     fPoleI[1] = -fPoleI[0]; 
127   }
128
129   if( amplif == 3 ) { // old PASCAL
130     fA0 = 16500.; // AL: 16500.;  // TB: 24000.; // 26000.; // 24000.; // 18000.; 
131     fPoleM[0] = 1.;
132     fPoleR[0] = -4140000.; // AL: -4140000.; // TB: -3000000.; // -3750000.; // -3500000; // -3000000.; 
133     fPoleI[0] = 0.; // AL: 0.; // TB: 4000000.; // 3750000.; // 3500000.; // 3000000.; 
134     fPoleM[1] = 1.;
135     fPoleR[1] = fPoleR[0];
136     fPoleI[1] = -fPoleI[0]; 
137   }
138
139   //cout << "fA0: " << fA0 << endl;
140   //cout << "fTimeDelay: " << fTimeDelay << endl;
141   
142   // Compute Transfer Function
143
144   Double_t pigr = acos(-1.);
145   for(i=0; i<=AliITSetfSDDparam::NumberOfSamples()/2; i++) {
146     Double_t frequency = fDf*i;
147     Double_t vVM = fA0;
148     Double_t vVA = 0.;
149     for(Int_t k=0; k<AliITSetfSDDparam::NumberOfPoles(); k++) {
150       if(fZeroM[k]) {
151         Double_t vVZR = -fZeroR[k];
152         Double_t vVZI = frequency - fZeroI[k];
153         Double_t vVZM = TMath::Sqrt(vVZR*vVZR+vVZI*vVZI);
154         Double_t vVZA = TMath::ATan2(vVZI,vVZR);
155         //      cout << "VZM: " << vVZM << ", VZA: " << vVZA << endl;
156         //      cout << "VZR: " << vVZR << ", VZI: " << vVZI << endl;
157         for(j=1; j<= (Int_t) fZeroM[k]; j++) {
158           vVM *= vVZM;
159           vVA += vVZA;
160           if(vVA >= pigr) vVA -= (2.*pigr);
161           if(vVA <= -pigr) vVA += (2.*pigr);
162           //cout << "vVM: " << vVM << ", VA: " << vVA << endl;
163         }
164       }
165
166       if(fPoleM[k]) {
167         Double_t vVPR = -fPoleR[k];
168         Double_t vVPI = frequency - fPoleI[k];
169         Double_t vVPM = TMath::Sqrt(vVPR*vVPR+vVPI*vVPI);
170         Double_t vVPA = TMath::ATan2(vVPI,vVPR);
171         //cout << "VPM: " << vVPM << ", VPA: " << vVPA << endl;
172         //cout << "VPR: " << vVPR << ", VPI: " << vVPI << endl;
173         for(j=1; j<= (Int_t) fPoleM[k]; j++) {
174           vVM /= vVPM;
175           vVA -= vVPA;
176           if(vVA >= pigr) vVA -= (2.*pigr);
177           if(vVA <= -pigr) vVA += (2.*pigr);
178           //cout << "VM: " << vVM << ", vVA: " << vVA << endl;
179         }
180       }
181       Double_t vVR = vVM*cos(vVA);
182       Double_t vVI = vVM*sin(vVA);
183       //cout << "VM: " << vVM << ", VA: " << vVA << endl;
184       //cout << "VR: " << vVR << ", VI: " << vVI << endl;
185       fTfR[i] = vVR*ppower(10,9);
186       fTfI[i] = vVI*ppower(10,9);
187       //cout << "fTfR[" << i << "] = " << fTfR[i] << endl;
188       //cout << "fTfI[" << i << "] = " << fTfI[i] << endl;
189       if(i) {
190         fTfR[AliITSetfSDDparam::NumberOfSamples()-i] = fTfR[i];
191         fTfI[AliITSetfSDDparam::NumberOfSamples()-i] = -fTfI[i];
192       }
193     }
194   }
195   
196   // Compute Fourier Weights
197
198   for(i=0; i<=AliITSetfSDDparam::NumberOfSamples()/2; i++) {
199     fWR[i] = cos(-2.*pigr*i/AliITSetfSDDparam::NumberOfSamples());
200     fWI[i] = sin(-2.*pigr*i/AliITSetfSDDparam::NumberOfSamples());
201     if(i) {
202       fWR[AliITSetfSDDparam::NumberOfSamples()-i] = fWR[i];
203       fWI[AliITSetfSDDparam::NumberOfSamples()-i] = -fWI[i];
204     }
205   }
206
207 }
208
209
210 AliITSetfSDD::~AliITSetfSDD(){
211   // Destructor
212   if(fZeroM) delete []fZeroM;
213   if(fZeroR) delete []fZeroR;
214   if(fZeroI) delete []fZeroI;
215   if(fPoleM) delete []fPoleM;
216   if(fPoleR) delete []fPoleR;
217   if(fPoleI) delete []fPoleI;
218   if(fTfR) delete []fTfR;
219   if(fTfI) delete []fTfI;
220   if(fWR) delete []fWR;
221   if(fWI) delete []fWI;
222 }
223
224 void AliITSetfSDD::PrintElectronics() const {
225   // Printout of the parameters defining the f.e. electronics
226
227   cout << "Time Delay " << fTimeDelay << endl;
228   cout << "Sampling Time " << fSamplingTime << endl;
229   cout << "Number of Time Samples " << AliITSetfSDDparam::NumberOfSamples() << endl;
230   cout << "fT0 " << fT0 << endl;
231   cout << "fDf " << fDf << endl;
232   cout << "fA0 " << fA0 << endl;
233
234   cout << "Zero's and Pole's" << endl;
235   cout << "fZeroM " << endl;
236   Int_t i;
237   for(i=0; i<AliITSetfSDDparam::NumberOfPoles(); i++) cout << fZeroM[i] << endl;
238   cout << "fZero_R " << endl;
239   for(i=0; i<AliITSetfSDDparam::NumberOfPoles(); i++) cout << fZeroR[i] << endl;
240   cout << "fZeroI " << endl;
241   for(i=0; i<AliITSetfSDDparam::NumberOfPoles(); i++) cout << fZeroI[i] << endl;
242   cout << "fPoleM " << endl;
243   for(i=0; i<AliITSetfSDDparam::NumberOfPoles(); i++) cout << fPoleM[i] << endl;
244   cout << "fPoleR " << endl;
245   for(i=0; i<AliITSetfSDDparam::NumberOfPoles(); i++) cout << fPoleR[i] << endl;
246   cout << "fPoleI " << endl;
247   for(i=0; i<AliITSetfSDDparam::NumberOfPoles(); i++) cout << fPoleI[i] << endl;
248
249   cout << "Transfer function" << endl;
250   cout << "Real Part" << endl;
251   for(i=0; i<AliITSetfSDDparam::NumberOfSamples(); i++) cout << fTfR[i] << endl;
252   cout << "Imaginary Part " << endl;
253   for(i=0; i<AliITSetfSDDparam::NumberOfSamples(); i++) cout << fTfI[i] << endl;
254
255   cout << "Fourier Weights" << endl;
256   cout << "Real Part" << endl;
257   for(i=0; i<AliITSetfSDDparam::NumberOfSamples(); i++) cout << fWR[i] << endl;
258   cout << "Imaginary Part " << endl;
259   for(i=0; i<AliITSetfSDDparam::NumberOfSamples(); i++) cout << fWI[i] << endl;
260 }
261
262
263
264
265
266
267
268