γ/π separation tool

This page provides the description of a tool designed to deal with the separtion of photons and neutral pions. It is divided into two different tools, named Calibation Tool and Resampling Tool.

Both tools are based in the same principle: the fact that the transverse momentum of the neutral particle (i.e., the photon or the neutral pion) is well reproduced in the simulation. In addition, the resampling tool also makes use of the neutral particle pseudo-rapidity.

The first of the tools (Calibration Tool) gives the efficiency for a certain pair of cuts in the photon/electron and in the photon/neutral pion separation variables. The output of the tool is a table in which, in terms of transverse momentum bins, the tool provides the efficiency for the given cuts.

The second tool (Resampling Tool) is thought as a tool to allow the use of the photon/neutral pion separation variable as training variable for multivariate analysis tools. What the tool does is a resampling of the variable (i.e., regenerates the separation variable) using real data separation variable distributions. The output of this tool is a new branch in the MC file that faithfully reproduces the photon/neutral pion separation. To do this resampling, the tool assumes that both the transverse momentum and the pseudo-rapidity of the neutral particle are well reproduced in the simulation and that by binning in them we can fully reproduce the photon/neutral pion separation. This implies the loss of any correlation of this variable to any other one.

Table of Contents
  • Idea and Motivation
  • Getting the package and setup
  • Calibration samples
  • Recalibration tool
    • Scripts
  • Resampling tool
    • Scripts
  • Documentation
Idea and Motivation

When performing an analysis in which photons are involved, one of the main sources of background is that related to merged neutral pions. Simulation of these particles is not easy and fails to reproduce real data in terms of the photon/neutral pion separation variables. This disagreement between real data and MC implies the incorrect computation of efficiencies for cuts in these variables. In addition, the disagreement of real data and MC does not allow the inclusion of these variables in MultiVariate analysis methods.

The aim for these two tools is, on one side, to extract the efficiency for a certain cut in photon identification (in both neutral pion and electron separation) and, on the other side, to resample the photon/neutral pion separation variable so the MC distribution matches the data one. To do so, both tools consider the photon transverse momentum to be a trustworthy variable, meaning that it is considered that the neutral particle transverse momentum is completely controlled and perfectly reproduced in simulation. For the case of the resampling tool, the neutral particle pseudo-rapidity is used along with the transverse momentum as calibration variable.

The usage of each of the tools is explained below. However, the 'help' option for every script is always available, by simply doing:


python any_script.py --help 
Getting the package and setup

The package is available in the head version of Urania. To download it into the user's local lxplus account, they must do:


SetupUrania --build-env v3r0

svn co svn+ssh://svn.cern.ch/reps/lhcb/Urania/trunk/Phys/GammaPi0SeparationCalib

This will download the package.

To configure the package so it is ready to be used, the user must move to:


cd ~/cmtuser/Urania_v3r0/GammaPi0SeparationCalib/ 

and then do

cmt config

cmt make

The previous steps will produce the setup.csh and setup.sh files. Depending on the user's machine, they must source one or the other. Once this is done, the package variables will be defined to the correct use of the package.

The source of the setup file will need to be done every time the user wants to use the package so the environment variables are properly defined.

source setup.csh 
Calibration samples

Both tools use the same calibration samples.

  • For photon studies the calibration sample consists of background subtracted B→K*(892)γ, using data from 2011 and 2012.
  • For merged neutral pion studies the calibration sample consists of D→Kππ events, selected from D*→Dπ, using data from 2011.
To get them, once the package has been configured, the user must:

cd ~/cmtuser/Urania_v3r0/GammaPi0SeparationCalib/python/GammaPi0SeparationCalib 

and run the get_data.py script

python get_data.py 

This will create ~/cmtuser/Urania_v3r0/GammaPi0SeparationCalib/calibration_samples, where all the real data and MC calibration samples will be stored.

Calibration tool

This tool is based on the idea that efficiencies for a given PID (where here PID means the separation between photons and neutral pions and the separation between photons and electrons) cut are approximately constant within a given bin of the variable(s) the PID depends on. In this case, this variable, as said before, is the photon (neutral pion) transverse momentum. The way the binning of the transverse momentum is chosen allows the assumption of equal efficiency for any PID cut for MC and real data.

The tool takes as input a photon confidence level (i.e., photon/electron separation) and a photon/neutral pion separation cut values and gives as output a table with the efficiencies and errors on efficiencies in bins of the neutral particle transverse momentum. The format in which the output is given can be chosen by the user.

Scripts

The tool is composed of two different scripts.

The first of them (build_efficiency_tables.py) performs the construction of the efficiency tables from the desired binning scheme and cuts in the photon/electron and photon/neutral pion separation. The efficiency can be calculated for photons as well as for neutral pions. As output, it gives the efficiency of those cuts in the format the user chooses (the options being text, python-like and cpp-like).

An example of how to run build_efficiency_tables.py would be:

