-- JosephBoudreau - 21-May-2012

Here are some instructions for running a certain body of code prepared by Joe Boudreau for the single top anomalous coupling analysis. Mostly these consist of standalone programs that can be build within ATLAS's offline system. Colloquially you might say they "run in athena" but really they don't-- they just share the common build system. So, anyone in ATLAS can build them and run them.


  • I. Setting up the release.
  • II. Building the code.
  • IV. Preparation of signal ntuples.
  • V. Determination of the efficiency functions.
  • VI. Determination of the resolution function
  • VII.Preparation of the background nutples.

I. Setting up the release.

The procedures here are working under release 17.6.0 or 17.7.0.

The gnu compiler version >= 4.6.3 is preferable but not required. If you have an earlier version, random number generation is buggy so some of the toy monte carlo studies will be unreliable.

asetup='source $AtlasSetup/scripts/asetup.sh'
asetup 17.8.0,here,gcc47

II. Building.

Get the build-cmt script from SVN:

export SVNUSR="svn+ssh://svn.cern.ch/reps/atlas-boudreau"
svn export ${SVNUSR}/boudreau/sw/trunk/build-cmt.sh

Copy that file to the TOP of your local release and then run the script (./build-cmt.sh). This will retrieve the code from SVN and will build all of the programs and all of their plugins.

IV. Preparation of signal ntuples:

From Kevins's private-format ntuples FOR THE SIGNAL make a supermini ntuple.(Note there are two varieties of these ntuples, one which is Tsar'd byCarlos and one which is Tsar'd by Kevin. In this section, we use Kevins', while waiting for a format merger)


Top D3PDs --> SGTOP D3PD --> Private Format --> Supermini.

You will do this twice for electrons and twice for muons, as shown below. In this example we work directly in the testrelease area. Some example input files can be found on lxplus, in the area


supermini.exe JETS=2 electronInput0.root electronInput1.root -o mc11c-2Jet.sig.el.root -p Pittsburgh/sw/STProcessesMC11c.root

supermini.exe JETS=3 electronInput0.root electronInput1.root -o mc11c-3Jet.sig.el.root -p Pittsburgh/sw/STProcessesMC11c.root

supermini.exe JETS=2 muonInput0.root muonInput1.root -o mc11c-2Jet.sig.mu.root -p Pittsburgh/sw/STProcessesMC11c.root

supermini.exe JETS=3 muonInput0.root muonInput1.root -o mc11c-3Jet.sig.mu.root -p Pittsburgh/sw/STProcessesMC11c.root

When you are done you can look at these with present.exe, for example:

present.exe mc11c-2Jet.sig.el.root

In the following sections some scripts are used to analyze these "supermini" ntuples. If you follow the naming scheme above (mc11c-2Jet.sig.el.root), in the tesrelease area, these scripts will work without modification.

We have already carried out this step for a some of the signal Monte Carlo. We do not include the tau contribution. Input is circa p834. These files are generated using PROTOS; the files that contain the string "SM" are generated with standard model couplings. They are in ~boudreau/public/SINGLETOP/SUPERMINI:

mc11c.2Jet.neg01.sig.el.root mc11c.3Jet.neg01.sig.el.root
mc11c.2Jet.neg01.sig.mu.root mc11c.3Jet.neg01.sig.mu.root
mc11c.2Jet.neg02.sig.el.root mc11c.3Jet.neg02.sig.el.root
mc11c.2Jet.neg02.sig.mu.root mc11c.3Jet.neg02.sig.mu.root
mc11c.2Jet.pos01.sig.el.root mc11c.3Jet.pos01.sig.el.root
mc11c.2Jet.pos01.sig.mu.root mc11c.3Jet.pos01.sig.mu.root
mc11c.2Jet.pos02.sig.el.root mc11c.3Jet.pos02.sig.el.root
mc11c.2Jet.pos02.sig.mu.root mc11c.3Jet.pos02.sig.mu.root
mc11c.2Jet.R.sig.el.root mc11c.3Jet.R.sig.el.root
mc11c.2Jet.R.sig.mu.root mc11c.3Jet.R.sig.mu.root
mc11c.2Jet.SM.sig.el.root mc11c.3Jet.SM.sig.el.root
mc11c.2Jet.SM.sig.mu.root mc11c.3Jet.SM.sig.mu.root

