How to create HLT TCKs

Creating split HLT1 and HLT2 TCKs for 2016

HLT piquets should follow this set of instructions for production TCKs for 2016 datataking

Producing a dataset with at least one accepted event per HLT line

This step is not normally needed, as the existing dataset should be sufficient. Please consult with one of the HLT experts if in doubt.

There is a script in Hlt/HltPiquetScripts which does this. scripts/ This script runs Moore with a configurable number of parallel processes. It keeps track of which lines have fired, and only writes out an accepted event if it is the first time for any of the lines. It is slightly more efficient though, since it doesn't actually require that the line fires -- only that the next to last algorithm has been executed. First step is to make sure that we have suitable input data. The process is most efficient if we start from a mix of raw data from the different streams. E.g,.

nsls /castor/ | head -n 5
Then copy the data to /scratch/hlt/make_tcks on the online system. From the online system do
getpack Hlt/HltPiquetScripts
You probably want to do this in a screen session:
lb-run Moore v25r1 python Hlt/HltPiquetScripts/scripts/ 2>&1 | tee log
There will be an .mdf and .log file for each Moore process, and they will be filled in real time.

Creating and testing split HLT TCKs.

Before you begin, you should have an appropriate hex key for the new TCKs. You can e.g. use the latest (use SetupMoore --list-versions) released Moore (v25r2 in this example) with TCKsh to find out:

lb-run Moore v25r2 TCKsh
>>> listConfigurations()
.... ....
      0x11301715 : b95ffa736bfc93d10bae16e76a3a6c96 : Prescale = 1
      0x11291600 : 8eed26d4c1e458200a7bb0ff69deeaf3 : Hlt1, Physics_pp_May2016, 0x1600
      0x21291600 : c3269de2a6f7e0bd687a82af0879778d : Hlt2, Physics_pp_May2016, 0x1600
Now if we want to make a new set of TCKs with the 0x1600 L0 TCK, we would use the keys 0x112a1600 and 0x212a1600. (For more details on the TCKsh functions, see this page.)

Now you are ready to create and test the TCKs. First, create the Moore environment. If you need to check out versions of packages that are different from the Moore release, then you will need to do an lb-dev. The following is an example with Moore v25r2.

lb-dev Moore v25r2
cd MooreDev_v25r2
# getpack XYZ if needed
make purge
make -j 8 install
If you don't need any package updates, then, in the following you could replace all "./run" with "lb-run Moore v25r2"

The scripts to create and test the Hlt TCKs live in the Hlt/Moore package under tests/options/TCK/ You can see them e.g. with

