StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StTrsFastChargeTransporter.cc
1 /**********************************************************************
2  *
3  * $Id: StTrsFastChargeTransporter.cc,v 1.19 2009/11/03 14:34:19 fisyak Exp $
4  *
5  * Author: brian June 1, 1998
6  *
7  **********************************************************************
8  *
9  * Description: Real class to project charge segment on pad-plane
10  *
11  **********************************************************************
12  *
13  * $Log: StTrsFastChargeTransporter.cc,v $
14  * Revision 1.19 2009/11/03 14:34:19 fisyak
15  * Remove default in zFromTB
16  *
17  * Revision 1.18 2008/06/20 15:01:17 fisyak
18  * move from StTrsData to StTpcRawData
19  *
20  * Revision 1.17 2003/09/07 03:49:06 perev
21  * gcc 3.2 + WarnOff
22  *
23  * Revision 1.16 2003/09/02 17:59:19 perev
24  * gcc 3.2 updates + WarnOff
25  *
26  * Revision 1.15 2000/07/30 02:39:51 long
27  * comment out diffusion calculations,they will be done in other place.
28  *
29  * Revision 1.14 2000/02/24 16:26:58 long
30  * changes for field on cases ( calculation of diffusion as a function of field)
31  *
32  * Revision 1.14 2000/02/08 long
33  * add sigmaL and sigmaT for all possible value of the field
34  * Revision 1.13 2000/02/10 01:21:50 calderon
35  * Switch to use StTpcDb.
36  * Coordinates checked for consistency.
37  * Fixed problems with StTrsIstream & StTrsOstream.
38  *
39  * Revision 1.12 1999/10/04 18:06:02 long
40  * output of z is not drift length any more due to the new definition of the coordinate system
41  *
42  * Revision 1.11 1999/07/13 17:46:44 lasiuk
43  * diffusion
44  *
45  * Revision 1.10 1999/07/09 03:47:56 lasiuk
46  * scale the centroid shift of charge distribution by the sqrt of the
47  * number of electrons. Original code was for single electrons ONLY!
48  *
49  * Revision 1.9 1999/04/07 15:05:08 lasiuk
50  * typo
51  *
52  * Revision 1.8 1999/04/07 00:49:36 lasiuk
53  * use the z offset for drift length
54  *
55  * Revision 1.7 1999/02/14 20:46:06 lasiuk
56  * debug info
57  *
58  * Revision 1.6 1999/02/12 01:26:37 lasiuk
59  * Limit debug output
60  *
61  * Revision 1.5 1999/02/10 18:02:54 lasiuk
62  * debug output
63  *
64  * Revision 1.4 1999/01/28 02:47:03 lasiuk
65  * drift length ambiguity
66  *
67  * Revision 1.3 1999/01/18 21:02:14 lasiuk
68  * frisch grid for +/-z
69  *
70  * Revision 1.2 1999/01/18 10:14:26 lasiuk
71  * pressure in mbar
72  *
73  * Revision 1.1 1998/11/10 17:12:24 fisyak
74  * Put Brian trs versin into StRoot
75  *
76  * Revision 1.3 1998/11/02 22:47:03 lasiuk
77  * Initialization in base class
78  * add attachment
79  * add transparency
80  *
81  * Revision 1.2 1998/10/22 00:24:23 lasiuk
82  * Oct 22
83  *
84  * Revision 1.1 1998/06/04 23:31:58 lasiuk
85  * Initial Revision
86  *
87  **********************************************************************/
88 #include "StTrsFastChargeTransporter.hh"
89 #include <unistd.h>
90 
91 StTrsChargeTransporter* StTrsFastChargeTransporter::mInstance = 0; // static data member
92 
93 StTrsChargeTransporter* StTrsFastChargeTransporter::instance(StTpcGeometry* geo, StTpcSlowControl* sc, StTrsDeDx* gas, StMagneticField* mag)
94 {
95  if(!mInstance) { // create an instance:
96  mInstance = new StTrsFastChargeTransporter(geo, sc, gas, mag);
97  }
98  //else do nothing
99 
100  return mInstance;
101 }
102 
103 StTrsFastChargeTransporter::StTrsFastChargeTransporter(StTpcGeometry* geodb, StTpcSlowControl* scdb, StTrsDeDx* gasdb, StMagneticField* magdb)
104  : StTrsChargeTransporter(geodb, scdb, gasdb, magdb)
105 {int i= fieldFactorTable(); if(i){/* nopt*/ }}
106 
107 StTrsFastChargeTransporter::~StTrsFastChargeTransporter() {/* nopt */}
108 
109 int StTrsFastChargeTransporter::fieldFactorTable()
110 {
111  mB2[0]=2.143;//in KG^2
112  mK[0]=0.51848343;
113  mb[0]=1.0;
114  mB2[1]=6.4286;//in KG^2
115  mK[1]=0.34075;
116  mb[1]=1.38088;
117  mB2[2]=12.14286;//in KG^2
118  mK[2]=0.325;
119  mb[2]=1.4821;
120  mB2[3]=25.0;//in KG^2
121  mK[3]=0.22222;
122  mb[3]=2.7302;
123  return 1;
124 
125 }
126 void StTrsFastChargeTransporter::transportToWire(StTrsMiniChargeSegment& seg,double& SigmaL,double& SigmaT)
127 {
128  double b =mMagDb->at(StThreeVector<double>(0,0,0)).z()/kilogauss;
129  b =b*b;//in KG^2
130  double driftLength =seg.position().z();//in cm
131  double drift =driftLength;
132 
133 
134  if( b <mB2[1])
135 
136  SigmaT= b<mB2[0]? mSigmaTransverse *::sqrt(drift/(mK[0]*b+mb[0])):
137  mSigmaTransverse *::sqrt(drift/(mK[1]*b+mb[1])) ;
138  else
139  SigmaT= b<mB2[2]? mSigmaTransverse *::sqrt(drift/(mK[2]*b+mb[2])):
140  mSigmaTransverse *::sqrt(drift/(mK[3]*b+mb[3])) ;
141  SigmaL= mSigmaLongitudinal*::sqrt(drift);
142  // Projection onto pad plane
143  //PR(mGeomDb->frischGrid());
144  //double frischGrid = (seg.position().z() > 0) ?
145  //mGeomDb->frischGrid() : -mGeomDb->frischGrid();
146 // PR(frischGrid);
147  // must keep time/z position of cluster! -->
148  // replace z component with transit (drift) distance!
149 // double driftLength = (frischGrid>0) ?
150 // frischGrid - seg.position().z() :
151 // seg.position().z() - frischGrid ;
152  // With the present coordinate system, local z is now drift length.
153  // MCBS Feb 2000
154  // double driftLength = seg.position().z();
155 
156 
157 
158 
159 // PR(driftLength);
160  if (driftLength<0) {// PROBLEMS
161  cout << "ERROR: StTrsFastChargeTransporter::transportToWire()" << endl;
162  cout << "ERROR: Drift distance < 0" << endl;
163  //continue; // Do something!!!
164  }
165  //
166  // Diffusion to move the centroid of the charge cluster
167  // while in transport. Must be scaled by the number
168  // of electrons in the charge cluster
169  //
170  // double ne = ::sqrt(seg.charge());
171  if (mTransverseDiffusion) {
172  // seg.position().setX(mGaussDistribution.shoot(seg.position().x(),
173  // SigmaT/ne));
174  // seg.position().setY(mGaussDistribution.shoot(seg.position().y(),
175  // SigmaT/ne));
176 
177  } // else do not alter the position!
178 
179  if (mLongitudinalDiffusion) {
180 
181  // seg.position().setZ(mGaussDistribution.shoot(seg.position().z(),
182  // SigmaL/ne));
183 
184  }
185  else {
186  // must alter the position to reflect the drift length. This information is
187  // needed in order to properly treat the charge distribution onto the wire plane!
188 
189  }
190 
191  if (seg.position().y() > mGeomDb->firstOuterSectorAnodeWire())
192  seg.position().setZ(seg.position().z()+ mGeomDb->outerSectorzOffSet());
193  else
194  seg.position().setZ(seg.position().z()+ mGeomDb->innerSectorzOffSet());
195  //
196  // Alter charge with:
197  // - absorption (O2)
198  // - wire grid transmision
199 
200  // O2 abosorption (stat)
201  if(mChargeAttachment) {
202  seg.setCharge(seg.charge()*chargeAttachment(driftLength));
203  }
204 
205 // PR(seg.charge());
206 
207  // Grid Transparency (stat)
208  if(mGatingGridTransparency) {
209  //PR(wireGridTransmission());
210  seg.setCharge(seg.charge()*wireGridTransmission());
211  }
212 
213 // PR(seg.charge());
214 }
215 
216 double StTrsFastChargeTransporter::wireGridTransmission()
217 {
218  if(mDoTransparencyCalc)
219  mTransparency = transparencyCalculation();
220  return mTransparency;
221 }
222 
223 double StTrsFastChargeTransporter::chargeAttachment(double driftL) const
224 {
225 // PR(mAttachment);
226 // PR(mO2Concentration);
227 // PR(.760*bar);
228 // PR(driftL);
229 // PR(mSCDb->driftVelocity());
230 // double suppression = 1.-mAttachment*(mO2Concentration/1.e+6)*sqr(.760*bar)*driftL/mSCDb->driftVelocity();
231 // PR(suppression);
232 
233  return 1.-mAttachment*(mO2Concentration/1.e+6)*sqr(.760*bar)*driftL/mDriftVelocity;
234 }