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
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063 #ifndef ST_TRS_WIRE_HISTOGRAM_HH
00064 #define ST_TRS_WIRE_HISTOGRAM_HH
00065
00066 #include <vector>
00067
00068 #if defined(__sun) && ! defined(__GNUG__)
00069 #include <stdcomp.h>
00070 #endif
00071
00072 #include "StThreeVector.hh"
00073 #include "Randomize.h"
00074 #include "TRandom.h"
00075
00076 #include "StTpcGeometry.hh"
00077 #include "StTpcSlowControl.hh"
00078 #include "StTrsDeDx.hh"
00079 #include "StMagneticField.hh"
00080 #include "StTrsWireBinEntry.hh"
00081
00082 #ifndef ST_NO_TEMPLATE_DEF_ARGS
00083 typedef vector<StTrsWireBinEntry> aTpcWire;
00084 typedef vector<aTpcWire> aTpcWirePlane;
00085 #else
00086 typedef vector<StTrsWireBinEntry, allocator<StTrsWireBinEntry> > aTpcWire;
00087 typedef vector<aTpcWire, allocator<aTpcWire> > aTpcWirePlane;
00088 #endif
00089
00090
00091 class StTrsWireHistogram {
00092 public:
00093 static StTrsWireHistogram* instance(StTpcGeometry*, StTpcSlowControl*, StTrsDeDx*,StMagneticField*);
00094 static void dropit(){delete mInstance;mInstance=0;}
00095 ~StTrsWireHistogram();
00096
00097
00098
00099
00100
00101 int minWire() const;
00102 int maxWire() const;
00103
00104
00105 void addEntry(StTrsWireBinEntry&,int );
00106 void clear();
00107
00108
00109 double wireCoordinate(int) const;
00110 aTpcWire& getWire(int) ;
00111 aTpcWirePlane& getWireHistogram() ;
00112 void FreqFunctionTableBuilder();
00113 double table_fast(double) const;
00114
00115 #ifndef ST_NO_TEMPLATE_DEF_ARGS
00116 vector<double> mFreqFunctionTable;
00117
00118 #else
00119
00120 vector<double, allocator<double> > mFreqFunctionTable;
00121
00122
00123 #endif
00124 double mNumberOfEntriesInTable;
00125 double mRangeOfTable ;
00126
00127
00128
00129
00130
00131
00132
00133 void setDoGasGain(bool) ;
00134 void setGasGainInnerSector(double) ;
00135 void setGasGainOuterSector(double) ;
00136 void setDoGasGainFluctuations(bool);
00137 void setDoSingleElectronMultiplication(bool);
00138 double exponentialAvalanche(int, double) ;
00139 double polyaAvalanche(int, double) ;
00140 double polya() ;
00141 double gaussianAvalanche(int, double) ;
00142
00143
00144 void setDoTimeDelay(bool);
00145
00146 private:
00147 void gasGainCalculation() ;
00148
00149 double noFluctuations(int) const;
00150 TRandom *random;
00151 private:
00152 StTrsWireHistogram(StTpcGeometry*, StTpcSlowControl*, StTrsDeDx*,StMagneticField*);
00153
00154 private:
00155 int mMin;
00156 int mMax;
00157
00158 StTpcGeometry* mGeomDb;
00159 StTpcSlowControl* mSCDb;
00160 StTrsDeDx* mGasDb;
00161
00162
00163
00164
00165 bool mDoGasGain;
00166 bool mDoGasGainFluctuations;
00167 bool mGasGainCalculationDone;
00168 bool mDoSingleElectronMultiplication;
00169
00170
00171 bool mDoTimeDelay;
00172
00173
00174
00175 aTpcWirePlane mSectorWires;
00176
00177 int mNumberOfInnerSectorAnodeWires;
00178 int mNumberOfOuterSectorAnodeWires;
00179 int mTotalNumberOfAnodeWires;
00180
00181 double mInnerSectorGasGain;
00182 double mOuterSectorGasGain;
00183
00184 static StTrsWireHistogram* mInstance;
00185
00186 static HepJamesRandom mEngine;
00187 static RandGauss mGaussianDistribution;
00188 static RandExponential mExponentialDistribution;
00189 float mOmegaTau;
00190 float dx[4];
00191 float dz[4];
00192
00193 };
00194 int inline StTrsWireHistogram::minWire() const {return mMin;}
00195 int inline StTrsWireHistogram::maxWire() const {return mMax;}
00196 void inline StTrsWireHistogram::setDoGasGain(bool gg) {mDoGasGain = gg;}
00197 void inline StTrsWireHistogram::setDoTimeDelay(bool t) {mDoTimeDelay = t;}
00198 void inline StTrsWireHistogram::setDoSingleElectronMultiplication(bool t) {mDoSingleElectronMultiplication = t;}
00199
00200
00201
00202
00203
00204 ;
00205
00206 #endif