Difference between revisions of "Generating Higgs To 4 Muons at NIKHEF"

From Atlas Wiki
Jump to navigation Jump to search
 
(60 intermediate revisions by the same user not shown)
Line 1: Line 1:
This page contains a description on how to generate Higgs production at the LHC, where the Higgs boson decays into 2 Z bosons that each decay into either 2 electrons or 2 muons. It is ment as a starting point. In this example we will use AtlFast so we see what the events look like in Atlas. The next steop will be the full simulation and reconstruction. We will produce a combined ntuple (CBNT) that contains the MC truth and reconstructed AtlFast objects.
+
An exercise to simulated Higgs production events at the LHC, where the Higgs boson decays into 2 Z bosons that each decay into 2 muons.
 +
 
 +
<center>
 +
<math> H \rightarrow ZZ^* \rightarrow \mu^+ \mu^-\mu^+ \mu^-</math>
 +
</center>
 +
 
 +
The exercise is ment as a starting point for the 'monkey-see monkey-do' technique. It will be easy to plug in your own favorite process. In this example we will use AtlFast for the detector simulation and reconstruction. We will produce an AOD that contains the MC truth and reconstructed AtlFast objects. Since the AOD is in pool format we will also transform the AOD into an Ntuple that allows a simple analysis program to be constructed in Root.
  
 
Note: We assume you have the CMT and Athena set-up at NIKHEF in ordnung [[CMT_and_Athena_at_NIKHEF | Starting with CMT and Athena at NIKHEF]]
 
Note: We assume you have the CMT and Athena set-up at NIKHEF in ordnung [[CMT_and_Athena_at_NIKHEF | Starting with CMT and Athena at NIKHEF]]
  
=== 1. producing 10 events ===
+
== 1) Setting up the ATLAS environment at NIKHEF ==
 +
 
 +
Some packages are required to get the ATLAS software environment ok. As a first time user you should follow steps a) and b). Every time you log on you only have to process c).
 +
 
 +
<b>a) Setting up the general ATLAS environment at NIKHEF (first time only)</b>
  
:'''a) Go to your favorite area (your project for example) and create a running directory'''
+
For a fast start follow the following steps:
  
: <font color=red> cd /project/atlas/users/<your_login_name> </font>
+
*Login to a SLC3 machine and: <tt>source /project/atlas/nikhef/setup/nikhef_setup_10.0.2.csh</tt>
: <font color=red> mkdir MyGeneration </font>
+
 
 +
<font color="red"><b>Note:</b></font> If your directory on the project disk is different from your login name you should tell the setup script. Somebody who's login name is 'Tommie', but wants to do all his ATLAS work under /project/atlas/users/pino should use: <tt>source /project/atlas/nikhef/setup/nikhef_setup_10.0.2.csh opt slc3 pino</tt>.
 +
 
 +
* Get the TestRelease (with some modifications: check the detailed description)
 +
# Go to your project directory: <tt> cd /project/atlas/users/<your_login_name> </tt>
 +
# Check out the <tt>TestRelease</tt> package from the NIKHEF/ATLAS CVS repository: <tt>cvs -d /project/atlas/cvs co  TestRelease</tt>
 +
# Go to the cmt directory: <tt>cd TestRelease/TestRelease-00-00-18/cmt</tt>
 +
# Execute <tt>cmt config</tt>
 +
# Execute <tt>source setup.csh</tt>
 +
 
 +
For a detailed description please follow the instructions on: [http://www.nikhef.nl/pub/experiments/atlaswiki/index.php/Atlas_1002_setup ATLAS setup at NIKHEF].
 +
 
 +
 
 +
<b>b) Setting up the Package required to produce Ntuples from the AOD (first time only)</b>
  
:'''b) Create your joboptions file'''
+
To produce Ntuples from an AOD you'll need to add an additional package created at NIKHEF.
  
: Each athena job requires a joboptions file as input. Here we will create a joboption file that will:
+
# Go to your project directory: <tt> cd /project/atlas/users/<your_login_name> </tt>
 +
# Check out the <tt>TTBarAnalysis</tt> package from the NIKHEF/ATLAS CVS repository: <tt>cvs -d /project/atlas/cvs co TTBarAnalysis</tt>
 +
# Go to the cmt directory: <tt>cd TTBarAnalysis/cmt</tt>
 +
# Execute <tt>cmt config</tt>
 +
# Execute <tt>source setup.csh</tt>
 +
# Build the library: <tt>gmake</tt> (Note: you might have to do gmake twice)
  
:* Define what 'algorithms to run (in our case Pythia and Atlfast)
+
You can also get a more detailed set of instructions from [http://www.nikhef.nl/pub/experiments/atlaswiki/index.php/Running_ttbar_package Installing the AOD->Ntuple (TTBarabalysis) package].
:* Define the Pythia settings
 
:* Define output parameters/ntuples
 
  
:Open a file called <font color-=blue>joboptions_HiggsGeneration.py</font> and fill it with the following code
+
Once this is set-up you can produce TopNtuples from an AOD if you wish to do so.
  
<font size ="-1" color=blue>
+
<b>c) Setting up all required packages ( every time, but not if you have just done a) and b) )</b>
<pre>
 
###############################################################
 
#
 
# Job options file
 
#
 
#==============================================================
 
  
#--------------------------------------------------------------
+
On every login you should now make sure the shell knows where to get the various programs,
# General Application Configuration options
+
which means both the ATLAS general and the Ntuple Make program. You can do this by simply sourcing a script similar to [http://www.nikhef.nl/~ivov/init1002.csh init1002.csh].
#--------------------------------------------------------------
+
Simply source it in every window where you want to do the generation:  <tt> source init1002.csh </tt>
include("AthenaCommon/Atlas_Gen.UnixStandardJob.py")
 
  
theApp.setup( MONTECARLO )
+
<font color="red"><b>Note:</b></font> Again, ... for those of you whose directory on the project disk is different from your login name you should tell the setup script. Edit the init1002.csh file and add the 3 additional parameters to the line in which the general ATLAS setup script in 'sourced'. Look for example in [http://www.nikhef.nl/~ivov/init1002_special.csh init1002_special.csh].
  
include( "PartPropSvc/PartPropSvc.py" )
+
== 2) Generating Higgs events decaying into 4 muons ==
include( "AtlfastStandardOptions.py" )
 
  
#--------------------------------------------------------------
+
'''a) Download the scripts'''
# Private Application Configuration options
 
#--------------------------------------------------------------
 
theApp.DLLs  += [ "TruthExamples", "Pythia_i" ]
 
theApp.Dlls  += [ "GaudiAlg", "GaudiAud" ]
 
theApp.Dlls  += [ "AtlfastAlgs" ]
 
  
# Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL )
+
Go again to your project area and check out the Higgs4MuonAnalysis package from the NIKHEF/ATLAS CVS repository:
MessageSvc = Service( "MessageSvc" )
+
: <font color=red> cd /project/atlas/users/<your_login_name> </font>
MessageSvc.OutputLevel = 3
+
: <font color=red> cvs -d /project/atlas/cvs co Higgs4MuonAnalysis </font>
MessageSvc.defaultLimit = 9999999
+
: <font color=red> cd Higgs4MuonAnalysis </font>
 +
Let's have a look at what files are in the package.
  
#--------------------------------------------------------------
+
Athena requires steering files telling it what to do. These files are called joboptions files and  
# Create the top level algorithm (and the Python equivalent)
+
since this exercise is made up of 2 steps we have 2 (basic) joboptions files. For there rest we have the script and some extra strange file required by Athena:
#--------------------------------------------------------------
 
theApp.TopAlg = [ "Sequencer/TopSequencer" ]
 
TopSequencer  = Algorithm( "TopSequencer" )
 
TopSequencer.StopOverride = TRUE
 
  
# Create two paths and populate them
+
#<font color=blue>jobOptions_Pythia_To_Atlfast_To_AOD_BASIC.py</font> joboptions for: Pythia -> AOD:     
TopSequencer.Members = [ "Sequencer/Generator", "Sequencer/Atlfast" ]
+
#<font color=blue>jobOptions_AOD_to_Ntuple_BASIC.py</font> joboptions for: AOD -> TopNtuple 
 +
#<font color=blue> ShipOff_Pythia.py</font> The script that generates events
 +
#<font color=blue> PDGTABLE.MeV</font> A steering file required for MC production in Athena (not to be edited)
  
Generator = Algorithm( "Generator" )
 
Generator.Members = [ "Pythia", ]
 
  
#--------------------------------------------------------------
+
'''b) Options in the script'''
# Event related parameters
 
#--------------------------------------------------------------
 
# Number of events to be processed (default is 10)
 
theApp.EvtMax = 10
 
#theApp.EvtMax = XNEVENTSX
 
  
#--------------------------------------------------------------
+
The script takes three arguments:
# Random numbers
 
#--------------------------------------------------------------
 
AtRndmGenSvc = Service( "AtRndmGenSvc" )
 
AtRndmGenSvc.Seeds = ["PYTHIA 5769791 690419913", "PYTHIA_INIT 690501 4106941"];
 
#AtRndmGenSvc.Seeds = ["PYTHIA XRNDPYTHIA0X XRNDPYTHIA1X", "PYTHIA_INIT XRNDPYTHIA2X XRNDPYTHIA3X"]
 
  
#--------------------------------------------------------------
+
# <Nevents> = The number of events per job
# Algorithms Private Options (Pythia)
+
# <Njobs> = the number of jobs
#--------------------------------------------------------------
+
# <f_interactive> = a flag to signal that you want everything on screen (1) instead of logfile (0, default)
Pythia = Algorithm( "Pythia" )
 
  
#-- Stolen from DC1 production (simple test)
+
The script is called using:  <tt>./ShipOff_Pythia.py <Nevents> <Njobs> <f_interactive> </tt>
Pythia.PythiaCommand = [
 
          # Higgs production
 
                        "pysubs msel 16",   # Higgs production
 
                "pydat2 pmas 25 1 150.",  # Higgs mass                       
 
  
          # Higgs decay
+
What does the script do. For each job a subdirectory is made called Jobs<JobNr>. In that directory
                "pydat3 mdme 210 1 0",  # H -> dd
+
the joboption files specific to this job are created and Athena is run for both steps. The output files
                "pydat3 mdme 211 1 0",  # H -> uu
+
(AOD and TopNtuple) are all stored in that directory.
                        "pydat3 mdme 212 1 0",  # H -> ss
 
                        "pydat3 mdme 213 1 0",  # H -> cc
 
                        "pydat3 mdme 214 1 0",  # H -> bb
 
                        "pydat3 mdme 215 1 0",  # H -> tt
 
                        "pydat3 mdme 218 1 0",  # H -> e+e-
 
                        "pydat3 mdme 219 1 0",  # H -> mu+mu-
 
                        "pydat3 mdme 220 1 0",  # H -> tau+tau-
 
                        "pydat3 mdme 222 1 0",  # H -> gluon gluon
 
                        "pydat3 mdme 223 1 0",  # H -> gamma gamma
 
                        "pydat3 mdme 224 1 0",  # H -> gluon + gamma
 
                        "pydat3 mdme 225 1 1",  # H -> ZZ              (ON)  
 
                        "pydat3 mdme 226 1 0",  # H -> WW
 
          # Z decay
 
                        "pydat3 mdme 174 1 0",  # Z -> dd
 
                        "pydat3 mdme 175 1 0",  # Z -> uu
 
                        "pydat3 mdme 176 1 0",  # Z -> ss
 
                        "pydat3 mdme 177 1 0",  # Z -> cc
 
                        "pydat3 mdme 178 1 0",  # Z -> bb
 
                        "pydat3 mdme 179 1 0",  # Z -> tt
 
                        "pydat3 mdme 182 1 1",  # Z -> e+e-          (ON)
 
                        "pydat3 mdme 183 1 0",  # Z -> nu_e nu_e
 
                        "pydat3 mdme 184 1 1",  # Z -> mu+mu-        (ON)
 
                        "pydat3 mdme 185 1 0",  # Z -> nu_mu nu_mu
 
                        "pydat3 mdme 186 1 0",  # Z -> tau+tau-
 
                        "pydat3 mdme 187 1 0"  # Z -> nu_tau nu_tau 
 
                        ]
 
  
#--------------------------------------------------------------
 
# What do you want in the CBNT
 
#--------------------------------------------------------------
 
include( "CBNT_Athena/CBNT_Athena_jobOptions.py" )
 
include( "CBNT_Athena/CBNT_EventInfo_jobOptions.py" )
 
include( "RecExCommon/CBNT_Truth_jobOptions.py" )
 
CBNT_Truth.MaxNbParticles = 6000              # maximum number of particles in the ntuple
 
CBNT_Truth.MaxNbVertices  = 6000              # maximum number of vertices in the ntuple
 
CBNT_Athena.NtupleLocID = "/FILE1/CBNT/t3333"  # name of the Tree
 
All.Enable = True                              # save ALL particles
 
  
#--------------------------------------------------------------
+
'''b) Produce 9 events in 1 job in interactive mode'''
# (Root) output service
 
#--------------------------------------------------------------
 
# ROOT Output Parameters
 
theApp.Dlls += [ "RootHistCnv" ]
 
# Select ROOT persistency
 
theApp.HistogramPersistency = "ROOT"
 
  
#--------------------------------------------------------------
+
:<font color=red> ./ShipOff_Pythia.py 9 1 1 </font>
# Output file for the Ntuple
 
#--------------------------------------------------------------
 
NTupleSvc = Service( "NTupleSvc" )
 
NTupleSvc.Output    = [ "FILE1 DATAFILE='./HiggsNtuple.root' OPT='NEW'" ]
 
#NTupleSvc.Output    = [ "FILE1 DATAFILE='./XOutputDirCBNTX/HiggsNtuple.JobXJOBNUMBERX.root' OPT='NEW'" ]
 
  
#==============================================================
+
Once the run is finished you can find all input and output files
#
+
in the sub-directory Job1.
# End of job options file
 
#
 
###############################################################
 
</pre>
 
</font>
 
  
:'''b) Get additional steering files'''
+
Input files:
 +
:./Job1/<font color=blue>jobOptions_Pythia_To_Atlfast_To_AOD_Job1.py</font>
 +
:./Job1/<font color=blue>jobOptions_AOD_to_Ntuple_Job1.py</font>
  
:There are some requires input files that you have to get. The way to obbtain them is using the command <font color=red>get_files</font>.
+
Output files:
 +
:./Job1/<font color=blue>AOD.Job1.pool.root</font>
 +
:./Job1/<font color=blue>TopNtupleV6.Job1.root</font>
  
:<font color=red>get_files PDGTABLE.MeV</font>
 
:<font color=red>get_files PartPropSvc.py</font>
 
:<font color=red>get_files AtlfastStandardOptions.py</font>
 
  
 +
'''c) Produce 1,000 events in 2 jobs of 500 events using LogFiles'''
  
:'''c) Run Athena'''
+
:<font color=red> ./ShipOff_Pythia.py 500 2 </font>
  
:Running Athena is now a single line: <font color=red>athena.py joboptions_HiggsGeneration.py</font>
+
<b>Note:</b> You will again put everything in the subDirectory Job1, so if it still exists you will have to rename it or remove it first.
  
:You can ask athena to print out al commands it is processing:
+
Once the run is finished you can find in the output files in Job1 and Job2 where not only the AOD and TopNtuple are located, but also the LogFiles for the Athena run for both steps.
:Full output of what athena is doing: <font color=red>athena.py -bs joboptions_HiggsGeneration.py</font>
 
  
 +
Finished! You have now produced 1,000 events with <math> H \rightarrow ZZ^* \rightarrow \mu^+ \mu^-\mu^+ \mu^-</math>.
  
:'''d) Check the output'''
 
  
: In the directory now an output file called <font color=blue>HiggsNtuple.root </font> has been produced. When you look in the file you'll find the Tree for the CBNT (MC Truth) and that for AtlFast (Event in ATLAS). Now you only have to write a ROOT macro to read the file and do your analysis.
+
'''d) Extra: Choosing a different Physics Process:'''
  
:Finished!
+
The Pythia settings that define the process that is generated is given in the file jobOptions_Pythia_To_Atlfast_To_AOD_BASIC.py. If you want to study a different process: simply edit this file and insert your set of pythia parameters.
  
=== 2. producing 10,000 events in 10 sets of 1000 ===
+
== 3) Analysing the content of the Ntuple ==
:Using scripts
+
To analyse the content of the Ntuple you can either do a MakeClass() yourself or use the
 +
Skeleton that was developed at NIKHEF to easily get a handle on the mainobjects and to
 +
perform an analysis. It is used in the ATLAS top group and can be found at
 +
[http://www.nikhef.nl/pub/experiments/atlaswiki/index.php/Ttbar_analysis_skeleton TopNtuple Analysis Skeleton]

Latest revision as of 15:51, 21 February 2006

An exercise to simulated Higgs production events at the LHC, where the Higgs boson decays into 2 Z bosons that each decay into 2 muons.

The exercise is ment as a starting point for the 'monkey-see monkey-do' technique. It will be easy to plug in your own favorite process. In this example we will use AtlFast for the detector simulation and reconstruction. We will produce an AOD that contains the MC truth and reconstructed AtlFast objects. Since the AOD is in pool format we will also transform the AOD into an Ntuple that allows a simple analysis program to be constructed in Root.

Note: We assume you have the CMT and Athena set-up at NIKHEF in ordnung Starting with CMT and Athena at NIKHEF

1) Setting up the ATLAS environment at NIKHEF

Some packages are required to get the ATLAS software environment ok. As a first time user you should follow steps a) and b). Every time you log on you only have to process c).

a) Setting up the general ATLAS environment at NIKHEF (first time only)

For a fast start follow the following steps:

  • Login to a SLC3 machine and: source /project/atlas/nikhef/setup/nikhef_setup_10.0.2.csh