./run ls '$MOOREROOT/tests/options/TCK' 
You will need to edit these scripts, so copy them locally
cp `./run echo '$MOOREROOT'`/tests/options/TCK/* .  ## for some reason I can't just do ./run cp '$MOOREROOT/tests/options/TCK/*' .
ways check the following items in
  • Do you have the correct ThresholdSettings?
  • Do you have the correct L0TCK?
  • Your proposed new TCK numbers are correct
  • The config label for the TCKs are sensible and meaningful

First we need to prepare the input data. The starting point is a small sample of real data events which is selected such that all HLT lines get to their next to last algorithm. It is currently at

Now, we need to process these data with the correct L0 TCK (0x1600 in this example).

You can run it with

./run 2>&1 | tee RedoL0.log
It should produce a file RedoL0.mdf, which will be the input to the next step.

The next step is to use the output .mdf from to create the HLT configuration using You need to make sure that the script points at the correct input data

Also pay particular attention to Moore().ThresholdSettings, Moore().ConfigLabel and the L0TCK. Now you should be ready to run
./run 2>&1 | tee CreateTCK1.log
This should create a directory TCKData containing a file, config.cdb If there is an issue with this, or any subsequent step, it is safest to delete the config.cdb file, fix the problems and start again. Pay attention and report all ERRORs and any WARNINGs that you are unsure of to the corresponding JIRA task. Now you need to map the configuration to a TCK number. You need to get the id from the log file, e.g. like this
ID=`cat CreateTCK1.log | grep HltGenConfig | grep "top id for this config" | cut -d ":" -f 2 | xargs`
And then feed this ID to the script, together with the your proposed TCK number (see above).
./run python ${ID} 0x112a1600 2>&1 | tee CreateTCKEntry1.log
The next step is to test that we can actually run from this TCK. Have a look at, and check that the input data is the same as in The following will run Moore in Split="Hlt1" with your newly
./run 2>&1 | tee TestTCK1.log
This should produce an output .mdf file called TestTCK1.mdf. We can use this file as input to produce the Hlt2 TCK. Take a look at, and, and make sure that the settings are correct. In particular:
  • and should take TestTCK1.mdf as their input data
  • should set the appropriate L0TCK and the ConfigLabel for the TCK should be sensible.
Now you should be able to run the remaining steps in one go
./run 2>&1 | tee CreateTCK2.log
ID=`cat CreateTCK2.log | grep HltGenConfig | grep "top id for this config" | cut -d ":" -f 2 | xargs`
TCK2=0x212F1600 ${ID} ${TCK2} 2>&1 | tee CreateTCKEntry2.log
./run 2>&1 | tee TestTCK2.log
Once you are comfortable with all of the above, you can of course wrap all the steps in one script, in case you need to redo the procedure, e.g. to pick up some package updates or other changes.

We could now add the new TCKs to the config.cdb in the TCK/HltTCK package, but first, we should

  • Share and discuss the log files, and warnings, errors etc... with the experts
  • Diffs with previous TCKs should be circulated for review by the trigger WG liaisons

Finally, you will want to copy these TCKs into the config.cdb in the TCK/HltTCK package. Here is an example. Checkout the head of TCK/HltTCK

from TCKUtils.utils import *
source_cas = ConfigAccessSvc("ConfigAccessSvcSource", File = 'TCKData/config.cdb') ## copy the new entries from here
target_cas = ConfigAccessSvc("ConfigAccessSvcTarget", File = 'TCK/HltTCK/config.cdb', Mode = 'ReadWrite') ## into here

# either of these would work
for source in ("0x*12a1600"):
#for source in (0x112a1600,0x212a1600):
    glob = 'TCK/0x%08x' % source if type(source) == int else "TCK/" + source
    copy(source = source_cas, target = target_cas, glob = glob)
Run like this (currently need to use the nightly since we need some features in TCKUtils that are newer than Moore v25r2). Or you could getpack Hlt/TCKUtils head and rebuild, and then just use ./run.
lb-run --nightly lhcb-head TUE Moore HEAD python

Creating unsplit HLT TCKS prior to 2016

HLT piquets should go to the instructions for producing split TCKs for 2016 datataking

Creating a private TCK

To keep this tutorial simple and complete a separate config.tar file is used to store the private TCK, but the same steps apply when using config.tar from the TCK/HltTCK package.

The first thing which needs to be done is to ensure that a ThresholdSettings is available which contains all of the required features. This will generally involve getpacking Hlt/HltSettings, Hlt/Hlt{1,2}Lines and sometimes other packages and making the required changes. This is assumed to be completed and the settings are assumed to be named PrivateThresholdSettings.

Setting up the environment

Start by setting up the cmt environment for Moore and creating an empty file in which the TCK(s) will be stored; this needs to be done only once. A template script to use is attached as; save it somewhere and modify it to suit the input MC DST you want to use. Make sure that the database tags and datatype are correct.
$> SetupProject --build-env Moore v24r0
$> cd $User_release_area/Moore_v24r0
$> mkdir TCKData
$> cp /path/to/

Make sure that the TCKData property in the script points to the directory you just created.

Create the TCK

Logout and log back in (or create a new shell), make sure that the modified threshold settings and other packages which contain the changes you require are properly installed and run the script.
$> SetupProject Moore v24r0
$> cd $User_release_area/Moore_v24r0

You should now have the TCK dumped in a config.cdb file in the TCKData directory. If something goes wrong, delete the TCKData directory, make it again, fix the problem and run again.

Mapping the configuration to a TCK.

The following steps require the use of TCKsh; you can stay in the same shell.

To prevent possible confusion and errors, It is vital that you select a unique and unused TCK for your configuration. To see which TCKs are already in use, start TCKsh and look at the configurations. Search for the latest Moore version and find the highest TCK.

$> TCKsh
>>> listConfigurations()
>>> quit()

Once you have found a suitable TCK, it is time to map your configuration to it. Below 0x00900032 is used.

$> TCKsh
>>> cas_rw = ConfigAccessSvc( Mode = 'ReadWrite', File='/path/to/config.cdb' )
>>> printConfigurations( getConfigurations( cas = cas_rw ) )
starting appMgr @ pid = 720
          <NONE> : 24e17751af7447fed73ec35b108218b6 : Test TCK
>>> id = '24e17751af7447fed73ec35b108218b6'
>>> createTCKEntries( { 0x00900032 : id }, cas = cas_rw )
creating mapping TCK: 0x00900032 -> ID: 24e17751af7447fed73ec35b108218b6
>>> quit()

The private TCK 0x00900032 is now created and stored in your own config.tar

Modifying a private TCK.

Instead of creating a new TCK from scratch, it can be easier, safer and faster to create a new TCK by modifying an existing one. This is described on the HLTTCK page.

Creating a DST using a private TCK

Once the private TCK has been generated, Moore needs to be run on the input DST using the private TCK.

The following lines insure the available TCKs are read from your private file:

from Configurables import ConfigCDBAccessSvc
ConfigCDBAccessSvc().File = 'config.cdb'

A template script is attached as; save it somewhere.

$> SetupProject Moore v12r7
$> cd $User_release_area/Moore_v12r7/scripts
$> cp

Running DaVinci on your DST with private TCK

Once the DST has been created, DaVinci can be run on it, but it needs to be told where to find the private TCK. This is done by adding the following options to the script:
from Configurables import ConfigAccessSvc
ConfigAccessSvc().File = '/path/to/your/config.tar'

Topic attachments
I Attachment History Action Size Date Who CommentSorted ascending
Texttxt r1 manage 0.6 K 2015-07-31 - 14:04 UnknownUser  
Texttxt r3 r2 r1 manage 0.8 K 2014-10-30 - 08:56 UnknownUser  
Texttxt r1 manage 0.8 K 2014-10-30 - 08:57 UnknownUser  
Texttxt r3 r2 r1 manage 1.9 K 2014-10-30 - 08:52 UnknownUser Script to generate a private TCK

This topic: LHCb > WebHome > LHCbTCK > PrivateTCK
Topic revision: r16 - 2016-04-28 - unknown
This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback