StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StTrsChargeTransporter.cc
1 /**********************************************************************
2  *
3  * $Id: StTrsChargeTransporter.cc,v 1.10 2008/06/20 15:01:16 fisyak Exp $
4  *
5  * Author: brian Nov 1, 1998
6  *
7  **********************************************************************
8  *
9  * Description: Abstract class does initialization
10  *
11  **********************************************************************
12  *
13  * $Log: StTrsChargeTransporter.cc,v $
14  * Revision 1.10 2008/06/20 15:01:16 fisyak
15  * move from StTrsData to StTpcRawData
16  *
17  * Revision 1.9 2004/05/03 23:31:12 perev
18  * Possible non init WarnOff
19  *
20  * Revision 1.8 2003/09/08 02:13:27 perev
21  * fabs instead abs
22  *
23  * Revision 1.7 2003/09/02 17:59:19 perev
24  * gcc 3.2 updates + WarnOff
25  *
26  * Revision 1.6 2001/12/14 20:54:36 hardtke
27  * Fix bug such that transverse diffusion coefficient is set correctly
28  *
29  * Revision 1.5 2000/07/17 19:14:41 long
30  * mSigmaTransverse =
31  * (gasdb->transverseDiffusionCoefficient())/(1+sqr(mOmegaTau));
32  * -----> gasdb->transverseDiffusionCoefficient(),field effects will be calculated
33  * later by reading a table
34  *
35  * Revision 1.4 1999/03/15 13:44:48 lasiuk
36  * omegaTau is calculated assuming mobility is independent of electric field
37  *
38  * Revision 1.3 1999/03/12 18:32:19 lasiuk
39  * diffusion calculation
40  *
41  * Revision 1.2 1999/01/18 10:16:28 lasiuk
42  * units consistency
43  *
44  * Revision 1.1 1998/11/10 17:12:23 fisyak
45  * Put Brian trs versin into StRoot
46  *
47  * Revision 1.3 1998/11/08 17:05:31 lasiuk
48  * boolean macros are not for C++
49  *
50  * Revision 1.2 1998/11/05 19:01:16 lasiuk
51  * setGatingGridVoltage() added
52  * transparency cacluation from db numbers
53  *
54  * Revision 1.1 1998/11/02 22:47:03 lasiuk
55  * Initialization in base class
56  * add attachment
57  * add transparency
58  *
59  **********************************************************************/
60 #include "SystemOfUnits.h"
61 #ifndef ST_NO_NAMESPACES
62 using namespace units;
63 #endif
64 #include "PhysicalConstants.h"
65 
66 #include "StTrsChargeTransporter.hh"
67 
68 HepJamesRandom StTrsChargeTransporter::mEngine;
69 RandFlat StTrsChargeTransporter::mFlatDistribution(mEngine);
70 RandGauss StTrsChargeTransporter::mGaussDistribution(mEngine);
71 
72 StTrsChargeTransporter::StTrsChargeTransporter(StTpcGeometry* geodb, StTpcSlowControl* scdb, StTrsDeDx* gasdb, StMagneticField* magdb)
73  :mChargeAttachment(false), mGatingGridTransparency(false), mTransverseDiffusion(false), mLongitudinalDiffusion(false), mExB(false)
74 {
75  mGeomDb = geodb;
76  mSCDb = scdb;
77  mGasDb = gasdb;
78  mMagDb = magdb;
79 
80  mDriftVelocity = scdb->driftVelocity(13); // East Drift velocity
81  mAttachment = gasdb->attachmentCoefficient();
82  // should actually use a Global Coordinate
83  StThreeVector<double> tmp(0,0,0);
84  mOmegaTau =
85  mDriftVelocity*(mMagDb->at(StThreeVector<double>(0,0,0)).z())/(fabs(scdb->driftVoltage())/(mGeomDb->frischGrid()));
86 // PR(mOmegaTau);
87  mSigmaTransverse = gasdb->transverseDiffusionCoefficient();
88  mSigmaLongitudinal = gasdb->longitudinalDiffusionCoefficient();
89  mO2Concentration = 50.; // 50 ppm //mO2Concentration = scdb->oxygenInPPM();
90  mGateVoltage = -130*volt; // scdb->gatingGridVoltage();
91  mTransparency = 1.;
92 
93  mDoTransparencyCalc = true;
94 }
95 
96 StTrsChargeTransporter::~StTrsChargeTransporter() {/* nopt */}
97 
98 //
99 // GATING GRID TRANSPARENCY CALCULATION
100 //
101 void StTrsChargeTransporter::Lg()
102 {
103  mLg = mZGate - mGatePitch/(2*pi)*::log(2*pi*mGateWireRadius/mGatePitch)-sqr(mZGate)/mDriftDistance;
104 }
105 
106 double StTrsChargeTransporter::transitionVoltage()
107 {
108  double value;
109  value = mDriftVoltage/mDriftDistance*(mZGate - 4*pi*mGateWireRadius*mLg/mGatePitch);
110  return value;
111 }
112 
113 double StTrsChargeTransporter::maximumTransparency()
114 {
115  double value;
116  value = mDriftVoltage/mDriftDistance*(4*pi*mGateWireRadius*mLg/mGatePitch + mZGate);
117  return value;
118 }
119 
120 void StTrsChargeTransporter::sigmaGC()
121 {
122  mSGC = ::fabs(4*pi*mGateWireRadius*epsilon0*mDriftVoltage/mDriftDistance/mGatePitch);
123 // PR(mSGC);
124 }
125 
126 void StTrsChargeTransporter::sigmaG() // (needs gate voltage (data member) charge density of the gating grid
127 {
128  mSG = epsilon0*(mGateVoltage - mZGate*mDriftVoltage/mDriftDistance)/mLg;
129 // PR(mSG);
130 }
131 
132 double StTrsChargeTransporter::sigmaGPlus()
133 {
134  sigmaGC();
135  sigmaG();
136  double term1, term2, value;
137 
138  term1 = ( 1./pi*(mSGC*::sqrt(1-sqr(mSG/mSGC))) );
139  term2 = ( 1./pi*mSG*acos(-mSG/mSGC) ) ;
140  value = term1 + term2;
141  //cout << " term1: " << term1 << " term2 " << term2 << endl;
142  //cout << " sigmaGPlus " << value << endl;
143 
144  return value;
145 }
146 
147 double StTrsChargeTransporter::zeroGateVoltage()
148 { // Transparency
149  double value;
150  value = 1.-mZGate/mLg;
151  return value;
152 }
153 
154 double StTrsChargeTransporter::linearOnset()
155 {
156  double value;
157  value = 1 - 4*pi*mGateWireRadius/mGatePitch;
158  return value;
159 }
160 
161 double StTrsChargeTransporter::linearTransparency()
162 {
163  // T(Vg=0) = zg/Lg
164  // T(Vg_linear) = 1 - 4 pi r_g/s_g
165  double T1 = zeroGateVoltage();
166  double T2 = linearOnset();
167  double V2 = transitionVoltage();
168  //double V1 = 0;
169  double slope = (T2-T1)/V2;
170  double eqn = slope*(mGateVoltage) + T1;
171 
172  return eqn;
173 }
174 double StTrsChargeTransporter::transparencyCalculation()
175 {
176  // set a lot of variables:
177  mDriftVoltage = mSCDb->driftVoltage();
178 // PR(mDriftVoltage);
179 
180  mDriftDistance = mGeomDb->driftDistance(); // (zDriftDistance)
181 // PR(mDriftDistance);
182 
183  mGateWireRadius = mGeomDb->gateWireRadius(); // (gateRadius)
184 // PR(mGateWireRadius);
185 
186  mGatePitch = mGeomDb->gatePitch(); // (gatePitch)
187  // PR(mGatePitch);
188 
189 
190  mZGate = mGeomDb->outerSectorGatingGridPadPlaneSeparation() -
191  mGeomDb->outerSectorFrischGridPadPlaneSeparation();
192 // PR(mZGate);
193 
194 
195  Lg();
196 
197  double trans=-999999.;
198  if(mGateVoltage <= maximumTransparency()) {
199  trans = 1.;
200  }
201  else if(mGateVoltage > maximumTransparency() && mGateVoltage < transitionVoltage()) {
202  double sigmaP = ::fabs(epsilon0*mDriftVoltage/mDriftDistance);
203  trans = (1-(sigmaGPlus()/sigmaP));
204  }
205  else if(mGateVoltage >=transitionVoltage()) {
206  trans = linearTransparency();
207  }
208 
209  return (trans>0) ? trans : 0;
210 }