-- AskEmilJensen - 2009-08-28

ByteStream mapping


The following describes scripts made to map ATLAS ByteStream files from one TriggerMenu to another TriggerMenu. The mapping will change CTPID and TriggerType in both the ROBFragment and the FullEventFragment accordingly.

It consist of four different scripts:

  • xml_diff_v1.1.py
  • xml_diff_v1.1._comic1to2.py
  • DumpCTP_0.95.py
  • ctpid_printer_0.2.py


This script does a CTPID mapping, mapping the CTPID's from the one TriggerMenu to another TriggerMenu. The mapping is done using XML TriggerMenu files, finding the differences between the two menus and generating a python dictionary with the CTPID map in a python file named ctpidmap.py. Furthermore a dictionary for the TriggerType mapping is written in the same file. This has to be modified manually.

There are options to compare both TriggerMenus from the same and from different TriggerMenuVersions.


The cosmic1to2 is a version specific for mapping between version 1 and version 2 of the cosmic TriggerMenus.


The DumpCTP changes the actual ByteStream files. As input it takes a ByteStream file and the ctpmap.py generated by xml_diff with the relevant TriggerMenus.

The program uses the EventFormat, EventApps and EventStorage (libpyevent_storage) in order to change the CTPIDs and TriggerTypes as stated in the ctpidmap generated with xml_diff.

Specifics of the ByteStreamFile mapping

The mapping of CTPIDs and TriggerTypes will be done in the FullEventFragment and the ROBFragment.

In the FullEventFragment of the binary ByteStream file the CTPIDs are stored in the class 'lvl1_trigger_info()' as a 24bit string(?) where the first 8 words are the CTPIDs before prescale, the next 8 are the CTPIDs after prescale, and the last 8 words are the CTPIDs after veto. The words are a binary representation of a list of decimal numbers - the actual CTPIDs.

  • Example from a 8bit string; [192,0,0,0,0,0,0,0] gives the CTPIDs [6,7] (2**6+2**7 = 192)

After having translated into decimal numbers, the mapping is done, and the CTPIDs is again transformed into the binary representation which is stored in the new datafile. This will be written after all events in the ByteStream file have been processed.

The same procedure is done for the TriggerTypes - taking the dictionary (triggermap) from the ctpidmap file and mapping it accordingly.

In the ROBFragment the mapping is done in the exact same way although CTPIDs are stored in the rod_data() class, which also contains other information that are not important for the mapping. The ROBFragment is actually the really important place to do the mapping, as it is from here the level 2 triggers gets their information.

Document links

  • The ATLAS Event Format (v4.0): EDMS


ctpid_printer is a small program that takes a ByteStream datafile and prints the level1 identifier, level1 trigger type and the CTPIDs of the triggers that fired in the events - both before and after prescale and after veto. And if provided with a trigger menu file (XML), it will paste the trigger names defined in the trigger menu.
Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r1 - 2009-08-28 - AskEmilJensen
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Sandbox All webs login

  • Edit
  • Attach
This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2021 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