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

From Atlas Wiki
Jump to navigation Jump to search
 
(29 intermediate revisions by the same user not shown)
Line 5: Line 5:
 
</center>
 
</center>
  
The exercise is ment as a starting point for the 'monkey-see monkey-do' technique. 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.
+
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) Setting up the ATLAS environment 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).
  
 
<b>a) Setting up the general ATLAS environment at NIKHEF (first time only)</b>
 
<b>a) Setting up the general ATLAS environment at NIKHEF (first time only)</b>
  
First set up the ATLAS environment at NIKHEF. Follow the instructions on: [http://www.nikhef.nl/pub/experiments/atlaswiki/index.php/Atlas_1002_setup ATLAS setup at NIKHEF].
+
For a fast start follow the following steps:
 +
 
 +
*Login to a SLC3 machine and: <tt>source /project/atlas/nikhef/setup/nikhef_setup_10.0.2.csh</tt>
 +
 
 +
<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>b) Setting up the Package required to produce Ntuples from the AOD (first time only)</b>
Line 19: Line 35:
 
To produce Ntuples from an AOD you'll need to add an additional package created at NIKHEF.
 
To produce Ntuples from an AOD you'll need to add an additional package created at NIKHEF.
  
# Go to the directory where you want to install the package: <tt> cd /project/atlas/users/<your_login_name> </tt>
+
# 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>
 
# 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>
 
# Go to the cmt directory: <tt>cd TTBarAnalysis/cmt</tt>
 
# Execute <tt>cmt config</tt>
 
# Execute <tt>cmt config</tt>
 
# Execute <tt>source setup.csh</tt>
 
# Execute <tt>source setup.csh</tt>
# Build the library: <tt>gmake</tt>
+
# Build the library: <tt>gmake</tt> (Note: you might have to do gmake twice)
  
 
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].
 
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].
  
Once this is set-up you can produce TopNtuples from an AOD
+
Once this is set-up you can produce TopNtuples from an AOD if you wish to do so.
 +
 
 +
<b>c) Setting up all required packages ( every time, but not if you have just done a) and b) )</b>
  
<b>c) Setting up all required packages (every time)</b>
 
 
On every login you should now make sure the shell knows where to get the various programs,  
 
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 [http://www.nikhef.nl/~ivov/init1002.csh init1002.csh].
 
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>
 
Simply source it in every window where you want to do the generation:  <tt> source init1002.csh </tt>
  
== 3) Get the code to run the full chain==
+
<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].
 +
 
 +
== 2) Generating Higgs events decaying into 4 muons ==
  
:'''a) Go to your favorite area and create a running directory'''
+
'''a) Download the scripts'''
  
At NIKHEF a logical place would be your project disk:
+
Go again to your project area and check out the Higgs4MuonAnalysis package from the NIKHEF/ATLAS CVS repository:
 
: <font color=red> cd /project/atlas/users/<your_login_name> </font>
 
: <font color=red> cd /project/atlas/users/<your_login_name> </font>
: <font color=red> cvs -d /project/atlas/cvs co Higgs4lAnalysis </font>
+
: <font color=red> cvs -d /project/atlas/cvs co Higgs4MuonAnalysis </font>
 