Note: If your directory on the project disk is different from your login name you should tell the setup script. Somebody who's login name is 'Tommie', but wants to do all his ATLAS work under /project/atlas/users/pino should use: source /project/atlas/nikhef/setup/nikhef_setup_10.0.2.csh opt slc3 pino.

  • Get the TestRelease (with some modifications: check the detailed description)
  1. Go to your project directory: cd /project/atlas/users/<your_login_name>
  2. Check out the TestRelease package from the NIKHEF/ATLAS CVS repository: cvs -d /project/atlas/cvs co TestRelease
  3. Go to the cmt directory: cd TestRelease/TestRelease-00-00-18/cmt
  4. Execute cmt config
  5. Execute source setup.csh

For a detailed description please follow the instructions on: ATLAS setup at NIKHEF.


b) Setting up the Package required to produce Ntuples from the AOD (first time only)

To produce Ntuples from an AOD you'll need to add an additional package created at NIKHEF.

  1. Go to your project directory: cd /project/atlas/users/<your_login_name>
  2. Check out the TTBarAnalysis package from the NIKHEF/ATLAS CVS repository: cvs -d /project/atlas/cvs co TTBarAnalysis
  3. Go to the cmt directory: cd TTBarAnalysis/cmt
  4. Execute cmt config
  5. Execute source setup.csh
  6. Build the library: gmake (Note: you might have to do gmake twice)

