LPC Computing
Step 2: Event generation on the farm with CMKIN
Make sure that you followed the steps explained in the previous 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
You will need to login the first time using cvs login and password: 98passwd
cvs co -r CMKIN_2_1_0 -d CMKIN_2_1_0 CMKIN
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)
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_jj_cmkin.jdf 8 10000 100
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 10001 to 10008.
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
set i=10001
while ($i < 10009)
dccp $PNFS_PATH/${i}/zprime_jj_${i}.root .
@ 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.
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_jj_10001.root");
root [1] f->ls();
TFile** zprime_jj_10001.root HBOOK file: zprime_jj_10001.ntpl converted to ROOT
TFile* zprime_jj_10001.root HBOOK file: zprime_jj_10001.ntpl converted to ROOT
KEY: TTree h101;1 HEPEVT
root [2] h101->MakeClass();
Info in <TTreePlayer::MakeClass>: Files: h101.h and h101.C generated from Tree:
h101
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_jj_10001.root");
h101.Add("zprime_jj_10002.root");
h101.Add("zprime_jj_10003.root");
h101.Add("zprime_jj_10004.root");
h101.Add("zprime_jj_10005.root");
h101.Add("zprime_jj_10006.root");
h101.Add("zprime_jj_10007.root");
h101.Add("zprime_jj_10008.root");
h101.MakeClass();
