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