CMS 3D CMS Logo

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::CSCDriftSim ( )

Definition at line 24 of file CSCDriftSim.cc.

References dNdEIntegral, JetChargeProducer_cfi::exp, mps_fire::i, N_INTEGRAL_STEPS, funct::pow(), STEP_SIZE, and geometryCSVtoXML::xx.

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

◆ ~CSCDriftSim()

CSCDriftSim::~CSCDriftSim ( )

Definition at line 53 of file CSCDriftSim.cc.

53 {}

Member Function Documentation

◆ avalancheCharge()

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

Definition at line 132 of file CSCDriftSim.cc.

References dNdEIntegral, mps_fire::i, LogTrace, pfDeepBoostedJetPreprocessParams_cfi::lower_bound, AlCaHLTBitMon_ParallelJobs::p, STEP_SIZE, x, testProducerWithPsetDescEmpty_cfi::x1, and testProducerWithPsetDescEmpty_cfi::x2.

Referenced by getWireHit().

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

◆ avgDrift()

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

◆ avgDriftTimeHighB()

double CSCDriftSim::avgDriftTimeHighB ( )
private

Definition at line 168 of file CSCDriftParamHighB.cc.

References ycell, and zcell.

Referenced by getWireHit().

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

◆ avgDriftTimeLowB()

double CSCDriftSim::avgDriftTimeLowB ( )
private

Definition at line 157 of file CSCDriftParamLowB.cc.

References ycell, and zcell.

Referenced by getWireHit().

157  {
158  /* Initialized data */
159 
160  static const double coeff[20] = {42.981588, 25.732805, 26.539129, 16.719016, 10.862044, 7.4859085, 5.0353142,
161  3.3620548, 1.9057762, 2.2207695, -2.6787582, 1.2977292, -.8358091, 1.2452612,
162  .74813469, -.57581194, .32705275, -.85426489, -.55688158, -.38384903};
163 
164  /* System generated locals */
165  float ret_val;
166 
167  /* Local variables */
168  double x10, x11, x12, x13, x14, x20, x21, x22, x23, x24, x25, 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  x10 = 1.;
211  x11 = fabs(ycell) * 2. - 1.;
212  x12 = x11 * 2. * x11 - x10;
213  x13 = x11 * 2. * x12 - x11;
214  x14 = x11 * 2. * x13 - x12;
215  x20 = 1.;
216  x21 = fabs(zcell) * 2. - 1.;
217  x22 = x21 * 2. * x21 - x20;
218  x23 = x21 * 2. * x22 - x21;
219  x24 = x21 * 2. * x23 - x22;
220  x25 = x21 * 2. * x24 - x23;
221  x26 = x21 * 2. * x25 - x24;
222  x27 = x21 * 2. * x26 - x25;
223  x28 = x21 * 2. * x27 - x26;
224  x29 = x21 * 2. * x28 - x27;
225 
226  ret_val = coeff[0] + coeff[1] * x11 + coeff[2] * x21 + coeff[3] * x22 + coeff[4] * x23 + coeff[5] * x24 +
227  coeff[6] * x25 + coeff[7] * x26 + coeff[8] * x12 + coeff[9] * x27 + coeff[10] * x11 * x21 +
228  coeff[11] * x28 + coeff[12] * x13 + coeff[13] * x12 * x21 + coeff[14] * x29 + coeff[15] * x13 * x21 +
229  coeff[16] * x14 + coeff[17] * x11 * x22 + coeff[18] * x11 * x23 + coeff[19] * x11 * x24;
230  return ret_val;
231 }
double zcell
Definition: CSCDriftSim.h:67
double ycell
Definition: CSCDriftSim.h:67

◆ avgPathLengthHighB()

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

◆ avgPathLengthLowB()

double CSCDriftSim::avgPathLengthLowB ( )
private

Definition at line 7 of file CSCDriftParamLowB.cc.

References ycell, and zcell.

Referenced by getWireHit().

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

◆ driftSigma()

double CSCDriftSim::driftSigma ( ) const
private

