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