Search
uscms.org  uscms.fnal.gov  www 

LPC Computing

Step 3: Event Generation on the Farm with CMKIN

Make sure that you followed the steps explained in the General Setup section. The cmkin version we are using is 2_1_0. To build an executable first change to the test area that we set up then do the following steps 

cd $TOP

cmscvsroot  CMKIN
cvs co -r CMKIN_2_1_0 -d CMKIN_2_1_0 CMKIN

Note the first time you access the CVS repository you have to login:

cvs login

when asked for the password type

98passwd

cd CMKIN_2_1_0/examples/make_ntpl_jobs/
setenv SCRATCH $PWD
project CMKIN  CMKIN_2_1_0
kine_make_ntpl_pyt.com

Will create kine_make_ntpl_pyt6220.exe which is basically a pythia executable with the difference that

- it has an interface to change the generator parameters without recompiling.
- the output of the results is in form of hepevt ntuples.

In addition there are also the scripts:

kine_make_ntpl_compHEP.com
kine_make_ntpl_isa.com
kine_make_ntpl_hwg.com 
kine_make_ntpl_pyt.com

which create executables for different event generators (ISAJET, HERWIG, COMPHEP, PYTHIA ...) Now we are ready to produce some Monte Carlo data using the scripts we created in the previous section. 

Now we are ready to submit our job into the queue. The following command will request 8 simultaneous processes, the run numbers of the created files will start at  10000, we request 100 events per process.

cd $SCRIPTS
setup kerberos
setup fbsng
fbs submit zprime_mumu_cmkin.jdf 8 10000 5

The Batch system should respond:

Farm Job <xxxx> has been submitted...

You can check the status of your batch ob by issuing the

fbs status <xxxx>

command. This job should finish pretty quickly and you should receive email from the batch system to the mail adress that you specified in the when issuing the setup.pl command in the previous section. If everything went ok it should say

Exit Code:0

and you should find the ntpl and root files in dcache in the pnfs directory created in the previous section.

ls ${PNFS_PATH}/<runnumber>

In this case the run numbers would be 10000 to 10007. If you didn't change anything in the .jdf file all the error and output messages of all your processed can be found in:

/storage/data/fbs-logs

You can list them by typing:

ls /storage/data/fbs-logs/FBS_<xxxx>*

We want to use root to analyze the data that we produced. In this simple example we calculate the invariant mass, of the dimuon and create pt and rapidity distributions. First copy the .root file out of dcache and setup the root environment (use the same root version as used by ORCA).

cd $ANALYSIS
foreach i ($PNFS_PATH/rootfiles/*)
dccp $i .
end

ROOT is used by ORCA therefore it is setup with the ORCA runtime environment. To set this up:

scram list ORCA
cd /afs/fnal.gov/files/code/cms/l/Releases/ORCA/ORCA_7_6_0
eval `scram runtime -csh`
cd -

Or, you may run source ${TOP}/setup_root.csh

Then start ROOT and execute the provided cint macros:

root
root [0] .L h101.C
root [1] .x plot.C
root [2]

will produce the plots below. The first row shows the invariant mass and pt distribution of the Z'. row 2 and 3 show the pt, rapidity and pseudo rapidity distribution of the mu+ and mu- respectively. Note the plots were obtained from a previous run with more statistics than in the example files.


(Click image for larger version)

To speed up the execution time of your macros you might want to compile the script (using the root ACLiC compiler). In addition to speed, the advantage of using ACLiC is that the syntax of the script is checked by the compiler. Many bugs and non-standard C++ syntax that Cint accepts will be caught that way and it will be easier to convert the script to a C++ program later on. The ROOT interpreter allows a syntax which is not compliant to C++ and should be avoided.

To do that use the following syntax:

root
root [0] .L h101.C+
root [1] .x plot.C+
root [2]

To create h101.C and h101.h I used the root MakeClass() function and then added the histograms to be filled in the loop. If you want to create your own class here is how it is done:

Following the procedure below the following files are produced: h101.h and h101.C The generated code in h101.h includes the following:

- Identification of the original Tree and Input file name
- Definition of analysis class (data and functions)
- the following class functions:

- constructor (connecting by default the Tree file)
- GetEntry(Int_t entry)
- Init(TTree *tree) to initialize a new TTree
- Show(Int_t entry) to read and Dump entry
- Loop() loops over all entries, this is the place where you want to add your analysis

For more information visit the ROOT site: http://root.cern.ch/

Below is an example of how to use MakeClass for one input file:

root [0] TFile *f = new TFile("zprime_mumu_10000.root");
root [1] f->ls();
TFile** zprime_mumu_10000.root HBOOK file: zprime_mumu_10000.ntpl converted to ROOT
TFile* zprime_mumu_10000.root HBOOK file: zprime_mumu_10000.ntpl converted to ROOT
KEY: TTree h101;1 HEPEVT

Similarly, if you want to analyze several files simultaneously you can chain them together and then create the classes for the chain (in this case the first 10) in the following way:

root

TChain h101("h101");
h101.Add("zprime_mumu_10000.root");
h101.Add("zprime_mumu_10001.root");
h101.Add("zprime_mumu_10002.root");
h101.Add("zprime_mumu_10003.root");
h101.Add("zprime_mumu_10004.root");
h101.Add("zprime_mumu_10005.root");
h101.Add("zprime_mumu_10006.root");
h101.Add("zprime_mumu_10007.root");
h101.MakeClass();

Continue to Next Step


  1. General setup
  2. Available data sets in DST format
  3. Event generation on the farm with CMKIN (Pythia), Analysis of the generator level output.
  4. Simulate the events with OSCAR.
  5. Digitize with ORCA and produce DST's
  6. Run a muon ROOT Tree maker looking at the DST and make some simple plots
Webmaster | Last modified: Wednesday, 09-Jan-2008 14:52:26 CST