Instructions for making the Tutorial plots

Installing the Software

If you are using a personal laptop for your analysis, or connecting remotely to a desktop, then please follow the InstallationDirections .

Building the Executable

cd to the location of the software at hcpss/packages

cd to the location of the executables at executables

Type make BASE=wjets to make the executable wjets.exe

Type wjets.exe . On the terminal, you should see the output

Usage: wjets.exe file.config file.root
The file is fine, except that ranges of the histograms are not ideal for the datasets you will be analyzing. To see output identical to that on the webpage, you should download the NewVersion, called "".

You make the executable by typing make BASE=wjets_pretty to produce the executable wjets_pretty.exe. Use this executable in the following.

Preparing to Run: the config file

In your favorite text editor, open the file Process.config, which should look something like:

# Nr of Events to be read
nevents                         100000

# The histograms will be saved into File
OutputFileName                  pythial.root

# use the following input files for the reader
# several may be specified
InputFileNames                  sample1.input
InputFileNames                  sample2.input

# enable Analysis to be performed
dijet_analysis                  false
z_analysis                      false
wplusjet_analysis               true
tau_analysis                    false
top_analysis                    false
ue_analysis                     false
etmiss_analysis                 false
elasScat_analysis               false
user_analysis                   false

# set Jet parameter
jet_coneRadius                  0.4
jet_overlapThreshold            0.75
jet_ptmin                       15.0
lepton_ptmin                    15.0
DeltaR_lepton_track             0.4
max_eta                         2.5 # cut on tracks for jet finder
min_pt                          0.5 # cut on tracks for jet finder

The key variables for you to recognize are:

  1. The number of events. If time is a factor, you can make this number smaller.
  2. The name of the output file, here pythial.root. This name is arbitrary.
  3. The "analysis" variables should not be changed. We have only enabled the "wplusjet_analysis" code.
  4. For the sake of the tutorial, you should not change the jet parameters. However, if you understand what they mean, you are free to play with them. To find out what they mean, search in google for "FastJet", then find the explanation of the "SIScone" algorithm from those links.

Preparing to Run: accessing the root file

The executable is meant to open a Monte Carlo file, access the HepMC product (containing generator level information), and fill some histograms subject to certain rules. Besides the fact that the code uses some of the "Monte Carlo truth" information, this exercise is very much like analyzing real data.

We have prepared some "root" files from different Monte Carlo tools.

You can access them in one of three ways.

  1. Preferred

    The files are located at You can access them using your browser or wget, for example.

  2. If you are on a "FNAL-kerberized" machine (one of the school laptops; or a personal laptop or remote desktop where you have a FNAL kerberos principal), you may access these files using ftp via:

    ftp 24127
    (type in username, or use default)
    >cd HCPSS
    >get filename
  3. Otherwise, try using the weak ftp back-door. You will have to ask for the PASSWORD.

    ftp 24126
    >Name: patriot
    >Password: *PASSWORD*
    >cd HCPSS
    >get filename

You can place these root files "anywhere" convenient on your computer. If they are not in the same directory as the "wjets.exe" executable, then you need to specify the path to the file. For example, if you placed them in the directory /tmp/rootfiles, you would identify the file by /tmp/rootfiles/myfile.root.

Running the executable

Now you have the pieces necessary to run the executable. If you config file is names "Process.config" (with the output file named "myoutput.root") and your root file is named "myfile.root", then type:

wjets.exe Process.config myfile.root

This will print out a message every 50 events, and produce the output file "myoutput.root".

Once this has completed successfully, you will want to run again with another Monte Carlo file ("myfile.root" in the first run) and edit "Process.config" to name the second output file.

Now you have two "analysis" files to compare.

Making the comparisons

The code to perform the comparison and make a webpage is located at HCPSScode.

Either download this code through your web browser, or a utility such as wget.

Choose a convenient working area.

cd myworkarea
tar xf HCPSSmacros.tar
cd macros

Follow the instructions "README", except I recommend running root in batch mode, i.e. root.exe -b -q plot.C

If the name of your "web" page was "TEST1", then you can use your web browser to view the file "TEST1_WplusJet".

Tutorial 0

Get the following Monte Carlo root files:

  • hepmc_00l.root (a Pythia file)
  • hepmc_01.root (a MadGraph+Pythia file)

Follow the above steps using these as the argument of "wjets.exe", i.e.

  1. Edit "Process.config" and choose a name for the output root file.
  2. wjets.exe Process.config hepmc_00l.root
  3. Edit "Process.config" and choose a different name for the output root file.
  4. wjets.exe Process.config hepmc_01.root
  5. Edit plotFiles.list in the "macros" directory, and run the comparison.
  6. View in the browser.

What if plot.C does not work?

Perform the following steps:

.L plot.C+

Tutorial 1

For this exercise, you need to modify the executable to access only events with a W+ boson for comparison with the Pythia analysis file produced in Tutorial 0 (note, you do not need to remake the file based on W+ and W- bosons, since we are only changing which events are analyzed, not how they are analyzed).

Instead of editing the code used in the previous step, we encourage you to make a copy, and edit the new version. For example, you would perform the following steps:

make BASE=wjets_tutorial1
wjets_tutorial1.exe Process.config myfile.root

If you "uncomment" (i.e. edit out the "//") the code in the correct place, you will get the desired behavior:

         // cheap way to select on W+
         if( pid != 24 )
            wMinus = true;
//       break;


//      if (wMinus) continue;

You complete the tutorial by comparing the original Pythia analysis file (W+ and W-) with the new analysis file (W+ only).

Tutorial 2

For this exercise, you will continue using the "W+ only" version of wjets.exe (called wjets_tutorial1.exe above).

The comparison is made to an analysis file generated from the PowHeg datafile which includes on W+, named hepmc_03p.root.

You complete the tutorial by comparing the W+ only Pythia analysis file to the PowHeg analysis file.

Tutorial 3

For this exercise, you will need a "W+ only" version of Pythia using CTEQ6M, instead of the original CTEQ6L version.

The comparison is made to an analysis file generated from the CTEQ6M version of Pythia, named hepmc_00m.root.

Tutorial 4

For this exercise, you will need to another modification on the analysis code. Therefore, you should copy and modify the code again.

(edit so that pT(W)>15 GeV)
make BASE=wjets_tutorial4
wjets_tutorial4.exe Process.config myfile.root

You will also need to make two new analysis files, one from the Pythia (CTEQ6L) dataset hepmc_00l.root and another from the MCFM W+1jet NLO dataset hepmc_mcfmw1.root. You will want to increase the number of events read from the MCFM file -- it contains about 1.2M weighted events.

Dumping out HepMC Records

A utility function is provided to print out (or dump) the HepMC record of a Monte Carlo dataset to the terminal. This may be useful for understanding the analysis or writing your own.

The current version must be modified before it works! You should change the ROOT tree name "mctruth" to "genjets/mctruth".

make BASE=printHepMCEvent
printHepMCEvent.exe mydataset.root

This produces a file named "IO_GenEvent.dat", showing an ascii representation of the HepMC record. It is perhaps more revealing to use the HepMC print method to visualize the Monte Carlo truth. This is accomplished by the following edit:

event = new HepMC::GenEvent;
ascii_out << event;
event->print();  // new line to use HepMC print method