+
: <font color=red> cd Higgs4MuonAnalysis </font>
:'''b) Create your joboptions file'''
+
Let's have a look at what files are in the package.
 
 
: 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: [http://www.nikhef.nl/~ivov/Higgs4Muons_Scripts/joboptions_HiggsGeneration.py joboptions_HiggsGeneration.py].
 
 
 
 
 
:'''c) Get additional steering files'''
 
 
 
: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>.
 
 
 
:<font color=red>get_files PDGTABLE.MeV</font>
 
:<font color=red>get_files PartPropSvc.py</font>
 
:<font color=red>get_files AtlfastStandardOptions.py</font>
 
 
 
 
 
:'''d) Run Athena'''
 
 
 
:Running Athena is now a single line: <font color=red>athena.py -bs joboptions_HiggsGeneration.py</font>
 
 
 
:Note: The "-bs" flag is optional and tells athena to print out <b>all</b> commands it is processing:
 
 
 
 
 
:'''e) 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.
 
 
 
: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 larger 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.
 
  <font color=red>
 
  cd MyGeneration/
 
  mkdir HiggsGen_BASICS
 
  cp PDGTABLE.MeV              ./HiggsGen_BASICS/
 
  cp PartPropSvc.py            ./HiggsGen_BASICS/
 
  cp AtlfastStandardOptions.py  ./HiggsGen_BASICS/
 
  </font>
 
:We also copy the joboptions file there and rename it
 
  <font color=red>
 
  cp joboptions_HiggsGeneration.py ./HiggsGen_BASICS/joboptions_HiggsGeneration.py.BASIC
 
  </font>
 
  
:'''b) Edit the standard joboptions file'''
+
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:
  
 +
#<font color=blue>jobOptions_Pythia_To_Atlfast_To_AOD_BASIC.py</font> joboptions for: Pythia -> AOD:     
 +
#<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)
  
  <font color=red>
 
  cd MyGeneration/HiggsGen_BASICS
 
  </font>
 
  
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: joboptions_HiggsGeneration.py.BASIC.
+
'''b) Options in the script'''
  
:1) Change Number of events
+
The script takes three arguments:
<font color=blue>
 
theApp.EvtMax = 10 </font> .    changes to ->
 
  
<font color=blue>theApp.EvtMax = XNEVENTSX</font>
+
# <Nevents> = The number of events per job
 +
# <Njobs> = the number of jobs
 +
# <f_interactive> = a flag to signal that you want everything on screen (1) instead of logfile (0, default)
  
:2) Change Random number seeds for Pythia
+
The script is called using: <tt>./ShipOff_Pythia.py <Nevents> <Njobs> <f_interactive> </tt>
<font color=blue>AtRndmGenSvc.Seeds = ["PYTHIA 5769791 690419913", "PYTHIA_INIT 690501 4106941"]</font>.    changes to ->
 
  
<font color=blue>
+
What does the script do. For each job a subdirectory is made called Jobs<JobNr>. In that directory
AtRndmGenSvc.Seeds = ["PYTHIA XRNDPYTHIA0X XRNDPYTHIA1X", "PYTHIA_INIT XRNDPYTHIA2X XRNDPYTHIA3X"]
+
the joboption files specific to this job are created and Athena is run for both steps. The output files
</font>
+
(AOD and TopNtuple) are all stored in that directory.
  
:3) Change Name output file (and output directory)
 
<font color=blue>NTupleSvc.Output    = [ "FILE1 DATAFILE='./HiggsNtuple.root' OPT='NEW'" ]</font>.    changes to ->
 
  
<font color=blue>
+
'''b) Produce 9 events in 1 job in interactive mode'''
NTupleSvc.Output    = [ "FILE1 DATAFILE='./XOutputDirCBNTX/HiggsNtuple.JobXJOBNUMBERX.root' OPT='NEW'"]
 
</font>
 
  
:'''c) Create an output directory (Ntuples and Logfiles)'''
+
:<font color=red> ./ShipOff_Pythia.py 9 1 1 </font>
  
  To store the ntuples and Logfiles we create an output directory:
+
Once the run is finished you can find all input and output files
  <font color=red>
+
in the sub-directory Job1.
  cd MyGeneration/
 
  mkdir HiggsGen_OUTPUT
 
  mkdir HiggsGen_OUTPUT/InputAndLogfiles
 
  </font>
 
  
:'''d) Get the script and tailor it to your needs'''
+
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>
  
:First copy the main script to your running directory
+
Output files:
  <font color=red>  
+
:./Job1/<font color=blue>AOD.Job1.pool.root</font>
  cd /project/atlas/users/<your_login_name>/MyGeneration/
+
:./Job1/<font color=blue>TopNtupleV6.Job1.root</font>
  cp /user/ivov/Higgs_Tutorial_Files/ShipOff_HiggsGen.py .
 
  </font>
 
  
: The main user control flags that need to be edited are listed at the top of the script in the
 
routine: <font color=blue> Get_InputParameters </font>
 
<font color=blue>
 
<pre>
 
  Nevents_joboptions  =    100  # number of events to be generated per job
 
  Njobs              =      2  # Number of jobs
 
  f_LogFile          =      0  # Write to screen or logfile
 
  
  steering_files_dir  = "/data/atlas/users/<your_login_name>/scratch/MyGeneration/HiggsGen_BASICS/"    # basic input files
+
'''c) Produce 1,000 events in 2 jobs of 500 events using LogFiles'''
  output_dir          = "/data/atlas/users/<your_login_name>/scratch/MyGeneration/HiggsGen_OUTPUT/"    # output directory
 
</pre>
 
</font>
 
  
: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 (50 events with a unique random number sequence for Pythia). In the
+
:<font color=red> ./ShipOff_Pythia.py 500 2 </font>
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 (logfiles)'''
+
<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.
  
:Now, once this is running, you might want to change 2 more things.
+
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.
  
:First, you should opt for the automatic logfile:
+
Finished! You have now produced 1,000 events with <math> H \rightarrow ZZ^* \rightarrow \mu^+ \mu^-\mu^+ \mu^-</math>.
<font color=blue>
 
<pre>
 
f_LogFile          =      1  # Logfile yes/no
 
</pre>
 
</font>
 
  
:Then you should remove the # from the line
 
<font color=blue>
 
<pre>
 
#CleanUp_Job(i_file)
 
</pre>
 
</font>
 
  
:This will make that at the end of the job both the logfile and the joboptions file for this job will
+
'''d) Extra: Choosing a different Physics Process:'''
be copied to the directory "HiggsGen_OUTPUT/InputAndLogfiles" and that the directory is removed.
 
  
 +
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.
  
Finally, chaning the Number of events to 1000 and the number of jobs to 10, you will produce 10,000 events with <math> H \rightarrow ZZ^* \rightarrow \mu^+ \mu^-\mu^+ \mu^-</math>.
+
== 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
 +
[http://www.nikhef.nl/pub/experiments/atlaswiki/index.php/Ttbar_analysis_skeleton TopNtuple Analysis Skeleton]

Latest revision as of 17: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