test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
CSCDriftSim Class Reference

#include <CSCDriftSim.h>

Public Member Functions

 CSCDriftSim ()
 
CSCDetectorHit getWireHit (const Local3DPoint &ionClusterPosition, const CSCLayer *, int wire, const PSimHit &simHit, CLHEP::HepRandomEngine *)
 
void setMagneticField (const MagneticField *field)
 
 ~CSCDriftSim ()
 

Private Member Functions

double avalancheCharge (CLHEP::HepRandomEngine *)
 
double avgDrift () const
 
double avgDriftTimeHighB ()
 
double avgDriftTimeLowB ()
 
double avgPathLengthHighB ()
 
double avgPathLengthLowB ()
 
double driftSigma () const
 
double driftTimeSigmaHighB ()
 
double driftTimeSigmaLowB ()
 
double gasGain (const CSCDetId &id) const
 
double pathSigmaHighB ()
 
double pathSigmaLowB ()
 

Private Attributes

float bz
 
std::vector< double > dNdEIntegral
 
const double ELECTRON_DIFFUSION_COEFF
 
const double STEP_SIZE
 
const MagneticFieldtheMagneticField
 
double ycell
 
double zcell
 

Detailed Description

Simulate drift of electrons through CSC gas.

Author
Rick Wilkinson

Someday this class will be subclassed into fast and slow sims, Now it's just slow, according to the rest of the ORCA developers...

Last mod:
30-Jun-00 ptc Doxygenate.
Bug-fix in ctor: first bin of integral was 'nan'.
Bug-trap in avalancheCharge(): very rarely could attempt access outside std::vector.

01-08/00 vin use binary search in avalancheCharge()

Definition at line 32 of file CSCDriftSim.h.

Constructor & Destructor Documentation

CSCDriftSim::CSCDriftSim ( )

Definition at line 24 of file CSCDriftSim.cc.

References dNdEIntegral, create_public_lumi_plots::exp, i, N_INTEGRAL_STEPS, funct::pow(), and STEP_SIZE.

25 : bz(0.), // should make these local variables
26  ycell(0.),
27  zcell(0.),
29  STEP_SIZE(0.01),
32 {
33  // just initialize avalanche sim. There has to be a better
34  // way to take the integral of a function!
35  double sum = 0.;
36  int i;
37  for(i = 0; i < N_INTEGRAL_STEPS; ++i) {
38  if(i > 1) {
39  double xx = STEP_SIZE * (double(i) - 0.5 );
40  double dNdE = pow( xx, 0.38) * exp(-1.38*xx);
41 
42  sum += dNdE;
43  }
44  // store this value in the map
45  dNdEIntegral[i] = sum;
46  }
47 
48  // now normalize the whole map
49  for(i = 0; i < N_INTEGRAL_STEPS; ++i) {
50  dNdEIntegral[i] /= sum;
51  }
52 }
int i
Definition: DBlmapReader.cc:9
double zcell
Definition: CSCDriftSim.h:66
const MagneticField * theMagneticField
Definition: CSCDriftSim.h:73
const double STEP_SIZE
Definition: CSCDriftSim.h:69
const double ELECTRON_DIFFUSION_COEFF
Definition: CSCDriftSim.h:71
double ycell
Definition: CSCDriftSim.h:66
static const int N_INTEGRAL_STEPS
Definition: CSCDriftSim.cc:22
std::vector< double > dNdEIntegral
Definition: CSCDriftSim.h:68
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
CSCDriftSim::~CSCDriftSim ( )

Definition at line 55 of file CSCDriftSim.cc.

56 {
57 }

Member Function Documentation

double CSCDriftSim::avalancheCharge ( CLHEP::HepRandomEngine *  engine)
private

Definition at line 138 of file CSCDriftSim.cc.

References dNdEIntegral, i, LogTrace, AlCaHLTBitMon_ParallelJobs::p, STEP_SIZE, and x.

Referenced by getWireHit().

138  {
139  double returnVal = 0.;
140  // pick a random value along the dNdE integral
141  double x = CLHEP::RandFlat::shoot(engine);
142  size_t i;
143  size_t isiz = dNdEIntegral.size();
144  /*
145  for(i = 0; i < isiz-1; ++i) {
146  if(dNdEIntegral[i] > x) break;
147  }
148  */
149  // return position of first element with a value >= x
150  std::vector<double>::const_iterator p=lower_bound(dNdEIntegral.begin(),dNdEIntegral.end(),x);
151  if (p==dNdEIntegral.end()) i=isiz-1;
152  else i = p-dNdEIntegral.begin();
153 
154 
155  // now extrapolate between values
156  if( i == isiz-1 ) {
157  //edm::LogInfo("CSCDriftSim") << "Funky integral in CSCDriftSim " << x;
158  returnVal = STEP_SIZE * double(i) * dNdEIntegral[i];
159  }
160  else {
161  double x1 = dNdEIntegral[i];
162  double x2 = dNdEIntegral[i+1];
163  returnVal = STEP_SIZE * (double(i) + (x-x1)/(x2-x1));
164  }
165  LogTrace("CSCDriftSim") << "CSCDriftSim: avalanche fluc " << returnVal << " " << x ;
166 
167  return returnVal;
168 }
int i
Definition: DBlmapReader.cc:9
const double STEP_SIZE
Definition: CSCDriftSim.h:69
#define LogTrace(id)
std::vector< double > dNdEIntegral
Definition: CSCDriftSim.h:68
double CSCDriftSim::avgDrift ( ) const
private

Definition at line 8 of file CSCDriftParam.cc.

References bz, and zcell.

Referenced by getWireHit().

8  {
9  /* Initialized data */
10 
11  static const double coeff[6] = { -.08618265,-.0020471805,-7.7771331e-4,
12  -.0058433565,-5.0241491e-4,.0010223353 };
13 
14 
15 /* ! Parameterization of Lorentz drift in CSCs */
16 /* ***********************************************************************
17  * DOC MC_ALL_BDFT *
18  * *
19  * DOC Function : Parameterization of the Lorentz drift of electrons *
20  * DOC in the muon endcap CSCs. *
21  * *
22  * DOC References : None *
23  * *
24  * DOC Arguments : BZ - z componant of the local magnetic *
25  * field in kgauss *
26  * DOC ZCELL - distance from the anode wire in the wire *
27  * plane coordinate normalized to one *
28  * DOC Errors : None *
29  * *
30  * DOC Returns : Drift distance along the anode wire *
31  * *
32  * DOC Created : 15-OCT-1996 Author : Jeff Rowe *
33  * ***********************************************************************
34  */
35 
36 
37 
38 
39  const double x10 = 1.;
40  const double x11 = bz / 40.;
41  const double x12 = x11 * 2. * x11 - x10;
42  const double x13 = x11 * 2. * x12 - x11;
43  const double x14 = x11 * 2. * x13 - x12;
44  const double x15 = x11 * 2. * x14 - x13;
45  const double x16 = x11 * 2. * x15 - x14;
46  const double x17 = x11 * 2. * x16 - x15;
47  const double x18 = x11 * 2. * x17 - x16;
48  const double x19 = x11 * 2. * x18 - x17;
49  const double x20 = 1.;
50  const double x21 = zcell;
51  const double x22 = x21 * 2. * x21 - x20;
52  const double x23 = x21 * 2. * x22 - x21;
53  const double x24 = x21 * 2. * x23 - x22;
54  const double x25 = x21 * 2. * x24 - x23;
55  const double x26 = x21 * 2. * x25 - x24;
56  const double x27 = x21 * 2. * x26 - x25;
57 
58  // not sure why we need a minus sign for avgDrift, but we think the
59  // parametrization has a wrong sign. For the +z endcap, bz should
60  // be negative in local coord, so it should drift to the right
61  // if drifting up (neg zcell), and to the left if it drifts down. It doesn't.
62  // the first-order term here is -0.08 * bz/40 * zcell
63 
64  return -1 * (coeff[0] * x11 * x21 + coeff[1] * x17 * x21 + coeff[2] * x21 +
65  coeff[3] * x11 * x27 + coeff[4] * x22 + coeff[5] * x19);
66 }
double zcell
Definition: CSCDriftSim.h:66
double CSCDriftSim::avgDriftTimeHighB ( )
private

Definition at line 157 of file CSCDriftParamHighB.cc.

References ycell, and zcell.

Referenced by getWireHit().

157  {
158  /* Initialized data */
159 
160  static const double coeff[27] = { 22.384492,10.562894,14.032961,7.06233,
161  3.5523289,-5.0176704,1.999075,1.0635552,-3.2770096,-2.7384958,
162  .98411495,-2.0963696,-1.4006525,-.47542728,.64179451,-.80308436,
163  .42964647,-.4153324,.50423068,.35049792,-.42595896,-.30947641,
164  .16671267,-.21336584,.22979164,.23481052,.32550435 };
165 
166  /* System generated locals */
167  float ret_val;
168 
169  /* Local variables */
170  double x10, x11, x12, x13, x14, x15, x16, x17, x20, x21, x22,
171  x23, x24, x25, x26, x27;
172 
173 /* ! Parameterization of drift time - high field chambers */
174 /* ***********************************************************************
175  */
176 /* DOC MC_BHGH_TIME *
177  */
178 /* *
179 */
180 /* DOC Function : Parameterization of the drift time *
181  */
182 /* DOC in the muon endcap CSCs. *
183  */
184 /* *
185 */
186 /* DOC References : None *
187  */
188 /* *
189 */
190 /* DOC Arguments : YCELL - distance from the anode wire in the *
191  */
192 /* anode-cathode coordinate plane *
193 */
194 /* (ycell=1 > d_acat) *
195 */
196 /* DOC ZCELL - distance from the anode wire in the wire *
197  */
198 /* plane coordinate (zcell=1 > d_anod/2.) *
199 */
200 /* DOC Errors : None *
201  */
202 /* *
203 */
204 /* DOC Returns : Drift time for high field CSC chambers *
205  */
206 /* *
207 */
208 /* DOC Created : 15-OCT-1996 Author : Jeff Rowe *
209  */
210 /* ***********************************************************************
211  */
212 
213 
214  x10 = 1.;
215  x11 = fabs(ycell) * 2. - 1.;
216  x12 = x11 * 2. * x11 - x10;
217  x13 = x11 * 2. * x12 - x11;
218  x14 = x11 * 2. * x13 - x12;
219  x15 = x11 * 2. * x14 - x13;
220  x16 = x11 * 2. * x15 - x14;
221  x17 = x11 * 2. * x16 - x15;
222  x20 = 1.;
223  x21 = fabs(zcell) * 2. - 1.;
224  x22 = x21 * 2. * x21 - x20;
225  x23 = x21 * 2. * x22 - x21;
226  x24 = x21 * 2. * x23 - x22;
227  x25 = x21 * 2. * x24 - x23;
228  x26 = x21 * 2. * x25 - x24;
229  x27 = x21 * 2. * x26 - x25;
230 
231  ret_val = coeff[0] + coeff[1] * x11 + coeff[2] * x21 + coeff[3] * x22 +
232  coeff[4] * x23 + coeff[5] * x11 * x21 + coeff[6] * x24 + coeff[7]
233  * x12 + coeff[8] * x11 * x22 + coeff[9] * x11 * x23 + coeff[10] *
234  x25 + coeff[11] * x11 * x24 + coeff[12] * x11 * x25 + coeff[13] *
235  x13 + coeff[14] * x12 * x21 + coeff[15] * x11 * x26 + coeff[16] *
236  x26 + coeff[17] * x11 * x27 + coeff[18] * x17 * x21 + coeff[19] *
237  x15 * x21 + coeff[20] * x12 * x22 + coeff[21] * x12 * x23 + coeff[
238  22] * x27 + coeff[23] * x14 * x22 + coeff[24] * x16 * x21 + coeff[
239  25] * x17 + coeff[26] * x17 * x22;
240 
241  return ret_val;
242 }
double zcell
Definition: CSCDriftSim.h:66
double ycell
Definition: CSCDriftSim.h:66
double CSCDriftSim::avgDriftTimeLowB ( )
private

Definition at line 155 of file CSCDriftParamLowB.cc.

References ycell, and zcell.

Referenced by getWireHit().

155  {
156  /* Initialized data */
157 
158  static const double coeff[20] = { 42.981588,25.732805,26.539129,16.719016,
159  10.862044,7.4859085,5.0353142,3.3620548,1.9057762,2.2207695,
160  -2.6787582,1.2977292,-.8358091,1.2452612,.74813469,-.57581194,
161  .32705275,-.85426489,-.55688158,-.38384903 };
162 
163  /* System generated locals */
164  float ret_val;
165 
166  /* Local variables */
167  double x10, x11, x12, x13, x14, x20, x21, x22, x23, x24, x25,
168  x26, x27, x28, x29;
169 
170 /* ! Parameterization of drift time - low field chambers */
171 /* ***********************************************************************
172  */
173 /* DOC MC_BLOW_TIME *
174  */
175 /* *
176 */
177 /* DOC Function : Parameterization of the drift time *
178  */
179 /* DOC in the muon endcap CSCs. *
180  */
181 /* *
182 */
183 /* DOC References : None *
184  */
185 /* *
186 */
187 /* DOC Arguments : YCELL - distance from the anode wire in the *
188  */
189 /* anode-cathode coordinate plane *
190 */
191 /* (ycell=1 > d_acat) *
192 */
193 /* DOC ZCELL - distance from the anode wire in the wire *
194  */
195 /* plane coordinate (zcell=1 > d_anod/2.) *
196 */
197 /* DOC Errors : None *
198  */
199 /* *
200 */
201 /* DOC Returns : Drift time for low field CSC chambers *
202  */
203 /* *
204 */
205 /* DOC Created : 15-OCT-1996 Author : Jeff Rowe *
206  */
207 /* ***********************************************************************
208  */
209 
210 
211 
212 
213  x10 = 1.;
214  x11 = fabs(ycell) * 2. - 1.;
215  x12 = x11 * 2. * x11 - x10;
216  x13 = x11 * 2. * x12 - x11;
217  x14 = x11 * 2. * x13 - x12;
218  x20 = 1.;
219  x21 = fabs(zcell) * 2. - 1.;
220  x22 = x21 * 2. * x21 - x20;
221  x23 = x21 * 2. * x22 - x21;
222  x24 = x21 * 2. * x23 - x22;
223  x25 = x21 * 2. * x24 - x23;
224  x26 = x21 * 2. * x25 - x24;
225  x27 = x21 * 2. * x26 - x25;
226  x28 = x21 * 2. * x27 - x26;
227  x29 = x21 * 2. * x28 - x27;
228 
229  ret_val = coeff[0] + coeff[1] * x11 + coeff[2] * x21 + coeff[3] * x22 +
230  coeff[4] * x23 + coeff[5] * x24 + coeff[6] * x25 + coeff[7] * x26
231  + coeff[8] * x12 + coeff[9] * x27 + coeff[10] * x11 * x21 + coeff[
232  11] * x28 + coeff[12] * x13 + coeff[13] * x12 * x21 + coeff[14] *
233  x29 + coeff[15] * x13 * x21 + coeff[16] * x14 + coeff[17] * x11 *
234  x22 + coeff[18] * x11 * x23 + coeff[19] * x11 * x24;
235  return ret_val;
236 }
double zcell
Definition: CSCDriftSim.h:66
double ycell
Definition: CSCDriftSim.h:66
double CSCDriftSim::avgPathLengthHighB ( )
private

Definition at line 4 of file CSCDriftParamHighB.cc.

References ycell, and zcell.

Referenced by getWireHit().

4  {
5  /* Initialized data */
6 
7  static const double coeff[18] = { .16916627,.11057547,.054287448,.01179527,
8  .0062073273,-.013570915,-.0027121772,-.0053792764,-.0027452986,
9  -.0020556715,.0021511659,.0011376412,.0026183373,.0017980602,
10  -.0012975418,-.0010798782,-.0012322628,-8.3635924e-4 };
11 
12  /* Local variables */
13  double x10, x11, x12, x13, x14, x20, x21, x22, x23, x24, x25;
14 
15 /* ! Parameterization of drift path length - high field chambers */
16 /* ***********************************************************************
17  */
18 /* DOC MC_BHGH_SLEN *
19  */
20 /* *
21 */
22 /* DOC Function : Parameterization of the drift path length *
23  */
24 /* DOC in the muon endcap CSCs. *
25  */
26 /* *
27 */
28 /* DOC References : None *
29  */
30 /* *
31 */
32 /* DOC Arguments : YCELL - distance from the anode wire in the *
33  */
34 /* anode-cathode coordinate plane *
35 */
36 /* DOC ZCELL - distance from the anode wire in the wire *
37  */
38 /* plane coordinate *
39 */
40 /* DOC Errors : None *
41  */
42 /* *
43 */
44 /* DOC Returns : Drift path length for high field CSC chambers *
45  */
46 /* *
47 */
48 /* DOC Created : 15-OCT-1996 Author : Jeff Rowe *
49  */
50 /* ***********************************************************************
51  */
52 
53 
54 
55  x10 = 1.;
56  x11 = fabs(ycell) * 2. - 1.;
57  x12 = x11 * 2. * x11 - x10;
58  x13 = x11 * 2. * x12 - x11;
59  x14 = x11 * 2. * x13 - x12;
60  x20 = 1.;
61  x21 = fabs(zcell) * 2. - 1.;
62  x22 = x21 * 2. * x21 - x20;
63  x23 = x21 * 2. * x22 - x21;
64  x24 = x21 * 2. * x23 - x22;
65  x25 = x21 * 2. * x24 - x23;
66 
67  return coeff[0] + coeff[1] * x11 + coeff[2] * x21 + coeff[3] * x22 +
68  coeff[4] * x12 + coeff[5] * x11 * x21 + coeff[6] * x13 + coeff[7]
69  * x12 * x22 + coeff[8] * x12 * x23 + coeff[9] * x11 * x24 + coeff[
70  10] * x12 * x21 + coeff[11] * x14 + coeff[12] * x11 * x22 + coeff[
71  13] * x13 * x22 + coeff[14] * x13 * x21 + coeff[15] * x12 * x24 +
72  coeff[16] * x11 * x25 + coeff[17] * x11 * x23;
73 }
double zcell
Definition: CSCDriftSim.h:66
double ycell
Definition: CSCDriftSim.h:66
double CSCDriftSim::avgPathLengthLowB ( )
private

Definition at line 7 of file CSCDriftParamLowB.cc.

References ycell, and zcell.

Referenced by getWireHit().

7  {
8 
9  static const double coeff[7] = { .28872209,.21705601,.063908389,-.012224924,
10  .012901814,-.0089355058,-.015769145 };
11 
12  // System generated locals
13  float ret_val;
14 
15  // Local variables
16  double x10, x11, x12, x13, x20, x21, x22;
17 
18 /* ! Parameterization of drift path length - low field chambers */
19 /* ***********************************************************************
20  */
21 /* DOC MC_BHGH_SLEN *
22  */
23 /* *
24 */
25 /* DOC Function : Parameterization of the drift path length *
26  */
27 /* DOC in the muon endcap CSCs. *
28  */
29 /* *
30 */
31 /* DOC References : None *
32  */
33 /* *
34 */
35 /* DOC Arguments : YCELL - distance from the anode wire in the *
36  */
37 /* anode-cathode coordinate plane *
38 */
39 /* DOC ZCELL - distance from the anode wire in the wire *
40  */
41 /* plane coordinate *
42 */
43 /* DOC Errors : None *
44  */
45 /* *
46 */
47 /* DOC Returns : Drift path length for low field CSC chambers *
48 */
49 /* *
50 */
51 /* DOC Created : 15-OCT-1996 Author : Jeff Rowe *
52  */
53 /* ***********************************************************************
54  */
55 
56 
57  x10 = 1.;
58  x11 = fabs(ycell) * 2. - 1.;
59  x12 = x11 * 2. * x11 - x10;
60  x13 = x11 * 2. * x12 - x11;
61  x20 = 1.;
62  x21 = fabs(zcell) * 2. - 1.;
63  x22 = x21 * 2. * x21 - x20;
64  ret_val = coeff[0] + coeff[1] * x11 + coeff[2] * x21 + coeff[3] * x12 *
65  x22 + coeff[4] * x22 + coeff[5] * x13 + coeff[6] * x11 * x21;
66  return ret_val;
67 }
double zcell
Definition: CSCDriftSim.h:66
double ycell
Definition: CSCDriftSim.h:66
double CSCDriftSim::driftSigma ( ) const
private

Definition at line 69 of file CSCDriftParam.cc.

References bz, and zcell.

Referenced by getWireHit().

69  {
70  // Initialized data
71 
72  static const double coeff[3] = { .01069525,.010364504,.0021662697 };
73 
74 
75 /* ! Parameterization of Lorentz drift error in CSCs */
76 /*************************************************************************
77  * DOC MC_ALL_BSIG *
78  * *
79  * DOC Function : Parameterization of the dispersion in Lorentz Drift*
80  * DOC in the muon endcap CSCs. *
81  * *
82  * DOC References : None *
83  * *
84  * DOC Arguments : BZ - z componant of the local magnetic *
85  * DOC ZCELL - distance from the anode wire in the wire *
86  * plane coordinate normalized to 1 *
87  * DOC Errors : None *
88  * *
89  * DOC Returns : Dispersion in Lorentz drift along anode wire *
90  * *
91  * DOC Created : 15-OCT-1996 Author : Jeff Rowe *
92  * ***********************************************************************
93  */
94 
95 
96  const double x11 = bz / 40.;
97  const double x20 = 1.;
98  const double x21 = zcell;
99  const double x22 = x21 * 2. * x21 - x20;
100 
101  return coeff[0] + coeff[1] * x11 * x21 + coeff[2] * x22;
102 }
double zcell
Definition: CSCDriftSim.h:66
double CSCDriftSim::driftTimeSigmaHighB ( )
private

Definition at line 245 of file CSCDriftParamHighB.cc.

References ycell, and zcell.