python -i build_efficiency_tables.py --binfile 'binning.txt' --isphotoncut 0.6 --clcut 0.25 --usemc --output 'text' --output 'python' 'gamma' 

For --isphotoncut 0.6 --clcut 0.25 --output 'text', the output should look like this:

####################################################################
#              Pt                                 Eff
####################################################################
 [2500.0, 3000.0) 0.98884043099 +/- 0.00167786060542
 [3000.0, 3500.0) 0.980608040915 +/- 0.00164220733388
 [3500.0, 4000.0) 0.979483149991 +/- 0.00187135399391
 [4000.0, 4500.0) 0.982785087719 +/- 0.00192327808115
 [4500.0, 5000.0) 0.9843387471 +/- 0.00188789879267
 [5000.0, 6000.0) 0.981715784601 +/- 0.00166255643977
 [6000.0, 7000.0) 0.983012592065 +/- 0.00198852694108
 [7000.0, 8000.0) 0.980741012472 +/- 0.00262635684199
 [8000.0, 9000.0) 0.977948990436 +/- 0.00337548509003
 [9000.0, 10000.0) 0.974751655629 +/- 0.00449651543583
####################################################################

The other script (make_efficiency_plots.py) uses the same information than build_efficiency_tables.py but in this case the output is a plot where the change in efficiency can be seen in terms of the neutral particle momentum or the photon/neutral pion separation.

An example of how to run make_efficiency_plots.py would be:

python -i make_efficiency_plots.py --binfile '../../../options/binning_calibration.txt' --clcut 0.25 'gamma' 'pt' 
Resampling tool

This tool (as the Calibration Tool) trusts the transverse momentum of the neutral particle as well as its pseudo-rapidity to be well reproduced in the simulation. Using a certain binning (that can be either the default one or a personal choice of the user), the tool assigns a new value for the photon/neutral pion separation variable to each event by selecting a random value extracted from the real data distribution of the separation variable in the corresponding transverse momentum and pseudo-rapidity 2D-bin for that event. The new distribution for this variable reproduces well the real distribution and therefore can be used in the training of MultiVariate analysis tools.

Scripts

The tool can be divided in scripts that are used to produce the so-called calibration histograms and the ones that perform the actual resampling. The calibration samples need to be downloaded prior the use of the tool as explained above.

The make_histos.py script produces the calibration histograms using the following parameters: variable that we want to be resampled (--var), the calibration variables (that will be the variable in which we will be binning, --binvarPT and --binvarETA, for the transverse momentum and the pseudo-rapidity respectively), the binning scheme to follow, the output file where the histograms will be stored and particle we are looking into (i.e., photon or neutral pion). The script gives also the option to try the method in calibration MC, in order to compute systematic uncertainties.

An example of the usage of the make_histos.py script would be:

python make_histos.py --var 'gamma_CaloHypo_isPhoton' --binvarPT 'gamma_PT' --binvarETA 'gamma_TRACK_Eta' --binfile '../../../options/binning_resampling.txt' --outputfile 'gamma_histos.root' 'gamma' 

The actual resampling is performed via the use of the apply_histos.py script. The series of parameters needed to run this script includes the file we want to resample, its tree, the choice for the name of the new variable, the calibration variables, the reference histograms file and the particle the resampling will be performed on, the photon or the neutral pion.

An example of the usage of the apply_histos.py script would be:

python apply_histos.py --treename 'DecayTree' --histosfile 'gamma_histos.root' --binvarPT 'gamma_PT' --binvarETA 'gamma_TRACK_Eta' --newvar 'resampled_Variable' 'FileToResample.root' 'gamma' 

The output of this tool is a new branch, with the chosen name, in the original file. That new branch corresponds to the resampled variable.

It is possible to check what arguments are mandatory by doing:

python any_script.py --help 
Binning Schemes

Both tools need binnings schemes provided by the user to work. The package itself provides default schemes that can be found is:

~/cmtuser/Urania_v3r0/GammaPi0SeparationCalib/options 

If desired, the user just needs to add/remove bins or change the suggested bin edges. The binning schemes will be read from this directory, so the user needs to put them there if wishes to use their own binning scheme.

If the user decides to bin in just one variable, they just need to define a very large single bin for the other variable.

Documentation

A dynamic note (i.e., a note that will be updated when needed) is available below, with detailed information about the principles of the separation of photons and neutral pions and how the tools work.

-- VicenteJoseRivesMolina - 2014-12-03

Topic attachments
I Attachment History Action Size Date Who Comment
PDFpdf Note.pdf r1 manage 919.5 K 2015-04-07 - 18:30 VicenteJoseRivesMolina Note that describes both the calibration and the re-sampling tool
PDFpdf Note_v2.pdf r1 manage 1169.8 K 2015-09-18 - 15:19 VicenteJoseRivesMolina Note that describes both the calibration and the re-sampling tool
Edit | Attach | Watch | Print version | History: r17 < r16 < r15 < r14 < r13 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r17 - 2015-09-18 - VicenteJoseRivesMolina
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Sandbox All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback