StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StTrsSlowAnalogSignalGenerator.hh
1 /***************************************************************************
2  *
3  * $Id: StTrsSlowAnalogSignalGenerator.hh,v 1.7 2008/10/13 19:56:11 fisyak Exp $
4  *
5  * Author:
6  ***************************************************************************
7  *
8  * Description:
9  *
10  ***************************************************************************
11  *
12  * $Log: StTrsSlowAnalogSignalGenerator.hh,v $
13  * Revision 1.7 2008/10/13 19:56:11 fisyak
14  * Account that Z-offset is sector dependent
15  *
16  * Revision 1.6 2003/09/02 17:59:16 perev
17  * gcc 3.2 updates + WarnOff
18  *
19  * Revision 1.5 1999/02/16 23:34:19 lasiuk
20  * inline 2 functions
21  * merge operations for speed up (after profiler0
22  *
23  * Revision 1.4 1999/01/18 21:01:42 lasiuk
24  * use fractionSampled(); enumerated types for function selection
25  *
26  * Revision 1.3 1999/01/18 10:20:57 lasiuk
27  * use integral to deposit total charge in time bin
28  *
29  * Revision 1.2 1998/11/16 14:49:43 lasiuk
30  * add deltaResponse()
31  *
32  * Revision 1.1 1998/11/10 17:12:12 fisyak
33  * Put Brian trs versin into StRoot
34  *
35  * Revision 1.3 1998/11/04 18:47:18 lasiuk
36  * signal sampler machinery
37  *
38  * Revision 1.2 1998/10/22 14:58:14 lasiuk
39  * image charge returns double and uses PRF integral
40  *
41  * Revision 1.1 1998/06/30 22:54:09 lasiuk
42  * Initial Revision
43  *
44  **************************************************************************/
45 #ifndef ST_TRS_SLOW_ANALOG_SIGNAL_GENERATOR_HH
46 #define ST_TRS_SLOW_ANALOG_SIGNAL_GENERATOR_HH
47 
48 #include <Stiostream.h>
49 #include "StTrsAnalogSignalGenerator.hh"
50 
52 public:
53  enum StDistribution {endo,
54  gatti,
55  dipole,
56  unknown};
57 
58  enum StSignal {delta,
59  symmetricGaussianApproximation,
60  symmetricGaussianExact,
61  asymmetricGaussianApproximation,
62  realShaper,
63  undefined};
64 
65 public:
67  //StTrsSlowAnalogSignalGenerator(const StTrsSlowAnalogSignalGenerator&);
68  //StTrsSlowAnalogSignalGenerator& operator=(const StTrsSlowAnalogSignalGenerator&);
69 
70  static StTrsAnalogSignalGenerator* instance();
72 
73  // charge generation
74  void setChargeDistribution(StDistribution);
75  void inducedChargeOnPad(StTrsWireHistogram*,Int_t sector);
76  inline double signalOnPad(double, double, double, double, double, double);
77 
78  // sampling
79  void setElectronicSampler(StSignal);
80  void sampleAnalogSignal();
81  inline double signalSampler(double, StTrsAnalogSignal&);
82 
83 private:
84  // charge generation
85  double imageChargeIntegral(double, double, double, double, double, double);
86  double endoChargeIntegral(double, double, double, double, double, double);
87  //double gattiChargeIntegral(double, double, double, double, double, double);
88 
89  // sampling
90  double deltaResponse(double, StTrsAnalogSignal&);
91  double symmetricGaussianApproximateResponse(double, StTrsAnalogSignal&);
92  double symmetricGaussianExactResponse(double, StTrsAnalogSignal&);
93  double asymmetricGaussianApproximateResponse(double, StTrsAnalogSignal&);
94  // double asymmetricGaussianResponseWithUnrestoredBaseline(double, StTrsAnalogSignal&);
95  double realShaperResponse(double, StTrsAnalogSignal&);
96  double oneOverT(double, double);
97 
98 protected:
99  //StTrsSlowAnalogSignalGenerator();
101 
102 private:
103  static StTrsAnalogSignalGenerator* mInstance;
104 
105  double mDriftVelocity;
106  double mTimeBinWidth;
107  double mTau;
108  double mTau1;
109  double mTau2;
110  double mSymGausApproxFactor;
111  double mAsymGausApproxFactor;
112  double mAsymGausUnRestFactor;
113 
114  StDistribution mChargeDistribution;
115  StSignal mSampler;
116 };
117 inline double StTrsSlowAnalogSignalGenerator::signalSampler(double t, StTrsAnalogSignal& sig)
118 {
119  //
120  // This is where the function for the Signal Sampling is selected
121  // Add a function that returns the amplitude of a signal at
122  // a time 't' given the position in time and amplitude of all
123  // the other signals (contained in the StTrsAnalogSignal 'sig'
124  // -- symmetricGaussianResponse
125  // -- asymmetricGaussianResponse
126  // -- endoResponse
127 
128  if(mSampler == (StTrsSlowAnalogSignalGenerator::undefined)) {
129  cerr << "ERROR: no function selected" << endl;
130  // this would be a good place to throw an exception
131  exit(0);
132  }
133 
134  switch(mSampler)
135  {
136  case symmetricGaussianApproximation:
137  return symmetricGaussianApproximateResponse(t, sig);
138  break;
139  case delta:
140  return deltaResponse(t, sig);
141  break;
142  case symmetricGaussianExact:
143  return symmetricGaussianExactResponse(t, sig);
144  break;
145  case asymmetricGaussianApproximation:
146  return asymmetricGaussianApproximateResponse(t, sig);
147  break;
148  case realShaper:
149  return realShaperResponse(t,sig);
150  break;
151  //case StSignal::asymmetricGaussianResponseWithUnRestoredBaseline:
152  //return asymmetricGaussianResponseWithUnRestoredBaseline(t, sig);
153  //break;
154  default:
155  cerr << "Default Function Selected. ERROR!" << endl;
156  exit(0);
157  break;
158  }
159 }
160 
161 inline double StTrsSlowAnalogSignalGenerator::signalOnPad(double xo, double yo, double xl, double xu, double yl, double yu)
162 {
163 // cout << "StTrsSlowAnalogSignalGenerator::signalOnPad()" << endl;
164  switch(mChargeDistribution)
165  {
166  case endo:
167 // cout << "********************Endo" << endl;
168  return endoChargeIntegral(xo,yo,xl,xu,yl,yu);
169  break;
170  case gatti:
171 // cout << "********************GATTI" << endl;
172 // return gattiChargeIntegral(xo,yo,xl,xu,yl,yu);
173  cout << "Gatti Distribution Not Implemented Yet!" << endl;
174  exit(0);
175  break;
176  case dipole:
177 // cout << "********************DIPOLE" << endl;
178  return imageChargeIntegral(xo,yo,xl,xu,yl,yu);
179  break;
180  default:
181  cerr << "Default Function Selected. ERROR!" << endl;
182  exit(0);
183  break;
184  }
185 }
186 #endif