00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045 #ifndef ST_TRS_SLOW_ANALOG_SIGNAL_GENERATOR_HH
00046 #define ST_TRS_SLOW_ANALOG_SIGNAL_GENERATOR_HH
00047
00048 #include <Stiostream.h>
00049 #include "StTrsAnalogSignalGenerator.hh"
00050
00051 class StTrsSlowAnalogSignalGenerator : public StTrsAnalogSignalGenerator {
00052 public:
00053 enum StDistribution {endo,
00054 gatti,
00055 dipole,
00056 unknown};
00057
00058 enum StSignal {delta,
00059 symmetricGaussianApproximation,
00060 symmetricGaussianExact,
00061 asymmetricGaussianApproximation,
00062 realShaper,
00063 undefined};
00064
00065 public:
00066 ~StTrsSlowAnalogSignalGenerator();
00067
00068
00069
00070 static StTrsAnalogSignalGenerator* instance();
00071 static StTrsAnalogSignalGenerator* instance(StTpcGeometry*, StTpcSlowControl*, StTpcElectronics*, StTrsSector*);
00072
00073
00074 void setChargeDistribution(StDistribution);
00075 void inducedChargeOnPad(StTrsWireHistogram*,Int_t sector);
00076 inline double signalOnPad(double, double, double, double, double, double);
00077
00078
00079 void setElectronicSampler(StSignal);
00080 void sampleAnalogSignal();
00081 inline double signalSampler(double, StTrsAnalogSignal&);
00082
00083 private:
00084
00085 double imageChargeIntegral(double, double, double, double, double, double);
00086 double endoChargeIntegral(double, double, double, double, double, double);
00087
00088
00089
00090 double deltaResponse(double, StTrsAnalogSignal&);
00091 double symmetricGaussianApproximateResponse(double, StTrsAnalogSignal&);
00092 double symmetricGaussianExactResponse(double, StTrsAnalogSignal&);
00093 double asymmetricGaussianApproximateResponse(double, StTrsAnalogSignal&);
00094
00095 double realShaperResponse(double, StTrsAnalogSignal&);
00096 double oneOverT(double, double);
00097
00098 protected:
00099
00100 StTrsSlowAnalogSignalGenerator(StTpcGeometry*, StTpcSlowControl*, StTpcElectronics*, StTrsSector*);
00101
00102 private:
00103 static StTrsAnalogSignalGenerator* mInstance;
00104
00105 double mDriftVelocity;
00106 double mTimeBinWidth;
00107 double mTau;
00108 double mTau1;
00109 double mTau2;
00110 double mSymGausApproxFactor;
00111 double mAsymGausApproxFactor;
00112 double mAsymGausUnRestFactor;
00113
00114 StDistribution mChargeDistribution;
00115 StSignal mSampler;
00116 };
00117 inline double StTrsSlowAnalogSignalGenerator::signalSampler(double t, StTrsAnalogSignal& sig)
00118 {
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128 if(mSampler == (StTrsSlowAnalogSignalGenerator::undefined)) {
00129 cerr << "ERROR: no function selected" << endl;
00130
00131 exit(0);
00132 }
00133
00134 switch(mSampler)
00135 {
00136 case symmetricGaussianApproximation:
00137 return symmetricGaussianApproximateResponse(t, sig);
00138 break;
00139 case delta:
00140 return deltaResponse(t, sig);
00141 break;
00142 case symmetricGaussianExact:
00143 return symmetricGaussianExactResponse(t, sig);
00144 break;
00145 case asymmetricGaussianApproximation:
00146 return asymmetricGaussianApproximateResponse(t, sig);
00147 break;
00148 case realShaper:
00149 return realShaperResponse(t,sig);
00150 break;
00151
00152
00153
00154 default:
00155 cerr << "Default Function Selected. ERROR!" << endl;
00156 exit(0);
00157 break;
00158 }
00159 }
00160
00161 inline double StTrsSlowAnalogSignalGenerator::signalOnPad(double xo, double yo, double xl, double xu, double yl, double yu)
00162 {
00163
00164 switch(mChargeDistribution)
00165 {
00166 case endo:
00167
00168 return endoChargeIntegral(xo,yo,xl,xu,yl,yu);
00169 break;
00170 case gatti:
00171
00172
00173 cout << "Gatti Distribution Not Implemented Yet!" << endl;
00174 exit(0);
00175 break;
00176 case dipole:
00177
00178 return imageChargeIntegral(xo,yo,xl,xu,yl,yu);
00179 break;
00180 default:
00181 cerr << "Default Function Selected. ERROR!" << endl;
00182 exit(0);
00183 break;
00184 }
00185 }
00186 #endif