Referenced by getWireHit().

245  {
246  /* Initialized data */
247 
248  static const double coeff[17] = { 5.5533465,3.3733352,3.776603,2.2673355,
249  1.3401485,.84209333,-.71621378,.57572407,-.52313936,-.78790514,
250  -.71786066,.43370011,.29223306,-.37791975,.21121024,.31513644,
251  .25382701 };
252 
253  /* System generated locals */
254  float ret_val;
255 
256  /* Local variables */
257  double x10, x11, x12, x13, x14, x15, x16, x17, x18, /*x19,*/ x20,
258  x21, x22, x23, x24, x25, x26, x27, x28, x29;
259 
260 /* ! Parameterization of drift time dispersion- high field chambers */
261 /* ***********************************************************************
262  */
263 /* DOC MC_BHGH_TSIG *
264  */
265 /* *
266 */
267 /* DOC Function : Parameterization of the drift time dispersion *
268  */
269 /* DOC in the muon endcap CSCs. *
270  */
271 /* *
272 */
273 /* DOC References : None *
274  */
275 /* *
276 */
277 /* DOC Arguments : YCELL - distance from the anode wire in the *
278  */
279 /* anode-cathode coordinate plane *
280 */
281 /* (ycell=1 > d_acat) *
282 */
283 /* DOC ZCELL - distance from the anode wire in the wire *
284  */
285 /* plane coordinate (zcell=1 > d_anod/2.) *
286 */
287 /* DOC Errors : None *
288  */
289 /* *
290 */
291 /* DOC Returns : Drift time dispersion for high field CSC chambers *
292  */
293 /* *
294 */
295 /* DOC Created : 15-OCT-1996 Author : Jeff Rowe *
296  */
297 /* ***********************************************************************
298  */
299 
300 
301 
302  x10 = 1.;
303  x11 = fabs(ycell) * 2. - 1.;
304  x12 = x11 * 2. * x11 - x10;
305  x13 = x11 * 2. * x12 - x11;
306  x14 = x11 * 2. * x13 - x12;
307  x15 = x11 * 2. * x14 - x13;
308  x16 = x11 * 2. * x15 - x14;
309  x17 = x11 * 2. * x16 - x15;
310  x18 = x11 * 2. * x17 - x16;
311  //x19 = x11 * 2. * x18 - x17; //not used later
312  x20 = 1.;
313  x21 = fabs(zcell) * 2. - 1.;
314  x22 = x21 * 2. * x21 - x20;
315  x23 = x21 * 2. * x22 - x21;
316  x24 = x21 * 2. * x23 - x22;
317  x25 = x21 * 2. * x24 - x23;
318  x26 = x21 * 2. * x25 - x24;
319  x27 = x21 * 2. * x26 - x25;
320  x28 = x21 * 2. * x27 - x26;
321  x29 = x21 * 2. * x28 - x27;
322 
323  ret_val = coeff[0] * x21 + coeff[1] + coeff[2] * x22 + coeff[3] * x23 +
324  coeff[4] * x24 + coeff[5] * x25 + coeff[6] * x11 * x23 + coeff[7]
325  * x26 + coeff[8] * x11 * x25 + coeff[9] * x11 * x24 + coeff[10] *
326  x11 * x22 + coeff[11] * x27 + coeff[12] * x28 + coeff[13] * x11 *
327  x26 + coeff[14] * x29 + coeff[15] * x16 * x21 + coeff[16] * x18 *
328  x21;
329 
330  return ret_val;
331 }
double zcell
Definition: CSCDriftSim.h:66
double ycell
Definition: CSCDriftSim.h:66
double CSCDriftSim::driftTimeSigmaLowB ( )
private

Definition at line 239 of file CSCDriftParamLowB.cc.

References ycell, and zcell.

Referenced by getWireHit().

239  {
240  /* Initialized data */
241 
242  static const double coeff[19] = { 6.2681223,3.5916437,5.5425809,4.6974052,
243  3.8472392,3.1019155,2.4323913,1.8695623,1.3909068,.99056625,
244  .52066638,.64671229,.68023389,.40512251,.40202738,.23908531,
245  -.41245784,-.32196924,-.29890696 };
246 
247  /* Local variables */
248  double /*x10,*/ x11, x20, x21, x22, x23, x24, x25, x26, x27, x28,
249  x29, x210, x211, x212;
250 
251 /* ! Parameterization of drift time dispersion- low field chambers */
252 /* ***********************************************************************
253  */
254 /* DOC MC_BHGH_TSIG *
255  */
256 /* *
257 */
258 /* DOC Function : Parameterization of the drift time dispersion *
259  */
260 /* DOC in the muon endcap CSCs. *
261  */
262 /* *
263 */
264 /* DOC References : None *
265  */
266 /* *
267 */
268 /* DOC Arguments : YCELL - distance from the anode wire in the *
269  */
270 /* anode-cathode coordinate plane *
271 */
272 /* (ycell=1 > d_acat) *
273 */
274 /* DOC ZCELL - distance from the anode wire in the wire *
275  */
276 /* plane coordinate (zcell=1 > d_anod/2.) *
277 */
278 /* DOC Errors : None *
279  */
280 /* *
281 */
282 /* DOC Returns : Drift time dispersion for low field CSC chambers *
283  */
284 /* *
285 */
286 /* DOC Created : 15-OCT-1996 Author : Jeff Rowe *
287  */
288 /* ***********************************************************************
289  */
290 
291 
292 
293  //x10 = 1.; //not used
294  x11 = fabs(ycell) * 2. - 1.;
295  x20 = 1.;
296  x21 = fabs(zcell) * 2. - 1.;
297  x22 = x21 * 2. * x21 - x20;
298  x23 = x21 * 2. * x22 - x21;
299  x24 = x21 * 2. * x23 - x22;
300  x25 = x21 * 2. * x24 - x23;
301  x26 = x21 * 2. * x25 - x24;
302  x27 = x21 * 2. * x26 - x25;
303  x28 = x21 * 2. * x27 - x26;
304  x29 = x21 * 2. * x28 - x27;
305  x210 = x21 * 2. * x29 - x28;
306  x211 = x21 * 2. * x210 - x29;
307  x212 = x21 * 2. * x211 - x210;
308 
309  return coeff[0] * x21 + coeff[1] + coeff[2] * x22 + coeff[3] * x23 +
310  coeff[4] * x24 + coeff[5] * x25 + coeff[6] * x26 + coeff[7] * x27
311  + coeff[8] * x28 + coeff[9] * x29 + coeff[10] * x11 + coeff[11] *
312  x11 * x21 + coeff[12] * x210 + coeff[13] * x11 * x22 + coeff[14] *
313  x211 + coeff[15] * x212 + coeff[16] * x11 * x25 + coeff[17] *
314  x11 * x27 + coeff[18] * x11 * x26;
315 }
double zcell
Definition: CSCDriftSim.h:66
double ycell
Definition: CSCDriftSim.h:66
double CSCDriftSim::gasGain ( const CSCDetId id) const
private

