StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StTrsParameterizedAnalogSignalGenerator.hh
1 /***************************************************************************
2  *
3  * StTrsParameterizedAnalogSignalGenerator.hh,v 1.1 1999/10/01
4  * 17:15:00 HUi Long Exp $
5  *
6  * Author: Hui Long
7  ***************************************************************************
8  *
9  * Description: Head file for the StTrsParameterizedAnalogSignalGenerator.cc.
10  *
11  *
12  ***************************************************************************
13  *
14  * $Log : v1.1 Hui Long$
15  *
16  **************************************************************************/
17 #ifndef ST_TRS_PARAMETERIZED_ANALOG_SIGNAL_GENERATOR_HH
18 #define ST_TRS_PARAMETERIZED_ANALOG_SIGNAL_GENERATOR_HH
19 
20 
21 
22 #include "StTpcDb/StTpcDb.h"
23 #include "TRandom.h"
24 #include <Stiostream.h>
25 #include "StTrsAnalogSignalGenerator.hh"
26 class SignalSum_t;
28 public:
29 
30 
31 public:
33  //StTrsParameterizedAnalogSignalGenerator(const StTrsParameterizedAnalogSignalGenerator&);
34  //StTrsParameterizedAnalogSignalGenerator& operator=(const StTrsParameterizedAnalogSignalGenerator&);
35 
36  static StTrsAnalogSignalGenerator* instance();
38 
39  // charge generation
40  void inducedChargeOnPad(StTrsWireHistogram*, Int_t sector);
41 
42  // sampling
43  void sampleAnalogSignal();
44  double signalSampler(double, StTrsAnalogSignal&);
45  double addNoise(double sigma);
46  void addNoise(bool l) {StTrsAnalogSignalGenerator::addNoise(l);}
47  void setNormalFactor(double FudgeFactor);
48  void addSignal(const int id, const double signal, SignalSum_t &sum);
49  int SignalId(SignalSum_t &sum);
50 
51 private:
52  // sampling
53  double realShaperResponse(double, StTrsAnalogSignal&);
54  // error function table initialization
55  void errorFunctionTableBuilder();
56  void localArrayBuilder();
57  double erf_fast(double) const;
58 
59 protected:
61 
62 private:
63  static StTrsAnalogSignalGenerator* mInstance;
64  StTpcDb* gTpcDbPtr;
65 
66  double mDriftVelocity;
67  double mTimeBinWidth;
68  double mTau;
69  double mSamplingFrequency;
70  double mFractionSampled;
71  double mPadResponseFunctionSigma;
72  double normalFactor;
73 const double mPadResponseFunctionSigmaOuter;
74 const double mPadResponseFunctionSigmaInner;
75 
76 
77  vector<double, allocator<double> > mChargeFractionOuter;
78  vector<double, allocator<double> > mChargeFractionInner;
79  vector<double, allocator<double> > mErrorFunctionTable;
80  vector<double, allocator<double> > mYb;
81 
82  double mNumberOfEntriesInTable;
83  double mRangeOfTable ;
84  int mPadsAtRow[200];
85  //To avoid initialization, define the following data members.
86  StTpcPadCoordinate mTpcRaw;
87  int mCentralPad;
88  int mCentralRow;
89  int mNumberOfRows;
90  int mNumberOfInnerRows;
91  double mFrischGrid;
92 
93  double rowNormalization;
94  double padWidth, padLength;
95  double zoffset, wire_to_plane_coupling;
96  double xCentroid[100][500], yCentroid[100],SignalInTimeBin[1000],gain[100][500];
97  double delx, gridMinusZ, sigma_x, localXDirectionCoupling[500];
98  double dely, constant, localYDirectionCoupling;
99  double timeOfSignal, chargeOfSignal;
100  double t, tzero, K, sigmaLoverTau, lambda,lambdasqr;
101  double mAdcConversion;
102  double landauConstant,landauMean,landauSigma,expConstant,expSlope,landauCut,
103  GausConstant[6], GausMean[6], GausSigma2[6],ExpConstant[6],ExpSlope[6],cutT[6];
104 
105 };
106 
107 inline double StTrsParameterizedAnalogSignalGenerator::signalSampler(double tt, StTrsAnalogSignal& sig)
108 {
109  //
110  // This is where the function for the Signal Sampling is selected
111  // Add a function that returns the amplitude of a signal at
112  // a time 't' given the position in time and amplitude of all
113  // the other signals (contained in the StTrsAnalogSignal 'sig'
114 
115 
116  return realShaperResponse(tt,sig);
117 
118 }
119 
120 inline void StTrsParameterizedAnalogSignalGenerator::setNormalFactor(double FudgeFactor) {normalFactor = FudgeFactor; cout << "TRS::Normal (Fudge) Factor applied to gain = " << normalFactor << endl;}
121 
122 #endif
123 
124 
125 
126