StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StTrsAnalogSignalGenerator.cc
1 /***************************************************************************
2  *
3  * $Id: StTrsAnalogSignalGenerator.cc,v 1.12 2003/09/02 17:59:19 perev Exp $
4  *
5  * Author: brian Nov 3, 1998
6  ***************************************************************************
7  *
8  * Description:
9  *
10  ***************************************************************************
11  *
12  * $Log: StTrsAnalogSignalGenerator.cc,v $
13  * Revision 1.12 2003/09/02 17:59:19 perev
14  * gcc 3.2 updates + WarnOff
15  *
16  * Revision 1.11 2000/07/30 02:47:04 long
17  * mDeltaPad(0)---> mDeltaPad(2)
18  *
19  * Revision 1.10 2000/06/23 00:12:40 snelling
20  * Removed dependence on local files now pointed to StDbUtilities
21  *
22  * Revision 1.9 2000/02/10 01:21:49 calderon
23  * Switch to use StTpcDb.
24  * Coordinates checked for consistency.
25  * Fixed problems with StTrsIstream & StTrsOstream.
26  *
27  * Revision 1.8 2000/01/10 23:14:30 lasiuk
28  * Include MACROS for compatiblity with SUN CC5
29  *
30  * Revision 1.7 1999/11/10 15:46:25 calderon
31  * Made changes to reduce timing, including:
32  * Made coordinate transfrom a data member of StTrsAnalogSignalGenerator
33  * Added upper-lower bound instead of symmetric cut.
34  * Revived checking if signal is above threshold.
35  *
36  * Revision 1.6 1999/10/04 15:28:31 long
37  * change on the value of mTimeShiftOfSignalCentroid
38  *
39  * Revision 1.6 1999/10/01 17:15:00 Hui Long
40  * mTimeShiftOfSignalCentroid(See Note in the code..
41  *
42  * Revision 1.5 1999/04/27 15:05:40 lasiuk
43  * itime shift in ns
44  *
45  * Revision 1.4 1999/04/23 19:19:49 lasiuk
46  * add delay to centroid of signal:
47  * Calculated in constructor (mTimeShiftOfSignalCentroid)
48  * and applied in in signalsampler()
49  *
50  * Revision 1.3 1999/02/28 20:13:29 lasiuk
51  * noise additions
52  *
53  * Revision 1.2 1999/01/18 21:00:32 lasiuk
54  * add fractionSampled(); reorder initialization
55  *
56  * Revision 1.1 1998/11/10 17:12:23 fisyak
57  * Put Brian trs versin into StRoot
58  *
59  * Revision 1.2 1998/11/08 17:02:43 lasiuk
60  * vector allocator, TRUE/true
61  *
62  * Revision 1.1 1998/11/04 18:46:11 lasiuk
63  * remove gas gain functionality (now in WireHistogram)
64  * initialization in base class
65  * incorporate signalSampler
66  *
67  **************************************************************************/
68 #include "StTrsAnalogSignalGenerator.hh"
69 #include "SystemOfUnits.h"
70 
71 #ifndef ST_NO_NAMESPACES
72 using namespace units;
73 #endif
74 
75 
76 
77 HepJamesRandom StTrsAnalogSignalGenerator::mEngine;
78 RandGauss StTrsAnalogSignalGenerator::mGaussDistribution(mEngine);
79 
80 StTrsAnalogSignalGenerator::StTrsAnalogSignalGenerator(StTpcGeometry* geo, StTpcSlowControl* sc, StTpcElectronics* el, StTrsSector* sec)
81  : mGeomDb(geo), mSCDb(sc), mElectronicsDb(el),
82  transformer(gStTpcDb),
83  mDeltaPad(2),
84  mDeltaRow(1),
85  mSector(sec),
86  mSignalThreshold(0.*volt),
87  mSuppressEmptyTimeBins(true)
88 {
89  //
90  // signal generation
91  mSigma1 = mElectronicsDb->shapingTime();
92  mSigma2 = 2.*mSigma1;
93  mTau = mElectronicsDb->tau();
94  mGain = mElectronicsDb->nominalGain();
95 
96  mSamplingFrequency = mElectronicsDb->samplingFrequency();
97  fractionSampled();
98  //
99  // noise
100  mAddNoise = false;
101  mAddNoiseUnderSignalOnly = false;
102  mNoiseRMS = 0.;
103  //
104  // Time Shift
105  // mTimeShiftOfSignalCentroid = 3.* mTau;
106  mTimeShiftOfSignalCentroid =mElectronicsDb->tZero();//HL,8/31/99
107  PR(mTimeShiftOfSignalCentroid/nanosecond);
108 
109 }
110 
111 void StTrsAnalogSignalGenerator::fractionSampled()
112 {
113  // Charge collected:
114  // Q(t) = Q ln(1+t/to)
115  // total collection time tmax = 62.5us
116  // sampling time is mSigma1 = 180 ns
117 
118  // should really come from a dataBase, but where??
119  double to = 1.5*nanosecond;
120  double tmax = 62500.*nanosecond;
121 
122  mFractionSampled = ::log(1+mSigma1/to)/::log(1+tmax/to);
123 }