Skip to content

bbtt: replaced booleans by enum based map of booleans

Jonathan Pampel requested to merge jpampel/easyjet-local:BooleanRestructure into main

A lot of booleans are defined in the .h-file, some, but not all of them, are saved into the output. To add a boolean to the output, one has to add a string to the list m_Bvarnames, declare said boolean and save its value in the list m_Bbranches of SysWriteDecorHandles, using its name as index. My main reason for changing this is that in order to build a reasonable cutflow algorithm, I need an easy way to access these booleans at the same time as their name.

The changes made here shall fulfill the purpose of easing this process. With the changes, all booleans that were previously initialized in the .h-file (in contrast to those initialized in the .cxx file) have been put into an enum based unordered map of booleans m_bools. At the same time, an unordered map of strings m_boolnames with the same keys is created, containing the boolean names. In order to declare a new boolean, one now needs to add one enum value to enum Booleans and to add a line specifying the name in m_boolnames.

With this, a cutflow can be made by specifying a vector containing strings that are in m_boolnames. Also, the saving of the values into m_Bbranches is now done in a loop at the end of the execute() function.

The disadvantage of this approach is that instead of directly accessing a boolean with something like the following, if (boolean) { do whatever } the map of booleans needs to be accessed like this: if (m_bools.at(HHBBTT::boolean)) { do whatever }

One missing change is the implementation of weights in the cutflow, since the main easyjet framework does not support this feature yet.

Edited by Jonathan Pampel

Merge request reports