You can also get a more detailed set of instructions from Installing the AOD->Ntuple (TTBarabalysis) package.

Once this is set-up you can produce TopNtuples from an AOD if you wish to do so.

c) Setting up all required packages ( every time, but not if you have just done a) and b) )

On every login you should now make sure the shell knows where to get the various programs, which means both the ATLAS general and the Ntuple Make program. You can do this by simply sourcing a script similar to init1002.csh. Simply source it in every window where you want to do the generation: source init1002.csh

Note: Again, ... for those of you whose directory on the project disk is different from your login name you should tell the setup script. Edit the init1002.csh file and add the 3 additional parameters to the line in which the general ATLAS setup script in 'sourced'. Look for example in init1002_special.csh.

2) Generating Higgs events decaying into 4 muons

a) Download the scripts

Go again to your project area and check out the Higgs4MuonAnalysis package from the NIKHEF/ATLAS CVS repository:

cd /project/atlas/users/<your_login_name>
cvs -d /project/atlas/cvs co Higgs4MuonAnalysis
cd Higgs4MuonAnalysis

Let's have a look at what files are in the package.

Athena requires steering files telling it what to do. These files are called joboptions files and since this exercise is made up of 2 steps we have 2 (basic) joboptions files. For there rest we have the script and some extra strange file required by Athena:

  1. jobOptions_Pythia_To_Atlfast_To_AOD_BASIC.py joboptions for: Pythia -> AOD:
  2. jobOptions_AOD_to_Ntuple_BASIC.py joboptions for: AOD -> TopNtuple
  3. ShipOff_Pythia.py The script that generates events
  4. PDGTABLE.MeV A steering file required for MC production in Athena (not to be edited)


b) Options in the script

The script takes three arguments:

  1. <Nevents> = The number of events per job
  2. <Njobs> = the number of jobs
  3. <f_interactive> = a flag to signal that you want everything on screen (1) instead of logfile (0, default)

The script is called using: ./ShipOff_Pythia.py <Nevents> <Njobs> <f_interactive>

What does the script do. For each job a subdirectory is made called Jobs<JobNr>. In that directory the joboption files specific to this job are created and Athena is run for both steps. The output files (AOD and TopNtuple) are all stored in that directory.


b) Produce 9 events in 1 job in interactive mode

./ShipOff_Pythia.py 9 1 1

Once the run is finished you can find all input and output files in the sub-directory Job1.

Input files:

./Job1/jobOptions_Pythia_To_Atlfast_To_AOD_Job1.py
./Job1/jobOptions_AOD_to_Ntuple_Job1.py

Output files:

./Job1/AOD.Job1.pool.root
./Job1/TopNtupleV6.Job1.root


c) Produce 1,000 events in 2 jobs of 500 events using LogFiles

./ShipOff_Pythia.py 500 2

Note: You will again put everything in the subDirectory Job1, so if it still exists you will have to rename it or remove it first.

Once the run is finished you can find in the output files in Job1 and Job2 where not only the AOD and TopNtuple are located, but also the LogFiles for the Athena run for both steps.

Finished! You have now produced 1,000 events with .


d) Extra: Choosing a different Physics Process:

The Pythia settings that define the process that is generated is given in the file jobOptions_Pythia_To_Atlfast_To_AOD_BASIC.py. If you want to study a different process: simply edit this file and insert your set of pythia parameters.

3) Analysing the content of the Ntuple

To analyse the content of the Ntuple you can either do a MakeClass() yourself or use the Skeleton that was developed at NIKHEF to easily get a handle on the mainobjects and to perform an analysis. It is used in the ATLAS top group and can be found at TopNtuple Analysis Skeleton