Analysis Tools
Contents:
This section presents more advanced topics on the Beta analysis
packages covering the basics on how to manipulate candidates with
operators, Monte Carlo truth associators, and introduces several concepts
useful for running physics analyses at BaBar. Users who are new to
using Beta candidates should first read the Workbook Event
Information section, and in particular the BtaCandidate section.
Quick links:
Charged PID Homepage
Neutral PID Homepage
About PID
Particle Identifcation (PID) is concerned with the identification
of detected particles  ones that live long enough to leave
an actual signal in the detector. The detected particles are electrons,
muons, pions, kaons, protons, and photons. Other particles decay too
quickly to be detected, and must be reconstructed by combining the
detected particles to form composite candidates, and testing these
candidates. You will learn about particle composition
later in this section.
The responsibility for Particle ID is divided between two
groups: the
Charged PID Group
and the
Neutral PID Group.
The PID groups develop, tests and maintain particle
selectors, standard sets of selection criteria used in all BaBar analyses
to identify the detected particles.
The efficiency of a selector is the fraction of signal events
accepted by the selector. The purity is the fraction of
all events selected that are signal events. In general, you want
high efficiency and high purity. However, there is usually a tradeoff
between efficiency and purity: if you tighten your selection criteria,
you will cut out more background events, but you will lose more signal events as well.
To provide each user with the level of selection required for his or her
analysis, each particle typically has several levels of selector,
from VeryLoose (most efficient, least pure) to VeryTight (most pure, least
efficient). You will need to determine which level of selector you require
by studying the efficiencies and purities of those selectors for your
specific analysis.
A PID list is a list of BtaCandidates that have passed a given
particle selector. For example, one of the lists provided by the
Charged PID group is the eMicroTight list of BtaCandidates that
have passed the selector "TightElectronMicroSelection".
The complete list of available PID lists can be found
in the Workbook's
Table of Runtime
Lists.
Since Monte Carlo (simulated data) is not a perfect imitation
of data, the performance of the particle selectors is not the
same for data and Monte Carlo. So whenever an analysis uses
Monte Carlo simulations to estimate the effect of a PID selector
on data, the result must be corrected for differences between
data and Monte Carlo.
The PID groups both provide methods for implementing data/MC
corrections in your analysis. For Charged PID, you have a choice
between two main methods: PID tweaking or PID weighting, which can
be set via tcl. For Neutral PID, the procedure usually involves
adding or changing some lines in a tcl file, and possibly
adding a package with a given tag.
Unfortunately, in both groups (especially the Neutrals Group)
the recommended procedure tends to change over time, so you need to
consult the PID Group webpages at the time you do your analysis
to find out what is the current method for data/MC corrections.
Related Links: (last updated: April 2007)
Charged PID data/MC corrections
18series recipe for neutrals data/MC corrections
(I was unable to find links to instructions for R22 recipes. Probably they have not been created yet. If/when you find them, please email me and let me know so I can update this page.)
Accessing the lists of BtaCandidates in the event store was the first
step for the analysis; we now have to learn which kind of operations
can be performed.
In the BtaCandidate section you saw some of the member functions of the
BtaCandidate class: functions to access the charge, energy, mass,
3momentum, and 4momentum of any Beta Candidate. These functions
belong to the BtaCandidate class.
There are also many functions that can be performed on
BtaCandidates. These functions are not members of the BtaCandidate
class; rather, they take BtaCandidates as input. Vertexing, massconstrained
fitting, and simple 4vector addition are examples of such operators.
The analyst selects the operator needed at particular stages in the
analysis, trading off accuracy and completeness for speed and flexibility.
This is just the beginning of the list of all the possible operations
that can be performed on BtaCandidates:
 Cloning
 Setting particle type
 Combining 4vectors
 Vertexing
 Applying constraints
 Obtaining Monte Carlo Truth
 Changing a reference frame
 ...............
In the following section you will learn about some of the tools
available for manipulating BtaCandidates.
A basic operation of analysis is creating acceptable candidates for a
particular reaction from scratch. There are many tools available
for combining Beta Candidates:
 Simple addition
 Beta Candidate (class BtaCandidate) can be simply combined to form a new Beta Candidate.
This type of addition imposes no constraints.
 Vertex and Kinematic Fitting
 These are fitters that can be used within a BaBar Framework application to
create composite candidates, incorporating geometric constraints, kinematic
constraints, or both.
 SimpleComposition
 SimpleComposition is a package full of BaBar Framework modules that create lists
