The LHCb software is organized in projects and each project is divided into packages. In order to be able to run the HLT, your application needs to get access to the HLT project. The DaVinci application has access to the HLT project, so you can run the HLT in DaVinci.
You need to set the environment of your application, that is, to define the paths where to find the include files and the libraries. The paths are in CMTPROJECTPATH environment variable. The following command does it for DaVinci version v19r8
setenvDaVinci v19r8
Applications:
There are several applications in LHCb. The one used for physics analysis is DaVinci and runs in DST files.
With the following commands you can get and compile the DaVinci application
getpack Phys/DaVinci v19r8
cd Phys/DaVinci/v19r8/cmt
cmt config
source setup.csh
gmake
Options:
Options define the configuration of your application, that is, what algorithms to execute, in which order and with which properties. The main option file to run the DaVinci application is DaVinci.opts and it is located in the Phys/DaVinci/v19r3/options directory.
To run the HLT you need to activate the HLT options. To do so, you need to uncomment the following lines in your DaVinci.opts. They emulate the L0 and run the HLT generic (also called alleys) and the HLT exclusive (also called selections). You can browse the options files of the trigger in the following directory: $HLTSYSROOT/options.
#include "$HLTSYSROOT/options/L0.opts"
#include "$HLTSYSROOT/options/Hlt.opts"
#include "$HLTSYSROOT/options/HltSelections.opts"
To run the DaVinci application with the DaVinci options do (in your platform/compiler directory i.e at Phys/DaVinci/v19r3/slc4_ia32_gcc34):
./DaVinci.exe ../options/DaVinci.opts
To run the HLT standarlone you only need the HltJob.opts file located at $HLTSYSROOT/options.
see for example the python script hltexamples.py at Hlt/HltPython/v*/python/examples
The output of the HLT is an HltSummaryobject with the summary of the HLT. For each event you will find a summary located in the Transient Event Store (TES) in following location (LHCb::HltSummaryLocation::Default).
You can check if an event has passed the HLT by applying to the summary object the method decision() that returns true or false. Only the HLT in/exclusive selections set a final HLT decision yes.
A HltSummary has a list of selections. A selection is the output of a HltAlgorithm, and contains the list of candidates that have passed that selection. Each selection is identified by a name and by an integer ID. For example, the selection HadPreTriggerSingle has as candidates a list of long tracks that have passed the cuts on impact parameter and PT.
If you want to know what selections have been passed in an event, and their candidates, you should use (in Python or C++) the following tool:
IHltConfSummaryTool hltsum = tool<IHltConfSummaryTool>("HltSummaryTool");* C++
hltsum = gaudi.toolsvc().create("HltSummaryTool",interface="IHltConfSummaryTool") ; in Python, see example at Hlt/Python/v*/python/exampleshltexamples.py
You can get for the list with the names of the selections that passed the event with the method:
How to get information about the HLT Configuration?
The HLT is configured via a unique key, named Trigger Configuration Key (TCK), that defines the sequence of algorithms, and the cuts (we refer to them as filters of a selection)
The HLT configuration stores:
map of selection name <-> integer ID
map of extraInfo name <-> integer ID
input selections given a selection
type of candidates of a selection (i.e Tracks, Vertices,...)
filters names applied in a selection , they are a list of names indicating the filter, i.e. "PT,>,2000 ", is the filter to apply a PT cut above 2000 MeV.
You can acces the HltConfiguration, it in Python, or C++ via the IHltConfSummaryTool (see how above):
to get the string name <-> integer ID of a selection use the method:
int id = hltsum->confInt("SelectionID/HadPreTriggerSingle"),
std::string name = hltsum->confString("SelectionID/304")
to get the string name <-> integer ID of a quantity stored as extraInfo in the candidate use the method:
int id = hltsum->confInt("InfoID/IP")
std::string name = hltsum->confString("InfoID/2")
to get the input selections used in a give selection, use the method:
std::string candidateType = hltsum->confString("HadPreTriggerSingle/SelectionType"), with candidateType = Track,Vertex,Particle
Please look at the python script hltexamples.py at Hlt/HltPython/v*/python/examples
How to define an HLT alley?
The HLT alleys are defined via options, see for example HltHadConfAlleySequence.opts at HltSys/v*/options. The alley is a sequencer, that contains different HltAlgorithms. Most of the HLT alleys uses the HLT generic code, that is, a collection of few generic algorithms that deals with the reconstruction and the filtering. Usually a reconstruction algorithm is followed by a filtering one.
An HltAlgorithm takes as input selections and produce an output selection. Note that the selections can be stored or taken from the HltSummary, so, in oder words, the HLT code runs in the HltSummary.
These are the generic HLT algorithms:
HltTrackFilter: filter a selection of tracks using a list of filters for tracks.
some examples of filter: "PT,>,2000", or "IP_PV2D,||>,0.1", the second filter represents the minimum absolut impact parameter with respect any vertices in the selection "PV2D", that is, the primary vertices made with 2D Velo tracks, greater than 0.1 mm.
MaxQuality = 4. (the maximun quality (chi square) required of the match)
OutputSelection = "TrackVeloT" (again, by default it takes the name of the algorithm)
HltVertexMaker: makes a 2 track vertex.
It combines two selections of tracks, into one selection of vertices
the vertices will have one track at least from the first selection of tracks!, so track1+track1, and track1+track2, vertices will be procuded, were track1 belong to the first selection of tracks, and track2 belongs to the second selection of tracks.
The vertices will be created if they pass a list of filters based on two tracks. One example of filter is "DOCA,<,0.2", that is the two tracks should have a Distance Of Closest Approach smaller than 0.2 mm.