User Tools

Site Tools


root:backcat

Categorizing Background using Monte Carlo truth

Idea

It may be useful to print the decay tree of a Monte Carlo particle that was associated to a reconstructed particle. Suppose you have a preselection and you want to see what particles the background, that passes your preselection, consists of. As your reconstruction “thinks”, your reconstructed particles are all signal, you have to print the decay tree of the Monte Carlo particle associated to your reconstructed particle. The following components save the decay-string of a Monte Carlo particle in a txt-file (in DaVinci) and convert them into a LaTeX-table.

Components

There are 3 components:

  • BGCat: A DaVinci algorithm, that writes the decay string in a text-file.
  • BGlatex: A standalone C++ class, that puts the decay-string in a formatted LaTeX-table.
  • convPDGnumber: A standalone C++ class, that converts the Monte Carlo particle numbers in a LaTeX-string with the particle name.

DaVinci Algorithm BGCat

This algorithm takes your reconstruced mother particle from CombineParticles, assigns the respective Monte Carlo particle and prints all daughters (with their respective daughters if they are not stable, etc. ) in ascending order, with antiparticles coming after particles. The decay strings are stored in a file named BG_cat.txt. In your options-file, add:

from Configurables import BGCat

BGCategory = BGCat("BGCategory")
BGCategory.addTool( PhysDesktop() )
BGCategory.PhysDesktop.InputLocations = ["Phys/yourLocation"]
BGCategory.OutputLevel = 4

yourSequence.Members.append(BGCategory)

yourLocation may be something like Bsmumu, when you are doing Bsmumu = CombineParticles(“Bsmumu”). In your /src directory, add: BGcat.cpp and BGcat.h, which are located at: /afs/cern.ch/user/d/decianm/cmtuser/DaVinci_v21r0/Phys/DaVinci/src/code (cut the .source-ending off)

C++ Classes BGlatex and convPDGnumber

BGlatex takes the output text-file of BGCat and turns it into a LaTeX-table. convPDGnumber converts the Monte Carlo numbers into a string of LaTeX-code. Note that BGlatex needs convPDGnumber, while convPDGnumber can be used separately.

How to install it

  • Copy the folders BGlatexClass, convPDGnumberClass, obj and lib, the Makefile and the PDGLaTeXTable.txt in /afs/cern.ch/user/d/decianm/analysis/tools/code in a directory of yours.
  • Type make. Some warnings about deprecated headers will appear.
  • After it is finished, you should have a libToolClasses.so shared object in the folder /lib.
  • Copy the BG_cat.txt of the DaVinci Algorithm in this directory. This is not absolutely necessary, but makes it a bit easier.

The makeTable()-method

The class BGlatex has the main method makeTable(). It takes five arguments:

  • The input file name. Default is: BG_cat.txt
  • The output file name. Defaul is: BG_cat.tex
  • The numbers of decays per table. This will create a second, third table after a certain amount of decays in the table, and prevents LaTeX from spreading the table over the bottom of the page. Default is: 15
  • The number of characters per line. This will create a second, third row in the table after a certain amount of characters per line, and prevents LaTeX from spreading the table of the right margin of the page. Default is: 20
  • Full LaTeX header. Choose true if you want to use the table standalone, false if you want to use it via /input in your LaTeX-document. Default is true.

Notes

At this moment (09/01/14), all anti-particle numbers are converted into particle numbers.

The PDGlatex()-method

The class convPDGnumber has the main method PDGlatex(), takes as an argument the Monte Carlo number and returns a string with the LaTeX-expression. This method is called internally by makeTable().

Notes

At this moment (09/01/14), no anti-particles are implemented.

How to use it in ROOT/C++

The classes have been tested to work with ROOT. To use them, start ROOT and type:

  • gSystem→Load(“lib/libToolClasses.so”)
  • BGlatex a
  • a.makeTable() (or with arguments)
  • .q

This should have created a file named BG_cat.tex in your directory.

How to use it in Python

The classes have not really been tested in Python. The following procedure seems to work, though. Copy the file libToolClasses.so in your working directory. Start python and type:

  • import GaudiPython
  • GaudiPython.loaddict('STLRflx')
  • import sys, ROOT
  • import libToolClasses It will complain about “dynamic module does not define init function”.
  • from ROOT import BGlatex, convPDGnumber
  • a = BGlatex()
  • a.makeTable() (or with arguments)
  • CTRL-D

This should have created a file named BG_cat.tex in your directory.

Disclaimer

Most of the above programming was done in a Trial-and-Error fashion and things have not been extensively tested. Feel free to add comments or report bugs.

root/backcat.txt · Last modified: 2009/02/03 12:20 by decianm