Atlas-D Meeting 2007 - Trigger Tutorial
Introduction
This Trigger Tutorial is customized for the
ATLAS-D-Meeting 2007 in Zeuthen, Germany. It is based on standard trigger tutorials. For a full list of available trigger tutorials and further information see
TriggerSoftwareTutorialPage.
For simplicity we will work in release 12.0.6 on lxplus at CERN. You can also work from a kit, but you should knwo how to set up your requirement file for this. As soon as you have a working requirement file, there shouldn't be any differences.
Setup:
A standard requirement file for CERN should do. For the
EventView tutorial you need to add one line to the requirements file:
macro ATLAS_GROUP_AREA "/afs/cern.ch/atlas/groups/PAT/Tutorial"
In addition you need to create your workarea, e.g.
testarea/12.0.6
. Then do the default set-up as explained in the
WorkBook:
source ~/cmthome/setup.sh -tag=12.0.6,opt
You can check your setup by looking at a few shell variables. For example, check that your working area is included in the CMT path
echo $CMTPATH
Other variables are $AtlasArea, $AtlasProject, $AtlasVersion, $TestArea, $GroupArea.
Needed Packages:
Go to
testare/12.0.6
and do the following to checkout the User Analysis package
Now you have the set-up as you are used to do and can check out the
UserAnalysis package (unless you're only interested in the
EventView examples.
cmt co -r UserAnalysis-00-09-10-01 PhysicsAnalysis/AnalysisCommon/UserAnalysis
cd PhysicsAnalysis/AnalysisCommon/UserAnalysis/cmt
cmt broadcast gmake
If you do not know which version of your package is in the release, use
get_tag package name
to retrieve this information.
Exercises for running directly on AOD's
Exercise 1: Retrieve Trigger Decision
The
TriggerDecision contains the Trigger Menu covering L1, L2 and EF. In this example you will learn how to retrieve the
TriggerDecision from an AOD and how to find out if your events have been accepted or rejected by a given trigger menu item.
To see the exercise, go to
TrigTutorialRetrieveDecision.
In contrast to what is written on the tutorial page you don't have to modify the source code, but have a look at the code. Only the change to the requirement file is needed. You get get the JO file with
get_files AnalysisSkeleton_topOptions.py
. Don't forget to change the output level and adjust the number of events to be processed.
Try either a mixed or a prescaled trigger. How about a SUSY trigger (XE50+J60 at L1) or a dedicated top trigger (e25i or mu20i plus jet160/2jet120 at EF).
Exercise 2: re-run the hypothesis on AOD's
In this exercise we want to re-run the hypothesis algorithm(s). We'll first need to look at the reconstructed csc produced data ourselves and re-optimise the trigger selection cuts. So to allow you to use our latest optimisations, you might want to do something similar as in this exercise.
To see the exercise, go to
TrigTutorialRerunHypo.
Don't forget to change the output level and adjust the number of events to be processed. Look out for the
TriggerMenu
in the output for the LVL1 configuration and
HLTConfig
(Sequence, XMLSignature, Signature) for the HLT configuration. For number have a look at the xml files for the CSC-06 trigger menu.
There are three ways to get information about the
StoreGate keys in an AOD or event:
-
StoreGateSvc.Dump = True
in joboptions
- load AOD into root and list file content
- checkFile.py AOD file
Exercises for running on AOD's using EventView
Restart from a new shell and set up your environment using the
EventView group area:
source ~/cmthome/setup.sh -tag=12.0.6,opt,groupArea
Explicitly check the $GroupArea variable to see if everything is okay.
Exercise 3: Retrieve Trigger Decision using HighPtView
This exercise will show you how to retrieve the
TriggerDecision using
HighPtView. First we will use
HighPtView to create a
ROOT ntuple and then analyse the ntuple to access the information stored in the
TriggerDecision object.
Create an job option file called
MyInput.py
to set the input AOD filename:
EventSelector.InputCollections=["/afs/cern.ch/user/m/mwielers/maxidisk/tutorial1206/trig1_misal1_mc12.005200.T1_McAtNlo_Jimmy.recon.AOD.v12000601_tid005997._00001.pool.root"]
Then run
HighPtView:
athena.py -c "theApp.EvtMax=100; " HighPtView/HighPtViewNtuple_topOptions.py MyInput.py
This will produce four
ROOT ntuples for the two different muon and tau reconstruction algorithms:
MuidTauRec_HighPtAANtuple.root,
MuidTau1p3p_HighPtAANtuple.root,
StacoTau1p3p_HighPtAANtuple.root,
StacoTauRec_HighPtAANtuple.root.
Take one and load it into root. Have a look at the branches starting with
Passed
in the
FullRec0
tree. This is the equivalent to
the
TriggerDecision from exercise 1. Count a few trigger items (e.g.
FullRec0->Draw("PassedEF_e25i")
) and compare with the results from
reading the
TriggerDecision directly from the AOD. Then plot the trigger efficiency for
EM25I as a function of Pt.
Create a
ROOT class:
FullRec0->MakeClass("THighPtView")
The code for filling a histogram should look like:
// only pt of first electron
for (int i = 0; i < 1 && i < El_N; ++i) {
h_pt->Fill((*El_p_T)[i]);
if (PassedEF_e25i) h_pt_passed->Fill((*El_p_T)[i]);
}
Booking and drawing the histograms and calculating the efficiency should be straight forward. You can extent this to the event filter or jet items.
If you want to see how it is done in
EventView, have a look at the
TriggerCATTutorial#Exercise_1_Retrieve_TriggerDecis.
Exercise 4: Creating an ntuple with the dump of all trigger information
The produced ntuple contains already a lot more information about the trigger. For every offline particle quantities for the corresponding trigger object are stored. Everything should be there to redo the trigger decision at the three different levels:
For example for LVL1:
* El_L1_EmCore
* El_L1_EmIsol
* El_L1_HdCore
* El_L1_HdIsol
As an exercise try to redo the trigger decision at LVL1 for
EM25I!
Modify the
Loop
function in
THighPtView.C
:
Bool_t passed = false;
for (int i = 0; i < El_N; ++i) {
if ( ((*El_L1_EmClus)[i] > 18000.) &&
((*El_L1_EmIsol)[i] <= 3000.) &&
((*El_L1_HdCore)[i] <= 2000.) &&
((*El_L1_HdIsol)[i] <= 2000.) ) {
passed = true;
break;
}
}
if (passed == PassedL1_EM25I) {
std::cout << "Event: " << eventNumber << " - reproduced L1 decision" << std::endl;
} else {
std::cout << "Event: " << eventNumber << " - failed to reproduced L1 decision" << std::endl;
}
Example header and source files are attached to this Twiki page:
https://twiki.cern.ch/twiki/pub/Main/AtlasD07TriggerTutorial/THiphPtView.h and
https://twiki.cern.ch/twiki/pub/Main/AtlasD07TriggerTutorial/THighPtView.C.
Can you reproduce the trigger flag from the
TriggerDecision (exercise 3)? What are the difference, what are the short comings of this method?
To see a similar exercise using
EventView, go to
EventViewTriggerTutorialEx2.
Exercise 5: Creating an ntuple with the dump of all trigger information
This might be the first or the last thing someone would want to look at. The
EventView tools support creating an AA ntuple with reconstructed, truth, and now even trigger information.
For this we need run
HighPtView again with more options and recreate the
ROOT ntuples. For more options see
HighPtViewInstructions:
athena.py -c "theApp.EvtMax=100; TriggerView=True" HighPtView/HighPtViewNtuple_topOptions.py MyInput.py
This option will create a new
ROOT file, called
Trigger_HighPtAANtuple.root
. The tree with the trigger related branches is called Trigger0. The naming convention for the variables is similar to the one in the
FullRec0 tree, only the particle name in the name is missing. As before the kinematics and features at the three trigger levels should be available.
For example for LVL1:
As an exercise redo the
EM25I trigger decision again. This time you have all trigger item available and hence you can do rate studies with this tree.
Create a
ROOT class:
Trigger0->MakeClass("TTriggerTree")
Modify the
Loop
function in
TTriggerTree.C
:
Bool_t passed = false;
for (int i = 0; i < L1EM_N; ++i) {
if ( ((*L1EM_EmClus)[i] > 18000.) &&
((*L1EM_EmIsol)[i] <= 3000.) &&
((*L1EM_HdCore)[i] <= 2000.) &&
((*L1EM_HdIsol)[i] <= 2000.) ) {
passed = true;
std::cout << "Event: " << TriggerEventAndInstance << " - passed EM25I" << std::endl;
std::cout << (*L1EM_EmClus)[i]
<< " " << (*L1EM_EmIsol)[i]
<< " " << (*L1EM_HdCore)[i]
<< " " << (*L1EM_HdIsol)[i] << std::endl;
}
Example header and source files are attached to this Twiki page:
https://twiki.cern.ch/twiki/pub/Main/AtlasD07TriggerTutorial/TTriggerTree.h and
https://twiki.cern.ch/twiki/pub/Main/AtlasD07TriggerTutorial/TTriggerTree.C.
What is the trigger rate in this sample? What is the rate in Hz for this sample and the design luminosity? The cross section should be found in the
AMI database. It is 18.2 nano barn.
To see a similar exercise using
EventView, go to
EventViewTriggerTutorialEx1.
Back to the Ganga Tutorial
Exercise 6: Production of HighPtView ntuples on the grid using Ganga
The goal of this exercise is to rerun the last
HighPtView command line on the grid on a high statistics (ttbar or minimum bias?) sample. The five ntuples should be registered as a dq2 dataset. Have you learned enough to do this without instructions?
--
WolfgangEhrenfeld - 17 Sep 2007