V. Determination of the efficiency functions.

In order to determine the efficiency function you need to have produced the "supermini" ntuples in the previous section. There is a script to determine efficiencies for those files:


so, unless you are going to customize that script, please locate the "supermini" files in the top directory of the test release area, give them names like mc11c-2Jet.sig.el.root, mc11c-2Jet.sig.mu.root, etc, and locate yourself in the directory Pittsburgh/sw/STEFFICIENCY.

The script runs a program called stefficiency.exe on the supermini files. It loops over muon and electron final states, and NJETS=2 an 3. For each fit it starts by fitting spherical harmonics up to L=2, then, it bumps up L=2 --> L=3 and fits again until you tell it to exit. At each iteration it uses the output of the previous iteration as a starting point--so remove any improperly closed root files before starting. So the easiest way to compute efficiencies (and the first step) is to execute the script;


A monitor appears on the screen which lets you look at the fits in 2D and in 1D projections (polar angle and azimuth). This compares the data with the fit, and provides access to several different views. You can close this monitor--the fit will continue without any monitoring. When the program prints "Minimization has terminated" (in the terminal window, which also has all of the MINUIT output) you can go onto the next iteration by closing the monitor window, if it is still open.

The program stefficiency.exe

The program stefficiency.exe (which is run within the script) can be invoked by hand and provides a lot of flexibility. The syntax is

stefficiency.exe pluginName -i inputFile [LMAX=N] [-c minuitCommand] -o outputFile -s startingValueFile


  • pluginName is the name of the plugin (from STPLUGINS) that does all the actual work.
  • inputFile is the input file (a supermini ntuple file)
  • minuitCommand is the MINUIT command to be run (SIMPLEX, MIGRAD, MINIMIZE, etc)
  • startingValueFile is the name of an input file containing starting point values from the previous pass.
  • LMAX=N gives the maximum order of the spherical harmonics fit in the program.
It's worth noting that the script only runs SIMPLEX, which does not calculate or record the error matrix in the output. To obtain an error matrix--you should change SIMPLEX to something like MIGRAD or MINIMIZE.

We have, additionally, prepared already several files as discussed in this section: They are in ~boudreau/public/SINGLETOP/EFFICIENCY. All of these have been minimized with SIMPLEX using the protos data samples at the standard model input point. The string "L[2-6]" part of the filename indicates how many spherical harmonics have been used, ie all of those up to the maximum L value. To continue with the tutorial using these files as input, you will need to install them in the proper directory and rename them according to the instructions given below.

eff11c.2Jet.SM.sig.el.L2-S.root eff11c.3Jet.SM.sig.el.L2-S.root
eff11c.2Jet.SM.sig.el.L3-S.root eff11c.3Jet.SM.sig.el.L3-S.root
eff11c.2Jet.SM.sig.el.L4-S.root eff11c.3Jet.SM.sig.el.L4-S.root
eff11c.2Jet.SM.sig.el.L5-S.root eff11c.3Jet.SM.sig.el.L5-S.root
eff11c.2Jet.SM.sig.el.L6-S.root eff11c.3Jet.SM.sig.el.L6-S.root
eff11c.2Jet.SM.sig.mu.L2-S.root eff11c.3Jet.SM.sig.mu.L2-S.root
eff11c.2Jet.SM.sig.mu.L3-S.root eff11c.3Jet.SM.sig.mu.L3-S.root
eff11c.2Jet.SM.sig.mu.L4-S.root eff11c.3Jet.SM.sig.mu.L4-S.root
eff11c.2Jet.SM.sig.mu.L5-S.root eff11c.3Jet.SM.sig.mu.L5-S.root
eff11c.2Jet.SM.sig.mu.L6-S.root eff11c.3Jet.SM.sig.mu.L6-S.root

