482 | | SELECT |
483 | | Size, |
484 | | Angle, |
485 | | NumUsedPixels, |
486 | | NumIslands, |
487 | | Leakage1, |
488 | | Weight, |
489 | | PI()*Width*Length AS Area, |
490 | | @PX := cosa*X - sina*Y, |
491 | | @PY := cosa*Y + sina*X, |
492 | | @DX := MeanX-@PX/1.02, |
493 | | @DY := MeanY-@PY/1.02, |
494 | | @Norm := SQRT(@DX*@DX + @DY*@DY), |
495 | | @Dist := @Norm*0.0117193246260285378 AS Dist, |
496 | | @LX := TRUNCATE((CosDelta*@DY - SinDelta*@DX)/@Norm, 6), |
497 | | @LY := TRUNCATE((CosDelta*@DX + SinDelta*@DY)/@Norm, 6), |
498 | | @Alpha := ASIN(@LX) AS Alpha, |
499 | | @Sign := SIGN(@LY) AS Sign, |
500 | | @M3L := M3Long*@Sign*0.0117193246260285378, |
501 | | @Slope := SlopeLong*@Sign/0.0117193246260285378 AS Slope, |
502 | | @Xi := 1.39252 + 0.154247*@Slope + 1.67972*(1-1/(1+4.86232*Leakage1)), |
503 | | @Sign1 := @M3L+0.07, |
504 | | @Sign2 := (@Dist-0.5)*7.2-@Slope, |
505 | | @Disp := IF (SIGN(@Sign1)<0 || SIGN(@Sign2)<0, -@Xi, @Xi) * (1-Width/Length), |
506 | | @ThetaSq := (@Disp*@Disp + @Dist*@Dist - 2*@Disp*@Dist*SQRT(1-@LX*@LX)) AS ThetaSq |
507 | | FROM RunInfo |
508 | | LEFT JOIN Events USING (FileId) |
509 | | LEFT JOIN Position USING (FileId, EvtNumber) |
510 | | CROSS JOIN Wobble |
511 | | WHERE |
512 | | fSourceKey=5 |
513 | | AND |
514 | | fRunTypeKey=1 |
515 | | AND |
516 | | FileId BETWEEN 131101000 AND 131107000 |
517 | | AND |
518 | | fZenithDistanceMax<35 |
519 | | AND |
520 | | fR750Cor>0.9*fR750Ref |
521 | | ) TableAlias |
522 | | |
523 | | WHERE |
524 | | ThetaSq<0.156 |
525 | | AND |
526 | | Area < LOG10(Size)*898-1535 |
527 | | AND |
528 | | NumUsedPixels>5.5 |
529 | | AND |
530 | | NumIslands<3.5 |
531 | | AND |
532 | | Leakage1<0.1 |
533 | | }}} |
534 | | |
| 481 | SELECT |
| 482 | @S := COUNT(IF(Weight>0, 1, NULL)) AS `Signal`, |
| 483 | @B := COUNT(IF(Weight<0, 1, NULL)) AS `Background` |
| 484 | FROM |
| 485 | ( |
| 486 | |
| 487 | SELECT |
| 488 | Size, |
| 489 | NumUsedPixels, |
| 490 | NumIslands, |
| 491 | Leakage1, |
| 492 | Weight, |
| 493 | PI()*Width*Length AS Area, |
| 494 | @PX := cosa*X - sina*Y, |
| 495 | @PY := cosa*Y + sina*X, |
| 496 | @DX := MeanX-@PX/1.02, |
| 497 | @DY := MeanY-@PY/1.02, |
| 498 | @Norm := SQRT(@DX*@DX + @DY*@DY), |
| 499 | @Dist := @Norm*0.0117193246260285378 AS Dist, |
| 500 | @LX := TRUNCATE((CosDelta*@DY - SinDelta*@DX)/@Norm, 6), |
| 501 | @LY := TRUNCATE((CosDelta*@DX + SinDelta*@DY)/@Norm, 6), |
| 502 | @Alpha := ASIN(@LX) AS Alpha, |
| 503 | @Sign := SIGN(@LY) AS Sign, |
| 504 | @M3L := M3Long*@Sign*0.0117193246260285378, |
| 505 | @Slope := SlopeLong*@Sign/0.0117193246260285378 AS Slope, |
| 506 | @Xi := 1.39252 + 0.154247*@Slope + 1.67972*(1-1/(1+4.86232*Leakage1)), |
| 507 | @Sign1 := @M3L+0.07, |
| 508 | @Sign2 := (@Dist-0.5)*7.2-@Slope, |
| 509 | @Disp := IF (SIGN(@Sign1)<0 || SIGN(@Sign2)<0, -@Xi, @Xi) * (1-Width/Length), |
| 510 | @ThetaSq := (@Disp*@Disp + @Dist*@Dist - 2*@Disp*@Dist*SQRT(1-@LX*@LX)) AS ThetaSq |
| 511 | FROM RunInfo |
| 512 | LEFT JOIN Events USING (FileId) |
| 513 | LEFT JOIN Position USING (FileId, EvtNumber) |
| 514 | CROSS JOIN Wobble |
| 515 | WHERE |
| 516 | fSourceKey=5 |
| 517 | AND |
| 518 | fRunTypeKey=1 |
| 519 | AND |
| 520 | FileId BETWEEN 131101000 AND 131107000 |
| 521 | AND |
| 522 | fZenithDistanceMax<35 |
| 523 | AND |
| 524 | fR750Cor>0.9*fR750Ref |
| 525 | ) TableAlias |
| 526 | |
| 527 | WHERE |
| 528 | ThetaSq<0.156 |
| 529 | AND |
| 530 | Area < LOG10(Size)*898-1535 |
| 531 | AND |
| 532 | NumUsedPixels>5.5 |
| 533 | AND |
| 534 | NumIslands<3.5 |
| 535 | AND |
| 536 | Leakage1<0.1 |
| 537 | |
| 538 | ) Counter |
| 539 | }}} |
| 540 | |
| 541 | I am sure there is also a query which in addition prints the effective on-time |