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