The program stp3Deff.exe

The program stp3deff.exe can be used to visualize the efficiency function. It plots the efficiency as a funtion of orientation (two angles) both jointly and in projection, and it can also be used to co-display the efficiency data with the curves after a run of stefficiency.exe. If you are working remotely your connection needs to allow X-windows traffic. Here are three ways to run it.

stp3Deff.exe LMAX=value

In this mode (i.e. taking one integer argument) the program will let you visualize efficiency curves. You can interactively edit the parameters in the "edit" command.

stp3Deff.exe -s startingValueFile

In this mode, the program reads a root file (normally the output of the stdefficiency.exe) and obtains an efficiency curve from the fit results stored in that file.

stp3Deff.exe -s startingValueFile -i inputFile

In this mode the program takes data from an inputFile a "supermini" ntuple) and plots efficiencies; while taking the shape of the fit curve from the startingValueFile.

VI Determination of the resolution function.

In order to determine the resolution function, you must have already produced the supermini ntuples and you must have also produced a description of the efficiency files. There is a script to extract resolution coefficients--that script works with files having standardized names. The supermini files (recall) are called mc11c-2Jet.sig.el.root, mc11c-2Jet.sig.mu.root, etc, and live in the top of the test release area. The efficiency files used as input are:


and should live in the Pittsburgh/sw/STEFFICIENCY area. To be ready to run resolution fits--put yourself in the Pittsburgh/sw/STRESOLUTION area.


OK, then. Type the following:


Plots will flash by. You can leaf through the plots one by one by hitting the "Next" button or just typing the N-key.

Now, in fact, the script just runs a program (stresolution.exe) over a set of input files (2 jets, 3 jets, muons, electrons) and for different LMAX values. You can run this program yourself if you like to do things more manually.

The program stresolution.exe

The program stresolution.exe (which is run within the script) can be invoked by hand and provides a lot of flexibility. The syntax is

stresolution.exe pluginName1 pluginName2 -i inputFile [-e efficiencyInput] [LMAX=N/default=4] -o outputFile [-v]


  • pluginName is the name of the plugin (from STPLUGINS) that does all the actual work.
  • inputFile is the input file (a supermini ntuple file)
  • efficiencyInput is a file containing efficiency coefficients (from the efficiency step).
  • LMAX=N gives the maximum order of the spherical harmonics fit in the program.
  • the -v flag turns on verbose output (from minuit)

Some sample resolution coefficient files are available. They are in ~boudreau/public/SINGLETOP/RESOLUTION. They use the the protos data samples at the standard model input point, and take the L=5 efficiency determination in carrying out the efficiency fit. The string "L[4-7]" part of the filename indicates the order of the maximum Legendre polynomial used in the fit.

The files are:

res11c-3Jet.sig.mu-L7.root res11c-3Jet.sig.mu-L4.root res11c-3Jet.sig.el-L5.root res11c-2Jet.sig.mu-L6.root res11c-2Jet.sig.el-L7.root res11c-2Jet.sig.el-L4.root
res11c-3Jet.sig.mu-L6.root res11c-3Jet.sig.el-L7.root res11c-3Jet.sig.el-L4.root res11c-2Jet.sig.mu-L5.root res11c-2Jet.sig.el-L6.root
res11c-3Jet.sig.mu-L5.root res11c-3Jet.sig.el-L6.root res11c-2Jet.sig.mu-L7.root res11c-2Jet.sig.mu-L4.root res11c-2Jet.sig.el-L5.root

VII. Preparation of background ntuples:

From Carlos's private-format ntuples FOR THE SIGNAL make a supermini ntuple.(Note there are two varieties of these ntuples, one which is Tsar'd byCarlos and one which is Tsar'd by Kevin. In this section, we use Carlos's, while waiting for a format merger). These input files are located in


You need to get these files out of EOS and copy them to your machine. In this section we describe how to take these files and turn them into "supermini" ntuples. The procedure uses a script (Pittsburgh/sw/SUPERMINI/execAtlas.sh). This script looks for background inputs in the area /atlasData/BACKGROUND/, so you need to either create this area or modify the script, pointing it to some other directory containing the background ntuples.