of composite particles, automating the work of making combinations,
performing fits, and making cuts.
Simple Addition of Beta Candidates
Two BtaCandidates can be combined by simply adding their 4momenta:
BtaCandidate* c1;
BtaCandidate* c2;
BtaOpAdd4 op;
BtaCandidate c3= op.combine( *c1, *c2 );
This operation combines BtaCandidates c1 and
c2 to give the (putative) mother, c3 .
BtaOpAdd4 specifies a simple kinematic addition.
This type of addition does not take into account any geometric
or kinematic constraints. The two BtaCandidates could
be separated by a long distance in space, or combine
to form a BtaCandidate with an impossible mass (for example, a mass
that does not belong to any existing particle). So you will need
to test the new BtaCandidate before you can be confident that it really
is the mother.
A more sophisticated way of combining BtaCandidate is the
vertexing/kinematic fitting procedure in which one uses physical
constraints governing a particle interaction or decay to improve the
measurements describing the process. Fitters can use geometric
constraints, kinematic constraints, or both; and can treat
singlelevel or more complicated decay trees.
Vertexers and kinematic fitters are both Beta operators. The
input is a list or tree of BtaCandidates. A vertexer returns
the most likely common vertex position, vertex momentum,
and their errors. A kinematic fitter returns the best fit to the
momenta/masses/energies of the candidates. Many Beta operators
do both. The output is a modified version of the tree with
improved vertices and momenta.
An example of the use of a vertexer can be found in the module,
which came in your BetaMiniUser package. This module forms K0
candidates by vertexing pairs of pion candidates. Looking at MyK0Analysis.cc,
you can see that the code #includes the required vertexing header
files,
#include "VtxBase/BtaAbsVertexer.hh"
#include "VtxFitter/VtxFitterOper.hh"
#include "VtxBase/VtxAbsAlgorithm.hh"
initiates some vertexers,
, vtxFitAlgo("vtxFitAlgo", this, VtxAbsAlgorithm::GeoKin)
, vtxFitMode("vtxFitMode", this, VtxAbsAlgorithm::Standard)
and uses them to obtain a "fitted Vee" (that is, a fitted hypothetical
K > pi+ pi decay).
VtxFitterOper veeVertexer(initialVee,vtxFitAlgo.value(), vtxFitMode.value());
veeVertexer.fit();
fittedVee = veeVertexer.getFittedTree();
To learn how to use the vertexing operators go at the Vertexing/Kinematic
Fitting User's Guide. This is a wellwritten, detailed and uptodate
guide based on analysis21. (Note that it is based on a different
release than analysis30, the release used in the Workbook Quicktour.)
Related Documents:
SimpleComposition is a package that takes existing lists of BtaCandidates (such as
ChargedTracks, GoodTracksLoose, piDefault, KDefault, gammaDefault) and
produces lists of composite BtaCandidates. A composite BtaCandidate is
really a decay tree, so geometric and kinematic fits can be performed
on each composite candidate.
SimpleComposition provides an interface for fitting and refitting, applying
and refining selection. Each "operation" that SimpleComposition supports
is given a module, and that module is configure by the user via tcl
The SimpleComposition home page has links to many
useful tutorials and examples on how to use the SimpleComposition package.
Another good way to get started using SimpleComposition is to try the
Workbook tutorial, How to generate a
set of CM2 ntuples using SimpleComposition and BtaTupleMaker.
The BetaTools and BetaCoreTools packages provide a diverse set of tools
for use with analyses at the Beta level. Those tools that are considered
core for any physics analysis are placed in BetaCoreTools. The
BetaTools package provides tools for carrying out Monte Carlo truth analyses.
Some of the more useful BetaCoreTools include:
 Tools for calculating event shape variables, such as thrust,
sphericity, the Fox Wolfram moment.
 Monte Carlo truth associators, which associate the
reconstructed objects in the event store to the corresponding Monte
Carlo truth candidate (if it exists).
 Tools providing additional event information, such as total
momentum and B variables like deltaE, mes, and eBeam.
 Utility functions to carry out tasks such as boosting a candidate and
all its decay products, and doing simple vertexing (adding 4 momenta)
Some of the more useful BetaTools include:
 Selectors and particle candidate makers.
 Tools for making cuts/histogramming.
 Beta Candidate counters
