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