Data Formatter Configurations Database (FTK)


The project started with the aim to create a Data Formatter Configurations Database (DFDB). The DFDB will act as a centralized bank of configurations rather than having a myriad of individual configuration files. This will result in more flexibility and control, as well as a more natural design. A schematic of the project is shown below:


Some of the contents aimed to be stored in this database include:

  • Physical locations of the DF boards (i.e. crate number, shelf number, slot number)
  • ROB IDs
  • Module IDs and their properties
  • Active/Inactive Modules

LUT Database

The first step in the project is to create the Look Up Table (LUT) Database, which consists of transferring the LUT information from SCT and Pixel cabling services to the DFDB. A working prototype of the LUT Database has been created using the COOL API and C++.

How to use the LUT Database

The following are instructions for setting up the ATLAS software and the COOL environment on lxplus:
mkdir cool;cd cool
export AtlasSetup=/afs/
alias asetup='source $AtlasSetup/scripts/'
asetup 19.2.0,slc6,here
export BOOSTDIR=/afs/

Alternatively, the script can be used for setting up the software after calling the command mkdir cool;cd cool. To start creating the database, download CoolSchema.cpp, the header file CoolSchema.h, and to your current working directory. Compile this code using the script A help menu is displayed when running the following command:

createCoolSchema -h. 

The program can be called with the following options: -s [COOL connection string]; -d [Drop previous COOL database]; -m [Create multi-version COOL folders]; -c [Attempt to create database instead of opening]. Example for connection string:

’oracle://devdb10;schema=lcg cool;dbname=COOLTEST’

The database can be filled from Look Up Table (LUT) files, which are in ROOT format. Download and compile the code using the script By calling the following helper program the database will be filled from LUT files:

DumpLUT2DB -h

The above program takes only one parameter -s, the connection string passed to the createCoolSchema program.

Creating A Configurations Database

To create a database schema locally run the following:

createCoolSchema -d -m -s ’sqlite://none;schema=sqliteTest.db;dbname=COOLTEST’

This will generate a message:

Conditions database created:
-> Database ID:sqlite://none;schema=sqliteTest.db;dbname=COOLTEST
Create a new folder: DF
Create a new folder: IM
Create a new folder: Module
Create a new folder: ROB

Storing Configurations in the Database

Then to fill the database from a LUT.root file stored in the current working directory do:

DumpLUT2DB -s ’sqlite://none;schema=sqliteTest.db;dbname=COOLTEST’

To browse the database the helper program can be called as follows:
open ’sqlite://none;schema=sqliteTest.db;dbname=COOLTEST’
cd FtkLUT

To display all the ROB IDs in the Module folder do:

listtag Module

This will display the ROB IDs:

Listing tags for folder /FtkLUT/Module
LUT 0x111816 (unlocked) []
LUT 0x112414 (unlocked) []
LUT 0x130007 (unlocked) []
LUT 0x130010 (unlocked) []
LUT 0x130011 (unlocked) []
LUT 0x210000 (unlocked) []
LUT 0x210109 (unlocked) []
LUT 0x21010a (unlocked) []

To display the modules corresponding to a specific ROB ID, select a ROB ID first by doing:

usetag LUT 0x130007

Then the modules will be displayed after calling the command less Module:

less Module
Using tag selection:
LUT 0x130007
[0,1] (0) [onlineId (Int32) : 1245191], [hittype (Int32) : 1], [hashId ... 2015-11-26 14:49:42.077022000 GMT
[1,2] (0) [onlineId (Int32) : 34799623], [hittype (Int32) : 1], [hashI ... 2015-11-26 14:49:42.077022000 GMT
[2,3] (0) [onlineId (Int32) : 269680647], [hittype (Int32) : 1], [hash... 2015-11-26 14:49:42.077022000 GMT
[3,4] (0) [onlineId (Int32) : 303235079], [hittype (Int32) : 1], [hash... 2015-11-26 14:49:42.077022000 GMT
[4,5] (0) [onlineId (Int32) : 1645412359], [hittype (Int32) : 1], [has... 2015-11-26 14:49:42.077022000 GMT
[5,6] (0) [onlineId (Int32) : 1880293383], [hittype (Int32) : 1], [has... 2015-11-26 14:49:42.077022000 GMT
[6,7] (0) [onlineId (Int32) : 1913847815], [hittype (Int32) : 1], [has... 2015-11-26 14:49:42.077022000 GMT

For more options, enter help in the command line.

Reading Back Data

For reading back data and access specific records in the database take a look at the block of code inside

cool::IObjectIteratorPtr objs = m_mod->browseObjects(0, cool::ValidityKeyMax, cool::ChannelSelection::all());
printf("# of IOVs: %d\n", objs->size());
while (objs->goToNext()) {
      const cool::IObject& obj = objs->currentRef();
      printf( "IOV [%d, %d] channel:%d ", obj.since(), obj.until(), obj.channelId() );
      cool::IRecordIterator& recItr = obj.payloadIterator();
      while (recItr.goToNext()) {
           const cool::IRecord& p = recItr.currentRef();
           std::cout << p << std::endl;

The interface cool::IObjectIteratorPtr takes the Interval Of Validity (IOV) range as well as the channels for a set of cool::IObject instances. The interface cool::IObject encapsulates and makes available both the metadata (data item, IOV and version) and the payload of a data object. If it was desired to select only objects within a certain IOV range, the first two parameters need to change. IOV can have any meaning, for example run number, actual times when the object is valid or relevant, a Data Formatter configuration ID, etc. For more details visit the COOL Data Model page and COOL IOV page. Channels are basically avenues to express different data within the same avenue, for more details look here. Tags represent sets of IOVs in one folder and could be used as DF configuration IDs also. An example using tagging can be found here and how to store and retrieve objects using tags here. In the LUT Database prototype tags are used to associate multiple Module IDs to different ROB IDs. Folders can also be tagged. The cool::IRecord interface is used to store the payload for each individual module.

To do more specific payload queries the COOL API include files (CoolKernel) needed are:

#include "CoolKernel/FieldSelection.h"
#include "CoolKernel/CompositeSelection.h"

Let's say a query needs to be done on modules with hittype (stored as a string) "1" with IOV range 0-100, in channel 0 and no specified tag. This can be done doing the following:

FieldSelection selectSEqual("hittype", cool_StorageType_TypeId::String4k, cool_FieldSelection_Relation::EQ,
                                  (String4k) "1");
objs = m_mod->browseObjects( 0, 100, 0, "", &selectSEqual);

This class demonstrates the use of payload queries in detail.

Expanding the Data Formatter Configurations Database Schema

This is a fully functional prototype which can be expanded and customized to store any configuration information. To customize the database schema look inside CoolSchema.cpp and the header file CoolSchema.h and expand by adding new tables (folders) or data items.

For reference, a more detailed and of course complex, example in the SCT DAQ. Setting up the schema:

and using it:

Next Steps

Rewrite DF and IM Code To Incorporate Database

The next steps are to rewrite,, and FtkDfApi into one FtkDfApi_new where this new code will reference the DF Database rather than text files.

Online and Offline Access

One of the key characteristics of the Data Formatter Configurations Database is that it should be available both online and offline. This feature is currently under development. A good place to start is by referencing this useful article and especially this other article.

-- VictorHugoRuelasRivera - 2016-01-06

Topic attachments
I Attachment History Action Size Date Who Comment
C source code filecpp CoolSchema.cpp r2 r1 manage 4.0 K 2016-01-15 - 17:33 VictorHugoRuelasRivera Code where database schema is defined
Header fileh CoolSchema.h r2 r1 manage 1.8 K 2016-01-15 - 17:40 VictorHugoRuelasRivera Header file where database schema is declared
Unknown file formatcc r2 r1 manage 5.8 K 2016-01-15 - 17:46 VictorHugoRuelasRivera Source code used for filling database
PNGpng Project_DFDB_Design.png r2 r1 manage 42.4 K 2016-01-15 - 18:50 VictorHugoRuelasRivera DF Database Project Design
Unix shell scriptsh r2 r1 manage 0.7 K 2016-01-15 - 17:49 VictorHugoRuelasRivera Script to compile DumpLUT2DB source code
Unix shell scriptsh r2 r1 manage 0.8 K 2016-01-15 - 17:59 VictorHugoRuelasRivera Scripts that compiles and links the CoolSchema and createCoolSchema source code
PDFpdf conddbtag.pdf r1 manage 189.0 K 2016-01-11 - 02:25 VictorHugoRuelasRivera Article that discusses COOL folders usage online
Unknown file formatcc r1 manage 4.6 K 2016-01-15 - 18:18 VictorHugoRuelasRivera Source code used for creating the database
Unix shell scriptsh r2 r1 manage 0.8 K 2016-01-15 - 18:12 VictorHugoRuelasRivera Script to setup the ATLAS and COOL environments
Edit | Attach | Watch | Print version | History: r7 < r6 < r5 < r4 < r3 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r7 - 2016-01-15 - VictorHugoRuelasRivera
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Sandbox All webs login

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