Descriptions and documentation for these and other BetaTools
can be found on the BetaTools and BetaCoreTools page.
Some of the more useful tools are described below.
A useful quantity in many analyses is the helicity angle.
In the reaction Y > X > a + b, the helicity angle of particle
a is the angle measured in the rest frame of the decaying parent
particle, X, between the direction of the decay daughter a and
the direction of the grandparent particle Y. (Source: BAD 529 (V5)
p.56)
The following short C++ routine can be used to
compute the cosine of the helicity angle.
#include <TLorentzVector.h>
#include <Vector3.h>
Float_t coshel(TLorentzVector particle, TLorentzVector parent,
TLorentzVector grandparent) {
TVector3 boosttoparent = (parent.BoostVector());
particle.Boost(boosttoparent);
grandparent.Boost(boosttoparent);
TVector3 particle3 = particle.Vect();
TVector3 grandparent3 = grandparent.Vect();
Float_t numerator = particle3.Dot(grandparent3);
Float_t denominator = (particle3.Mag())*(grandparent3.Mag());
Float_t temp = numerator/denominator;
return temp;
}
Alternatively, the helicity is expressed in terms of Lorentz invariant
quantities in BAD 522 (V6), Eq. 141, page 120. This expression
avoids the need to do boosts for calculating the helicity angle.
NOTE: You should NOT use BtaBooster to compute helicity, because
you cannot compare angles between a BtaBooster'ed vector and an
unBtaBooster'ed vector, as the two coordinate systems have a relative
rotation. Instead, a straight Lorentz boost should be used.
In the special case where X and a are already boosted to
the Y reference frame, you can use the BetaCoreTools package
BtaHelicity to compute the helicity. The syntax is:
#include "BetaCoreTools/BtaHelicity.hh"
BtaHelicity h(a, b); // a and b are BtaCandidates in X > a + b
double hel = h.helicity();
For example, in the BetaMiniUser package, BtaHelicity is used in MyK0Analysis.cc
to compute the helicity of d1 in the decay Kcandidate > d1 d2.
It is often useful to associate one candidate with another
during analysis. Reconstruction candidates are associated with their
appropriate Monte Carlo truth candidates, etc. the BtaAssociator
classes provide a family of ways to do this with a consistent
interface. For example in efficiency studies it is important to
be able to associate the Monte Carlo truth to the reconstructed
objects. An example of how to do use associators is in our very own MyMiniAnalysis.cc, where a truth map is initiated,
, _btaTruthMap( "btaTruthMap", this, "GHit")
made frameworkaccessible,
commands()>append( &_btaTruthMap );
accessed,
// get the default truth mapping
//
BtaMcAssoc* truthMap =
Ifd< BtaMcAssoc >::get(anEvent, _btaTruthMap.value());
and finally used to associate each Beta Candidate in
the list *btaMicroList with its MC partner.
// Simple example of map usage
HepAListIterator<BtaCandidate> recoIter(*btaMicroList);
while (BtaCandidate* reco = recoIter()){
BtaCandidate *mcPartner = truthMap>mcFromReco(reco);
Then the difference between the momentum of the MC partner
and the original candidate is written to a histogram:
_aHisto>accumulate(mcPartner>p()  reco>p());
Other useful analysis tools
At BaBar, Bmesons are always produced in pairs: one B and one antiB. In
many studies, including the measurement of sin2beta, it is important to be
able to determine the flavor (b or antib) of one (and thus both) of the
Bmesons. Developing and maintaining a Bflavor tagging algorithm is the
responsility of the B Tagging Tools Group.
A typical scenario is that one of the Bmesons (the signal B) decays
in the mode of interest, while the other Bmeson (the tagging B) is used
to determine the flavor. The tagging B decays to a charged lepton or kaon.
Then the bquark flavor can be determined from the correlation between the
bquark charge and the charge of the "tagging" lepton or kaon.
The home page of the B Tagging Tools Group
includes links to BaBar Analysis Document (BAD) 729, which describes
Tag04, the latest (2004) Btagging algorithm, and a recipe for making
ntuples in CM2 with release 14.5.2.
Related Documents:
These older BADs describe earlier versions of the Btagging algorithm:
The RooFit packages provide a toolkit for modeling the expected distribution
of events in a physics analysis. Models can be used to perform likelihood
fits, produce plots, and generate "toy Monte Carlo" samples for various
studies. The RooFit tools are integrated with ROOT.
Related Documents:
An event display is a graphical tool for viewing detector structure
and events. BaBar's tool of choice is called WIRED. Instructions
on how to set up and run WIRED can be found at the links below:
Page maintained by Adam Edwards
Last modified: January 2008
