-- AskEmilJensen - 2009-08-28

ByteStream mapping

Introduction

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.py
  • xml_diff_comic1to2.py
  • dumpCTP_0.95.py
  • ctpid_printer_0.2.py

xml_diff

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.

xml_diff_cosmic1to2

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

dumpCTP

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

ctpid_printer is a small program that takes a ByteStream datafile and prints the level 1 identifier, level 1 TriggerType and the CTPIDs of the triggers that fired in the events - both before and after prescale and after veto. If provided with a TriggerMenu file (XML), it will paste the trigger names defined in the TriggerMenu.

Usage

xml_diff

The program is run by typing: python xml_diff.py <!OldTriggerMenuFile> <!NewTriggerMenuFile> Agruments
  • -a: "all" - gives errors and warning as both files and as output in terminal.
  • -s: "simple" - only writes errors and warnings to a file without printing to terminal.
  • -sv: "same version" - for files of same version, as this avoids some false errors that otherwise show up when comparing files from same version.

The created files:

  • ctpidmap.py:
    • A pyton file with a dictionary of the ctpid mapping and triggernames as comments and a map of triggertypes.
  • errors.dat:
    • Triggers from both files that have NOTHING in common
  • warnings.dat:
    • Triggers were BGRP 0/1 was mapped to BGRP 0 and BPTX 0/1

dumpCTP

The program is run by typing: python dumpCTP.py < Input ByteStream file> ctpidmap ByteStream file>, where ctiidmap is the ctpidmap.py made by xml_diff.py OBS. If you need to change the TriggerType mapping do this manually in the triggermap dictionary in ctpidmap.py before running dumpCTP or in xml_diff.py.

ctpid_printer

The program is run with: ctpid_printer.py < Input BS file> ( <menu-file.xml> ) The last argument ( <menu-file.xml> ) can be provided to return TriggerNames as well.

-- AskEmilJensen - 2009-08-28 -- MortenBadensoe - 2009-08-28


This topic: Sandbox > WebHome > WebTopicList > AskEmilJensen
Topic revision: r3 - 2009-08-28 - AskEmilJensen
 
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