File: | programs/Simulation/HDGeant/hitFDC.c |
Location: | line 629, column 7 |
Description: | Value stored to 'status' is never read |
1 | /* |
2 | * hitFDC - registers hits for forward drift chambers |
3 | * |
4 | * This is a part of the hits package for the |
5 | * HDGeant simulation program for Hall D. |
6 | * |
7 | * version 1.0 -Richard Jones July 16, 2001 |
8 | * |
9 | * changes: Wed Jun 20 13:19:56 EDT 2007 B. Zihlmann |
10 | * add ipart to the function hitForwardDC |
11 | */ |
12 | |
13 | #include <stdlib.h> |
14 | #include <stdio.h> |
15 | #include <math.h> |
16 | |
17 | #include <HDDM/hddm_s.h> |
18 | #include <geant3.h> |
19 | #include <bintree.h> |
20 | #include <gid_map.h> |
21 | |
22 | #include "calibDB.h" |
23 | extern s_HDDM_t* thisInputEvent; |
24 | extern double asic_response(double t); |
25 | extern double Ei(double x); |
26 | |
27 | typedef struct{ |
28 | int writeenohits; |
29 | int showersincol; |
30 | int driftclusters; |
31 | }controlparams_t; |
32 | |
33 | extern controlparams_t controlparams_; |
34 | |
35 | static int itrack; |
36 | |
37 | const float wire_dead_zone_radius[4]={3.0,3.0,3.9,3.9}; |
38 | const float strip_dead_zone_radius[4]={1.3,1.3,1.3,1.3}; |
39 | |
40 | #define CATHODE_ROT_ANGLE1.309 1.309 // 75 degrees |
41 | |
42 | // Drift speed 2.2cm/us is appropriate for a 90/10 Argon/Methane mixture |
43 | static float DRIFT_SPEED =.0055; |
44 | static float ACTIVE_AREA_OUTER_RADIUS =48.5; |
45 | static float ANODE_CATHODE_SPACING =0.5; |
46 | static float TWO_HIT_RESOL =25.; |
47 | static int WIRES_PER_PLANE =96; |
48 | static float WIRE_SPACING =1.0; |
49 | static float U_OF_WIRE_ZERO =0;//(-((WIRES_PER_PLANE-1.)*WIRE_SPACING)/2) |
50 | static float STRIPS_PER_PLANE =192; |
51 | static float STRIP_SPACING =0.5; |
52 | static float U_OF_STRIP_ZERO =0;// (-((STRIPS_PER_PLANE-1.)*STRIP_SPACING)/2) |
53 | static float STRIP_GAP =0.1; |
54 | static int FDC_MAX_HITS =1000; |
55 | static float K2 =1.15; |
56 | static float STRIP_NODES = 3; |
57 | static float THRESH_KEV =1. ; |
58 | static float THRESH_ANODE = 1.; |
59 | static float THRESH_STRIPS =5. ; /* pC */ |
60 | static float ELECTRON_CHARGE =1.6022e-4; /* fC */ |
61 | static float DIFFUSION_COEFF = 1.1e-6; // cm^2/s --> 200 microns at 1 cm |
62 | static float FDC_TIME_WINDOW = 1000.0; //time window for accepting FDC hits, ns |
63 | static float GAS_GAIN = 8e4; |
64 | |
65 | static float drift_table[1000]; // time-to-distance table |
66 | static float bscale[2]; // scale factors for B-dependence of drift time |
67 | static float lorentz_parms[4]; // parameters for modeling shift of avalanche along wire due to Lorentz force |
68 | |
69 | |
70 | // Note by RTJ: |
71 | // This constant "MAX_HITS" is a convenience constant |
72 | // that I introduced to help with preallocating arrays |
73 | // to hold hits. It is NOT a tunable simulation parameter. |
74 | // DO NOT MODIFY IT. |
75 | #define MAX_HITS1000 1000 |
76 | |
77 | #if 0 |
78 | static float wire_dx_offset[2304]; |
79 | static float wire_dz_offset[2304]; |
80 | #endif |
81 | |
82 | binTree_t* forwardDCTree = 0; |
83 | static int stripCount = 0; |
84 | static int wireCount = 0; |
85 | static int pointCount = 0; |
86 | static int initializedx=0; |
87 | |
88 | void gpoiss_(float*,int*,const int*); // avoid solaris compiler warnings |
89 | void rnorml_(float*,int*); |
90 | |
91 | typedef int (*compfn)(const void*, const void*); |
92 | |
93 | // Sort functions for sorting clusters |
94 | int fdc_anode_cluster_sort(const void *a,const void *b){ |
95 | const s_FdcAnodeTruthHit_t *ca=a; |
96 | const s_FdcAnodeTruthHit_t *cb=b; |
97 | if (ca->t<cb->t) return -1; |
98 | else if (ca->t>cb->t) return 1; |
99 | else return 0; |
100 | } |
101 | int fdc_cathode_cluster_sort(const void *a,const void *b){ |
102 | const s_FdcCathodeTruthHit_t *ca=a; |
103 | const s_FdcCathodeTruthHit_t *cb=b; |
104 | if (ca->t<cb->t) return -1; |
105 | else if (ca->t>cb->t) return 1; |
106 | else return 0; |
107 | } |
108 | |
109 | |
110 | |
111 | // Locate a position in array xx given x |
112 | void locate(float *xx,int n,float x,int *j){ |
113 | int ju,jm,jl; |
114 | int ascnd; |
115 | |
116 | jl=-1; |
117 | ju=n; |
118 | ascnd=(xx[n-1]>=xx[0]); |
119 | while(ju-jl>1){ |
120 | jm=(ju+jl)>>1; |
121 | if ((x>=xx[jm])==ascnd) |
122 | jl=jm; |
123 | else |
124 | ju=jm; |
125 | } |
126 | if (x==xx[0]) *j=0; |
127 | else if (x==xx[n-1]) *j=n-2; |
128 | else *j=jl; |
129 | } |
130 | |
131 | // Polynomial interpolation on a grid. |
132 | // Adapted from Numerical Recipes in C (2nd Edition), pp. 121-122. |
133 | void polint(float *xa, float *ya,int n,float x, float *y,float *dy){ |
134 | int i,m,ns=0; |
135 | float den,dif,dift,ho,hp,w; |
136 | |
137 | float *c=(float *)calloc(n,sizeof(float)); |
138 | float *d=(float *)calloc(n,sizeof(float)); |
139 | |
140 | dif=fabs(x-xa[0]); |
141 | for (i=0;i<n;i++){ |
142 | if ((dift=fabs(x-xa[i]))<dif){ |
143 | ns=i; |
144 | dif=dift; |
145 | } |
146 | c[i]=ya[i]; |
147 | d[i]=ya[i]; |
148 | } |
149 | *y=ya[ns--]; |
150 | |
151 | for (m=1;m<n;m++){ |
152 | for (i=1;i<=n-m;i++){ |
153 | ho=xa[i-1]-x; |
154 | hp=xa[i+m-1]-x; |
155 | w=c[i+1-1]-d[i-1]; |
156 | if ((den=ho-hp)==0.0) { |
157 | free(c); |
158 | free(d); |
159 | return; |
160 | } |
161 | |
162 | den=w/den; |
163 | d[i-1]=hp*den; |
164 | c[i-1]=ho*den; |
165 | |
166 | } |
167 | |
168 | *y+=(*dy=(2*ns<(n-m) ?c[ns+1]:d[ns--])); |
169 | } |
170 | free(c); |
171 | free(d); |
172 | } |
173 | |
174 | // Simulation of signal on a wire |
175 | double wire_signal(double t,s_FdcAnodeTruthHits_t* ahits){ |
176 | int m; |
177 | double asic_gain=0.76; // mV/fC |
178 | double func=0; |
179 | for (m=0;m<ahits->mult;m++){ |
180 | if (t>ahits->in[m].t){ |
181 | double my_time=t-ahits->in[m].t; |
182 | func+=asic_gain*ahits->in[m].dE*asic_response(my_time); |
183 | } |
184 | } |
185 | return func; |
186 | } |
187 | |
188 | // Simulation of signal on a cathode strip (ASIC output) |
189 | double cathode_signal(double t,s_FdcCathodeTruthHits_t* chits){ |
190 | int m; |
191 | double asic_gain=2.3; |
192 | double func=0; |
193 | for (m=0;m<chits->mult;m++){ |
194 | if (t>chits->in[m].t){ |
195 | double my_time=t-chits->in[m].t; |
196 | func+=asic_gain*chits->in[m].q*asic_response(my_time); |
197 | } |
198 | } |
199 | return func; |
200 | } |
201 | |
202 | // Generate hits in two cathode planes flanking the wire plane |
203 | void AddFDCCathodeHits(int PackNo,float xwire,float avalanche_y,float tdrift, |
204 | int n_p,int track,int ipart,int chamber,int module, |
205 | int layer, int global_wire_number){ |
206 | |
207 | s_FdcCathodeTruthHits_t* chits; |
208 | |
209 | // Anode charge |
210 | float q_anode; |
211 | int n_t; |
212 | // Average number of secondary ion pairs for 40/60 Ar/CO2 mixture |
213 | float n_s_per_p=1.89; |
214 | if (controlparams_.driftclusters==0){ |
215 | /* Total number of ion pairs. On average for each primary ion |
216 | pair produced there are n_s secondary ion pairs produced. The |
217 | probability distribution is a compound poisson distribution |
218 | that requires generating two Poisson variables. |
219 | */ |
220 | int n_s,one=1; |
221 | float n_s_mean = ((float)n_p)*n_s_per_p; |
222 | gpoiss_(&n_s_mean,&n_s,&one); |
223 | n_t = n_s+n_p; |
224 | q_anode=((float)n_t)*GAS_GAIN*ELECTRON_CHARGE; |
225 | } |
226 | else{ |
227 | // Distribute the number of secondary ionizations for this primary |
228 | // ionization according to a Poisson distribution with mean n_s_over_p. |
229 | // For simplicity we assume these secondary electrons and the primary |
230 | // electron stay together as a cluster. |
231 | int n_s; |
232 | int one=1; |
233 | gpoiss_(&n_s_per_p,&n_s,&one); |
234 | // Anode charge in units of fC |
235 | n_t=1+n_s; |
236 | q_anode=GAS_GAIN*ELECTRON_CHARGE*((float)n_t); |
237 | } |
238 | |
239 | /* Mock-up of cathode strip charge distribution */ |
240 | int plane, node; |
241 | for (plane=1; plane<4; plane+=2){ |
242 | float theta = (plane == 1)? M_PI3.14159265358979323846-CATHODE_ROT_ANGLE1.309: CATHODE_ROT_ANGLE1.309; |
243 | float cathode_u =-xwire*cos(theta)-avalanche_y*sin(theta); |
244 | int strip1 = ceil((cathode_u-U_OF_STRIP_ZERO)/STRIP_SPACING +0.5); |
245 | float cathode_u1 = (strip1-1)*STRIP_SPACING + U_OF_STRIP_ZERO; |
246 | float delta = cathode_u-cathode_u1; |
247 | float half_gap=ANODE_CATHODE_SPACING; |
248 | |
249 | #if 0 |
250 | half_gap+=(plane==1)?+wire_dz_offset[global_wire_number]: |
251 | -wire_dz_offset[global_wire_number]; |
252 | #endif |
253 | |
254 | for (node=-STRIP_NODES; node<=STRIP_NODES; node++){ |
255 | /* Induce charge on the strips according to the Mathieson |
256 | function tuned to results from FDC prototype |
257 | */ |
258 | float lambda1=(((float)node-0.5)*STRIP_SPACING+STRIP_GAP/2. |
259 | -delta)/half_gap; |
260 | float lambda2=(((float)node+0.5)*STRIP_SPACING-STRIP_GAP/2. |
261 | -delta)/half_gap; |
262 | float factor=0.25*M_PI3.14159265358979323846*K2; |
263 | float q = 0.25*q_anode*(tanh(factor*lambda2)-tanh(factor*lambda1)); |
264 | |
265 | int strip = strip1+node; |
266 | /* Throw away hits on strips falling within a certain dead-zone |
267 | radius */ |
268 | float strip_outer_u=cathode_u1 |
269 | +(STRIP_SPACING+STRIP_GAP/2.)*(int)node; |
270 | float cathode_v=-xwire*sin(theta)+avalanche_y*cos(theta); |
271 | float check_radius=sqrt(strip_outer_u*strip_outer_u |
272 | +cathode_v*cathode_v); |
273 | |
274 | if ((strip > 0) |
275 | && (check_radius>strip_dead_zone_radius[PackNo]) |
276 | && (strip <= STRIPS_PER_PLANE)){ |
277 | int mark = (chamber<<20) + (plane<<10) + strip; |
278 | void** cathodeTwig = getTwig(&forwardDCTree, mark); |
279 | if (*cathodeTwig == 0){ |
280 | s_ForwardDC_t* fdc = *cathodeTwig = make_s_ForwardDC(); |
281 | s_FdcChambers_t* chambers = make_s_FdcChambers(1); |
282 | s_FdcCathodeStrips_t* strips = make_s_FdcCathodeStrips(1); |
283 | strips->mult = 1; |
284 | strips->in[0].plane = plane; |
285 | strips->in[0].strip = strip; |
286 | strips->in[0].fdcCathodeTruthHits = chits |
287 | = make_s_FdcCathodeTruthHits(MAX_HITS1000); |
288 | chambers->mult = 1; |
289 | chambers->in[0].module = module; |
290 | chambers->in[0].layer = layer; |
291 | chambers->in[0].fdcCathodeStrips = strips; |
292 | fdc->fdcChambers = chambers; |
293 | stripCount++; |
294 | } |
295 | else{ |
296 | s_ForwardDC_t* fdc = *cathodeTwig; |
297 | chits = fdc->fdcChambers->in[0].fdcCathodeStrips |
298 | ->in[0].fdcCathodeTruthHits; |
299 | } |
300 | |
301 | int nhit; |
302 | for (nhit = 0; nhit < chits->mult; nhit++){ |
303 | // To cut down on the number of output clusters, combine |
304 | // those that would be indistiguishable in time given the |
305 | // expected timing resolution |
306 | if (fabs(chits->in[nhit].t - tdrift) <TWO_HIT_RESOL) |
307 | { |
308 | break; |
309 | } |
310 | } |
311 | if (nhit < chits->mult) /* merge with former hit */ |
312 | { |
313 | /* Use the time from the earlier hit but add the charge */ |
314 | chits->in[nhit].q += q; |
315 | if(chits->in[nhit].t>tdrift){ |
316 | chits->in[nhit].t = tdrift; |
317 | chits->in[nhit].itrack = itrack; |
318 | chits->in[nhit].ptype = ipart; |
319 | } |
320 | } |
321 | else if (nhit < MAX_HITS1000){ /* create new hit */ |
322 | chits->in[nhit].t = tdrift; |
323 | chits->in[nhit].q = q; |
324 | chits->in[nhit].itrack = itrack; |
325 | chits->in[nhit].ptype = ipart; |
326 | chits->mult++; |
327 | } |
328 | else{ |
329 | fprintf(stderrstderr,"HDGeant error in hitForwardDC: "); |
330 | fprintf(stderrstderr,"max hit count %d exceeded, truncating!\n", MAX_HITS1000); |
331 | } |
332 | |
333 | } |
334 | } // loop over cathode strips |
335 | } // loop over cathode views |
336 | } |
337 | |
338 | |
339 | // Add wire information |
340 | int AddFDCAnodeHit(s_FdcAnodeTruthHits_t* ahits,int layer,int ipart,int track, |
341 | float xwire,float xyz[3],float dE,float t,float *tdrift){ |
342 | |
343 | // Generate 2 random numbers from a Gaussian distribution |
344 | // |
345 | float rndno[2]; |
346 | int two=2; |
347 | |
348 | // Only and always use the built-in Geant random generator, |
349 | // otherwise debugging is a problem because sequences are not |
350 | // reproducible from a given pair of random seeds. [rtj] |
351 | |
352 | /* rnorml_(rndno,&two); */ { |
353 | float rho,phi1; |
354 | grndm_(rndno,&two); |
355 | rho = sqrt(-2*log(rndno[0])); |
356 | phi1 = rndno[1]*2*M_PI3.14159265358979323846; |
357 | rndno[0] = rho*cos(phi1); |
358 | rndno[1] = rho*sin(phi1); |
359 | } |
360 | |
361 | // Get the magnetic field at this cluster position |
362 | float x[3],B[3]; |
363 | transformCoord(xyz,"local",x,"global")transformcoord_(xyz,"local",x,"global",strlen("local"),strlen ("global")); |
364 | gufld_db_(x,B); |
365 | |
366 | // Find the angle between the wire direction and the direction of the |
367 | // magnetic field in the x-y plane |
368 | float wire_dir[2]; |
369 | float wire_theta=1.0472*(float)((layer%3)-1); |
370 | float phi=0.; |
371 | float Br=sqrt(B[0]*B[0]+B[1]*B[1]); |
372 | |
373 | wire_dir[0]=sin(wire_theta); |
374 | wire_dir[1]=cos(wire_theta); |
375 | if (Br>0.) phi= acos((B[0]*wire_dir[0]+B[1]*wire_dir[1])/Br); |
376 | |
377 | // useful combinations of dx and dz |
378 | float dx=xyz[0]-xwire; |
379 | float dx2=dx*dx; |
380 | float dx4=dx2*dx2; |
381 | float dz2=xyz[2]*xyz[2]; |
382 | float dz4=dz2*dz2; |
383 | |
384 | // Next compute the avalanche position along wire. |
385 | // Correct avalanche position with deflection along wire due to |
386 | // Lorentz force. |
387 | xyz[1]+=(lorentz_parms[0]*B[2]*(1.+lorentz_parms[1]*Br) )*dx |
388 | +(lorentz_parms[2]+lorentz_parms[3]*(B[2]))*(Br*cos(phi))*xyz[2] |
389 | +( -0.000176 )*dx*dx2/(dz2+0.001); |
390 | // Add transverse diffusion |
391 | xyz[1]+=(( 0.01 )*pow(dx2+dz2,0.125)+( 0.0061 )*dx2)*rndno[0]; |
392 | |
393 | // Do not use this cluster if the Lorentz force would deflect |
394 | // the electrons outside the active region of the detector |
395 | if (sqrt(xyz[1]*xyz[1]+xwire*xwire)>ACTIVE_AREA_OUTER_RADIUS) |
396 | return 0; |
397 | |
398 | // Model the drift time and longitudinal diffusion as a function of |
399 | // position of the cluster within the cell |
400 | double dradius=sqrt(dx2+dz2); |
401 | // locate the position in the drift table for the time corresponding to this |
402 | // distance |
403 | int index=0; |
404 | locate(drift_table,1000,dradius,&index); |
405 | #if OLD_LINEAR_DRIFT_TIME_LOOKUP_INTERPOLATOR |
406 | float dd=drift_table[index+1]-drift_table[index]; |
407 | float frac=(dradius-drift_table[index])/dd; |
408 | float tdrift_unsmeared=0.5*((float)index+frac); |
409 | #else |
410 | // use a quadratic interpolator on the lookup table |
411 | float *dd = &drift_table[(index < 997)? index : 997]; |
412 | double tt = 0.5; //ns |
413 | double dd10 = dd[1] - dd[0]; |
414 | double dd20 = dd[2] - dd[0]; |
415 | double dd21 = dd[2] - dd[1]; |
416 | double qa = tt*index; |
417 | double qb = (dd20/dd10 - 2*dd10/dd20) * tt/dd21; |
418 | double qc = (2/dd20 - 1/dd10) * tt/dd21; |
419 | double d0 = dradius - dd[0]; |
420 | double tdrift_unsmeared = qa + qb*d0 + qc*d0*d0; |
421 | #endif |
422 | // Apply small B-field dependence on the drift time |
423 | tdrift_unsmeared*=1.+bscale[0]+bscale[1]*B[2]*B[2]; |
424 | |
425 | // Minimum drift time for docas near wire (very crude approximation) |
426 | double v_max=0.08; // guess for now based on Garfield, near wire |
427 | double tmin=dradius/v_max; |
428 | |
429 | // longitidinal diffusion, derived from Garfield calculations |
430 | float dt=(( 39.44 )*dx4/(0.5-dz2)+( 56.0 )*dz4/(0.5-dx2) |
431 | +( 0.01566 )*dx4/(dz4+0.002)/(0.251-dx2))*(rndno[1]-0.5); |
432 | |
433 | double tdrift_smeared=tdrift_unsmeared+dt; |
434 | if (tdrift_smeared<tmin){ |
435 | tdrift_smeared=tmin; |
436 | } |
437 | |
438 | |
439 | // Avalanche time |
440 | *tdrift=t+tdrift_smeared; |
441 | |
442 | // Skip cluster if the time would go beyond readout window |
443 | if( *tdrift > FDC_TIME_WINDOW ) return 0; |
444 | |
445 | int nhit; |
446 | |
447 | // Record the anode hit |
448 | for (nhit = 0; nhit < ahits->mult; nhit++) |
449 | { |
450 | if (fabs(ahits->in[nhit].t - *tdrift) < TWO_HIT_RESOL) |
451 | { |
452 | break; |
453 | } |
454 | } |
455 | if (nhit < ahits->mult) /* merge with former hit */ |
456 | { |
457 | /* use the time from the earlier hit but add the energy */ |
458 | ahits->in[nhit].dE += dE; |
459 | if(ahits->in[nhit].t>*tdrift){ |
460 | ahits->in[nhit].t = *tdrift; |
461 | ahits->in[nhit].t_unsmeared=tdrift_unsmeared; |
462 | ahits->in[nhit].d = sqrt(dx2+dz2); |
463 | |
464 | ahits->in[nhit].itrack = itrack; |
465 | ahits->in[nhit].ptype = ipart; |
466 | } |
467 | |
468 | #ifdef FDC_AVERAGE_TIME_FOR_MERGED_HITS |
469 | /* This old treatment tried to average the lead-edge |
470 | * times of merged hits. It has been disabled, in favor |
471 | * of just keeping the time of the first hit recorded. |
472 | */ |
473 | ahits->in[nhit].t = |
474 | (ahits->in[nhit].t * ahits->in[nhit].dE + *tdrift * dE) |
475 | / (ahits->in[nhit].dE += dE); |
476 | #endif |
477 | |
478 | } |
479 | else if (nhit < MAX_HITS1000) /* create new hit */ |
480 | { |
481 | ahits->in[nhit].t = *tdrift; |
482 | ahits->in[nhit].t_unsmeared=tdrift_unsmeared; |
483 | ahits->in[nhit].dE = dE; |
484 | ahits->in[nhit].d = sqrt(dx2+dz2); |
485 | ahits->in[nhit].itrack = itrack; |
486 | ahits->in[nhit].ptype = ipart; |
487 | ahits->mult++; |
488 | } |
489 | else |
490 | { |
491 | fprintf(stderrstderr,"HDGeant error in hitForwardDC: "); |
492 | fprintf(stderrstderr,"max hit count %d exceeded, truncating!\n",MAX_HITS1000); |
493 | } |
494 | |
495 | return 1; |
496 | } |
497 | |
498 | /* register hits during tracking (from gustep) */ |
499 | |
500 | void hitForwardDC (float xin[4], float xout[4], |
501 | float pin[5], float pout[5], float dEsum, |
502 | int track, int stack, int history, int ipart) |
503 | { |
504 | float x[3], t; |
505 | float dx[3], dr; |
506 | float dEdx; |
507 | float xlocal[3]; |
508 | float xinlocal[3]; |
509 | float xoutlocal[3]; |
510 | float dradius=0; |
511 | float alpha,sinalpha,cosalpha; |
512 | |
513 | if (!initializedx){ |
514 | mystr_t strings[250]; |
515 | float values[250]; |
516 | int nvalues = 250; |
517 | |
518 | // Get parameters related to the geometry and the signals |
519 | int status = GetConstants("FDC/fdc_parms", &nvalues,values,strings); |
520 | if (!status) { |
521 | int ncounter = 0; |
522 | int i; |
523 | for ( i=0;i<(int)nvalues;i++){ |
524 | //printf("%d %s %f\n",i,strings[i].str,values[i]); |
525 | if (!strcmp(strings[i].str,"FDC_DRIFT_SPEED")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (strings[i].str) && __builtin_constant_p ("FDC_DRIFT_SPEED" ) && (__s1_len = strlen (strings[i].str), __s2_len = strlen ("FDC_DRIFT_SPEED"), (!((size_t)(const void *)((strings[i].str ) + 1) - (size_t)(const void *)(strings[i].str) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("FDC_DRIFT_SPEED" ) + 1) - (size_t)(const void *)("FDC_DRIFT_SPEED") == 1) || __s2_len >= 4)) ? __builtin_strcmp (strings[i].str, "FDC_DRIFT_SPEED" ) : (__builtin_constant_p (strings[i].str) && ((size_t )(const void *)((strings[i].str) + 1) - (size_t)(const void * )(strings[i].str) == 1) && (__s1_len = strlen (strings [i].str), __s1_len < 4) ? (__builtin_constant_p ("FDC_DRIFT_SPEED" ) && ((size_t)(const void *)(("FDC_DRIFT_SPEED") + 1) - (size_t)(const void *)("FDC_DRIFT_SPEED") == 1) ? __builtin_strcmp (strings[i].str, "FDC_DRIFT_SPEED") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("FDC_DRIFT_SPEED"); int __result = (((const unsigned char * ) (const char *) (strings[i].str))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (strings[i].str))[1] - __s2[1]); if ( __s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (strings[i].str))[2] - __s2[ 2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (strings[i].str))[3 ] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("FDC_DRIFT_SPEED" ) && ((size_t)(const void *)(("FDC_DRIFT_SPEED") + 1) - (size_t)(const void *)("FDC_DRIFT_SPEED") == 1) && (__s2_len = strlen ("FDC_DRIFT_SPEED"), __s2_len < 4) ? ( __builtin_constant_p (strings[i].str) && ((size_t)(const void *)((strings[i].str) + 1) - (size_t)(const void *)(strings [i].str) == 1) ? __builtin_strcmp (strings[i].str, "FDC_DRIFT_SPEED" ) : (__extension__ ({ const unsigned char *__s1 = (const unsigned char *) (const char *) (strings[i].str); register int __result = __s1[0] - ((const unsigned char *) (const char *) ("FDC_DRIFT_SPEED" ))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((const unsigned char *) (const char *) ("FDC_DRIFT_SPEED" ))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((const unsigned char *) (const char *) ("FDC_DRIFT_SPEED" ))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((const unsigned char *) (const char *) ("FDC_DRIFT_SPEED" ))[3]); } } __result; }))) : __builtin_strcmp (strings[i].str , "FDC_DRIFT_SPEED")))); })) { |
526 | DRIFT_SPEED = values[i]; |
527 | ncounter++; |
528 | } |
529 | if (!strcmp(strings[i].str,"FDC_ACTIVE_AREA_OUTER_RADIUS")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (strings[i].str) && __builtin_constant_p ("FDC_ACTIVE_AREA_OUTER_RADIUS" ) && (__s1_len = strlen (strings[i].str), __s2_len = strlen ("FDC_ACTIVE_AREA_OUTER_RADIUS"), (!((size_t)(const void *)( (strings[i].str) + 1) - (size_t)(const void *)(strings[i].str ) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("FDC_ACTIVE_AREA_OUTER_RADIUS") + 1) - (size_t)(const void *)("FDC_ACTIVE_AREA_OUTER_RADIUS") == 1) || __s2_len >= 4 )) ? __builtin_strcmp (strings[i].str, "FDC_ACTIVE_AREA_OUTER_RADIUS" ) : (__builtin_constant_p (strings[i].str) && ((size_t )(const void *)((strings[i].str) + 1) - (size_t)(const void * )(strings[i].str) == 1) && (__s1_len = strlen (strings [i].str), __s1_len < 4) ? (__builtin_constant_p ("FDC_ACTIVE_AREA_OUTER_RADIUS" ) && ((size_t)(const void *)(("FDC_ACTIVE_AREA_OUTER_RADIUS" ) + 1) - (size_t)(const void *)("FDC_ACTIVE_AREA_OUTER_RADIUS" ) == 1) ? __builtin_strcmp (strings[i].str, "FDC_ACTIVE_AREA_OUTER_RADIUS" ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("FDC_ACTIVE_AREA_OUTER_RADIUS"); int __result = (((const unsigned char *) (const char *) (strings [i].str))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ( strings[i].str))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (strings[i].str))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char * ) (const char *) (strings[i].str))[3] - __s2[3]); } } __result ; }))) : (__builtin_constant_p ("FDC_ACTIVE_AREA_OUTER_RADIUS" ) && ((size_t)(const void *)(("FDC_ACTIVE_AREA_OUTER_RADIUS" ) + 1) - (size_t)(const void *)("FDC_ACTIVE_AREA_OUTER_RADIUS" ) == 1) && (__s2_len = strlen ("FDC_ACTIVE_AREA_OUTER_RADIUS" ), __s2_len < 4) ? (__builtin_constant_p (strings[i].str) && ((size_t)(const void *)((strings[i].str) + 1) - (size_t)(const void *)(strings[i].str) == 1) ? __builtin_strcmp (strings[i] .str, "FDC_ACTIVE_AREA_OUTER_RADIUS") : (__extension__ ({ const unsigned char *__s1 = (const unsigned char *) (const char *) (strings[i].str); register int __result = __s1[0] - ((const unsigned char *) (const char *) ("FDC_ACTIVE_AREA_OUTER_RADIUS"))[0]; if (__s2_len > 0 && __result == 0) { __result = ( __s1[1] - ((const unsigned char *) (const char *) ("FDC_ACTIVE_AREA_OUTER_RADIUS" ))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((const unsigned char *) (const char *) ("FDC_ACTIVE_AREA_OUTER_RADIUS" ))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((const unsigned char *) (const char *) ("FDC_ACTIVE_AREA_OUTER_RADIUS" ))[3]); } } __result; }))) : __builtin_strcmp (strings[i].str , "FDC_ACTIVE_AREA_OUTER_RADIUS")))); })) { |
530 | ACTIVE_AREA_OUTER_RADIUS = values[i]; |
531 | ncounter++; |
532 | } |
533 | if (!strcmp(strings[i].str,"FDC_ANODE_CATHODE_SPACING")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (strings[i].str) && __builtin_constant_p ("FDC_ANODE_CATHODE_SPACING" ) && (__s1_len = strlen (strings[i].str), __s2_len = strlen ("FDC_ANODE_CATHODE_SPACING"), (!((size_t)(const void *)((strings [i].str) + 1) - (size_t)(const void *)(strings[i].str) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("FDC_ANODE_CATHODE_SPACING" ) + 1) - (size_t)(const void *)("FDC_ANODE_CATHODE_SPACING") == 1) || __s2_len >= 4)) ? __builtin_strcmp (strings[i].str, "FDC_ANODE_CATHODE_SPACING") : (__builtin_constant_p (strings [i].str) && ((size_t)(const void *)((strings[i].str) + 1) - (size_t)(const void *)(strings[i].str) == 1) && (__s1_len = strlen (strings[i].str), __s1_len < 4) ? (__builtin_constant_p ("FDC_ANODE_CATHODE_SPACING") && ((size_t)(const void *)(("FDC_ANODE_CATHODE_SPACING") + 1) - (size_t)(const void * )("FDC_ANODE_CATHODE_SPACING") == 1) ? __builtin_strcmp (strings [i].str, "FDC_ANODE_CATHODE_SPACING") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("FDC_ANODE_CATHODE_SPACING"); int __result = (((const unsigned char *) (const char *) (strings[i].str))[0] - __s2[0]); if ( __s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (strings[i].str))[1] - __s2[ 1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (strings[i].str)) [2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (strings [i].str))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("FDC_ANODE_CATHODE_SPACING") && ((size_t)(const void *)(("FDC_ANODE_CATHODE_SPACING") + 1) - (size_t)(const void * )("FDC_ANODE_CATHODE_SPACING") == 1) && (__s2_len = strlen ("FDC_ANODE_CATHODE_SPACING"), __s2_len < 4) ? (__builtin_constant_p (strings[i].str) && ((size_t)(const void *)((strings [i].str) + 1) - (size_t)(const void *)(strings[i].str) == 1) ? __builtin_strcmp (strings[i].str, "FDC_ANODE_CATHODE_SPACING" ) : (__extension__ ({ const unsigned char *__s1 = (const unsigned char *) (const char *) (strings[i].str); register int __result = __s1[0] - ((const unsigned char *) (const char *) ("FDC_ANODE_CATHODE_SPACING" ))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((const unsigned char *) (const char *) ("FDC_ANODE_CATHODE_SPACING" ))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((const unsigned char *) (const char *) ("FDC_ANODE_CATHODE_SPACING" ))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((const unsigned char *) (const char *) ("FDC_ANODE_CATHODE_SPACING" ))[3]); } } __result; }))) : __builtin_strcmp (strings[i].str , "FDC_ANODE_CATHODE_SPACING")))); })) { |
534 | ANODE_CATHODE_SPACING = values[i]; |
535 | ncounter++; |
536 | } |
537 | if (!strcmp(strings[i].str,"FDC_TWO_HIT_RESOL")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (strings[i].str) && __builtin_constant_p ("FDC_TWO_HIT_RESOL" ) && (__s1_len = strlen (strings[i].str), __s2_len = strlen ("FDC_TWO_HIT_RESOL"), (!((size_t)(const void *)((strings[i] .str) + 1) - (size_t)(const void *)(strings[i].str) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("FDC_TWO_HIT_RESOL" ) + 1) - (size_t)(const void *)("FDC_TWO_HIT_RESOL") == 1) || __s2_len >= 4)) ? __builtin_strcmp (strings[i].str, "FDC_TWO_HIT_RESOL" ) : (__builtin_constant_p (strings[i].str) && ((size_t )(const void *)((strings[i].str) + 1) - (size_t)(const void * )(strings[i].str) == 1) && (__s1_len = strlen (strings [i].str), __s1_len < 4) ? (__builtin_constant_p ("FDC_TWO_HIT_RESOL" ) && ((size_t)(const void *)(("FDC_TWO_HIT_RESOL") + 1 ) - (size_t)(const void *)("FDC_TWO_HIT_RESOL") == 1) ? __builtin_strcmp (strings[i].str, "FDC_TWO_HIT_RESOL") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("FDC_TWO_HIT_RESOL"); int __result = (((const unsigned char *) (const char *) (strings[i].str))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (strings[i].str))[1] - __s2[1]); if ( __s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (strings[i].str))[2] - __s2[ 2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (strings[i].str))[3 ] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("FDC_TWO_HIT_RESOL" ) && ((size_t)(const void *)(("FDC_TWO_HIT_RESOL") + 1 ) - (size_t)(const void *)("FDC_TWO_HIT_RESOL") == 1) && (__s2_len = strlen ("FDC_TWO_HIT_RESOL"), __s2_len < 4) ? (__builtin_constant_p (strings[i].str) && ((size_t)( const void *)((strings[i].str) + 1) - (size_t)(const void *)( strings[i].str) == 1) ? __builtin_strcmp (strings[i].str, "FDC_TWO_HIT_RESOL" ) : (__extension__ ({ const unsigned char *__s1 = (const unsigned char *) (const char *) (strings[i].str); register int __result = __s1[0] - ((const unsigned char *) (const char *) ("FDC_TWO_HIT_RESOL" ))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((const unsigned char *) (const char *) ("FDC_TWO_HIT_RESOL" ))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((const unsigned char *) (const char *) ("FDC_TWO_HIT_RESOL" ))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((const unsigned char *) (const char *) ("FDC_TWO_HIT_RESOL" ))[3]); } } __result; }))) : __builtin_strcmp (strings[i].str , "FDC_TWO_HIT_RESOL")))); })) { |
538 | TWO_HIT_RESOL = values[i]; |
539 | ncounter++; |
540 | } |
541 | if (!strcmp(strings[i].str,"FDC_WIRES_PER_PLANE")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (strings[i].str) && __builtin_constant_p ("FDC_WIRES_PER_PLANE" ) && (__s1_len = strlen (strings[i].str), __s2_len = strlen ("FDC_WIRES_PER_PLANE"), (!((size_t)(const void *)((strings[ i].str) + 1) - (size_t)(const void *)(strings[i].str) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("FDC_WIRES_PER_PLANE" ) + 1) - (size_t)(const void *)("FDC_WIRES_PER_PLANE") == 1) || __s2_len >= 4)) ? __builtin_strcmp (strings[i].str, "FDC_WIRES_PER_PLANE" ) : (__builtin_constant_p (strings[i].str) && ((size_t )(const void *)((strings[i].str) + 1) - (size_t)(const void * )(strings[i].str) == 1) && (__s1_len = strlen (strings [i].str), __s1_len < 4) ? (__builtin_constant_p ("FDC_WIRES_PER_PLANE" ) && ((size_t)(const void *)(("FDC_WIRES_PER_PLANE") + 1) - (size_t)(const void *)("FDC_WIRES_PER_PLANE") == 1) ? __builtin_strcmp (strings[i].str, "FDC_WIRES_PER_PLANE") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("FDC_WIRES_PER_PLANE"); int __result = (((const unsigned char *) (const char *) (strings[i].str))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (strings[i].str))[1] - __s2[1]); if ( __s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (strings[i].str))[2] - __s2[ 2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (strings[i].str))[3 ] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("FDC_WIRES_PER_PLANE" ) && ((size_t)(const void *)(("FDC_WIRES_PER_PLANE") + 1) - (size_t)(const void *)("FDC_WIRES_PER_PLANE") == 1) && (__s2_len = strlen ("FDC_WIRES_PER_PLANE"), __s2_len < 4) ? (__builtin_constant_p (strings[i].str) && ((size_t )(const void *)((strings[i].str) + 1) - (size_t)(const void * )(strings[i].str) == 1) ? __builtin_strcmp (strings[i].str, "FDC_WIRES_PER_PLANE" ) : (__extension__ ({ const unsigned char *__s1 = (const unsigned char *) (const char *) (strings[i].str); register int __result = __s1[0] - ((const unsigned char *) (const char *) ("FDC_WIRES_PER_PLANE" ))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((const unsigned char *) (const char *) ("FDC_WIRES_PER_PLANE" ))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((const unsigned char *) (const char *) ("FDC_WIRES_PER_PLANE" ))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((const unsigned char *) (const char *) ("FDC_WIRES_PER_PLANE" ))[3]); } } __result; }))) : __builtin_strcmp (strings[i].str , "FDC_WIRES_PER_PLANE")))); })) { |
542 | WIRES_PER_PLANE = values[i]; |
543 | ncounter++; |
544 | } |
545 | if (!strcmp(strings[i].str,"FDC_WIRE_SPACING")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (strings[i].str) && __builtin_constant_p ("FDC_WIRE_SPACING" ) && (__s1_len = strlen (strings[i].str), __s2_len = strlen ("FDC_WIRE_SPACING"), (!((size_t)(const void *)((strings[i]. str) + 1) - (size_t)(const void *)(strings[i].str) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("FDC_WIRE_SPACING" ) + 1) - (size_t)(const void *)("FDC_WIRE_SPACING") == 1) || __s2_len >= 4)) ? __builtin_strcmp (strings[i].str, "FDC_WIRE_SPACING" ) : (__builtin_constant_p (strings[i].str) && ((size_t )(const void *)((strings[i].str) + 1) - (size_t)(const void * )(strings[i].str) == 1) && (__s1_len = strlen (strings [i].str), __s1_len < 4) ? (__builtin_constant_p ("FDC_WIRE_SPACING" ) && ((size_t)(const void *)(("FDC_WIRE_SPACING") + 1 ) - (size_t)(const void *)("FDC_WIRE_SPACING") == 1) ? __builtin_strcmp (strings[i].str, "FDC_WIRE_SPACING") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("FDC_WIRE_SPACING"); int __result = (((const unsigned char * ) (const char *) (strings[i].str))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (strings[i].str))[1] - __s2[1]); if ( __s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (strings[i].str))[2] - __s2[ 2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (strings[i].str))[3 ] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("FDC_WIRE_SPACING" ) && ((size_t)(const void *)(("FDC_WIRE_SPACING") + 1 ) - (size_t)(const void *)("FDC_WIRE_SPACING") == 1) && (__s2_len = strlen ("FDC_WIRE_SPACING"), __s2_len < 4) ? ( __builtin_constant_p (strings[i].str) && ((size_t)(const void *)((strings[i].str) + 1) - (size_t)(const void *)(strings [i].str) == 1) ? __builtin_strcmp (strings[i].str, "FDC_WIRE_SPACING" ) : (__extension__ ({ const unsigned char *__s1 = (const unsigned char *) (const char *) (strings[i].str); register int __result = __s1[0] - ((const unsigned char *) (const char *) ("FDC_WIRE_SPACING" ))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((const unsigned char *) (const char *) ("FDC_WIRE_SPACING" ))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((const unsigned char *) (const char *) ("FDC_WIRE_SPACING" ))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((const unsigned char *) (const char *) ("FDC_WIRE_SPACING" ))[3]); } } __result; }))) : __builtin_strcmp (strings[i].str , "FDC_WIRE_SPACING")))); })) { |
546 | WIRE_SPACING = values[i]; |
547 | ncounter++; |
548 | } |
549 | if (!strcmp(strings[i].str,"FDC_STRIPS_PER_PLANE")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (strings[i].str) && __builtin_constant_p ("FDC_STRIPS_PER_PLANE" ) && (__s1_len = strlen (strings[i].str), __s2_len = strlen ("FDC_STRIPS_PER_PLANE"), (!((size_t)(const void *)((strings [i].str) + 1) - (size_t)(const void *)(strings[i].str) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("FDC_STRIPS_PER_PLANE" ) + 1) - (size_t)(const void *)("FDC_STRIPS_PER_PLANE") == 1) || __s2_len >= 4)) ? __builtin_strcmp (strings[i].str, "FDC_STRIPS_PER_PLANE" ) : (__builtin_constant_p (strings[i].str) && ((size_t )(const void *)((strings[i].str) + 1) - (size_t)(const void * )(strings[i].str) == 1) && (__s1_len = strlen (strings [i].str), __s1_len < 4) ? (__builtin_constant_p ("FDC_STRIPS_PER_PLANE" ) && ((size_t)(const void *)(("FDC_STRIPS_PER_PLANE") + 1) - (size_t)(const void *)("FDC_STRIPS_PER_PLANE") == 1) ? __builtin_strcmp (strings[i].str, "FDC_STRIPS_PER_PLANE") : ( __extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("FDC_STRIPS_PER_PLANE"); int __result = ( ((const unsigned char *) (const char *) (strings[i].str))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (strings[i].str)) [1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (strings [i].str))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (strings [i].str))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("FDC_STRIPS_PER_PLANE") && ((size_t)(const void *)( ("FDC_STRIPS_PER_PLANE") + 1) - (size_t)(const void *)("FDC_STRIPS_PER_PLANE" ) == 1) && (__s2_len = strlen ("FDC_STRIPS_PER_PLANE" ), __s2_len < 4) ? (__builtin_constant_p (strings[i].str) && ((size_t)(const void *)((strings[i].str) + 1) - (size_t)(const void *)(strings[i].str) == 1) ? __builtin_strcmp (strings[i] .str, "FDC_STRIPS_PER_PLANE") : (__extension__ ({ const unsigned char *__s1 = (const unsigned char *) (const char *) (strings [i].str); register int __result = __s1[0] - ((const unsigned char *) (const char *) ("FDC_STRIPS_PER_PLANE"))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((const unsigned char *) (const char *) ("FDC_STRIPS_PER_PLANE"))[1] ); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((const unsigned char *) (const char *) ("FDC_STRIPS_PER_PLANE" ))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((const unsigned char *) (const char *) ("FDC_STRIPS_PER_PLANE" ))[3]); } } __result; }))) : __builtin_strcmp (strings[i].str , "FDC_STRIPS_PER_PLANE")))); })) { |
550 | STRIPS_PER_PLANE = values[i]; |
551 | ncounter++; |
552 | } |
553 | if (!strcmp(strings[i].str,"FDC_STRIP_SPACING")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (strings[i].str) && __builtin_constant_p ("FDC_STRIP_SPACING" ) && (__s1_len = strlen (strings[i].str), __s2_len = strlen ("FDC_STRIP_SPACING"), (!((size_t)(const void *)((strings[i] .str) + 1) - (size_t)(const void *)(strings[i].str) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("FDC_STRIP_SPACING" ) + 1) - (size_t)(const void *)("FDC_STRIP_SPACING") == 1) || __s2_len >= 4)) ? __builtin_strcmp (strings[i].str, "FDC_STRIP_SPACING" ) : (__builtin_constant_p (strings[i].str) && ((size_t )(const void *)((strings[i].str) + 1) - (size_t)(const void * )(strings[i].str) == 1) && (__s1_len = strlen (strings [i].str), __s1_len < 4) ? (__builtin_constant_p ("FDC_STRIP_SPACING" ) && ((size_t)(const void *)(("FDC_STRIP_SPACING") + 1 ) - (size_t)(const void *)("FDC_STRIP_SPACING") == 1) ? __builtin_strcmp (strings[i].str, "FDC_STRIP_SPACING") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("FDC_STRIP_SPACING"); int __result = (((const unsigned char *) (const char *) (strings[i].str))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (strings[i].str))[1] - __s2[1]); if ( __s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (strings[i].str))[2] - __s2[ 2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (strings[i].str))[3 ] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("FDC_STRIP_SPACING" ) && ((size_t)(const void *)(("FDC_STRIP_SPACING") + 1 ) - (size_t)(const void *)("FDC_STRIP_SPACING") == 1) && (__s2_len = strlen ("FDC_STRIP_SPACING"), __s2_len < 4) ? (__builtin_constant_p (strings[i].str) && ((size_t)( const void *)((strings[i].str) + 1) - (size_t)(const void *)( strings[i].str) == 1) ? __builtin_strcmp (strings[i].str, "FDC_STRIP_SPACING" ) : (__extension__ ({ const unsigned char *__s1 = (const unsigned char *) (const char *) (strings[i].str); register int __result = __s1[0] - ((const unsigned char *) (const char *) ("FDC_STRIP_SPACING" ))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((const unsigned char *) (const char *) ("FDC_STRIP_SPACING" ))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((const unsigned char *) (const char *) ("FDC_STRIP_SPACING" ))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((const unsigned char *) (const char *) ("FDC_STRIP_SPACING" ))[3]); } } __result; }))) : __builtin_strcmp (strings[i].str , "FDC_STRIP_SPACING")))); })) { |
554 | STRIP_SPACING = values[i]; |
555 | ncounter++; |
556 | } |
557 | if (!strcmp(strings[i].str,"FDC_STRIP_GAP")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (strings[i].str) && __builtin_constant_p ("FDC_STRIP_GAP" ) && (__s1_len = strlen (strings[i].str), __s2_len = strlen ("FDC_STRIP_GAP"), (!((size_t)(const void *)((strings[i].str ) + 1) - (size_t)(const void *)(strings[i].str) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("FDC_STRIP_GAP" ) + 1) - (size_t)(const void *)("FDC_STRIP_GAP") == 1) || __s2_len >= 4)) ? __builtin_strcmp (strings[i].str, "FDC_STRIP_GAP" ) : (__builtin_constant_p (strings[i].str) && ((size_t )(const void *)((strings[i].str) + 1) - (size_t)(const void * )(strings[i].str) == 1) && (__s1_len = strlen (strings [i].str), __s1_len < 4) ? (__builtin_constant_p ("FDC_STRIP_GAP" ) && ((size_t)(const void *)(("FDC_STRIP_GAP") + 1) - (size_t)(const void *)("FDC_STRIP_GAP") == 1) ? __builtin_strcmp (strings[i].str, "FDC_STRIP_GAP") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("FDC_STRIP_GAP" ); int __result = (((const unsigned char *) (const char *) (strings [i].str))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ( strings[i].str))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (strings[i].str))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char * ) (const char *) (strings[i].str))[3] - __s2[3]); } } __result ; }))) : (__builtin_constant_p ("FDC_STRIP_GAP") && ( (size_t)(const void *)(("FDC_STRIP_GAP") + 1) - (size_t)(const void *)("FDC_STRIP_GAP") == 1) && (__s2_len = strlen ("FDC_STRIP_GAP"), __s2_len < 4) ? (__builtin_constant_p ( strings[i].str) && ((size_t)(const void *)((strings[i ].str) + 1) - (size_t)(const void *)(strings[i].str) == 1) ? __builtin_strcmp (strings[i].str, "FDC_STRIP_GAP") : (__extension__ ({ const unsigned char *__s1 = (const unsigned char *) (const char *) (strings [i].str); register int __result = __s1[0] - ((const unsigned char *) (const char *) ("FDC_STRIP_GAP"))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((const unsigned char *) (const char *) ("FDC_STRIP_GAP"))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((const unsigned char *) (const char *) ("FDC_STRIP_GAP"))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((const unsigned char *) (const char *) ("FDC_STRIP_GAP"))[3]); } } __result; }))) : __builtin_strcmp (strings[i].str, "FDC_STRIP_GAP")))) ; })) { |
558 | STRIP_GAP = values[i]; |
559 | ncounter++; |
560 | } |
561 | if (!strcmp(strings[i].str,"FDC_MAX_HITS")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (strings[i].str) && __builtin_constant_p ("FDC_MAX_HITS" ) && (__s1_len = strlen (strings[i].str), __s2_len = strlen ("FDC_MAX_HITS"), (!((size_t)(const void *)((strings[i].str) + 1) - (size_t)(const void *)(strings[i].str) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("FDC_MAX_HITS" ) + 1) - (size_t)(const void *)("FDC_MAX_HITS") == 1) || __s2_len >= 4)) ? __builtin_strcmp (strings[i].str, "FDC_MAX_HITS" ) : (__builtin_constant_p (strings[i].str) && ((size_t )(const void *)((strings[i].str) + 1) - (size_t)(const void * )(strings[i].str) == 1) && (__s1_len = strlen (strings [i].str), __s1_len < 4) ? (__builtin_constant_p ("FDC_MAX_HITS" ) && ((size_t)(const void *)(("FDC_MAX_HITS") + 1) - ( size_t)(const void *)("FDC_MAX_HITS") == 1) ? __builtin_strcmp (strings[i].str, "FDC_MAX_HITS") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("FDC_MAX_HITS" ); int __result = (((const unsigned char *) (const char *) (strings [i].str))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ( strings[i].str))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (strings[i].str))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char * ) (const char *) (strings[i].str))[3] - __s2[3]); } } __result ; }))) : (__builtin_constant_p ("FDC_MAX_HITS") && (( size_t)(const void *)(("FDC_MAX_HITS") + 1) - (size_t)(const void *)("FDC_MAX_HITS") == 1) && (__s2_len = strlen ("FDC_MAX_HITS" ), __s2_len < 4) ? (__builtin_constant_p (strings[i].str) && ((size_t)(const void *)((strings[i].str) + 1) - (size_t)(const void *)(strings[i].str) == 1) ? __builtin_strcmp (strings[i] .str, "FDC_MAX_HITS") : (__extension__ ({ const unsigned char *__s1 = (const unsigned char *) (const char *) (strings[i].str ); register int __result = __s1[0] - ((const unsigned char *) (const char *) ("FDC_MAX_HITS"))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((const unsigned char *) (const char *) ("FDC_MAX_HITS"))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((const unsigned char *) (const char *) ("FDC_MAX_HITS"))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((const unsigned char *) (const char *) ("FDC_MAX_HITS"))[3]); } } __result; } ))) : __builtin_strcmp (strings[i].str, "FDC_MAX_HITS")))); } )) { |
562 | FDC_MAX_HITS = values[i]; |
563 | ncounter++; |
564 | } |
565 | if (!strcmp(strings[i].str,"FDC_K2")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (strings[i].str) && __builtin_constant_p ("FDC_K2") && (__s1_len = strlen (strings[i].str), __s2_len = strlen ("FDC_K2" ), (!((size_t)(const void *)((strings[i].str) + 1) - (size_t) (const void *)(strings[i].str) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("FDC_K2") + 1) - (size_t)(const void *)("FDC_K2") == 1) || __s2_len >= 4)) ? __builtin_strcmp ( strings[i].str, "FDC_K2") : (__builtin_constant_p (strings[i] .str) && ((size_t)(const void *)((strings[i].str) + 1 ) - (size_t)(const void *)(strings[i].str) == 1) && ( __s1_len = strlen (strings[i].str), __s1_len < 4) ? (__builtin_constant_p ("FDC_K2") && ((size_t)(const void *)(("FDC_K2") + 1 ) - (size_t)(const void *)("FDC_K2") == 1) ? __builtin_strcmp (strings[i].str, "FDC_K2") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("FDC_K2" ); int __result = (((const unsigned char *) (const char *) (strings [i].str))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ( strings[i].str))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (strings[i].str))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char * ) (const char *) (strings[i].str))[3] - __s2[3]); } } __result ; }))) : (__builtin_constant_p ("FDC_K2") && ((size_t )(const void *)(("FDC_K2") + 1) - (size_t)(const void *)("FDC_K2" ) == 1) && (__s2_len = strlen ("FDC_K2"), __s2_len < 4) ? (__builtin_constant_p (strings[i].str) && ((size_t )(const void *)((strings[i].str) + 1) - (size_t)(const void * )(strings[i].str) == 1) ? __builtin_strcmp (strings[i].str, "FDC_K2" ) : (__extension__ ({ const unsigned char *__s1 = (const unsigned char *) (const char *) (strings[i].str); register int __result = __s1[0] - ((const unsigned char *) (const char *) ("FDC_K2" ))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((const unsigned char *) (const char *) ("FDC_K2" ))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((const unsigned char *) (const char *) ("FDC_K2" ))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((const unsigned char *) (const char *) ("FDC_K2" ))[3]); } } __result; }))) : __builtin_strcmp (strings[i].str , "FDC_K2")))); })) { |
566 | K2 = values[i]; |
567 | ncounter++; |
568 | } |
569 | if (!strcmp(strings[i].str,"FDC_STRIP_NODES")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (strings[i].str) && __builtin_constant_p ("FDC_STRIP_NODES" ) && (__s1_len = strlen (strings[i].str), __s2_len = strlen ("FDC_STRIP_NODES"), (!((size_t)(const void *)((strings[i].str ) + 1) - (size_t)(const void *)(strings[i].str) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("FDC_STRIP_NODES" ) + 1) - (size_t)(const void *)("FDC_STRIP_NODES") == 1) || __s2_len >= 4)) ? __builtin_strcmp (strings[i].str, "FDC_STRIP_NODES" ) : (__builtin_constant_p (strings[i].str) && ((size_t )(const void *)((strings[i].str) + 1) - (size_t)(const void * )(strings[i].str) == 1) && (__s1_len = strlen (strings [i].str), __s1_len < 4) ? (__builtin_constant_p ("FDC_STRIP_NODES" ) && ((size_t)(const void *)(("FDC_STRIP_NODES") + 1) - (size_t)(const void *)("FDC_STRIP_NODES") == 1) ? __builtin_strcmp (strings[i].str, "FDC_STRIP_NODES") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("FDC_STRIP_NODES"); int __result = (((const unsigned char * ) (const char *) (strings[i].str))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (strings[i].str))[1] - __s2[1]); if ( __s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (strings[i].str))[2] - __s2[ 2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (strings[i].str))[3 ] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("FDC_STRIP_NODES" ) && ((size_t)(const void *)(("FDC_STRIP_NODES") + 1) - (size_t)(const void *)("FDC_STRIP_NODES") == 1) && (__s2_len = strlen ("FDC_STRIP_NODES"), __s2_len < 4) ? ( __builtin_constant_p (strings[i].str) && ((size_t)(const void *)((strings[i].str) + 1) - (size_t)(const void *)(strings [i].str) == 1) ? __builtin_strcmp (strings[i].str, "FDC_STRIP_NODES" ) : (__extension__ ({ const unsigned char *__s1 = (const unsigned char *) (const char *) (strings[i].str); register int __result = __s1[0] - ((const unsigned char *) (const char *) ("FDC_STRIP_NODES" ))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((const unsigned char *) (const char *) ("FDC_STRIP_NODES" ))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((const unsigned char *) (const char *) ("FDC_STRIP_NODES" ))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((const unsigned char *) (const char *) ("FDC_STRIP_NODES" ))[3]); } } __result; }))) : __builtin_strcmp (strings[i].str , "FDC_STRIP_NODES")))); })) { |
570 | STRIP_NODES = values[i]; |
571 | ncounter++; |
572 | } |
573 | if (!strcmp(strings[i].str,"FDC_THRESH_KEV")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (strings[i].str) && __builtin_constant_p ("FDC_THRESH_KEV" ) && (__s1_len = strlen (strings[i].str), __s2_len = strlen ("FDC_THRESH_KEV"), (!((size_t)(const void *)((strings[i].str ) + 1) - (size_t)(const void *)(strings[i].str) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("FDC_THRESH_KEV" ) + 1) - (size_t)(const void *)("FDC_THRESH_KEV") == 1) || __s2_len >= 4)) ? __builtin_strcmp (strings[i].str, "FDC_THRESH_KEV" ) : (__builtin_constant_p (strings[i].str) && ((size_t )(const void *)((strings[i].str) + 1) - (size_t)(const void * )(strings[i].str) == 1) && (__s1_len = strlen (strings [i].str), __s1_len < 4) ? (__builtin_constant_p ("FDC_THRESH_KEV" ) && ((size_t)(const void *)(("FDC_THRESH_KEV") + 1) - (size_t)(const void *)("FDC_THRESH_KEV") == 1) ? __builtin_strcmp (strings[i].str, "FDC_THRESH_KEV") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("FDC_THRESH_KEV"); int __result = (((const unsigned char *) (const char *) (strings[i].str))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (strings[i].str))[1] - __s2[1]); if ( __s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (strings[i].str))[2] - __s2[ 2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (strings[i].str))[3 ] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("FDC_THRESH_KEV" ) && ((size_t)(const void *)(("FDC_THRESH_KEV") + 1) - (size_t)(const void *)("FDC_THRESH_KEV") == 1) && (__s2_len = strlen ("FDC_THRESH_KEV"), __s2_len < 4) ? (__builtin_constant_p (strings[i].str) && ((size_t)(const void *)((strings [i].str) + 1) - (size_t)(const void *)(strings[i].str) == 1) ? __builtin_strcmp (strings[i].str, "FDC_THRESH_KEV") : (__extension__ ({ const unsigned char *__s1 = (const unsigned char *) (const char *) (strings[i].str); register int __result = __s1[0] - ( (const unsigned char *) (const char *) ("FDC_THRESH_KEV"))[0] ; if (__s2_len > 0 && __result == 0) { __result = ( __s1[1] - ((const unsigned char *) (const char *) ("FDC_THRESH_KEV" ))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((const unsigned char *) (const char *) ("FDC_THRESH_KEV" ))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((const unsigned char *) (const char *) ("FDC_THRESH_KEV" ))[3]); } } __result; }))) : __builtin_strcmp (strings[i].str , "FDC_THRESH_KEV")))); })) { |
574 | THRESH_KEV = values[i]; |
575 | ncounter++; |
576 | } |
577 | if (!strcmp(strings[i].str,"FDC_THRESH_STRIPS")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (strings[i].str) && __builtin_constant_p ("FDC_THRESH_STRIPS" ) && (__s1_len = strlen (strings[i].str), __s2_len = strlen ("FDC_THRESH_STRIPS"), (!((size_t)(const void *)((strings[i] .str) + 1) - (size_t)(const void *)(strings[i].str) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("FDC_THRESH_STRIPS" ) + 1) - (size_t)(const void *)("FDC_THRESH_STRIPS") == 1) || __s2_len >= 4)) ? __builtin_strcmp (strings[i].str, "FDC_THRESH_STRIPS" ) : (__builtin_constant_p (strings[i].str) && ((size_t )(const void *)((strings[i].str) + 1) - (size_t)(const void * )(strings[i].str) == 1) && (__s1_len = strlen (strings [i].str), __s1_len < 4) ? (__builtin_constant_p ("FDC_THRESH_STRIPS" ) && ((size_t)(const void *)(("FDC_THRESH_STRIPS") + 1 ) - (size_t)(const void *)("FDC_THRESH_STRIPS") == 1) ? __builtin_strcmp (strings[i].str, "FDC_THRESH_STRIPS") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("FDC_THRESH_STRIPS"); int __result = (((const unsigned char *) (const char *) (strings[i].str))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (strings[i].str))[1] - __s2[1]); if ( __s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (strings[i].str))[2] - __s2[ 2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (strings[i].str))[3 ] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("FDC_THRESH_STRIPS" ) && ((size_t)(const void *)(("FDC_THRESH_STRIPS") + 1 ) - (size_t)(const void *)("FDC_THRESH_STRIPS") == 1) && (__s2_len = strlen ("FDC_THRESH_STRIPS"), __s2_len < 4) ? (__builtin_constant_p (strings[i].str) && ((size_t)( const void *)((strings[i].str) + 1) - (size_t)(const void *)( strings[i].str) == 1) ? __builtin_strcmp (strings[i].str, "FDC_THRESH_STRIPS" ) : (__extension__ ({ const unsigned char *__s1 = (const unsigned char *) (const char *) (strings[i].str); register int __result = __s1[0] - ((const unsigned char *) (const char *) ("FDC_THRESH_STRIPS" ))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((const unsigned char *) (const char *) ("FDC_THRESH_STRIPS" ))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((const unsigned char *) (const char *) ("FDC_THRESH_STRIPS" ))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((const unsigned char *) (const char *) ("FDC_THRESH_STRIPS" ))[3]); } } __result; }))) : __builtin_strcmp (strings[i].str , "FDC_THRESH_STRIPS")))); })) { |
578 | THRESH_STRIPS = values[i]; |
579 | ncounter++; |
580 | } |
581 | if (!strcmp(strings[i].str,"FDC_ELECTRON_CHARGE")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (strings[i].str) && __builtin_constant_p ("FDC_ELECTRON_CHARGE" ) && (__s1_len = strlen (strings[i].str), __s2_len = strlen ("FDC_ELECTRON_CHARGE"), (!((size_t)(const void *)((strings[ i].str) + 1) - (size_t)(const void *)(strings[i].str) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("FDC_ELECTRON_CHARGE" ) + 1) - (size_t)(const void *)("FDC_ELECTRON_CHARGE") == 1) || __s2_len >= 4)) ? __builtin_strcmp (strings[i].str, "FDC_ELECTRON_CHARGE" ) : (__builtin_constant_p (strings[i].str) && ((size_t )(const void *)((strings[i].str) + 1) - (size_t)(const void * )(strings[i].str) == 1) && (__s1_len = strlen (strings [i].str), __s1_len < 4) ? (__builtin_constant_p ("FDC_ELECTRON_CHARGE" ) && ((size_t)(const void *)(("FDC_ELECTRON_CHARGE") + 1) - (size_t)(const void *)("FDC_ELECTRON_CHARGE") == 1) ? __builtin_strcmp (strings[i].str, "FDC_ELECTRON_CHARGE") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("FDC_ELECTRON_CHARGE"); int __result = (((const unsigned char *) (const char *) (strings[i].str))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (strings[i].str))[1] - __s2[1]); if ( __s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (strings[i].str))[2] - __s2[ 2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (strings[i].str))[3 ] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("FDC_ELECTRON_CHARGE" ) && ((size_t)(const void *)(("FDC_ELECTRON_CHARGE") + 1) - (size_t)(const void *)("FDC_ELECTRON_CHARGE") == 1) && (__s2_len = strlen ("FDC_ELECTRON_CHARGE"), __s2_len < 4) ? (__builtin_constant_p (strings[i].str) && ((size_t )(const void *)((strings[i].str) + 1) - (size_t)(const void * )(strings[i].str) == 1) ? __builtin_strcmp (strings[i].str, "FDC_ELECTRON_CHARGE" ) : (__extension__ ({ const unsigned char *__s1 = (const unsigned char *) (const char *) (strings[i].str); register int __result = __s1[0] - ((const unsigned char *) (const char *) ("FDC_ELECTRON_CHARGE" ))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((const unsigned char *) (const char *) ("FDC_ELECTRON_CHARGE" ))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((const unsigned char *) (const char *) ("FDC_ELECTRON_CHARGE" ))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((const unsigned char *) (const char *) ("FDC_ELECTRON_CHARGE" ))[3]); } } __result; }))) : __builtin_strcmp (strings[i].str , "FDC_ELECTRON_CHARGE")))); })) { |
582 | ELECTRON_CHARGE = values[i]; |
583 | ncounter++; |
584 | } |
585 | if (!strcmp(strings[i].str,"FDC_DIFFUSION_COEFF")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (strings[i].str) && __builtin_constant_p ("FDC_DIFFUSION_COEFF" ) && (__s1_len = strlen (strings[i].str), __s2_len = strlen ("FDC_DIFFUSION_COEFF"), (!((size_t)(const void *)((strings[ i].str) + 1) - (size_t)(const void *)(strings[i].str) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("FDC_DIFFUSION_COEFF" ) + 1) - (size_t)(const void *)("FDC_DIFFUSION_COEFF") == 1) || __s2_len >= 4)) ? __builtin_strcmp (strings[i].str, "FDC_DIFFUSION_COEFF" ) : (__builtin_constant_p (strings[i].str) && ((size_t )(const void *)((strings[i].str) + 1) - (size_t)(const void * )(strings[i].str) == 1) && (__s1_len = strlen (strings [i].str), __s1_len < 4) ? (__builtin_constant_p ("FDC_DIFFUSION_COEFF" ) && ((size_t)(const void *)(("FDC_DIFFUSION_COEFF") + 1) - (size_t)(const void *)("FDC_DIFFUSION_COEFF") == 1) ? __builtin_strcmp (strings[i].str, "FDC_DIFFUSION_COEFF") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("FDC_DIFFUSION_COEFF"); int __result = (((const unsigned char *) (const char *) (strings[i].str))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (strings[i].str))[1] - __s2[1]); if ( __s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (strings[i].str))[2] - __s2[ 2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (strings[i].str))[3 ] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("FDC_DIFFUSION_COEFF" ) && ((size_t)(const void *)(("FDC_DIFFUSION_COEFF") + 1) - (size_t)(const void *)("FDC_DIFFUSION_COEFF") == 1) && (__s2_len = strlen ("FDC_DIFFUSION_COEFF"), __s2_len < 4) ? (__builtin_constant_p (strings[i].str) && ((size_t )(const void *)((strings[i].str) + 1) - (size_t)(const void * )(strings[i].str) == 1) ? __builtin_strcmp (strings[i].str, "FDC_DIFFUSION_COEFF" ) : (__extension__ ({ const unsigned char *__s1 = (const unsigned char *) (const char *) (strings[i].str); register int __result = __s1[0] - ((const unsigned char *) (const char *) ("FDC_DIFFUSION_COEFF" ))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((const unsigned char *) (const char *) ("FDC_DIFFUSION_COEFF" ))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((const unsigned char *) (const char *) ("FDC_DIFFUSION_COEFF" ))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((const unsigned char *) (const char *) ("FDC_DIFFUSION_COEFF" ))[3]); } } __result; }))) : __builtin_strcmp (strings[i].str , "FDC_DIFFUSION_COEFF")))); })) { |
586 | DIFFUSION_COEFF = values[i]; |
587 | ncounter++; |
588 | } |
589 | } |
590 | U_OF_WIRE_ZERO = (-((WIRES_PER_PLANE-1.)*WIRE_SPACING)/2); |
591 | U_OF_STRIP_ZERO = (-((STRIPS_PER_PLANE-1.)*STRIP_SPACING)/2); |
592 | |
593 | int num_drift_values=4; |
594 | float my_drift_values[4]; |
595 | mystr_t my_drift_strings[4]; |
596 | status=GetArrayConstants("FDC/drift_function_parms",&num_drift_values, |
597 | my_drift_values,my_drift_strings); |
598 | if (!status){ |
599 | int num_ext_values=2; |
600 | float my_ext_values[2]; |
601 | mystr_t my_ext_strings[2]; |
602 | status=GetArrayConstants("FDC/drift_function_ext",&num_ext_values, |
603 | my_ext_values,my_ext_strings); |
604 | if (!status){ |
605 | float t_high=my_ext_values[0]; |
606 | int j=0; |
607 | for (j=0;j<1000;j++){ |
608 | float t=0.5*(float)j; |
609 | if (t<t_high){ |
610 | float tsq=t*t; |
611 | drift_table[j]=my_drift_values[0]*sqrt(t)+my_drift_values[1]*t |
612 | +my_drift_values[2]*tsq+my_drift_values[3]*tsq*t; |
613 | } |
614 | else{ |
615 | float t_high_sq=t_high*t_high; |
616 | drift_table[j]=my_drift_values[0]*sqrt(t_high) |
617 | +my_drift_values[1]*t_high |
618 | +my_drift_values[2]*t_high_sq |
619 | +my_drift_values[3]*t_high_sq*t_high |
620 | +my_ext_values[1]*(t-t_high); |
621 | } |
622 | } |
623 | } |
624 | mystr_t my_bscale_strings[2]; |
625 | status=GetArrayConstants("FDC/fdc_drift_parms",&num_ext_values, |
626 | bscale,my_bscale_strings); |
627 | int num_lorentz_values=4; |
628 | mystr_t my_lorentz_strings[4]; |
629 | status=GetArrayConstants("FDC/lorentz_deflection_parms", |
Value stored to 'status' is never read | |
630 | &num_lorentz_values, |
631 | lorentz_parms,my_lorentz_strings); |
632 | } |
633 | |
634 | |
635 | |
636 | if (ncounter==16){ |
637 | printf("FDC: ALL parameters loaded from Data Base\n"); |
638 | } else if (ncounter<16){ |
639 | printf("FDC: NOT ALL necessary parameters found in Data Base %d out of 16\n",ncounter); |
640 | } else { |
641 | printf("FDC: SOME parameters found more than once in Data Base\n"); |
642 | } |
643 | #if 0 |
644 | { |
645 | int num_values=2304*2; |
646 | float my_values[2304*2]; |
647 | mystr_t my_strings[2304*2]; |
648 | status=GetArrayConstants("FDC/fdc_wire_offsets",&num_values, |
649 | my_values,my_strings); |
650 | if (!status){ |
651 | int i; |
652 | for (i=0;i<num_values;i+=2){ |
653 | int j=i/2; |
654 | wire_dx_offset[j]=my_values[i]; |
655 | wire_dz_offset[j]=my_values[i+1]; |
656 | } |
657 | } |
658 | } |
659 | #endif |
660 | } |
661 | |
662 | initializedx = 1 ; |
663 | } |
664 | |
665 | /* Get chamber information */ |
666 | int layer = getlayer_wrapper_(); |
667 | if (layer==0){ |
668 | printf("hitFDC: FDC layer number evaluates to zero! THIS SHOULD NEVER HAPPEN! drop this particle.\n"); |
669 | return; |
670 | } |
671 | //int module = getmodule_wrapper_(); |
672 | //int chamber = (module*10)+layer; |
673 | //int PackNo = (chamber-11)/20; |
674 | int PackNo = getpackage_wrapper_()-1; |
675 | if (PackNo==-1){ |
676 | printf("hitFDC: FDC package number evaluates to zero! THIS SHOULD NEVER HAPPEN! drop this particle.\n"); |
677 | return; |
678 | } |
679 | int glayer=6*PackNo+layer-1; |
680 | int module = 2*(PackNo)+(layer-1)/3+1; |
681 | int chamber = (module*10)+(layer-1)%3+1; |
682 | int wire1,wire2; |
683 | int wire,dwire; |
684 | |
685 | // transform layer number into Richard's scheme |
686 | layer=(layer-1)%3+1; |
687 | |
688 | transformCoord(xin,"global",xinlocal,"local")transformcoord_(xin,"global",xinlocal,"local",strlen("global" ),strlen("local")); |
689 | |
690 | wire1 = ceil((xinlocal[0] - U_OF_WIRE_ZERO)/WIRE_SPACING +0.5); |
691 | transformCoord(xout,"global",xoutlocal,"local")transformcoord_(xout,"global",xoutlocal,"local",strlen("global" ),strlen("local")); |
692 | wire2 = ceil((xoutlocal[0] - U_OF_WIRE_ZERO)/WIRE_SPACING +0.5); |
693 | // Check that wire numbers are not out of range |
694 | if ((wire1>WIRES_PER_PLANE && wire2==WIRES_PER_PLANE) || |
695 | (wire2>WIRES_PER_PLANE && wire1==WIRES_PER_PLANE)) |
696 | wire1=wire2=WIRES_PER_PLANE; |
697 | if ((wire1<1 && wire2==1) || (wire1==1 && wire2<1)){ |
698 | wire1=wire2=1; |
699 | } |
700 | // Make sure at least one wire number is valid |
701 | if (wire1>WIRES_PER_PLANE&&wire2>WIRES_PER_PLANE) return; |
702 | if (wire1<1 && wire2<1) return; |
703 | |
704 | if (wire1>WIRES_PER_PLANE) wire1=wire2; |
705 | else if (wire2>WIRES_PER_PLANE) wire2=wire1; |
706 | if (wire1<1) wire1=wire2; |
707 | else if (wire2<1) wire2=wire1; |
708 | |
709 | dwire = (wire1 < wire2)? 1 : -1; |
710 | alpha = atan2(xoutlocal[0]-xinlocal[0],xoutlocal[2]-xinlocal[2]); |
711 | sinalpha=sin(alpha); |
712 | cosalpha=cos(alpha); |
713 | xlocal[0] = (xinlocal[0] + xoutlocal[0])/2; |
714 | xlocal[1] = (xinlocal[1] + xoutlocal[1])/2; |
715 | xlocal[2] = (xinlocal[2] + xoutlocal[2])/2; |
716 | |
717 | wire = ceil((xlocal[0] - U_OF_WIRE_ZERO)/WIRE_SPACING +0.5); |
718 | x[0] = (xin[0] + xout[0])/2; |
719 | x[1] = (xin[1] + xout[1])/2; |
720 | x[2] = (xin[2] + xout[2])/2; |
721 | t = (xin[3] + xout[3])/2 * 1e9; |
722 | dx[0] = xin[0] - xout[0]; |
723 | dx[1] = xin[1] - xout[1]; |
724 | dx[2] = xin[2] - xout[2]; |
725 | dr = sqrt(dx[0]*dx[0] + dx[1]*dx[1] + dx[2]*dx[2]); |
726 | if (dr > 1e-3) |
727 | { |
728 | dEdx = dEsum/dr; |
729 | } |
730 | else |
731 | { |
732 | dEdx = 0; |
733 | } |
734 | |
735 | /* Make a fuzzy boundary around the forward dead region |
736 | * by killing any track segment whose midpoint is within the boundary */ |
737 | |
738 | if (sqrt(xlocal[0]*xlocal[0]+xlocal[1]*xlocal[1]) |
739 | < wire_dead_zone_radius[PackNo]) |
740 | { |
741 | return; |
742 | } |
743 | |
744 | /* post the hit to the truth tree */ |
745 | |
746 | itrack = (stack == 0)? gidGetId(track) : -1; |
747 | |
748 | if (history == 0) |
749 | { |
750 | int mark = (1<<16) + (chamber<<20) + pointCount; |
751 | void** twig = getTwig(&forwardDCTree, mark); |
752 | if (*twig == 0) |
753 | { |
754 | s_ForwardDC_t* fdc = *twig = make_s_ForwardDC(); |
755 | s_FdcChambers_t* chambers = make_s_FdcChambers(1); |
756 | s_FdcTruthPoints_t* points = make_s_FdcTruthPoints(1); |
757 | float xwire = U_OF_WIRE_ZERO + (wire-1)*WIRE_SPACING; |
758 | float u[2]; |
759 | u[0] = xinlocal[2]; |
760 | u[1] = xinlocal[0]-xwire; |
761 | dradius = fabs(u[1]*cosalpha-u[0]*sinalpha); |
762 | //printf("fdc truth hit, in u,v=%f,%f out u,v=%f,%f dradius=%f\n", |
763 | // u[0], u[1], xoutlocal[2], xoutlocal[0]-xwire, dradius); |
764 | points->mult = 1; |
765 | int a = thisInputEvent->physicsEvents->in[0].reactions->in[0].vertices->in[0].products->mult; |
766 | points->in[0].primary = (track <= a && stack == 0); |
767 | points->in[0].track = track; |
768 | points->in[0].x = x[0]; |
769 | points->in[0].y = x[1]; |
770 | points->in[0].z = x[2]; |
771 | points->in[0].t = t; |
772 | points->in[0].px = pin[0]*pin[4]; |
773 | points->in[0].py = pin[1]*pin[4]; |
774 | points->in[0].pz = pin[2]*pin[4]; |
775 | points->in[0].E = pin[3]; |
776 | points->in[0].dradius = dradius; |
777 | points->in[0].dEdx = dEdx; |
778 | points->in[0].ptype = ipart; |
779 | points->in[0].trackID = make_s_TrackID(); |
780 | points->in[0].trackID->itrack = itrack; |
781 | chambers->mult = 1; |
782 | chambers->in[0].module = module; |
783 | chambers->in[0].layer = layer; |
784 | chambers->in[0].fdcTruthPoints = points; |
785 | fdc->fdcChambers = chambers; |
786 | pointCount++; |
787 | } |
788 | } |
789 | |
790 | /* post the hit to the hits tree, mark cell as hit */ |
791 | |
792 | if (dEsum > 0) |
793 | { |
794 | float sign=1.; // for dealing with the y-position for tracks crossing two cells |
795 | |
796 | for (wire=wire1; wire-dwire != wire2; wire+=dwire) |
797 | { |
798 | float dE; |
799 | float x0[3],x1[3]; |
800 | float xwire = U_OF_WIRE_ZERO + (wire-1)*WIRE_SPACING; |
801 | int global_wire_number=96*glayer+wire-1; |
802 | |
803 | #if 0 |
804 | xwire+=wire_dx_offset[global_wire_number]; |
805 | #endif |
806 | |
807 | if (wire1==wire2){ |
808 | dE=dEsum; |
809 | x0[0] = xinlocal[0]; |
810 | x0[1] = xinlocal[1]; |
811 | x0[2] = xinlocal[2]; |
812 | x1[0] = xoutlocal[0]; |
813 | x1[1] = xoutlocal[1]; |
814 | x1[2] = xoutlocal[2]; |
815 | } |
816 | else{ |
817 | x0[0] = xwire-0.5*dwire*WIRE_SPACING; |
818 | x0[1] = xinlocal[1] + (x0[0]-xinlocal[0]+1e-20)* |
819 | (xoutlocal[1]-xinlocal[1])/(xoutlocal[0]-xinlocal[0]+1e-20); |
820 | x0[2] = xinlocal[2] + (x0[0]-xinlocal[0]+1e-20)* |
821 | (xoutlocal[2]-xinlocal[2])/(xoutlocal[0]-xinlocal[0]+1e-20); |
822 | if (fabs(x0[2]-xoutlocal[2]) > fabs(xinlocal[2]-xoutlocal[2])) |
823 | { |
824 | x0[0] = xinlocal[0]; |
825 | x0[1] = xinlocal[1]; |
826 | x0[2] = xinlocal[2]; |
827 | } |
828 | x1[0] = xwire+0.5*dwire*WIRE_SPACING; |
829 | x1[1] = xinlocal[1] + (x1[0]-xinlocal[0]+1e-20)* |
830 | (xoutlocal[1]-xinlocal[1])/(xoutlocal[0]-xinlocal[0]+1e-20); |
831 | x1[2] = xinlocal[2] + (x1[0]-xinlocal[0]+1e-20)* |
832 | (xoutlocal[2]-xinlocal[2])/(xoutlocal[0]-xinlocal[0]+1e-20); |
833 | if (fabs(x1[2]-xinlocal[2]) > fabs(xoutlocal[2]-xinlocal[2])) |
834 | { |
835 | x1[0] = xoutlocal[0]; |
836 | x1[1] = xoutlocal[1]; |
837 | x1[2] = xoutlocal[2]; |
838 | } |
839 | dE = dEsum*(x1[2]-x0[2])/(xoutlocal[2]-xinlocal[2]); |
840 | } |
841 | |
842 | if (dE > 0){ |
843 | s_FdcAnodeTruthHits_t* ahits; |
844 | |
845 | // Create (or grab) an entry in the tree for the anode wire |
846 | int mark = (chamber<<20) + (2<<10) + wire; |
847 | void** twig = getTwig(&forwardDCTree, mark); |
848 | |
849 | if (*twig == 0) |
850 | { |
851 | s_ForwardDC_t* fdc = *twig = make_s_ForwardDC(); |
852 | s_FdcChambers_t* chambers = make_s_FdcChambers(1); |
853 | s_FdcAnodeWires_t* wires = make_s_FdcAnodeWires(1); |
854 | wires->mult = 1; |
855 | wires->in[0].wire = wire; |
856 | wires->in[0].fdcAnodeTruthHits = ahits = make_s_FdcAnodeTruthHits(MAX_HITS1000); |
857 | chambers->mult = 1; |
858 | chambers->in[0].module = module; |
859 | chambers->in[0].layer = layer; |
860 | chambers->in[0].fdcAnodeWires = wires; |
861 | fdc->fdcChambers = chambers; |
862 | wireCount++; |
863 | } |
864 | else |
865 | { |
866 | s_ForwardDC_t* fdc = *twig; |
867 | ahits = fdc->fdcChambers->in[0].fdcAnodeWires->in[0].fdcAnodeTruthHits; |
868 | } |
869 | |
870 | int two=2; |
871 | |
872 | // Find the number of primary ion pairs: |
873 | /* The total number of ion pairs depends on the energy deposition |
874 | and the effective average energy to produce a pair, w_eff. |
875 | On average for each primary ion pair produced there are n_s_per_p |
876 | secondary ion pairs produced. |
877 | */ |
878 | int one=1; |
879 | // Average number of secondary ion pairs for 40/60 Ar/CO2 mixture |
880 | float n_s_per_p=1.89; |
881 | //Average energy needed to produce an ion pair for 50/50 mixture |
882 | float w_eff=30.2e-9; // GeV |
883 | // Average number of primary ion pairs |
884 | float n_p_mean = dE/w_eff/(1.+n_s_per_p); |
885 | int n_p; // number of primary ion pairs |
886 | gpoiss_(&n_p_mean,&n_p,&one); |
887 | |
888 | // Drift time |
889 | float tdrift=0; |
890 | |
891 | if (controlparams_.driftclusters==0){ |
892 | double dx[3] = {x1[0]-x0[0], x1[1]-x0[1], x1[2]-x0[2]}; |
893 | double a = -((x0[0] - xwire) * dx[0] + x0[2] * dx[2]) / |
894 | (dx[0] * dx[0] + dx[2] * dx[2] + 1e-99); |
895 | a = (a < 0)? 0 : (a > 1)? 1 : a; |
896 | xlocal[0]=x0[0]+a*dx[0]; |
897 | xlocal[1]=x0[1]+a*dx[1]; |
898 | xlocal[2]=x0[2]+a*dx[2]; |
899 | |
900 | /* If the cluster position is within the wire-deadened region of the |
901 | detector, skip this cluster |
902 | */ |
903 | if (sqrt(xlocal[0]*xlocal[0]+xlocal[1]*xlocal[1]) |
904 | >=wire_dead_zone_radius[PackNo]){ |
905 | if (AddFDCAnodeHit(ahits,layer,ipart,track,xwire,xlocal,dE,t,&tdrift)){ |
906 | AddFDCCathodeHits(PackNo,xwire,xlocal[1],tdrift,n_p,track,ipart, |
907 | chamber,module,layer,global_wire_number); |
908 | } |
909 | |
910 | } |
911 | } |
912 | else{ |
913 | // Loop over the number of primary ion pairs |
914 | int n; |
915 | for (n=0;n<n_p;n++){ |
916 | // Generate a cluster at a random position along the path with cell |
917 | float rndno[2]; |
918 | grndm_(rndno,&two); |
919 | float dzrand=(x1[2]-x0[2])*rndno[0]; |
920 | // Position of the cluster |
921 | xlocal[0]=x0[0]+(x1[0]-x0[0])*rndno[0]; |
922 | xlocal[1]=x0[1]+(x1[1]-x0[1])*rndno[0]; |
923 | xlocal[2]=x0[2]+dzrand; |
924 | /* If the cluster position is within the wire-deadened region of the |
925 | detector, skip this cluster |
926 | */ |
927 | if (sqrt(xlocal[0]*xlocal[0]+xlocal[1]*xlocal[1]) |
928 | >=wire_dead_zone_radius[PackNo]){ |
929 | if (AddFDCAnodeHit(ahits,layer,ipart,track,xwire,xlocal,dE,t,&tdrift)){ |
930 | AddFDCCathodeHits(PackNo,xwire,xlocal[1],tdrift,n_p,track,ipart, |
931 | chamber,module,layer,global_wire_number); |
932 | } |
933 | } |
934 | |
935 | } // loop over primary ion pairs |
936 | } |
937 | } // Check for non-zero energy |
938 | |
939 | sign*=-1; // for dealing with the y-position for tracks crossing two cells |
940 | } // loop over wires |
941 | } // Check that total energy deposition is not zero |
942 | } |
943 | |
944 | /* entry points from fortran */ |
945 | |
946 | void hitforwarddc_(float* xin, float* xout, |
947 | float* pin, float* pout, float* dEsum, |
948 | int* track, int* stack, int* history, int* ipart) |
949 | { |
950 | hitForwardDC(xin,xout,pin,pout,*dEsum,*track,*stack,*history,*ipart); |
951 | } |
952 | |
953 | |
954 | /* pick and package the hits for shipping */ |
955 | |
956 | s_ForwardDC_t* pickForwardDC () |
957 | { |
958 | s_ForwardDC_t* box; |
959 | s_ForwardDC_t* item; |
960 | |
961 | if ((stripCount == 0) && (wireCount == 0) && (pointCount == 0)) |
962 | { |
963 | return HDDM_NULL(void*)&hddm_s_nullTarget; |
964 | } |
965 | |
966 | box = make_s_ForwardDC(); |
967 | box->fdcChambers = make_s_FdcChambers(32); |
968 | box->fdcChambers->mult = 0; |
969 | while ((item = (s_ForwardDC_t*) pickTwig(&forwardDCTree))) |
970 | { |
971 | s_FdcChambers_t* chambers = item->fdcChambers; |
972 | int module = chambers->in[0].module; |
973 | int layer = chambers->in[0].layer; |
974 | int m = box->fdcChambers->mult; |
975 | |
976 | /* compress out the hits below threshold */ |
977 | s_FdcAnodeWires_t* wires = chambers->in[0].fdcAnodeWires; |
978 | int wire; |
979 | s_FdcCathodeStrips_t* strips = chambers->in[0].fdcCathodeStrips; |
980 | int strip; |
981 | s_FdcTruthPoints_t* points = chambers->in[0].fdcTruthPoints; |
982 | int point; |
983 | int mok=0; |
984 | for (wire=0; wire < wires->mult; wire++) |
985 | { |
986 | s_FdcAnodeTruthHits_t* ahits = wires->in[wire].fdcAnodeTruthHits; |
987 | |
988 | // Sort the clusters by time |
989 | qsort(ahits->in,ahits->mult,sizeof(s_FdcAnodeTruthHit_t), |
990 | (compfn)fdc_anode_cluster_sort); |
991 | |
992 | int i,iok=0; |
993 | |
994 | if (controlparams_.driftclusters==0){ |
995 | for (iok=i=0; i < ahits->mult; i++) |
996 | { |
997 | if (ahits->in[i].dE > THRESH_KEV/1e6) |
998 | { |
999 | if (iok < i) |
1000 | { |
1001 | ahits->in[iok] = ahits->in[i]; |
1002 | } |
1003 | ++iok; |
1004 | ++mok; |
1005 | } |
1006 | } |
1007 | } |
1008 | else{ // Simulate clusters within the cell |
1009 | |
1010 | // printf("-------------\n"); |
1011 | |
1012 | |
1013 | // Temporary histogram in 1 ns bins to store waveform data |
1014 | int num_samples=(int)FDC_TIME_WINDOW; |
1015 | float *samples=(float *)malloc(num_samples*sizeof(float)); |
1016 | for (i=0;i<num_samples;i++){ |
1017 | samples[i]=wire_signal((float)i,ahits); |
1018 | //printf("%f %f\n",(float)i,samples[i]); |
1019 | } |
1020 | |
1021 | int returned_to_baseline=0; |
1022 | float q=0; |
1023 | for (i=0;i<num_samples;i++){ |
1024 | if (samples[i] > THRESH_ANODE){ |
1025 | if (returned_to_baseline==0){ |
1026 | ahits->in[iok].itrack = ahits->in[0].itrack; |
1027 | ahits->in[iok].ptype = ahits->in[0].ptype; |
1028 | |
1029 | // Do an interpolation to find the time at which the threshold |
1030 | // was crossed. |
1031 | float t_array[4]; |
1032 | int k; |
1033 | float my_t,my_terr; |
1034 | for (k=0;k<4;k++) t_array[k]=i-1+k; |
1035 | polint(&samples[i-1],t_array,4,THRESH_ANODE,&my_t,&my_terr); |
1036 | ahits->in[iok].t=my_t; |
1037 | |
1038 | returned_to_baseline=1; |
1039 | iok++; |
1040 | mok++; |
1041 | } |
1042 | q+=samples[i]; |
1043 | } |
1044 | if (returned_to_baseline |
1045 | && (samples[i] <= THRESH_ANODE)){ |
1046 | returned_to_baseline=0; |
1047 | } |
1048 | } |
1049 | free(samples); |
1050 | } // Simulation of clusters within cell |
1051 | |
1052 | if (iok) |
1053 | { |
1054 | ahits->mult = iok; |
1055 | } |
1056 | else if (ahits != HDDM_NULL(void*)&hddm_s_nullTarget) |
1057 | { |
1058 | FREE(ahits)free(ahits); |
1059 | } |
1060 | } |
1061 | if ((wires != HDDM_NULL(void*)&hddm_s_nullTarget) && (mok == 0)) |
1062 | { |
1063 | FREE(wires)free(wires); |
1064 | wires = HDDM_NULL(void*)&hddm_s_nullTarget; |
1065 | } |
1066 | |
1067 | |
1068 | mok = 0; |
1069 | for (strip=0; strip < strips->mult; strip++) |
1070 | { |
1071 | s_FdcCathodeTruthHits_t* chits = strips->in[strip].fdcCathodeTruthHits; |
1072 | |
1073 | // Sort the clusters by time |
1074 | qsort(chits->in,chits->mult,sizeof(s_FdcCathodeTruthHit_t), |
1075 | (compfn)fdc_cathode_cluster_sort); |
1076 | |
1077 | int i,iok=0; |
1078 | |
1079 | if (controlparams_.driftclusters==0){ |
1080 | for (iok=i=0; i < chits->mult; i++) |
1081 | { |
1082 | if (chits->in[i].q > 0.) |
1083 | { |
1084 | if (iok < i) |
1085 | { |
1086 | chits->in[iok] = chits->in[i]; |
1087 | } |
1088 | ++iok; |
1089 | ++mok; |
1090 | } |
1091 | } |
1092 | |
1093 | } |
1094 | else{ |
1095 | |
1096 | // Temporary histogram in 1 ns bins to store waveform data |
1097 | int num_samples=(int)(FDC_TIME_WINDOW); |
1098 | float *samples=(float *)malloc(num_samples*sizeof(float)); |
1099 | for (i=0;i<num_samples;i++){ |
1100 | samples[i]=cathode_signal((float)i,chits); |
1101 | //printf("t %f V %f\n",(float)i,samples[i]); |
1102 | } |
1103 | |
1104 | int threshold_toggle=0; |
1105 | int istart=0; |
1106 | int FADC_BIN_SIZE=1; |
1107 | for (i=0;i<num_samples;i+=FADC_BIN_SIZE){ |
1108 | if (samples[i] > THRESH_STRIPS){ |
1109 | if (threshold_toggle==0){ |
1110 | chits->in[iok].itrack = chits->in[0].itrack; |
1111 | chits->in[iok].ptype = chits->in[0].ptype; |
1112 | chits->in[iok].t=(float) i; |
1113 | //chits->in[iok].q=samples[i]; |
1114 | istart=(i > 0)? i-1 : 0; |
1115 | threshold_toggle=1; |
1116 | //iok++; |
1117 | //mok++; |
1118 | } |
1119 | } |
1120 | if (threshold_toggle && |
1121 | (samples[i] <= THRESH_STRIPS)){ |
1122 | int j; |
1123 | // Find the first peak |
1124 | for (j=istart+1;j<i-1;j++){ |
1125 | if (samples[j]>samples[j-1] && samples[j]>samples[j+1]){ |
1126 | chits->in[iok].q=samples[j]; |
1127 | break; |
1128 | } |
1129 | } |
1130 | threshold_toggle=0; |
1131 | iok++; |
1132 | mok++; |
1133 | //break; |
1134 | } |
1135 | } |
1136 | i=num_samples-1; |
1137 | if (samples[i] > THRESH_STRIPS&&threshold_toggle){ |
1138 | int j; |
1139 | for (j=istart+1;j<i-1;j++){ |
1140 | if (samples[j]>samples[j-1] && samples[j]>samples[j+1]){ |
1141 | chits->in[iok].q=samples[j]; |
1142 | break; |
1143 | } |
1144 | } |
1145 | } |
1146 | |
1147 | free(samples); |
1148 | }// Simulate clusters within cell |
1149 | |
1150 | if (iok) |
1151 | { |
1152 | chits->mult = iok; |
1153 | //chits->mult=1; |
1154 | } |
1155 | else if (chits != HDDM_NULL(void*)&hddm_s_nullTarget) |
1156 | { |
1157 | FREE(chits)free(chits); |
1158 | } |
1159 | |
1160 | } |
1161 | if ((strips != HDDM_NULL(void*)&hddm_s_nullTarget) && (mok == 0)) |
1162 | { |
1163 | FREE(strips)free(strips); |
1164 | strips = HDDM_NULL(void*)&hddm_s_nullTarget; |
1165 | } |
1166 | |
1167 | if ((wires != HDDM_NULL(void*)&hddm_s_nullTarget) || |
1168 | (strips != HDDM_NULL(void*)&hddm_s_nullTarget) || |
1169 | (points != HDDM_NULL(void*)&hddm_s_nullTarget)) |
1170 | { |
1171 | if ((m == 0) || (module > box->fdcChambers->in[m-1].module) |
1172 | || (layer > box->fdcChambers->in[m-1].layer)) |
1173 | { |
1174 | box->fdcChambers->in[m] = chambers->in[0]; |
1175 | |
1176 | box->fdcChambers->in[m].fdcCathodeStrips = |
1177 | make_s_FdcCathodeStrips(stripCount); |
1178 | box->fdcChambers->in[m].fdcAnodeWires = |
1179 | make_s_FdcAnodeWires(wireCount); |
1180 | box->fdcChambers->in[m].fdcTruthPoints = |
1181 | make_s_FdcTruthPoints(pointCount); |
1182 | box->fdcChambers->mult++; |
1183 | } |
1184 | else |
1185 | { |
1186 | m--; |
1187 | } |
1188 | for (strip=0; strip < strips->mult; ++strip) |
1189 | { |
1190 | int mm = box->fdcChambers->in[m].fdcCathodeStrips->mult++; |
1191 | box->fdcChambers->in[m].fdcCathodeStrips->in[mm] = strips->in[strip]; |
1192 | } |
1193 | if (strips != HDDM_NULL(void*)&hddm_s_nullTarget) |
1194 | { |
1195 | FREE(strips)free(strips); |
1196 | } |
1197 | for (wire=0; wire < wires->mult; ++wire) |
1198 | { |
1199 | int mm = box->fdcChambers->in[m].fdcAnodeWires->mult++; |
1200 | box->fdcChambers->in[m].fdcAnodeWires->in[mm] = wires->in[wire]; |
1201 | } |
1202 | if (wires != HDDM_NULL(void*)&hddm_s_nullTarget) |
1203 | { |
1204 | FREE(wires)free(wires); |
1205 | } |
1206 | for (point=0; point < points->mult; ++point) |
1207 | { |
1208 | int track = points->in[point].track; |
1209 | double t = points->in[point].t; |
1210 | int mm = box->fdcChambers->in[m].fdcTruthPoints->mult; |
1211 | if (points->in[point].trackID->itrack < 0 || |
1212 | (mm > 0 && box->fdcChambers->in[m].fdcTruthPoints |
1213 | ->in[mm-1].track == track && |
1214 | fabs(box->fdcChambers->in[m].fdcTruthPoints |
1215 | ->in[mm-1].t - t) < 0.5)) |
1216 | { |
1217 | FREE(points->in[point].trackID)free(points->in[point].trackID); |
1218 | continue; |
1219 | } |
1220 | box->fdcChambers->in[m].fdcTruthPoints->in[mm] = points->in[point]; |
1221 | box->fdcChambers->in[m].fdcTruthPoints->mult++; |
1222 | } |
1223 | if (points != HDDM_NULL(void*)&hddm_s_nullTarget) |
1224 | { |
1225 | FREE(points)free(points); |
1226 | } |
1227 | } |
1228 | FREE(chambers)free(chambers); |
1229 | FREE(item)free(item); |
1230 | } |
1231 | |
1232 | stripCount = wireCount = pointCount = 0; |
1233 | |
1234 | if ((box->fdcChambers != HDDM_NULL(void*)&hddm_s_nullTarget) && |
1235 | (box->fdcChambers->mult == 0)) |
1236 | { |
1237 | FREE(box->fdcChambers)free(box->fdcChambers); |
1238 | box->fdcChambers = HDDM_NULL(void*)&hddm_s_nullTarget; |
1239 | } |
1240 | if (box->fdcChambers->mult == 0) |
1241 | { |
1242 | FREE(box)free(box); |
1243 | box = HDDM_NULL(void*)&hddm_s_nullTarget; |
1244 | } |
1245 | return box; |
1246 | } |