Definition at line 171 of file CSCDriftSim.cc.

References mps_fire::result, relativeConstraints::ring, CSCDetId::ring(), and CSCDetId::station().

Referenced by getWireHit().

172 {
173  double result = 130000.; // 1.30 E05
174  // if ME1/1, add some extra gas gain to compensate
175  // for a smaller gas gap
176  int ring = detId.ring();
177  if(detId.station() == 1 && (ring == 1 || ring == 4))
178  {
179  result = 213000.; // 2.13 E05 ( to match real world as of Jan-2011)
180  }
181  return result;
182 }
tuple result
Definition: mps_fire.py:83
CSCDetectorHit CSCDriftSim::getWireHit ( const Local3DPoint ionClusterPosition,
const CSCLayer layer,
int  wire,
const PSimHit simHit,
CLHEP::HepRandomEngine *  engine 
)

takes a point, and creates a signal on the wire

Definition at line 61 of file CSCDriftSim.cc.

References CSCChamberSpecs::anodeCathodeSpacing(), assert(), avalancheCharge(), avgDrift(), avgDriftTimeHighB(), avgDriftTimeLowB(), avgPathLengthHighB(), avgPathLengthLowB(), bz, CSCLayer::chamber(), RecoTauCleanerPlugins::charge, driftSigma(), driftTimeSigmaHighB(), driftTimeSigmaLowB(), e_SI, ELECTRON_DIFFUSION_COEFF, gasGain(), relativeConstraints::geom, CSCLayer::geometry(), CSCLayer::id(), MagneticField::inKGauss(), LogTrace, bookConverter::max, pathSigmaHighB(), pathSigmaLowB(), idealTransformation::rotation, CSCChamber::specs(), mathSSE::sqrt(), GeomDet::surface(), lumiQTWidget::t, theMagneticField, PSimHit::tof(), Surface::toGlobal(), GeomDet::toLocal(), CSCLayerGeometry::wireAngle(), CSCChamberSpecs::wireSpacing(), x, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), ycell, CSCLayerGeometry::yOfWire(), z, PV3DBase< T, PVType, FrameType >::z(), and zcell.

Referenced by CSCWireHitSim::simulate().

