Fixing a little overlap. Adding flags to perform material budget studies (Mario)
[u/mrichter/AliRoot.git] / ITS / AliITSetfSDD.cxx
CommitLineData
b0f5e3fc 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 **************************************************************************/
4ae5bbc4 15
88cb7938 16/* $Id$ */
b9d0a01d 17
ee523d3a 18
4ae5bbc4 19#include <Riostream.h>
b0f5e3fc 20#include <TMath.h>
21#include "AliITSetfSDD.h"
22
23////////////////////////////////////////////////////////////////////////
24// Version: 0
25// Written by Piergiorgio Cerello
26// November 23 1999
ee523d3a 27// Revised to comply with coding conventions: Nov, 21 2003 m.m.
b0f5e3fc 28//_____________________________________________________________________________
b669392e 29
fe7d86eb 30using std::endl;
31using std::cout;
b0f5e3fc 32ClassImp(AliITSetfSDD)
33
ee523d3a 34const Int_t AliITSetfSDD::AliITSetfSDDparam::fgkMaxNofPoles = 5;
35const Int_t AliITSetfSDD::AliITSetfSDDparam::fgkMaxNofSamples = 1024;
36
7537d03c 37AliITSetfSDD::AliITSetfSDD():
38fTimeDelay(0),
39fSamplingTime(0),
40fT0(0),
41fDf(0.),
42fA0(0.) ,
43fZeroM(0),
44fZeroR(0),
45fZeroI(0),
46fPoleM(0),
47fPoleR(0),
48fPoleI(0),
49fTfR(0),
50fTfI(0),
51fWR(0),
52fWI(0){
ee523d3a 53 // Default constructor
ee523d3a 54}
55
7537d03c 56AliITSetfSDD::AliITSetfSDD(Double_t timestep, Int_t amplif):
57fTimeDelay(0),
58fSamplingTime(0),
59fT0(0),
60fDf(0.),
61fA0(0.) ,
62fZeroM(0),
63fZeroR(0),
64fZeroI(0),
65fPoleM(0),
66fPoleR(0),
67fPoleI(0),
68fTfR(0),
69fTfI(0),
70fWR(0),
71fWI(0)
b0f5e3fc 72{
ee523d3a 73 // Standard constructor. sampling time in ns
e8189707 74
ee523d3a 75 /*
76 cout<<"Number of poles: "<<AliITSetfSDDparam::NumberOfPoles()<<endl;
77 cout<<"Number of samples: "<<AliITSetfSDDparam::NumberOfSamples()<<endl;
78 */
11ad066f 79 fTimeDelay = 53.5;
80 if(amplif == 2) fTimeDelay = 35.5;
e8189707 81 fSamplingTime = timestep;
8343dab6 82 Double_t xGiga=1.0E+9;
b0f5e3fc 83 fT0 = 0.;
8343dab6 84 fDf = xGiga/(AliITSetfSDDparam::NumberOfSamples()*fSamplingTime);
e8189707 85 Int_t i,j;
ee523d3a 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++) {
e8189707 98 fZeroM[i] = 0.;
99 fZeroR[i] = 0.;
100 fZeroI[i] = 0.;
101 fPoleM[i] = 0.;
102 fPoleR[i] = 0.;
103 fPoleI[i] = 0.;
b0f5e3fc 104 }
11ad066f 105 // Alice
106
48058160 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.;
11ad066f 116 fPoleR[0] = -3000000.;
117 fPoleI[0] = 4000000.;
48058160 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];
11ad066f 131 }
b0f5e3fc 132
48058160 133 //cout << "fA0: " << fA0 << endl;
134 //cout << "fTimeDelay: " << fTimeDelay << endl;
135
11ad066f 136 // Compute Transfer Function
b0f5e3fc 137
ee523d3a 138 Double_t pigr = acos(-1.);
139 for(i=0; i<=AliITSetfSDDparam::NumberOfSamples()/2; i++) {
b0f5e3fc 140 Double_t frequency = fDf*i;
ee523d3a 141 Double_t vVM = fA0;
142 Double_t vVA = 0.;
143 for(Int_t k=0; k<AliITSetfSDDparam::NumberOfPoles(); k++) {
e8189707 144 if(fZeroM[k]) {
ee523d3a 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;
e8189707 151 for(j=1; j<= (Int_t) fZeroM[k]; j++) {
ee523d3a 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;
b0f5e3fc 157 }
158 }
159
e8189707 160 if(fPoleM[k]) {
ee523d3a 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;
e8189707 167 for(j=1; j<= (Int_t) fPoleM[k]; j++) {
ee523d3a 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;
b0f5e3fc 173 }
174 }
ee523d3a 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;
8343dab6 179 fTfR[i] = vVR*xGiga;
180 fTfI[i] = vVI*xGiga;
e8189707 181 //cout << "fTfR[" << i << "] = " << fTfR[i] << endl;
182 //cout << "fTfI[" << i << "] = " << fTfI[i] << endl;
b0f5e3fc 183 if(i) {
ee523d3a 184 fTfR[AliITSetfSDDparam::NumberOfSamples()-i] = fTfR[i];
185 fTfI[AliITSetfSDDparam::NumberOfSamples()-i] = -fTfI[i];
b0f5e3fc 186 }
187 }
188 }
189
190 // Compute Fourier Weights
191
ee523d3a 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());
b0f5e3fc 195 if(i) {
ee523d3a 196 fWR[AliITSetfSDDparam::NumberOfSamples()-i] = fWR[i];
197 fWI[AliITSetfSDDparam::NumberOfSamples()-i] = -fWI[i];
b0f5e3fc 198 }
199 }
200
201}
202
ee523d3a 203
204AliITSetfSDD::~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
218void AliITSetfSDD::PrintElectronics() const {
219 // Printout of the parameters defining the f.e. electronics
220
11ad066f 221 cout << "Time Delay " << fTimeDelay << endl;
b0f5e3fc 222 cout << "Sampling Time " << fSamplingTime << endl;
ee523d3a 223 cout << "Number of Time Samples " << AliITSetfSDDparam::NumberOfSamples() << endl;
b0f5e3fc 224 cout << "fT0 " << fT0 << endl;
225 cout << "fDf " << fDf << endl;
226 cout << "fA0 " << fA0 << endl;
227
228 cout << "Zero's and Pole's" << endl;
e8189707 229 cout << "fZeroM " << endl;
230 Int_t i;
ee523d3a 231 for(i=0; i<AliITSetfSDDparam::NumberOfPoles(); i++) cout << fZeroM[i] << endl;
b0f5e3fc 232 cout << "fZero_R " << endl;
ee523d3a 233 for(i=0; i<AliITSetfSDDparam::NumberOfPoles(); i++) cout << fZeroR[i] << endl;
e8189707 234 cout << "fZeroI " << endl;
ee523d3a 235 for(i=0; i<AliITSetfSDDparam::NumberOfPoles(); i++) cout << fZeroI[i] << endl;
e8189707 236 cout << "fPoleM " << endl;
ee523d3a 237 for(i=0; i<AliITSetfSDDparam::NumberOfPoles(); i++) cout << fPoleM[i] << endl;
e8189707 238 cout << "fPoleR " << endl;
ee523d3a 239 for(i=0; i<AliITSetfSDDparam::NumberOfPoles(); i++) cout << fPoleR[i] << endl;
e8189707 240 cout << "fPoleI " << endl;
ee523d3a 241 for(i=0; i<AliITSetfSDDparam::NumberOfPoles(); i++) cout << fPoleI[i] << endl;
b0f5e3fc 242
243 cout << "Transfer function" << endl;
244 cout << "Real Part" << endl;
ee523d3a 245 for(i=0; i<AliITSetfSDDparam::NumberOfSamples(); i++) cout << fTfR[i] << endl;
b0f5e3fc 246 cout << "Imaginary Part " << endl;
ee523d3a 247 for(i=0; i<AliITSetfSDDparam::NumberOfSamples(); i++) cout << fTfI[i] << endl;
b0f5e3fc 248
249 cout << "Fourier Weights" << endl;
250 cout << "Real Part" << endl;
ee523d3a 251 for(i=0; i<AliITSetfSDDparam::NumberOfSamples(); i++) cout << fWR[i] << endl;
b0f5e3fc 252 cout << "Imaginary Part " << endl;
ee523d3a 253 for(i=0; i<AliITSetfSDDparam::NumberOfSamples(); i++) cout << fWI[i] << endl;
b0f5e3fc 254}
255
256
257
258
259
260
261
262