The files in /eos/atlas/user/c/cescobar/top/ntuples/5fb_r17_SGTOP/ contain

  • data inputs
  • mc inputs for signal
  • mc inputs for background
  • data inputs for background
We need to run over the latter two, meaning JetElectron _QCD.[el,mu].root and all of the files mc11_7TeV.*.root, except the signal file mc11_7TeV.11736[0-2].st_tchan_[mu,el,tau]_AcerMC.[mu,el].root. So collect these into /atlasData/BACKGROUND.

Then, run SUPERMINI/execAtlas.sh. It will create for you four files called:

  • mc11c-2Jet.bkg.el.root
  • mc11c-2Jet.bkg.mu.root
  • mc11c-3Jet.bkg.el.root
  • mc11c-3Jet.bkg.mu.root

Some sampes can be found it ~boudreau/public/SINGLETOP/SUPERMINI.

VI Determination of the background shape

The background shape is determined using a program called stbackground.exe, whose source is in Pittsburgh/sw/STBACKGROUND. In the same directory you will find a script called execAtlas.sh which runs this program on data--the data consisting of the four files created according to the instructions in the previous section.

You should:

  • Go to Pittsburgh/sw/STBACKGROUND
  • Look over the script. You will see that it is looking for for input files in the area Pittsburgh/sw/SUPERMINI. So, insure that those files are present, (or if you put them somewhere else you will need to modify the script).
  • ./execAtlas.sh
For each of the four input types (electron/2Jet, muon/2Jet, electron/3Jet, muon 3Jet) the fits are run first with L=1 and then with L=2, L=3, etc. (At each stage the starting point is taken from the previous stage). (Note, by L=7, MINUITS parameter space limit of 100 is exceeded. So don't go that high! Or if you must let me know so I can make a compile-time change to allow for this).

For your information

For your information, the program stbackground.exe uses a plugin. The plugin, which does most of the work, can be found in /sw/STPLUGINS/STBACKGROUND. You can modify that if you need to change or experiment with the algorithms. To build, go into STPLUGINS/cmt and type

cmt generatestplugins

The program stbackground.exe

The program stbackground.exe is invoked like this:

stbackground.exe [-s StartingParameters.root] -o Output.root -p ProcessDB.root [-v] [-c minuitcommand] [LMAX=value] [-x Plugin1] [-x Plugin2] Input1 Input2 Input3 ...

As usual, convergence can be a problem with MINUIT, and if you you can use this program by hand to try to coax the fit to convergence. The program lets you run a fit using the results of a previous fit as input (with the -s flag) and to change the MINUIT command (with the -c) flag. The plugin architecture lets you make a new plugin in order to test a change--without breaking the existing plugin. The commands that are accepted are the usual MINUIT commands, i.e. SIMPLEX, MIGRAD, MINOS, MINIMIZE.

The program detects the number of CPUs and divides up the calculation across all of the CPUs.

stp3Dbkg.exe: viewing the results of the background shape determination after the fit has run.

After the fit has run you may wish to view the results again. This can be done with a program called stp3Dbkg.exe. The syntax is

stp3Dbkg.exe -i InputFile -s BkgFitFile

Where the first argument (given by -i) is the input to the fit and the second argument (given by -s) is the output from the fit. This procedure lets you see the same plots (1D and 2D) as during the background fit. Also, it labels the plots. When you select "Print" from the file menu (or type "p" key), it will save the plot to a .png file.

You scan your directory for fits and plot them all, one after another, with the script plotBkgtlas.sh. This is the easiest way to obtain a set of plots for the note. As you open the files, toggle through all of the windows (theta-phi, theta, and phi) and print each window. The script automatically renames them, giving them names corresponding to what is in the latex of the accompanying note.

Edit | Attach | Watch | Print version | History: r17 < r16 < r15 < r14 < r13 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r17 - 2020-08-31 - TWikiAdminUser
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Sandbox/SandboxArchive All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2023 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