|
MUSIC unknown
Analysis for the MUSIC active-target ionization chamber
|
Helpers for the 2-D beam-spot description. More...
#include <BeamFit2D.hpp>
Classes | |
| struct | SpotFit |
| Result of a beam spot fit: the spot to use, and whether the Gaussian fit (rather than the clipped-moments fallback) made it. More... | |
Static Public Member Functions | |
| static Bool_t | InEllipseXY (const BeamFit2D &b, Double_t x, Double_t y, Double_t n) |
Whether a point lies inside the fitted ellipse at n sigma: the correlation-aware Mahalanobis chi2 below n^2, one level, since a density contour has one. | |
| static void | DrawEllipse (const BeamFit2D &b, Double_t n, Color_t color) |
Draw the n-sigma contour of a fitted spot on the current pad. | |
| static Moments2D | ComputeMoments (TH2F *h, Int_t lo_bx, Int_t hi_bx, Int_t lo_by, Int_t hi_by, Double_t thresh, Double_t bw_x, Double_t bw_y) |
| Second moments of a histogram region above a threshold. | |
| static Moments2D | ClippedMoments (const std::vector< std::pair< Float_t, Float_t > > &pts, const Moments2D &seed, Double_t clip=3.0) |
Sigma-clipped centroid and covariance of a point sample, the 2-D counterpart of the strip-width clip: each pass keeps the points within clip (Mahalanobis) of the current estimate and takes their mean and covariance, scaled up by the variance a 2-D Gaussian loses outside clip. | |
| static Moments2D | SeedSpotMoments (TH2F *h, Int_t seed_half_bins) |
Second moments of a coarse spot histogram's seed window: the maximum bin, ± seed_half_bins around it, over the bins at or above 0.3 of the peak. | |
| static SpotFit | FitSpotFromPoints (TH2F *h, std::vector< std::pair< Float_t, Float_t > > &pts, const Moments2D &seed) |
A beam spot from a coarse histogram and the same events unbinned: the sample's sigma-clipped moments seeded from seed, then a correlated Gaussian on a flat pedestal over a fine histogram re-binned around the clip — the inner 2 sigma fitted, the rest judged. | |
| static BeamFit2D | FitSpot (TH2F *h, const Moments2D &seed, Double_t window_nsigma=2.0, Double_t *chi2_ndf=nullptr) |
Fit a correlated 2-D Gaussian on a flat pedestal to h: ROOT's bigaus written out, Poisson likelihood, Minuit limits from seed. | |
| static Bool_t | FitPeak (TH1F *h, Double_t seed_mu, Double_t seed_sigma, Double_t window_nsigma, Bool_t fix_mu, Double_t &mu, Double_t &sigma, Double_t *chi2_ndf=nullptr) |
The 1-D counterpart: a Gaussian on a flat pedestal, fitted over window_nsigma of the seed and judged over the whole of h. | |
Helpers for the 2-D beam-spot description.
Definition at line 42 of file BeamFit2D.hpp.
|
static |
Sigma-clipped centroid and covariance of a point sample, the 2-D counterpart of the strip-width clip: each pass keeps the points within clip (Mahalanobis) of the current estimate and takes their mean and covariance, scaled up by the variance a 2-D Gaussian loses outside clip.
The widths are then a Gaussian's sigma for a Gaussian spot, and the clipped RMS of anything else; no binning or peak-fraction threshold enters.
| pts | The (x, y) sample. |
| seed | Starting estimate, e.g. ComputeMoments over the core. Its widths may be too narrow; the passes grow them. |
| clip | Mahalanobis radius kept per pass. |
Definition at line 94 of file BeamFit2D.cpp.
Referenced by FitSpotFromPoints().
|
static |
Second moments of a histogram region above a threshold.
| h | Histogram to measure. Must not be null. |
| lo_bx | First x bin, inclusive. |
| hi_bx | Last x bin, inclusive. |
| lo_by | First y bin, inclusive. |
| hi_by | Last y bin, inclusive. |
| thresh | Bin contents at or below this are ignored, which keeps background out of the widths. |
| bw_x | x bin width, for converting bin indices to physical units. |
| bw_y | y bin width. |
thresh. Definition at line 42 of file BeamFit2D.cpp.
Referenced by FindBeamGateStrips(), and SeedSpotMoments().
|
static |
Draw the n-sigma contour of a fitted spot on the current pad.
The correlated 2-D Gaussian's TEllipse rotated per the covariance eigen-decomposition, so the drawn contour is the InEllipseXY() gate (chi2 < n^2).
| b | Fitted spot; ok must be true. |
| n | Level, in sigma. |
| color | Line colour of the contour. |
Definition at line 24 of file BeamFit2D.cpp.
Referenced by FindBeamGateStrips().
|
static |
The 1-D counterpart: a Gaussian on a flat pedestal, fitted over window_nsigma of the seed and judged over the whole of h.
| h | Histogram to fit, and to judge chi2 over; must not be null, and a couple of bins per seed sigma would do. |
| seed_mu | Seed centre; sets the fitted window and mu's limits. |
| seed_sigma | Seed width; positive, and sets the fitted window and sigma's limits at 0.2 to 5 times the seed. |
| window_nsigma | Half-width fitted, in the seed's sigma. |
| fix_mu | Hold the centre at seed_mu, for a distribution with more than one peak. |
| mu | Fitted centre, untouched when the fit is rejected. |
| sigma | Fitted width, untouched when the fit is rejected. |
| chi2_ndf | Reduced chi2 over the whole of h, so what the window excluded is what it notices; -1 if no fit ran. |
mu and sigma are then untouched. Definition at line 289 of file BeamFit2D.cpp.
|
static |
Fit a correlated 2-D Gaussian on a flat pedestal to h: ROOT's bigaus written out, Poisson likelihood, Minuit limits from seed.
| h | Finely binned spot reaching past the fit window; a couple of bins per sigma would fit the binning. |
| seed | Sets the window and the limits, e.g. ClippedMoments. |
| window_nsigma | Half-width fitted, in the seed's sigma; narrow keeps a shoulder out of the width (+4 percent at 2, +10 at 4). |
| chi2_ndf | Reduced chi2 over the whole of h, so what the window excluded is what it notices; -1 if no fit ran. |
Definition at line 206 of file BeamFit2D.cpp.
Referenced by FitSpotFromPoints().
|
static |
A beam spot from a coarse histogram and the same events unbinned: the sample's sigma-clipped moments seeded from seed, then a correlated Gaussian on a flat pedestal over a fine histogram re-binned around the clip — the inner 2 sigma fitted, the rest judged.
| h | Coarse histogram; names the fine one and supplies the fallback amplitude. |
| pts | The spot's events unbinned (up to a cap); consumed. |
| seed | Seed moments, e.g. SeedSpotMoments(); weight must be > 0. |
Definition at line 164 of file BeamFit2D.cpp.
Referenced by FindBeamGateStrips().
|
static |
Whether a point lies inside the fitted ellipse at n sigma: the correlation-aware Mahalanobis chi2 below n^2, one level, since a density contour has one.
A Gaussian keeps 1 - exp(-n^2/2) inside.
| b | Fitted spot; ok must be true. |
| x | Point x coordinate. |
| y | Point y coordinate. |
| n | Level, in sigma. |
Definition at line 9 of file BeamFit2D.cpp.
Referenced by CollectAnchorSamplesOneSubfile().
|
static |
Second moments of a coarse spot histogram's seed window: the maximum bin, ± seed_half_bins around it, over the bins at or above 0.3 of the peak.
| h | Coarse histogram of the spot, already filled. |
| seed_half_bins | Half-width of the seed window, in bins of h. |
Definition at line 147 of file BeamFit2D.cpp.
Referenced by FindBeamGateStrips().