Generating Higgs To 4 Muons at NIKHEF

From Atlas Wiki
Jump to navigation Jump to search

Produce simulated events from Higgs production at the LHC, where the Higgs boson decays into 2 Z bosons that each decay into 2 muons. It is ment as a starting point for the usual monkey-see monkey-do technique. In this example we will also use AtlFast so we can see what would be observed in ATLAS. We will produce a combined ntuple (CBNT) that contains the MC truth and reconstructed AtlFast objects. The next step will be to produce an ESD/AOD (with full simulation and reconstruction).

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

0. Setting up the ATLAS environment at NIKHEF

First set up the ATLAS environment at NIKHEF. Follow the instructions on: ATLAS setup at NIKHEF.


1. producing 10 events

a) Go to your favorite area (your project for example) and create a running directory
cd /project/atlas/users/<your_login_name>
mkdir MyGeneration
b) Create your joboptions file
Each athena job requires a joboptions file as input. Here we will create a joboption file that will:
  • Define what 'algorithms to run (in our case Pythia and Atlfast)
  • Define the Pythia settings
  • Define output parameters/ntuples
Create a file called joboptions_HiggsGeneration.py. You can download the file from: joboptions_HiggsGeneration.py.


b) Get additional steering files
There are some requires input files that you have to get. The way to obbtain them is using the command get_files.
get_files PDGTABLE.MeV
get_files PartPropSvc.py
get_files AtlfastStandardOptions.py


c) Run Athena
Running Athena is now a single line: athena.py joboptions_HiggsGeneration.py
You can ask athena to print out al commands it is processing:
Full output of what athena is doing: athena.py -bs joboptions_HiggsGeneration.py


d) Check the output
In the directory now an output file called HiggsNtuple.root 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.
Finished!

2. producing 10,000 events in 10 sets of 1000

When using the joboptions file in the example above you have produced 10 events, but when you want to have a bit large production you want to automatise everything a bit:

Create a new joboption file for each job each having

  • A unique random number seed for Pythia
  • A user defined number of events
  • An output ntuple that is different for each event
  • Store output and Logfiles in a separate directory

To do just this a small script has been created.

a) Create a BASICS-directory
Create a directory with the basic information you require.
  
 cd /project/atlas/users/<your_login_name>/MyGeneration/
 mkdir HiggsGen_BASICS
 cp PDGTABLE.MeV               ./HiggsGen_BASICS/
 cp PartPropSvc.py             ./HiggsGen_BASICS/
 cp AtlfastStandardOptions.py  ./HiggsGen_BASICS/
 
We also copy the joboptions file there and rename it
   
  cp joboptions_HiggsGeneration.py ./HiggsGen_BASICS/joboptions_HiggsGeneration.py.BASIC
  
b) Edit the standard joboptions file

To allow the script to change the job-dependent settings in the joboptions file we'll now have to change 3 lines in the joboptions file.

1) Change Number of events

theApp.EvtMax = 10 . changes to ->

theApp.EvtMax = XNEVENTSX

2) Change Random number seeds for Pythia

AtRndmGenSvc.Seeds = ["PYTHIA 5769791 690419913", "PYTHIA_INIT 690501 4106941"]. changes to ->

AtRndmGenSvc.Seeds = ["PYTHIA XRNDPYTHIA0X XRNDPYTHIA1X", "PYTHIA_INIT XRNDPYTHIA2X XRNDPYTHIA3X"]

3) Change Name output file (and output directory)

NTupleSvc.Output = [ "FILE1 DATAFILE='./HiggsNtuple.root' OPT='NEW'" ]. changes to ->

NTupleSvc.Output = [ "FILE1 DATAFILE='./XOutputDirCBNTX/HiggsNtuple.JobXJOBNUMBERX.root' OPT='NEW'"]

c) Create an output directory (Ntuples and Logfiles)
 To store the ntuples and Logfiles we create an output directory
  
 cd /project/atlas/users/<your_login_name>/MyGeneration/
 mkdir HiggsGen_OUTPUT
 mkdir HiggsGen_OUTPUT/InputAndLogfiles
 
d) Get the script and tailor it to your needs
First copy the main script to your running directory
  
 cd /project/atlas/users/<your_login_name>/MyGeneration/
 cp /user/ivov/Higgs_Tutorial_Files/ShipOff_HiggsGen.py .
 
The main user control flags that need to be edited are listed at the bottom of the script where you see: User control flags

output_dir          = "/project/atlas/users/<your_login_name>/MyGeneration/HiggsGen_OUTPUT/"
steering_files_dir  = "/project/atlas/users/<your_login_name>/MyGeneration/HiggsGen_BASICS/"
Nevents_joboptions  =      20  # Number of events per job
Njobs               =       2  # Number of jobs
f_LogFile           =       0  # Logfile yes/no

By default what will happen is that for job 1, a directory called Job1 is produced that contains the files from HiggsGen_OUTPUT/ and a unique joboptions file (20 events with a unique random number sequence for Pythia). In the directory a link is put to the HiggsGen_BASICS/ directory. After the job is finished the Ntuple called HiggsNtuple.Job1.root is put in that directory. For job number 2 a similar thing happened.
e) The real thing
Now, once this is running, you might want to change 2 more things.
First, you should opt for the automatic logfile:

f_LogFile           =       1  # Logfile yes/no

Then you should remove the # from the line

#CleanUp_Job(i_file)

This will make that at the end of the job both the logfile and the joboptions file for this job will be copied to the directory "HiggsGen_OUTPUT/InputAndLogfiles" and that the directory is removed.


Finally, chaning the Number of events to 1000 and the number of jobs to 10, you will produce 10,000 events with .