Belle II Software development
|
Helper class for performing up- and downloads of SoftwareTriggerCuts from the database. More...
#include <SoftwareTriggerDBHandler.h>
Public Member Functions | |
SoftwareTriggerDBHandler (const std::string &baseIdentifier) | |
Use the default constructor (needed as we delete the copy constructor) | |
void | initialize () |
Download the trigger menu and afterwards the cuts with the given base name and specific names from the database and register them here. | |
void | checkForChangedDBEntries () |
Helper function to check for changes in the DB of all cuts registered in the initialize function. | |
const std::map< std::string, std::unique_ptr< const SoftwareTriggerCut > > & | getCutsWithNames () const |
Get the already downloaded list of constant cuts with their identifiers. | |
bool | getAcceptOverridesReject () const |
Return true of the trigger menu is in accept mode. | |
Static Public Member Functions | |
static std::unique_ptr< SoftwareTriggerCut > | createCutFromDB (const DBRepresentationOfSoftwareTriggerCut &dbCut) |
Helper factory function to generate a unique cut pointer from its representation in the database. | |
static std::string | makeFullCutName (const std::string &baseCutIdentifier, const std::string &cutIdentifier) |
Helper function to compile the full identifier from the base and the specific cut name. | |
static std::string | makeTotalResultName (const std::string &baseIdentifier="all") |
Handy function to create the name related to the total result of a specific trigger stage (either filter or skim) in the stored results or the total result. | |
static std::string | makeFullTriggerMenuName (const std::string &baseIdentifier) |
Helper function to compile the full menu identifier from the base name. | |
static bool | hasBaseIdentifier (const std::string &cutName, const std::string &baseIdentifier) |
Check if a given cut name in the form <package_identifier>&<base_name>&<cut_name> has the given base name. | |
static void | upload (const std::unique_ptr< SoftwareTriggerCut > &cut, const std::string &baseCutIdentifier, const std::string &cutIdentifier, const IntervalOfValidity &iov) |
Upload a new (or replace an old version) cut with the given base and specific name. | |
static void | uploadTriggerMenu (const std::string &baseCutIdentifier, const std::vector< std::string > &cutIdentifiers, bool acceptMode, const IntervalOfValidity &iov) |
Upload a new (or replace an old version) trigger menu with the given base and specific names. | |
static std::unique_ptr< SoftwareTriggerCut > | download (const std::string &baseCutIdentifier, const std::string &cutIdentifier) |
Download a cut from the database. | |
static std::unique_ptr< SoftwareTriggerMenu > | downloadTriggerMenu (const std::string &baseCutIdentifier) |
Download a trigger menu from the database. | |
Static Public Attributes | |
static const std::string | s_dbPackageIdentifier = "software_trigger_cut" |
Common prefix to identify all software trigger cuts in the database. | |
static const std::string | s_totalResultIdentifier = "total_result" |
Common suffix to identify all total results in the stored results. | |
Private Member Functions | |
SoftwareTriggerDBHandler (const SoftwareTriggerDBHandler &rhs)=delete | |
Delete the copy constructor. | |
SoftwareTriggerDBHandler & | operator= (SoftwareTriggerDBHandler &rhs)=delete |
Delete the assignment constructror. | |
Private Attributes | |
std::string | m_baseIdentifier = "" |
Base identifier. | |
DBObjPtr< SoftwareTriggerMenu > | m_softwareTriggerMenu |
Database entry of the software trigger menu. | |
std::vector< DBObjPtr< DBRepresentationOfSoftwareTriggerCut > > | m_databaseObjects |
Database entries of the cuts, which where created in the initialize function. | |
std::map< std::string, std::unique_ptr< const SoftwareTriggerCut > > | m_cutsWithIdentifier |
Map of cuts with their identifiers, downloaded from the database. | |
Helper class for performing up- and downloads of SoftwareTriggerCuts from the database.
In the typical module setup, you would create an instance of this class as a module member, call the initialize function with the cuts you want to process in the module's initialize method and look for changed DB entries in the beginRun function.
In the normal event function of the module, you can get a list of cuts with their names by calling the getCutsWithNames method.
You can also upload new cuts (or new versions of cuts) with the upload function.
In all download and upload methods, you have to provide both a base name and a specific name for the cut. Both names are used (together with a package name) to construct the identifier of the cut (using the getFullCutName method). You can only download cuts from the same set (defined with the same base name), to not mix e.g. level3 and hlt cuts.
Definition at line 38 of file SoftwareTriggerDBHandler.h.
|
inlineexplicit |
Use the default constructor (needed as we delete the copy constructor)
Definition at line 128 of file SoftwareTriggerDBHandler.h.
void checkForChangedDBEntries | ( | ) |
Helper function to check for changes in the DB of all cuts registered in the initialize function.
Definition at line 104 of file SoftwareTriggerDBHandler.cc.
|
static |
Helper factory function to generate a unique cut pointer from its representation in the database.
Was part of the DBRepresentation before, but is now a standalone function.
Definition at line 22 of file SoftwareTriggerDBHandler.cc.
|
static |
Download a cut from the database.
This function should only be called from python to interact with/edit single cuts and not from your module to check the cuts (use the initialize method etc. for this).
baseCutIdentifier | The base name of the cut to download. |
cutIdentifier | The identifier of the cut to download. |
Definition at line 80 of file SoftwareTriggerDBHandler.cc.
|
static |
Download a trigger menu from the database.
This function should only be called from python to interact with/edit single menus and not from your module to check the cuts (use the initialize method etc. for this).
baseCutIdentifier | The base name of the trigger menu to download. |
Definition at line 93 of file SoftwareTriggerDBHandler.cc.
bool getAcceptOverridesReject | ( | ) | const |
Return true of the trigger menu is in accept mode.
Definition at line 149 of file SoftwareTriggerDBHandler.cc.
const std::map< std::string, std::unique_ptr< const SoftwareTriggerCut > > & getCutsWithNames | ( | ) | const |
Get the already downloaded list of constant cuts with their identifiers.
Definition at line 154 of file SoftwareTriggerDBHandler.cc.
|
static |
Check if a given cut name in the form <package_identifier>&<base_name>&<cut_name> has the given base name.
Definition at line 50 of file SoftwareTriggerDBHandler.cc.
void initialize | ( | ) |
Download the trigger menu and afterwards the cuts with the given base name and specific names from the database and register them here.
When calling the checkForChangedDBEntries, these cuts will be checked for changes.
To get the cuts with their identifiers, call the getCutsWithNames function.
Definition at line 122 of file SoftwareTriggerDBHandler.cc.
|
static |
Helper function to compile the full identifier from the base and the specific cut name.
The full name is then created as: <package_identifier>&<base_name>&<cut_name>
Make sure to not include & into the base or cut name.
Definition at line 29 of file SoftwareTriggerDBHandler.cc.
|
static |
Helper function to compile the full menu identifier from the base name.
The full name is then created as: <package_identifier>&<base_name>
Make sure to not include & into the base name.
Definition at line 43 of file SoftwareTriggerDBHandler.cc.
|
static |
Handy function to create the name related to the total result of a specific trigger stage (either filter or skim) in the stored results or the total result.
It is in the form <package_identifier>&<base_name>&total_result
baseIdentifier | The baseIdentifier (either filter or skim or all) |
Definition at line 38 of file SoftwareTriggerDBHandler.cc.
|
static |
Upload a new (or replace an old version) cut with the given base and specific name.
Neither the base nor the cut name are allowed to have '&' in it. Please make sure that the base name must correspond to the identifiers of the calculation objects created in the SoftwareTriggerModule.
Definition at line 58 of file SoftwareTriggerDBHandler.cc.
|
static |
Upload a new (or replace an old version) trigger menu with the given base and specific names.
Neither the base nor the cut names are allowed to have '&' in it. Please make sure that the base name must correspond to the identifiers of the calculation objects created in the SoftwareTriggerModule and the cut names must correspond to cuts uploaded into the database.
Definition at line 69 of file SoftwareTriggerDBHandler.cc.
|
private |
Base identifier.
Definition at line 161 of file SoftwareTriggerDBHandler.h.
|
private |
Map of cuts with their identifiers, downloaded from the database.
Definition at line 167 of file SoftwareTriggerDBHandler.h.
|
private |
Database entries of the cuts, which where created in the initialize function.
Definition at line 165 of file SoftwareTriggerDBHandler.h.
|
private |
Database entry of the software trigger menu.
Definition at line 163 of file SoftwareTriggerDBHandler.h.
|
static |
Common prefix to identify all software trigger cuts in the database.
Definition at line 41 of file SoftwareTriggerDBHandler.h.
|
static |
Common suffix to identify all total results in the stored results.
Definition at line 43 of file SoftwareTriggerDBHandler.h.