63  {
64 
65  const CSCChamberSpecs * specs = layer->chamber()->specs();
66  const CSCLayerGeometry * geom = layer->geometry();
67  math::LocalPoint clusterPos(pos.x(), pos.y(), pos.z());
68  LogTrace("CSCDriftSim") << "CSCDriftSim: ionization cluster at: " << pos;
69  // set the coordinate system with the x-axis along the nearest wire,
70  // with the origin in the center of the chamber, on that wire.
71  math::LocalVector yShift(0, -1.*geom->yOfWire(nearestWire), 0.);
72  ROOT::Math::RotationZ rotation(-1.*geom->wireAngle());
73 
74  clusterPos = yShift + clusterPos;
75  clusterPos = rotation * clusterPos;
76  GlobalPoint globalPosition = layer->surface().toGlobal(pos);
78 
79  // bz = theMagneticField->inTesla(globalPosition).z() * 10.;
80 
81  // We need magnetic field in _local_ coordinates
82  // Interface now allows access in kGauss directly.
83  bz = layer->toLocal( theMagneticField->inKGauss( globalPosition ) ).z();
84 
85  // these subroutines label the coordinates in GEANT coords...
86  ycell = clusterPos.z() / specs->anodeCathodeSpacing();
87  zcell = 2.*clusterPos.y() / specs->wireSpacing();
88 
89  LogTrace("CSCDriftSim") << "CSCDriftSim: bz " << bz <<" avgDrift " << avgDrift()
90  << " wireAngle " << geom->wireAngle()
91  << " ycell " << ycell << " zcell " << zcell;
92 
93  double avgPathLength, pathSigma, avgDriftTime, driftTimeSigma;
94  static const float B_FIELD_CUT = 15.f;
95  if(fabs(bz) < B_FIELD_CUT) {
96  avgPathLength = avgPathLengthLowB();
97  pathSigma = pathSigmaLowB();
98  avgDriftTime = avgDriftTimeLowB();
99  driftTimeSigma = driftTimeSigmaLowB();
100  }
101  else {
102  avgPathLength = avgPathLengthHighB();
103  pathSigma = pathSigmaHighB();
104  avgDriftTime = avgDriftTimeHighB();
105  driftTimeSigma = driftTimeSigmaHighB();
106  }
107 
108  // electron drift path length
109  double pathLength = std::max(CLHEP::RandGaussQ::shoot(engine, avgPathLength, pathSigma), 0.);
110 
111  // electron drift distance along the anode wire, including diffusion
112  double diffusionSigma = ELECTRON_DIFFUSION_COEFF * sqrt(pathLength);
113  double x = clusterPos.x() + CLHEP::RandGaussQ::shoot(engine, avgDrift(), driftSigma())
114  + CLHEP::RandGaussQ::shoot(engine, 0., diffusionSigma);
115 
116  // electron drift time
117  double driftTime = std::max(CLHEP::RandGaussQ::shoot(engine, avgDriftTime, driftTimeSigma), 0.);
118 
119  //@@ Parameters which should be defined outside the code
120  // f_att is the fraction of drift electrons lost due to attachment
121  //static const double f_att = 0.5;
122  static const double f_collected = 0.82;
123 
124  // Avalanche charge, with fluctuation ('avalancheCharge()' is the fluctuation generator!)
125  //double charge = avalancheCharge() * f_att * f_collected * gasGain(layer->id()) * e_SI * 1.e15;
126  // doing fattachment by random chance of killing
127  double charge = avalancheCharge(engine) * f_collected * gasGain(layer->id()) * e_SI * 1.e15;
128 
129  float t = simHit.tof() + driftTime;
130  LogTrace("CSCDriftSim") << "CSCDriftSim: tof = " << simHit.tof() <<
131  " driftTime = " << driftTime <<
132  " MEDH = " << CSCDetectorHit(nearestWire, charge, x, t, &simHit);
133  return CSCDetectorHit(nearestWire, charge, x, t, &simHit);
134 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:106
double avgDrift() const
Definition: CSCDriftParam.cc:8
float tof() const
deprecated name for timeOfFlight()
Definition: PSimHit.h:72
double zcell
Definition: CSCDriftSim.h:66
double pathSigmaHighB()
CSCDetId id() const
Definition: CSCLayer.h:42
assert(m_qm.get())
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:67
const MagneticField * theMagneticField
Definition: CSCDriftSim.h:73
double avgPathLengthHighB()
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:40
double driftTimeSigmaLowB()
double driftTimeSigmaHighB()
float wireAngle() const
double avgDriftTimeHighB()
double avalancheCharge(CLHEP::HepRandomEngine *)
Definition: CSCDriftSim.cc:138
#define e_SI
double avgDriftTimeLowB()
const double ELECTRON_DIFFUSION_COEFF
Definition: CSCDriftSim.h:71
float yOfWire(float wire, float x=0.) const
const CSCChamberSpecs * specs() const
Definition: CSCChamber.h:42
double pathSigmaLowB()
T sqrt(T t)
Definition: SSEVec.h:18
double ycell
Definition: CSCDriftSim.h:66
float wireSpacing() const
#define LogTrace(id)
double avgPathLengthLowB()
GlobalVector inKGauss(const GlobalPoint &gp) const
Field value ad specified global point, in KGauss.
Definition: MagneticField.h:34
double driftSigma() const
double gasGain(const CSCDetId &id) const
Definition: CSCDriftSim.cc:171
float anodeCathodeSpacing() const
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< float >, ROOT::Math::LocalCoordinateSystemTag > LocalPoint
point in local coordinate system
Definition: Point3D.h:15
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< float >, ROOT::Math::LocalCoordinateSystemTag > LocalVector
vector in local coordinate system
Definition: Vector3D.h:25
const CSCChamber * chamber() const
Definition: CSCLayer.h:52
const CSCLayerGeometry * geometry() const
Definition: CSCLayer.h:47
double CSCDriftSim::pathSigmaHighB ( )
private

Definition at line 76 of file CSCDriftParamHighB.cc.

References ycell, and zcell.

Referenced by getWireHit().

76  {
77  /* Initialized data */
78 
79  static const double coeff[9] = { .0049089564,.0091482062,.0024036507,
80  .0065285652,.0041487742,-.0038102526,-.0043923587,.0019230151,
81  .0013543258 };
82 
83  /* System generated locals */
84  float ret_val;
85 
86  /* Local variables */
87  double /*x10,*/ x11, x12, x13, x14, x15, x16, /*x20,*/ x21, x22, x23,
88  x24, x25, x26, x27, x28, x29;
89 
90 /* ! Parameterization of path length dispersion- high field chambers */
91 /* ***********************************************************************
92  */
93 /* DOC MC_BHGH_SSIG *
94  */
95 /* *
96 */
97 /* DOC Function : Parameterization of the drift path length *
98  */
99 /* DOC dispersion in the muon endcap CSCs. *
100  */
101 /* *
102 */
103 /* DOC References : None *
104  */
105 /* *
106 */
107 /* DOC Arguments : YCELL - distance from the anode wire in the *
108  */
109 /* anode-cathode coordinate plane *
110 */
111 /* DOC ZCELL - distance from the anode wire in the wire *
112  */
113 /* plane coordinate *
114 */
115 /* **NOTE** Both distances normalize to cell dim=1x1 *
116 */
117 /* DOC Errors : None *
118  */
119 /* *
120 */
121 /* DOC Returns : Path length dispersion for high field CSC chambers *
122  */
123 /* *
124 */
125 /* DOC Created : 15-OCT-1996 Author : Jeff Rowe *
126  */
127 /* ***********************************************************************
128  */
129 
130 
131  //x10 = 1.; //not used later
132  x11 = fabs(ycell) * 2. - 1.;
133  x12 = x11 * x11;
134  x13 = x11 * x12;
135  x14 = x11 * x13;
136  x15 = x11 * x14;
137  x16 = x11 * x15;
138  //x20 = 1.; //not used later
139  x21 = fabs(zcell) * 2. - 1.;
140  x22 = x21 * x21;
141  x23 = x21 * x22;
142  x24 = x21 * x23;
143  x25 = x21 * x24;
144  x26 = x21 * x25;
145  x27 = x21 * x26;
146  x28 = x21 * x27;
147  x29 = x21 * x28;
148 
149  ret_val = coeff[0] + coeff[1] * x21 + coeff[2] * x11 + coeff[3] * x22 +
150  coeff[4] * x11 * x21 + coeff[5] * x16 * x22 + coeff[6] * x16 *
151  x23 + coeff[7] * x11 * x22 + coeff[8] * x29;
152 
153  return ret_val;
154 }
double zcell
Definition: CSCDriftSim.h:66
double ycell
Definition: CSCDriftSim.h:66
double CSCDriftSim::pathSigmaLowB ( )
private

Definition at line 70 of file CSCDriftParamLowB.cc.

References ycell, and zcell.

Referenced by getWireHit().

70  {
71  /* Initialized data */
72 
73  static const double coeff[12] = { .002854441,8.701339e-4,.0053064193,
74  .0012356508,9.8627318e-4,.0013802449,-5.4633755e-4,.0026078648,
75  .0044171026,6.2029063e-4,.0011392474,-.0056275595 };
76 
77  /* System generated locals */
78  float ret_val;
79 
80  /* Local variables */
81  double /*x10,*/ x11, x12, x13, x14, x15, x16, /*x20,*/ x21, x22, x23,
82  x24, x25, x26, x27, x28, x29, x210, x211, x212, x213;
83 
84 /* ! Parameterization of path length dispersion- low field chambers */
85 /* ***********************************************************************
86  */
87 /* DOC MC_BHGH_SSIG *
88  */
89 /* *
90 */
91 /* DOC Function : Parameterization of the drift path length *
92  */
93 /* DOC dispersion in the muon endcap CSCs. *
94  */
95 /* *
96 */
97 /* DOC References : None *
98  */
99 /* *
100 */
101 /* DOC Arguments : YCELL - distance from the anode wire in the *
102  */
103 /* anode-cathode coordinate plane *
104 */
105 /* DOC ZCELL - distance from the anode wire in the wire *
106  */
107 /* plane coordinate *
108 */
109 /* **NOTE** Both distances normalize to cell dim=1x1 *
110 */
111 /* DOC Errors : None *
112  */
113 /* *
114 */
115 /* DOC Returns : Path length dispersion for low field CSC chambers *
116 */
117 /* *
118 */
119 /* DOC Created : 15-OCT-1996 Author : Jeff Rowe *
120  */
121 /* ***********************************************************************
122  */
123 
124 
125  //x10 = 1.; //not used later
126  x11 = fabs(ycell) * 2. - 1.;
127  x12 = x11 * x11;
128  x13 = x11 * x12;
129  x14 = x11 * x13;
130  x15 = x11 * x14;
131  x16 = x11 * x15;
132  //x20 = 1.; //not used later
133  x21 = fabs(zcell) * 2. - 1.;
134  x22 = x21 * x21;
135  x23 = x21 * x22;
136  x24 = x21 * x23;
137  x25 = x21 * x24;
138  x26 = x21 * x25;
139  x27 = x21 * x26;
140  x28 = x21 * x27;
141  x29 = x21 * x28;
142  x210 = x21 * x29;
143  x211 = x21 * x210;
144  x212 = x21 * x211;
145  x213 = x21 * x212;
146  ret_val = coeff[0] + coeff[1] * x23 + coeff[2] * x24 + coeff[3] * x13 +
147  coeff[4] * x11 * x21 + coeff[5] * x11 * x22 + coeff[6] * x16 +
148  coeff[7] * x213 + coeff[8] * x212 + coeff[9] * x21 + coeff[10] *
149  x11 * x23 + coeff[11] * x26;
150 
151  return ret_val;
152 }
double zcell
Definition: CSCDriftSim.h:66
double ycell
Definition: CSCDriftSim.h:66
void CSCDriftSim::setMagneticField ( const MagneticField field)
inline

Definition at line 46 of file CSCDriftSim.h.

References theMagneticField.

Referenced by CSCDigitizer::setMagneticField().

46 {theMagneticField = field;}
const MagneticField * theMagneticField
Definition: CSCDriftSim.h:73

Member Data Documentation

float CSCDriftSim::bz
private

Definition at line 64 of file CSCDriftSim.h.

Referenced by avgDrift(), driftSigma(), and getWireHit().

std::vector<double> CSCDriftSim::dNdEIntegral
private

Definition at line 68 of file CSCDriftSim.h.

Referenced by avalancheCharge(), and CSCDriftSim().

const double CSCDriftSim::ELECTRON_DIFFUSION_COEFF
private

Definition at line 71 of file CSCDriftSim.h.

Referenced by getWireHit().

const double CSCDriftSim::STEP_SIZE
private

Definition at line 69 of file CSCDriftSim.h.

Referenced by avalancheCharge(), and CSCDriftSim().

const MagneticField* CSCDriftSim::theMagneticField
private

Definition at line 73 of file CSCDriftSim.h.

Referenced by getWireHit(), and setMagneticField().

double CSCDriftSim::ycell
private
double CSCDriftSim::zcell
private