16.5 Efficiency Simulation
Table of Contents
Event acceptance
In many analyses you are not able to detect or keep every generated event. Some events fail trigger requirements, lie outside the detector coverage, or are rejected by analysis cuts. The fraction of true events that survive these steps is called the acceptance.
In a simple Monte Carlo study in ROOT, acceptance is often implemented as a geometrical or kinematic requirement on the generated variables. For example, you might generate particle directions uniformly in solid angle, but accept only those with $|\eta| < 2.5$ or $|\cos\theta| < 0.9$, or keep only energies above a certain threshold.
A typical workflow for acceptance simulation in a ROOT macro uses a random number generator such as TRandom3. For each generated event you first draw the true variables, then check whether they fall into the accepted region. If they do, you count the event as accepted. You can monitor this by filling one histogram with all generated events and another histogram with only the accepted ones. The ratio of the integrals of these histograms gives the overall acceptance.
The acceptance $A$ is defined as
$$
A = \frac{N_{\text{accepted}}}{N_{\text{generated}}} \,,
$$
where $N_{\text{generated}}$ is the number of true events you intended to study and $N_{\text{accepted}}$ is the number that pass the acceptance criteria.
In practice the acceptance can depend strongly on kinematic variables. For instance, low transverse momentum particles may curve too much in a magnetic field and miss the detector, while very forward particles may leave the detector acceptance completely. To study this, you can fill histograms of generated and accepted events as a function of a variable like $p_T$ or $\eta$. The bin-by-bin ratio then gives an acceptance curve.
A convenient pattern in ROOT is to use two histograms with identical binning. After filling them in a loop, you can clone one histogram and divide:
- Create
TH1orTH2objects for generated and accepted events with the same binning. - Run an event loop, generate your variables with
TRandom3, and apply anifcondition for acceptance. - Fill the generated histogram for every event and the accepted histogram only when the condition passes.
- After the loop, create an efficiency or acceptance histogram by cloning the accepted histogram and calling
Divideby the generated histogram.
This approach not only gives the acceptance as a function of variables, but also allows you to visualize where the detector or selection becomes inefficient. It also provides a way to correct for acceptance by weighting real data or simulated events with the inverse of the acceptance curve, while being careful to propagate the statistical uncertainties that come from the finite Monte Carlo sample.
Statistical fluctuations must be taken into account. The number of accepted events in each bin follows binomial statistics with parameters $N_{\text{generated}}$ and $A$. ROOT can help estimate these uncertainties automatically if you use TEfficiency or TGraphAsymmErrors constructed from the two histograms, but the core idea remains that the acceptance is a probability estimated from generated and accepted counts.
Detector efficiency
Even within the accepted region, a detector does not record every particle that passes through it. Inefficiencies can come from dead channels, reconstruction failures, threshold effects, or imperfect pattern recognition. The probability that a true, accepted event is actually detected or reconstructed is called the detector efficiency.
Detector efficiency is conceptually similar to acceptance, but it is usually applied on top of a given acceptance. Often you first define the region in which the detector is intended to work, then within that region you model the efficiency as a function of relevant variables, such as energy, position, or time. In simulations, you can represent this by taking each accepted event and deciding probabilistically whether it is detected.
A simple way to implement detector efficiency in a ROOT Monte Carlo is to use a comparison between a random number and an efficiency function. Suppose you have an efficiency that depends on energy, $\epsilon(E)$. For each event that has already passed your acceptance criteria, you do the following:
- Evaluate the efficiency $\epsilon$ at the event’s true value, for example
double eff = EfficiencyFunction(E);. - Draw a uniform random number
ubetween 0 and 1, usingrnd.Uniform(). - If
u < eff, count the event as detected, otherwise the event is lost.
You can again keep track of the process with histograms. One histogram contains all events that satisfy the acceptance, and another contains only the detected events. Their ratio as a function of variables gives the detector efficiency curve.
The detector efficiency $\epsilon$ can be defined as
$$
\epsilon = \frac{N_{\text{detected}}}{N_{\text{accepted}}} \,,
$$
and the overall efficiency including acceptance is
$$
\epsilon_{\text{total}} = \frac{N_{\text{detected}}}{N_{\text{generated}}} = A \times \epsilon \,.
$$
Efficiency can take many shapes. A typical example is a turn-on curve, where the efficiency rises from zero at low energy or low amplitude and approaches a plateau at high values. In ROOT, you can model such shapes with functions created using TF1, for example a sigmoid or an error function. You then use TF1::Eval() to get the efficiency for each event in your loop. By adjusting the parameters of this function, you can tune the simulated efficiency to match real detector performance measured from calibration data.
To study efficiency as a function of several variables, you can use two-dimensional histograms. Fill one TH2 with all accepted events and another with detected ones, then compute the bin-by-bin ratio using Divide. When dealing with low statistics, be careful with bins where the denominator is small or zero. ROOT’s specialized classes provide methods to store asymmetric efficiency uncertainties, which are especially important in regions of low counts.
Ultimately, efficiency simulation is crucial when you want to compare theoretical predictions or generator-level Monte Carlo with measured data. By applying acceptance criteria followed by detector efficiency, you can propagate realistic detector effects into your simulated observables, then compare the resulting histograms with those from real experiments. This allows you to perform corrections, estimate systematic uncertainties associated with imperfect knowledge of efficiency, and understand how detector performance influences physics results.
Views: 9
KAHIBARO