ToyMC for Basic Performance Studies

Overview

The BGV Toy MC is a standalone python tool. It uses simple detector geometry and pp or pA collisions to study:
  • Multiple scattering (MS) and detector hit resolution
  • Track and vertex fitting

Originally developed by M. Ferro-Luzzi, later extended by P. Hopchev with contributions from M. Witek and H. Dijkstra.

Depends on scipy/matplotlib. One of the two vertex fitting algorithms requires root.

How to run (Feb 2015)

It is recommended to copy the tool and develop it as an independent version. The recipe below is for lxplus

  • Login to lxplus
  • Copy and extract the BGV ToyMC tar archive to a local directory
    • cp /afs/cern.ch/user/p/phopchev/public/BGV/BGV_ToyMC_v2r3.tar.gz ./
    • tar -xzvf BGV_ToyMC_v2r3.tar.gz
  • Setup the working environment
    • SetupProject ROOT (ROOT environment is needed by the C++ version of the vertex fitter; if you don't use it, you can skip this step but you need to comment-out "import ROOT" in bgv.py)
    • export PYTHONPATH=/afs/cern.ch/sw/lcg/external/pyanalysis/1.3_python2.7/x86_64-slc6-gcc47-opt/lib/python2.7/site-packages/:$PYTHONPATH (or the equivalent for tcsh). This allows to use numpy, scipy and matplotlib
  • Run the tool
    • cd BGV_ToyMC_v2r3/workdir/
    • python -i ../bgv.py

Description of the components

  • bgv.py
    Main executable script. Defines the job configuration and executes the main algorithm that tracks the particles and calculates MS, detector hits and fits the tracks. The following switches can be used to modify the behavior:
    • boolAcceptanceOnly: calculate acceptance and "fraction of good events"
    • boolAcceptanceMapOnly: calculate acceptance by scanning (modifying) the z-position of the input vertices
    • boolDoVertexFit: After track fitting, call 2 possible vertex fitting routines in cpp and/or python
    • boolCheckDistributions: Draw some distributions
    • boolMakeFigures: Draw other distributions
    • boolDrawEvents: Draw event display(s)
    • boolDrawDetector: Draw detector geometry
    • boolMaterialScan: Draw eta-phi plot of the material seen by the tracks
    • boolVaryWinThick, exitWinTaperAngle: replace the exit window geometry element
    • boolIPFitSingleG: Fit the IP distribution with a single or double gaussian

  • BGVClassAndMeth.py
    Classes and functions providing the functionality of the tool: calculations of geometrical objects and other utility functions

  • FuncsInputTracks.py
    The input tracks data used in bgv.py is in the form of a "double list" of charged particles coming from the PV, i.e. list of lists of tracks (one track list per event). This type of data (LLMCP) can be obtained with a few different functions:
    • read_tracks: reads a properly formatted ascii file and returns the LLMCP. Example data file: gausssim_hi_10_7000.dat
    • read_tracks_from_sim: runs a Panoramix job that reads a .sim file and returns a formatted list of tracks. A file name can be specified (boolWriteAsciiFile) to write the input tracks to a new ascii file. See PanoReadTracks.py for more details
    • A few functions generating test tracks: e.g. tracks arranged in a circle

  • Folder DetectorGeo
    Contains all detector description files (one layout version = one file)

  • Folder SciPyModules
    Contains a few scipy modules used in bgv.py. Most notably FitUserFunction.py is used to perform Gaussian fits (if you like, change it with your preferred fitting function)

  • FuncsAcceptance.py
    Functions used in the track acceptance calculations

  • VertexTool.{c,h}
    C++ vertex fitting class by Mariusz Witek. Loaded in bgv.py as a Macro

  • myTrgutils_v1.py
    Python vertex fitting and utility functions from Hans Dijkstra and Hugo Ruiz Perez

  • PanoReadTracks
    Run a Panoramix job that loops over the events of a sim file and returns the tracks data in the format used by bgv.py. Optionally can write to an ascii file. Provides track filter functions. Can be run standalone: "python -i ../PanoReadTracks.py" after calling "SetupProject Panoramix". Note that the latter will modify $PYTHONPATH, and potentially will mess up scipy/matplotlib

  • Folder tmpPickles1
    Contains python pickle files with the residuals between MC-true and fitted vertices. These pickles can be analyzed with a separate script to get the vertex resolution


This topic: BGV > WebHome > ComputingAndSW > BGVToyMC
Topic revision: r1 - 2015-02-14 - PlamenHopchev
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2022 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