How to run MC_exam
Updated :April 2003 Major cleaning and added chapter H in
complement of Chapter G for MC testing
This file can be found on /dist/packages/mc_exam/devel/doc/mc_exam.html
This is a description on how to run the histogram/Ntuple/Root-tuple maker.
In case of problems/suggestions contact: Laurent Duflot
and Armand Zylberstejn and Sarah Eno
A-Introduction
B-Description of the packages
C-Building a working directory and getting the files
D-Important warning using mc_exam
E-Running the executable
F-Description of rcp files
G-Using the code: a few examples
H-More examples: how to run the code to test MC
production
I-Liste of macros to run the jobs and analyze the root-tuples
J-Use the macros to run the jobs and analyze the root-tuples
K-Brief instructions to run and analyze a sim type file (written by Sarah- July 2003)
MC_exam , an histogram, ntuple or root-tuple
maker was written before most analyse packages were written. It
was first designed to analyse and/or reconstruct data coming from
D0gstar.
Informations about HITS, DIGI and clusters for
most subdetectors:SMT, CFT, CAL (DIGI only), CPS, FPS and MUON as well
as informations on the generated particles were written in the
histograms or Ntuple/Rootuple.
Later on, blocks corresponding to reconstructed
quantities (clusters in all the detectors, tracks) were added. In
addition, the MCexam_x executable was compiled with em_analyze,
jet_analyze, MuoIdAnalyze, VertexAnalysis_data allowing to get in the
same Ntuples the blocks defined in these packages.
Since the d0reco package has somewhat stabilized
since the early times when MC_exam was written, the reco
part of MC_exam is deprecated, although still doable.
As of release t01.22.00 the old package MC_exam
has been split in 3 different packages: Sim_exam, Reco_exam and MC_exam.
Later on, the part for generated particles was put in a separate
package: gene_exam.
Since January 2003 (release p13.04.00) MC_exam
as well as Sim_Exam and Reco_exam are not part of the releases and the
devel versions have to be used.
What can be done in each of the package is driven by its
own two rcp files: framework.rcp and XX_exam.rcp
In each package the quantities entering in the plots may be
re-built using the appropriate keys in framework.rcp
Plots/Ntuple for quantities defined at the simulation (MC ) and/or digi level (MC and data) for all detectors. Some relevant quantities can be rebuilt
Plotted quantities:
Hits : x,y,z,px,py,pz,dE/dx
Digits : channel address, ADC
Generated particles and vertices (plot in package gene_exam)
Functionnalities
Hits cannot be rebuilt
Digits can be rebuilt after dropping the relevant chunks before being plotted
No reconstructed quantities (clusters, objects) can be plotted or rebuilt
Plotted quantities:
Clusters
Jets (using jet_analyze)
Tracks
Generated particles and vertices
EM- object (using em_analyze)
Functionnalitie:
Hits or digi cannot be rebuilt nor plotted;
Clusters, jets, em objects can be rebuilt after dropping the relevant chunks prior to be plotted.
Hits
Plotted quantities:
Digits
Generated particles and vertices
Clusters
Jets (obsolete, replaced by call to jet_analyze)
Tracks
Functionnalities
Hits cannot be rebuilt;
Digits can be rebuilt after dropping the relevant chunks before being plotted;
clusters, jets, em objects can be rebuilt after dropping the relevant chunks prior to be plotted
What a package does is controlled by the list of packages given in its
own framework.rcp. The list of packages called is described below and
may be modified by the user at execution time
Reco_exam and MC_exam are linked with d0reco and included
are the Ntuples made by some analysis packages: em_analyze,
jet_analyze, MuoIdAnalyze, VertexAnalysis_data
As these packages rely on most of the offline packages to compile and
run smoothly, it sometimes happens (as for d0reco) that the xx_exam
version on a given release is broken. Please have a look at the mc_exam
news page for indications on which versions of xx_exam work with which
release and for new features of the packages
Setting up a working directory (assuming one does not exist already)
cd working_dir (your working directory)
setup D0RunII <release version> (for now on and for clarity we will use t01.30.0 as example)
newrel -t t01.30.00 mcexm (mcexm is an arbitrary name) cd mcexm
d0setwa
or
mkdir -p reco_exam/rcpmkdir -p mc_exam/rcp mc_exam/bin
cd mc_exam/rcp
cp $D0RUNII_DIR/mc_exam/rcp/*.rcp .
cd ../bin
$D0RUNII_DIR/mc_exam/bin/only_once.csh
$D0RUNII_DIR/mc_exam/bin/make_link.csh
rm Analyze.x
ln -sf $D0RUNII_DIR/bin/$SRT_SUBDIR/MCexam_x Analyze.x
cp $D0RUNII_DIR/mc_exam/bin/*.list .
Now we have made a working directory to be used by the D0 framework,
setup the rcp database. Then links to the XXexam_x executable has been
made as well as other links needed to run mc_exam on sim files (i.e.
calling the reco packages). We have created a local/rcp directory to
hold the rcp script that we may modify. The framework control rcp has
been copied to the working
directory.
We assume
that the user is in mcexm
In the
following, xx stands for reco, sim or mc
setup d0cvsFor releases containing mc_exam you can run the packages individually; you type: addpkg [-h] xx_exam
[ -h] is optional for release < p14.01 (Jan 2003) and compulsory above, not using it makes you retrieve the version associated with the release <release version> if it exists
cd xx_exam/bin
only_once.csh
make_link.csh
For releases not containing mc_exam you must "addpkg" all the packages:addpkg -h gene_exam
Then you have to link some files in the packages this is done using the 2 script files: only_once.csh and make_link.csh that are found in the directories xx_exam/bin
addpkg -h sim_exam
addpkg -h reco_exam
addpkg -h mc_exam
addpkg -h trig_exam
cd sim_exam/bin
if you want to change anything in the histograms or ntuple for dectector DET , yyy (Where DET is a detector name and yyy is hit, clus or dig)..
only_once.csh
make_link.csh
cd reco_exam/bin
only_once.csh
make_link.csh
cd mc_exam/bin
only_once.csh
make_link.csh
edit the files mcexm /sim_exam/Exam_DET_yyy.hpp and mcexm/sim_exam/src/Exam_DET_yyy.cpp mcexm/Reco_exam/Exam_DET_yyy.hpp and mcexm/reco_exam/src/Exam_DET_yyy.cp
MC_exam.rcp is there for compatibility
with the framework. The control parameters for the package are actually
Sim_exam.rcp and Reco_exam.rcp. We highly recommend, if you want
to have the control of what exactly goes on the Ntuple, to change
in ../rcp/framework.rcp
RCP sim_exam = <sim_exam Sim_exam>
to
RCP sim_exam = <mc_exam Sim_exam>
RCP reco_exam = <reco_exam
Reco_exam>
RCP reco_exam = <mc_exam Reco_exam>
//------------------------------
// SMT
//------------------------------
int Xsmt_clus =1
float Emin_SMT_clus = 0.0
int Nmax_SMT_Barrel_clus =100
int Nmax_SMT_Disk_clus =100
//------------------------------
// SFT
//------------------------------
int Xsft_clus =1
float Emin_SFT_clus = 0.0
int Nmax_SFT_clus =100
//-------------------------------------------------
// reconstructed vertices
//-------------------------------------------------
int Xvertex =0
int Nmax_vert_reco=200
//------------------------------------------------
// reconstructed tracks
//-------------------------------------------------
int Tracking =1
int Nmax_tra =200 //maximum nb. of recontructed track
float Track_min_Pt=1.
//select type of reconstructed tracks (0 = all)
//reconstructed track ID
// ID = 101 CFT only (central and overlap)
// ID = 111 central CFT only -no SMT
// ID = 121 is overlap CFT only- no SMT
// ID = 201 is for central and overlap CFT tracks extended into the
SMT.
// ID = 301 SMT only
// ID = 401 tracks in all eta SFT+SMT
int Track_Type = 401
int Errors =0 //write error matrix in block TRACK, kept for back
compatibility
string error_dca ="none"// error on the track at the DCA
//choices are "diag" "full ,"none"
string error_last ="none"// errors on the track at last chosen plane
// choices are "diag" "full ,"none"
//---------------------------------
// etmiss
//---------------------------------
int Xetmiss =1
int Nmax_Etmiss =1
float Emin_Etmiss=1.
The main keys are:
geo read ->standard: do not touch
drop chunks (check DropEvent.rcp to check if it corresponds to what you want)
smt1b smt1d smt2b smt2d smt3b smt3d smt4b smt4d -> perform SMT clusters reconstruction
cft1 cps1 fps1 -> CFT, CPS and FPS: perform digitization
cft2 cps2 fps2-> CFT, CPS and FPS: perform clusterization
gtr-> perform reconstruction of tracks .
vtxpv1 vtxsv1 vtxpv2 vtxsv2 -> primary and secondary vertex reconstruction and filtering
cal0 scone EMnn cone kt ktkine -> different jet algorithms
em ->emreco
met -> missing Et
ntplmgr -> use global Ntuple (recommended)
sim_exam, reco_exam -> build histos and/or root/ntuples using sim_exam, reco_exam
em_ana ->put in Ntuple blocks for em-id
ntplmgr: allows to put in the same Ntuple, blocks coming from various packages (recommended) .
Do not use if histo option is chosen in XX_exam.rcp (int Do_Histo =1) //turn histo off/on)
Remark:To look at digit's for data is more complicated since we need to unpack the raw data chunk
The way to do it is not described in this document.Reco_exam:
to plot rconstructed quantities (clusters) and some physics objects
Although reco_exam has all the functionalities of d0reco (drop and rebuld digi chunks, drop and reconstruct physics objects,...), and some from d0reco_analyze we refer the reader to the proper doc for this part.
cd /mcexm/reco_exam/rcp
Plot reconstructed quantities :
edit Reco_exam.rcp
As above set to 1 (0) the key associated the detector you do (not) want to examine,
for Ntuple/Roottuple: modify threshold values, modify max. number of objects in each block
For instance, let's assume that we no not want the clusters information of the SMT and FPS on the Ntuple:
int Xsmt_clus =0
int Xsft_clus =0
Edit framework.rcp .
Re-do the tracking
string Packages = "geo read mcsetlinks reco_exam".
Don't forget to change the references to Reco_exam.rcp and ReadEvent.rcp to :local Reco_exam and ReadEvent
Do not use ntplmgr if histo option is chosen in Reco_exam.rcp
Edit DropChunks.rcp (which you have copied in directory local)
string DropChunks = "GTrackChunk "
Edit framework.rcp .
string Packages = "geo read mcsetlinks gtr reco_exam".
MC_exam
You can mix at will all the options you have in the previous 2 packages simulation
and reconstruction: you can plot and/or rebuild any chunk you want (except KINE and digi).
You have to adjust local/framework.rcp (or mc_exam/rcp/framework.rcp) and/or local/Reco_exam.rcp
(or mc_exam/rcp/Reco_exam.rcp) and/or local/Sim_exam.rcp
(or mc_exam/rcp/Sim_exam.rcp).You may add jetreco,emreco,em_analyze,? H-More examples: how to run the code to test MC production
In this chapter we give some recipes to run mc_exam to check MC production and analyze the root_tuples that are produced.
The following scripts in mc_exam/macros are used. They are copied in each of the xxx_exam/bin directory copied in each of the xxx_exam/bin directory
create_proj.csh: create sam project
run_job.csh : create script to run with no sam
run_sam.csh : create script to run with sam
run_sam_all.csh will submit anal-sim,anal-dig and anal-rec for a given project (that the macro will ask for)
global submission: must be done in working directory( mcexm in our case)
These scripts use the following templates:
you need to define in your working directory a file containing the names of the project you want to analyze without its extension (sim, rec or dig)
for instance you define file "single_p14_03-input"
single_mu_50_p140301
sub_sam_dig will analyze the projects xxx_dig xxx_dig
single_mu_10_p140301
single_e_10_p140301
single_e_100_p1403
sub_sam_fullwill analyze the projects xxx_dig, xxx_sim and xxx_rec
sub_sam_rec xxx_rec
sub_sam_sim xxx_sim
Exemple of global submission :
sub_sam_dig
you are asked : define input file ?
answer single_p14_03-input this will produce root-tuples for projects:
single_mu_50_p140301_dig
single_mu_10_p140301_dig
single_e_10_p140301_dig
single_e_100_p1403_dig
templ_ReadEvent
From now on let's assume you are in mcexm
templ_create_proj
templ_rootMgr
templ_run_sam
- Preliminary steps:
The first time you have to get the packages, make the executables and get some files for constants.
If you do not have a working directory follow the procedures in chapter C
addpkg -h mc_exam
and then run the job in the appropriate directory: sim_exam/bin for generated files ("d0g" type) and/or simulated file ("sim" type)
cd mc_exam/macros
Util.csh : this will addpkg the packages you need, make the libraries, make the executables (this may take some time) and get the appropriate files for constants
d0setwa,
- Subsequent times:
d0setwa,
- Running the job using SAM
if project does not exist check for request ID in certification samples in:
http://www-d0.fnal.gov/computing/mcprod/mcc.html
and use this number to create the project using: create_proj.csh
cd xxx_exam/bin (assuming you are in directory mcexm)
to run on d0g data and/or sim: cd sim_exam/bin
to run on dst:
cd reco_exam/bin
run_sam.csh and answer the questions- Running the job with no SAM
(file(s) on disk (or on sam cache disk))
to run on d0g data and/or sim:
cd sim_exam/bin
to run on dst:
cd reco_exam/bin run_job.csh and answer the questions
I-Liste of macros
to run the jobs and analyze the root-tuples macros are found in:
d0dist-d0dist-d0dist-dist-packages-mc_exam-devel-macros;
running the root_tuples makers
Util.csh
analysis of the root_tuple
anal_dig.C
anal_dig.h
anal_rec.C
anal_rec.h
anal_sim.C
anal_sim.h
create_proj.csh
run_job.csh
run_sam.csh
templ_ReadEvent
templ_run
templ_run_sam
Makefile_alpha_dig
Makefile_alpha_rec
Makefile_alpha_sim
Makefile_linux_sim
Makefile_sgi_rec
histo_dig.h
histo_rec.h
histo_sim.h
main_dig.C
main_rec.C
main_sim.C
make_ps.csh
templ_create_proj
templ_histo_dig.h
templ_main_dig.C
templ_main_rec
templ_main_sim
templ_rootMgr
J-Use the macros to run the jobs and analyze the root-tuples
K-Brief instructions to run and analyze a sim type file
When using macros to analyze root-tuples produced by mc-exam (or satellites) there is a makefile which requests the gcc compiler when on a linux machine. On clued0 the automated procedure works for release p15 and above but does not work for p14. The correction has to be made by hand.
setup D0RunII p14.03.01
setup d0cvs
newrel -t p14.03.01 lala
cd lala <
d0setwa
setup mc_runjob
addpkg -h mc_exam
cd mc_exam/macros
./Util.csh (ignore all the error messages)
wait a long time until the following exe's appear in ../../bin/Linux2.4-KCC_4_0/
MCexam_x, Recoexam_x, Simexam_x
cd ../../sim_exam/bin
ln -s ../../d0g-dest/d0gstar/d0g(hit tab key) inputfile
edit run_job.csh and comment out the "set echo" lines and the last two lines
source run_job.csh
it will ask for inputs. give it the current directory (which it echos for you)
inputfile
sim
0
./Analyze.x -rcp frame_sim.rcp
source make_cl.csh
it will ask for inputs. give it
inputfile_sim.root
sim
source make_ps.csh
ignore errors
for P14 and below.. not for p15 and above
edit Makefile
make active: //ARCH =linuxkcc removing the //)
delete: ARCH=Linux
gmake This creates the executable anal_sim.x
anal_sim.x "path" "root_tuple_file" this creates 2 files :
"root_tuple_file".ps which is the old visualization of the histos and hist_"root_tuple_file".root which is a root-tuple file that contains the histos.