450 | | |
451 | | |
452 | | |
453 | | Some statistics: |
454 | | |
455 | | |
456 | | == Simple Analysis == |
457 | | |
458 | | |
| 450 | You can of course include all the calculations into your query already |
| 451 | |
| 452 | {{{ |
| 453 | SELECT |
| 454 | Events.*, |
| 455 | Angle, |
| 456 | weight, |
| 457 | @PX := cosa*X - sina*Y, |
| 458 | @PY := cosa*Y + sina*X, |
| 459 | @DX := MeanX-@PX/1.02, |
| 460 | @DY := MeanY-@PY/1.02, |
| 461 | @Norm := SQRT(@DX*@DX + @DY*@DY), |
| 462 | @Dist := @Norm*0.0117193246260285378 AS Dist, |
| 463 | PI()*Width*Length*0.0117193246260285378*0.0117193246260285378 AS Area, |
| 464 | @LX := TRUNCATE((CosDelta*@DY - SinDelta*@DX)/@Norm, 6), |
| 465 | @LY := TRUNCATE((CosDelta*@DX + SinDelta*@DY)/@Norm, 6), |
| 466 | @Alpha := ASIN(@LX) AS Alpha, |
| 467 | @Sign := SIGN(@LY) AS Sign, |
| 468 | @M3L := M3Long*@Sign*0.0117193246260285378, |
| 469 | @Slope := SlopeLong*@Sign/0.0117193246260285378 AS Slope, |
| 470 | @Xi := 1.39 + 0.154*@Slope + 1.679*(1-1/(1+4.86*Leakage1)), |
| 471 | @Sign1 := @M3L+0.07, |
| 472 | @Sign2 := (@Dist-0.5)*7.2-@Slope, |
| 473 | @Disp := IF (SIGN(@Sign1)<0 || SIGN(@Sign2)<0, -@Xi, @Xi) * (1-Width/Length), |
| 474 | @ThetaSq := (@Disp*@Disp + @Dist*@Dist - 2*@Disp*@Dist*SQRT(1-@LX*@LX)) AS ThetaSq |
| 475 | FROM RunInfo |
| 476 | LEFT JOIN Events USING (FileId) |
| 477 | LEFT JOIN Position USING (FileId, EvtNumber) |
| 478 | CROSS JOIN |
| 479 | ( |
| 480 | SELECT 0 AS Angle UNION ALL |
| 481 | SELECT 60 AS Angle UNION ALL |
| 482 | SELECT 120 AS Angle UNION ALL |
| 483 | SELECT 180 AS Angle UNION ALL |
| 484 | SELECT 240 AS Angle UNION ALL |
| 485 | SELECT 300 AS Angle |
| 486 | ) Wobble |
| 487 | WHERE |
| 488 | fSourceKey=5 |
| 489 | AND |
| 490 | fRunTypeKey=1 |
| 491 | AND |
| 492 | FileId BETWEEN 131101000 AND 131107000 |
| 493 | AND |
| 494 | fZenithDistanceMax<35 |
| 495 | AND |
| 496 | fR750Ref/fR750Cor>0.9 |
| 497 | }}} |
| 498 | |
| 499 | Or you use the existing table for the standard 60° Wobble positions and do just {{{CROSS JOIN Wobble}}}. |
| 500 | |
| 501 | This will give you all you need in ''crab.root'' ({{{rootifysql --out=crab.root}}}), but significantly increases computing time and the output file will be about six times larger. |
| 502 | |
| 503 | A simple macro just applying all the cuts would then be enough to do a theta-square plot |
| 504 | |
| 505 | {{{ |
| 506 | void ganymed3() |
| 507 | { |
| 508 | // Create chain for the tree Result |
| 509 | // This is just easier than using TFile/TTree |
| 510 | TChain c("Result"); |
| 511 | |
| 512 | // Add the input file to the |
| 513 | c.AddFile("crab.root"); |
| 514 | |
| 515 | // Set some constants (they could be included in the database |
| 516 | // in the future) |
| 517 | c.SetAlias("mm2deg", "+0.0117193246260285378"); |
| 518 | |
| 519 | // Define the cuts |
| 520 | c.SetAlias("CutQ", "NumIslands<3.5 && NumUsedPixels>5.5 && Leakage1<0.1"); |
| 521 | |
| 522 | c.SetAlias("Cut0", |
| 523 | "SlopeSpreadWeighted<0.68 &&" |
| 524 | "SlopeSpreadWeighted>0.18 &&" |
| 525 | "log10(Area)<(log10(Size)-2)*1.1-1.55 &&" |
| 526 | "ConcCore>0.13 &&" |
| 527 | "ConcCOG >0.15"); |
| 528 | |
| 529 | // Do one plot for each wobble position |
| 530 | c.Draw("ThetaSq", "(ThetaSq<1 && CutQ && Cut0 && Angle==0)*( weight)"); |
| 531 | c.Draw("ThetaSq", "(ThetaSq<1 && CutQ && Cut0 && Angle!=0)*(-weight)", "same"); |
| 532 | } |
| 533 | }}} |
| 534 | |