Monte Carlo Framework

 http://www.phys.cmu.edu/halld/MCS/mc_framework.html



A Monte Carlo framework has been developed to understand the performance of key aspects of the HALL D detector systems. The Monte Carlo program is in general a pipeline of modules. These modules consist of individual programs and library routines which utilize common event I/O formats.

First, a Monte Carlo four-vector generator is used for generating phase-space distributed events. Next in the pipeline is the detector simulation, HDFast, which is a fast and flexible simulation program based upon the MCFast framework developed by the simulation group at Fermilab. The Monte Carlo output is a ROOT Tree data file ( *.rdt file -root data tree).

Genr8

Monte Carlo events can be generated using the program genr8 or cwrap . Both programs generate peripheral phase space Monte Carlo events where events can be produced which describe a complex decay chain of intermediary states. Both meson and baryon decay chains are allowed, but with a limiting assumption of a t-channel production process.

HDFast

HDFast is a fast and flexible simulation program based upon the MCFast framework developed by the simulation group at Fermilab. MCFast consists of a set of modularized Monte Carlo library routines; it is designed to perform parameterized tracking by assembling a covariance matrix for each track that takes into account materials, efficiencies, and resolutions for all measurements planes, and use this matrix to smear the track parameters randomly. In principle, the distribution of smeared tracks produced by this method would be similar to the distribution of real tracks that were measured by a real detector(with the same parameters) and analyzed with an idealized track fitting procedure.

ROOT

What is ROOT?

Root is not a computer program, but instead it is a set of over 300 C++ classes (a class is a piece of C++ code that defines variables and functions related to a specific purpose) and a interactive C++ interpreter. The description below is taken from the ROOT mission statement.

 "The ROOT system provides a set of OO frameworks with all the functionality needed to handle and analyse large amounts of data in a very efficient way. Having the data defined as a set of objects, specialised storage methods are used to get direct access to the separate attributes of the selected objects, without having to touch the bulk of the data. Included are histogramming methods in 1, 2 and 3 dimensions, curve fitting, function evaluation, minimisation, graphics and visualization classes to allow the easy setup of an analysis system that can query and process the data interactively or in batch mode.

Thanks to the builtin CINT C++ interpreter the command language, the scripting, or macro, language and the programming language are all C++. The interpreter allows for fast prototyping of the macros since it removes the time consuming compile/link cycle. It also provides a good environment to learn C++. If more performance is needed the interactively developed macros can be compiled using a C++ compiler.

The system has been designed in such a way that it can query its databases in parallel on MPP machines or on clusters of workstations or high-end PC's. ROOT is an open system that can be dynamically extended by linking external libraries. This makes ROOT a premier platform on which to build data acquisition, simulation and data analysis systems."

For more information on ROOT visit the ROOT web pages from http://root.cern.ch/.

Using  ROOT I/O

Currently, the Hall D Collaboration does not subscribe to any standard input/output formats. It is expected that Hall D software development will have its foundation based on the C++ object-oriented programing language.

The ROOT framework includes a set of classes to support I/O to/from machine independent files. The I/O system is designed to be particularly efficient for objects frequently manipulated by modern high volume data experiments.

HDFast output structure

HDFast creates and writes data to a ROOT data tree. A ROOT tree is a data container similar to but with much less limitations than itape or BOS. Each event is contained in a super-branch which in turns contains the data branches(a data branch is like a itape group or BOS bank). Each branch contains the data structure of a defined class. Adding new branches reduces to creating a class which inherits from the ROOT TObject class. Currently HDFast save 5 branches: In addition there is one virtual or constructed branch:

Hall D MCRoot Development

In the mcroot development (Hall D CVS repository mcroot) there exists programs and macros designed to access the data from a rdt file. The program dumpRdt reads a rdt file and prints out the event objects.

DumpRdt Usage:

exotic 167% dumpRdt -h

dumpRdt usage: [switches] inputfile
        -n The number of event to read (default all).
        -L   List branch names of first event
        -Bbranch1,branch2,... Dump only these branches
        -h Print this help message

Listing branches in file:

exotic 168% dumpRdt -L test.rdt
Opening test.rdt for input
Branch list:
        hepevt
        tof_trace
        offtrk
        bcal
        lgdSmears


Dumping only one branch:

exotic 169% dumpRdt -n1 -Bhepevt test.rdt
Dumping 1 event
Dumping only these branches:
        hepevt
Opening test.rdt for input
Branche list:
        hepevt
        tof_trace
        offtrk
        bcal
        lgdSmears


 Nevhep: 2
         Nhep: 6
                 Ishep: 1 Idhep: 321 Mass: 0.494
                 Px: -0.203053 Py: -0.175953 Pz: 1.16301 E: 1.29183
                 Vx: 0.0123466 Vy: 0.0186673 Vz: 102.158 Vt: 383.947
                 Ishep: 1 Idhep: 22 Mass: 0
                 Px: 0.133062 Py: 0.002583 Pz: 0.337673 E: 0.362953
                 Vx: 0.0123466 Vy: 0.0186673 Vz: 102.158 Vt: 383.947
                 Ishep: 1 Idhep: 22 Mass: 0
                 Px: -0.006568 Py: -0.059309 Pz: 0.143684 E: 0.155582
                 Vx: 0.0123466 Vy: 0.0186673 Vz: 102.158 Vt: 383.947
                 Ishep: 1 Idhep: -211 Mass: 0.14
                 Px: -0.565609 Py: -0.216014 Pz: 2.92477 E: 2.99006
                 Vx: 0.0123466 Vy: 0.0186673 Vz: 102.158 Vt: 383.947
                 Ishep: 1 Idhep: 321 Mass: 0.494
                 Px: 0.397965 Py: 0.224851 Pz: 5.0126 E: 5.05758
                 Vx: 0.0123466 Vy: 0.0186673 Vz: 102.158 Vt: 383.947
                 Ishep: 1 Idhep: 2112 Mass: 0.939
                 Px: 0.244203 Py: 0.223843 Pz: 0.418274 E: 1.08001
                 Vx: 0.0123466 Vy: 0.0186673 Vz: 102.158 Vt: 383.947

Ntp_maker Usage:

megux2 56% ntp_maker -h

ntp_maker usage: [switches] inputfile
        -o    Save output as .root (default: halld.root).
        -c          Book four-momenta components.
        -n The number of event to read (default all).
        -s The number of events to skip before reading(default=0).
        -h Print this help message


megux2 58% root
  *******************************************
  *                                         *
  *        W E L C O M E  to  R O O T       *
  *                                         *
  *   Version   2.20/06   12 January 1999   *
  *                                         *
  *  You are welcome to visit our Web site  *
  *          http://root.cern.ch            *
  *                                         *
  *******************************************

CINT/ROOT C/C++ Interpreter version 5.13.83, Dec 2 1998
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
root [0] TFile f("o0.root");// gamma p -> p omega events 
root [1] TBrowser b;
root [2] .q
megux2 59% 

In addition, there are some example macros which are executed by the ROOT C++ interpreter to create some histograms of the data. Also, the macro GeoDraw.C reads in the MCFast geometry file (.db file) and displays a 2-D view of the detector geometry.

exotic 170% root .x GeoDraw.C
  *******************************************
  *                                         *
  *        W E L C O M E  to  R O O T       *
  *                                         *
  *   Version   2.20/06  18 December 1998   *
  *                                         *
  *  You are welcome to visit our Web site  *
  *          http://root.cern.ch            *
  *                                         *
  *******************************************

CINT/ROOT C/C++ Interpreter version 5.13.83, Dec 2 1998
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
root [0] 
Processing GeoDraw.C...



Author: Paul Eugenio 6-Jan-99