StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StTrsWireHistogram.hh
1 /***************************************************************************
2  *
3  * $Id: StTrsWireHistogram.hh,v 1.9 2001/02/15 21:34:48 perev Exp $
4  *
5  * Author: brian, May 1998
6  ***************************************************************************
7  *
8  * Description: Collection of all StTrsMiniChargeSegment transported to
9  * the pad-plane
10  *
11  ***************************************************************************
12  *
13  * $Log: StTrsWireHistogram.hh,v $
14  * Revision 1.9 2001/02/15 21:34:48 perev
15  * clear improved
16  *
17  * Revision 1.8 2000/07/30 02:43:13 long
18  * add erf function look up table,table builder,etc.
19  *
20  * Revision 1.7 1999/12/08 02:10:25 calderon
21  * Modified to eliminate warnings on Linux.
22  *
23  * Revision 1.6 1999/07/19 21:39:31 lasiuk
24  * - addEntry() distributes charge on a (user) settable range of wires
25  * - setRangeOfWiresForChargeDistribution(int) added (default is 0)
26  *
27  * Revision 1.5 1999/07/09 03:46:49 lasiuk
28  * add switch for singleElectron multiplication, gaussian random
29  * number generator
30  *
31  * Revision 1.4 1999/06/16 14:26:51 fisyak
32  * Add flags for egcs on Solaris
33  *
34  * Revision 1.3 1999/02/10 18:03:27 lasiuk
35  * gas gain manual setting
36  *
37  * Revision 1.2 1998/11/16 14:50:22 lasiuk
38  * remove diagnostics (mLastEntry, mLastWire)
39  *
40  * Revision 1.1 1998/11/10 17:12:13 fisyak
41  * Put Brian trs versin into StRoot
42  *
43  * Revision 1.5 1998/11/08 17:07:53 lasiuk
44  * change from boolean macros
45  * use resize() for LINUX/ allocators for SUN
46  * add typedefs for vector<> types
47  *
48  * Revision 1.4 1998/11/03 17:31:47 lasiuk
49  * incorporate gas gain/fluctuations
50  * add time delay of collection depending on charge position wrt wire position
51  * rename wire()
52  *
53  * Revision 1.3 1998/10/22 00:23:26 lasiuk
54  * Oct 22
55  *
56  * Revision 1.2 1998/06/30 22:56:59 lasiuk
57  * added clear(), wire() and wireHistogram()
58  *
59  * Revision 1.1 1998/06/04 23:32:21 lasiuk
60  * Initial Revision
61  *
62  **************************************************************************/
63 #ifndef ST_TRS_WIRE_HISTOGRAM_HH
64 #define ST_TRS_WIRE_HISTOGRAM_HH
65 
66 #include <vector>
67 
68 #if defined(__sun) && ! defined(__GNUG__)
69 #include <stdcomp.h>
70 #endif
71 
72 #include "StThreeVector.hh"
73 #include "Randomize.h"
74 #include "TRandom.h"
75 
76 #include "StTpcGeometry.hh"
77 #include "StTpcSlowControl.hh"
78 #include "StTrsDeDx.hh"
79 #include "StMagneticField.hh"
80 #include "StTrsWireBinEntry.hh"
81 
82 #ifndef ST_NO_TEMPLATE_DEF_ARGS
83 typedef vector<StTrsWireBinEntry> aTpcWire;
84 typedef vector<aTpcWire> aTpcWirePlane;
85 #else
86 typedef vector<StTrsWireBinEntry, allocator<StTrsWireBinEntry> > aTpcWire;
87 typedef vector<aTpcWire, allocator<aTpcWire> > aTpcWirePlane;
88 #endif
89 
90 
92 public:
94  static void dropit(){delete mInstance;mInstance=0;}
96 
97  //StTrsWireHistogram(const StTrsWireHistogramy&);
98  //StTrsWireHistogram& operator=(cont StTrsWireHistogram&);
99 
100  // access functions
101  int minWire() const;
102  int maxWire() const;
103 
104  // Book-keeping
105  void addEntry(StTrsWireBinEntry&,int );
106  void clear();
107 
108  // Wire Operations (and access)
109  double wireCoordinate(int) const;
110  aTpcWire& getWire(int) ;
111  aTpcWirePlane& getWireHistogram() ;
112  void FreqFunctionTableBuilder();
113  double table_fast(double) const;
114 
115 #ifndef ST_NO_TEMPLATE_DEF_ARGS
116  vector<double> mFreqFunctionTable;
117 
118 #else
119 
120  vector<double, allocator<double> > mFreqFunctionTable;
121 
122 
123 #endif
124  double mNumberOfEntriesInTable;
125  double mRangeOfTable ;
126  //Maybe needed later?
127  //void sortTimeBins();
128  //void putWire(vector<StTrsWireBinEntry>&);
129 
130 
131 
132  // Gas Gain
133  void setDoGasGain(bool) ;
134  void setGasGainInnerSector(double) ;
135  void setGasGainOuterSector(double) ;
136  void setDoGasGainFluctuations(bool);
137  void setDoSingleElectronMultiplication(bool);
138  double exponentialAvalanche(int, double) ;
139  double polyaAvalanche(int, double) ;
140  double polya() ;//b=0.4
141  double gaussianAvalanche(int, double) ;
142 
143  // Time Delay For Charge Collection
144  void setDoTimeDelay(bool);
145 
146 private:
147  void gasGainCalculation() ;
148 
149  double noFluctuations(int) const;
150  TRandom *random;
151 private:
153 
154 private:
155  int mMin; // minimum bin filled
156  int mMax; // maximum bin filled
157 
158  StTpcGeometry* mGeomDb;
159  StTpcSlowControl* mSCDb;
160  StTrsDeDx* mGasDb;
161 
162  // void setRangeOfWiresForChargeDistribution(int);
163 
164  // Gas Gain
165  bool mDoGasGain;
166  bool mDoGasGainFluctuations;
167  bool mGasGainCalculationDone;
168  bool mDoSingleElectronMultiplication;
169 
170  // Time Delay
171  bool mDoTimeDelay;
172 
173  // Charge Distribution
174 
175  aTpcWirePlane mSectorWires;
176 
177  int mNumberOfInnerSectorAnodeWires; // from dataBase
178  int mNumberOfOuterSectorAnodeWires; // from dataBase
179  int mTotalNumberOfAnodeWires;
180 
181  double mInnerSectorGasGain;
182  double mOuterSectorGasGain;
183 
184  static StTrsWireHistogram* mInstance;
185 
186  static HepJamesRandom mEngine;
187  static RandGauss mGaussianDistribution;
188  static RandExponential mExponentialDistribution;
189  float mOmegaTau;
190  float dx[4];
191  float dz[4];
192 
193 };
194 int inline StTrsWireHistogram::minWire() const {return mMin;}
195 int inline StTrsWireHistogram::maxWire() const {return mMax;}
196 void inline StTrsWireHistogram::setDoGasGain(bool gg) {mDoGasGain = gg;}
197 void inline StTrsWireHistogram::setDoTimeDelay(bool t) {mDoTimeDelay = t;}
198 void inline StTrsWireHistogram::setDoSingleElectronMultiplication(bool t) {mDoSingleElectronMultiplication = t;}
199 
200 
201 
202 
203 
204 ;
205 
206 #endif