Definition at line 63 of file CSCDriftParam.cc.

References bz, and zcell.

Referenced by getWireHit().

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

◆ driftTimeSigmaHighB()

double CSCDriftSim::driftTimeSigmaHighB ( )
private

Definition at line 249 of file CSCDriftParamHighB.cc.

References ycell, and zcell.

Referenced by getWireHit().

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

◆ driftTimeSigmaLowB()

double CSCDriftSim::driftTimeSigmaLowB ( )
private

Definition at line 233 of file CSCDriftParamLowB.cc.

References ycell, and zcell.

Referenced by getWireHit().

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

◆ gasGain()

double CSCDriftSim::gasGain ( const CSCDetId id) const
private

Definition at line 164 of file CSCDriftSim.cc.

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

Referenced by getWireHit().

164  {
165  double result = 130000.; // 1.30 E05
166  // if ME1/1, add some extra gas gain to compensate
167  // for a smaller gas gap
168  int ring = detId.ring();
169  if (detId.station() == 1 && (ring == 1 || ring == 4)) {
170  result = 213000.; // 2.13 E05 ( to match real world as of Jan-2011)
171  }
172  return result;
173 }

◆ getWireHit()

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 55 of file CSCDriftSim.cc.

References cms::cuda::assert(), avalancheCharge(), avgDrift(), avgDriftTimeHighB(), avgDriftTimeLowB(), avgPathLengthHighB(), avgPathLengthLowB(), bz, ALCARECOTkAlJpsiMuMu_cff::charge, driftSigma(), driftTimeSigmaHighB(), driftTimeSigmaLowB(), e_SI, ELECTRON_DIFFUSION_COEFF, gasGain(), relativeConstraints::geom, MagneticField::inKGauss(), phase1PixelTopology::layer, LogTrace, SiStripPI::max, pathSigmaHighB(), pathSigmaLowB(), idealTransformation::rotation, rpcPointValidation_cfi::simHit, HistogramManager_cfi::specs, mathSSE::sqrt(), submitPVValidationJobs::t, theMagneticField, x, ycell, z, and zcell.

Referenced by CSCWireHitSim::simulate().

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

◆ pathSigmaHighB()

double CSCDriftSim::pathSigmaHighB ( )
private

Definition at line 85 of file CSCDriftParamHighB.cc.

References ycell, and zcell.

Referenced by getWireHit().

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

◆ pathSigmaLowB()

double CSCDriftSim::pathSigmaLowB ( )
private

Definition at line 66 of file CSCDriftParamLowB.cc.

References ycell, and zcell.

Referenced by getWireHit().

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

◆ setMagneticField()

void CSCDriftSim::setMagneticField ( const MagneticField field)
inline

Definition at line 47 of file CSCDriftSim.h.

References theMagneticField.

Referenced by CSCDigitizer::setMagneticField().

47 { theMagneticField = field; }
const MagneticField * theMagneticField
Definition: CSCDriftSim.h:74

Member Data Documentation

◆ bz

float CSCDriftSim::bz
private

Definition at line 65 of file CSCDriftSim.h.

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

◆ dNdEIntegral

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

Definition at line 69 of file CSCDriftSim.h.

Referenced by avalancheCharge(), and CSCDriftSim().

◆ ELECTRON_DIFFUSION_COEFF

const double CSCDriftSim::ELECTRON_DIFFUSION_COEFF
private

Definition at line 72 of file CSCDriftSim.h.

Referenced by getWireHit().

◆ STEP_SIZE

const double CSCDriftSim::STEP_SIZE
private

Definition at line 70 of file CSCDriftSim.h.

Referenced by avalancheCharge(), and CSCDriftSim().

◆ theMagneticField

const MagneticField* CSCDriftSim::theMagneticField
private

Definition at line 74 of file CSCDriftSim.h.

Referenced by getWireHit(), and setMagneticField().

◆ ycell

double CSCDriftSim::ycell
private

◆ zcell

double CSCDriftSim::zcell
private