262 {
265 double offsetp = 0.0;
266 double offsetc = 0.0;
267 double sigcos = 0.0;
268 double sigp = 0.0;
269
270
272 case 0: {
273 double ptemp = ptrk;
274 double costm = cost;
275
276 if(rundedx2>0)
277 { if(ptrk < 0.3) ptemp = 0.3;
278 if(ptrk > 1.3) ptemp = 1.3;
279 }
280 else
281 { if(ptrk < 0.3) ptemp = 0.3;
282 if(ptrk > 1.3) ptemp = 1.3;
283 }
284
285 double plog = log(ptemp);
286 double costcos =
cos(costm);
287 offsetp=
mypol5(plog,m_momentpara[0][0],m_momentpara[0][1],m_momentpara[0][2],m_momentpara[0][3],m_momentpara[0][4],m_momentpara[0][5]);
288 sigp=
mypol5(plog,m_momentpara[0][6],m_momentpara[0][7],m_momentpara[0][8],m_momentpara[0][9],m_momentpara[0][10],m_momentpara[0][11]);
289
290 if(costm<-0.83) {
291 offsetc=m_endcappara[0][0];
292 sigcos=m_endcappara[0][2];
293 }
294 if(costm>0.83) {
295 offsetc=m_endcappara[0][1];
296 sigcos=m_endcappara[0][3];
297 }
298 if(fabs(costm)<=0.83)
299 {
300 offsetc=
mypol3(costcos,m_thetapara[0][0],m_thetapara[0][1],m_thetapara[0][2],m_thetapara[0][3]);
301 sigcos=
mypol3(costcos,m_thetapara[0][4],m_thetapara[0][5],m_thetapara[0][6],m_thetapara[0][7]);
302 }
303
304
305 offset=offsetc+sigcos*offsetp;
306
307 offset=offsetp+sigp*offsetc;
308 break;
309 }
310
311 case 1: {
312 double ptemp = ptrk;
313 double costm = cost;
314 if(rundedx2>0)
315 { if(ptrk < 0.3) ptemp = 0.3;
316 if(ptrk > 1.3) ptemp = 1.3;
317 }
318 else
319 { if(ptrk < 0.3) ptemp = 0.3;
320 if(ptrk > 1.3) ptemp = 1.3;
321 }
322
323 double plog = log(ptemp);
324 double costcos =
cos(costm);
325 offsetp=
mypol5(plog,m_momentpara[1][0],m_momentpara[1][1],m_momentpara[1][2],m_momentpara[1][3],m_momentpara[1][4],m_momentpara[1][5]);
326 sigp=
mypol5(plog,m_momentpara[1][6],m_momentpara[1][7],m_momentpara[1][8],m_momentpara[1][9],m_momentpara[1][10],m_momentpara[1][11]);
327
328 if(costm<-0.83) {
329 offsetc=m_endcappara[1][0];
330 sigcos=m_endcappara[1][2];
331 }
332 if(costm>0.83) {
333 offsetc=m_endcappara[1][1];
334 sigcos=m_endcappara[1][3];
335 }
336 if(fabs(costm)<=0.83)
337 {
338 offsetc=
mypol3(costcos,m_thetapara[1][0],m_thetapara[1][1],m_thetapara[1][2],m_thetapara[1][3]);
339 sigcos=
mypol3(costcos,m_thetapara[1][4],m_thetapara[1][5],m_thetapara[1][6],m_thetapara[1][7]);
340 }
341
342
343 offset=offsetc+sigcos*offsetp;
344
345 offset=offsetp+sigp*offsetc;
346 break;
347 }
348
349 case 2: {
350 double ptemp = ptrk;
351 double costm = cost;
352 if(rundedx2>0)
353 { if(ptrk < 0.3) ptemp = 0.3;
354 if(ptrk > 1.6) ptemp = 1.6;
355 }
356 else
357 { if(ptrk < 0.3) ptemp = 0.3;
358 if(ptrk > 1.6) ptemp = 1.6;
359 }
360
361 double plog = log(ptemp);
362 double costcos =
cos(costm);
363 offsetp=
mypol5(plog,m_momentpara[2][0],m_momentpara[2][1],m_momentpara[2][2],m_momentpara[2][3],m_momentpara[2][4],m_momentpara[2][5]);
364 sigp=
mypol5(plog,m_momentpara[2][6],m_momentpara[2][7],m_momentpara[2][8],m_momentpara[2][9],m_momentpara[2][10],m_momentpara[2][11]);
365
366 if(costm<-0.83) {
367 offsetc=m_endcappara[2][0];
368 sigcos=m_endcappara[2][2];
369 }
370 if(costm>0.83) {
371 offsetc=m_endcappara[2][1];
372 sigcos=m_endcappara[2][3];
373 }
374 if(fabs(costm)<=0.83)
375 {
376 offsetc=
mypol3(costcos,m_thetapara[2][0],m_thetapara[2][1],m_thetapara[2][2],m_thetapara[2][3]);
377 sigcos=
mypol3(costcos,m_thetapara[2][4],m_thetapara[2][5],m_thetapara[2][6],m_thetapara[2][7]);
378 }
379
380
381 offset=offsetc+sigcos*offsetp;
382
383 offset=offsetp+sigp*offsetc;
384 break;
385 }
386
387 case 3: {
388 double ptemp = ptrk;
389 double costm = cost;
390 if(rundedx2>0)
391 { if(ptrk < 0.4) ptemp = 0.4;
392 if(ptrk > 1.3) ptemp = 1.3;
393 }
394 else
395 { if(ptrk < 0.4) ptemp = 0.4;
396 if(ptrk > 1.3) ptemp = 1.3;
397 }
398 double plog = log(ptemp);
399 double costcos =
cos(costm);
400 offsetp=
mypol5(plog,m_momentpara[3][0],m_momentpara[3][1],m_momentpara[3][2],m_momentpara[3][3],m_momentpara[3][4],m_momentpara[3][5]);
401 sigp=
mypol5(plog,m_momentpara[3][6],m_momentpara[3][7],m_momentpara[3][8],m_momentpara[3][9],m_momentpara[3][10],m_momentpara[3][11]);
402
403 if(costm<-0.83) {
404 offsetc=m_endcappara[3][0];
405 sigcos=m_endcappara[3][2];
406 }
407 if(costm>0.83) {
408 offsetc=m_endcappara[3][1];
409 sigcos=m_endcappara[3][3];
410 }
411 if(fabs(costm)<=0.83)
412 {
413 offsetc=
mypol3(costcos,m_thetapara[3][0],m_thetapara[3][1],m_thetapara[3][2],m_thetapara[3][3]);
414 sigcos=
mypol3(costcos,m_thetapara[3][4],m_thetapara[3][5],m_thetapara[3][6],m_thetapara[3][7]);
415 }
416
417
418 offset=offsetc+sigcos*offsetp;
419
420 offset=offsetp+sigp*offsetc;
421 break;
422 }
423
424 case 4 : {
425 double ptemp = ptrk;
426 double costm = cost;
427 if(rundedx2>0)
428 { if(ptrk < 0.5) ptemp = 0.5;
429 if(ptrk > 1.3) ptemp = 1.3;
430 }
431 else
432 { if(ptrk < 0.5) ptemp = 0.5;
433 if(ptrk > 1.3) ptemp = 1.3;
434 }
435 double plog = log(ptemp);
436 double costcos =
cos(costm);
437 offsetp=
mypol5(plog,m_momentpara[4][0],m_momentpara[4][1],m_momentpara[4][2],m_momentpara[4][3],m_momentpara[4][4],m_momentpara[4][5]);
438 sigp=
mypol5(plog,m_momentpara[4][6],m_momentpara[4][7],m_momentpara[4][8],m_momentpara[4][9],m_momentpara[4][10],m_momentpara[4][11]);
439
440 if(costm<-0.83) {
441 offsetc=m_endcappara[4][0];
442 sigcos=m_endcappara[4][2];
443 }
444 if(costm>0.83) {
445 offsetc=m_endcappara[4][1];
446 sigcos=m_endcappara[4][3];
447 }
448 if(fabs(costm)<=0.83)
449 {
450 offsetc=
mypol3(costcos,m_thetapara[4][0],m_thetapara[4][1],m_thetapara[4][2],m_thetapara[4][3]);
451 sigcos=
mypol3(costcos,m_thetapara[4][4],m_thetapara[4][5],m_thetapara[4][6],m_thetapara[4][7]);
452 }
453
454 offset=offsetc+sigcos*offsetp;
455
456 offset=offsetp+sigp*offsetc;
457 break;
458 }
459
460 default:
462 break;
463 }
464
466}
double cos(const BesAngle a)
double mypol3(double x, double par0, double par1, double par2, double par3)
double mypol5(double x, double par0, double par1, double par2, double par3, double par4, double par5)
double offset(int n) const