Belle II Software development
SoftwareTriggerModule.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#pragma once
10
11#include <framework/core/Module.h>
12
13#include <hlt/softwaretrigger/calculations/SoftwareTriggerCalculation.h>
14#include <mdst/dataobjects/SoftwareTriggerResult.h>
15#include <hlt/softwaretrigger/core/SoftwareTriggerDBHandler.h>
16
17#include <stdint.h>
18#include <string>
19#include <vector>
20
21namespace Belle2 {
26 namespace SoftwareTrigger {
60 public:
63
65 virtual ~SoftwareTriggerModule() = default;
66
68 void initialize() override;
69
71 void event() override;
72
74 void beginRun() override;
75
77 void terminate() override;
78
79 private:
80 // Parameters
82 std::string m_param_baseIdentifier = "";
90 std::string m_param_debugOutputFileName = "software_trigger_debug.root";
95
96 // Object pools
100 std::unique_ptr<SoftwareTriggerDBHandler> m_dbHandler;
102 std::unique_ptr<SoftwareTriggerCalculation> m_calculation;
104 std::unique_ptr<TFile> m_debugOutputFile;
106 std::unique_ptr<TTree> m_debugTTree;
109
111 std::vector<uint32_t> m_counters;
112
116
120
122 void initializeCounters();
123
125 void makeCut(const SoftwareTriggerObject& prefilledObject);
126
128 void makeDebugOutput();
129 };
130 }
132}
Base class for Modules.
Definition: Module.h:72
Module to perform cuts on various variables in the event.
virtual ~SoftwareTriggerModule()=default
default virtaual constructor because this is a derived class using virtual methods
bool m_param_useRandomNumbersForPreScale
Flag to use random numbers or a counter for applying a prescale.
unsigned int m_param_preScaleStoreDebugOutputToDataStore
Prescale with which to save the results of the calculations into the DataStore.
std::string m_param_baseIdentifier
Base identifier for all cuts downloaded from database.
std::unique_ptr< SoftwareTriggerDBHandler > m_dbHandler
Internal handler object for the DB interface.
void initializeDebugOutput()
Helper function to initliaze debug output creation by creating a TTree and an object in the data stor...
std::string m_param_resultStoreArrayName
Store Object Pointer name for storing the trigger decision.
void initialize() override
Initialize/Require the DB object pointers and any needed store arrays.
std::string m_param_debugOutputStoreObjName
Output store object name for the debug output. Is only used if debug is turned on.
void makeCut(const SoftwareTriggerObject &prefilledObject)
Helper function to perform the actual cut on the prefilled object and set the return value of the mod...
void event() override
Run over all cuts and check them. If one of the cuts yields true, give a positive return value of the...
void terminate() override
Store and delete the ttree if it was created.
std::unique_ptr< SoftwareTriggerCalculation > m_calculation
Internal handler for the Calculations (will be set in initialize to the correct one).
void beginRun() override
Check if the cut representations in the database have changed and download newer ones if needed.
std::vector< uint32_t > m_counters
Vector of the internal counters used to apply a prescale.
void initializeCalculation()
Helper function to initialize the calculation by creating a new calculation object and requiring all ...
bool m_param_storeDebugOutputToROOTFile
Flag to also store the result of the calculations into a root file.
SoftwareTriggerModule()
Create a new module instance and set the parameters.
void makeDebugOutput()
Helper function to store the calculated variables from the calculation either in the TTree or in the ...
std::string m_param_debugOutputFileName
Output file name for the debug output. Is only used if debug is turned on.
void initializeCounters()
Helper function to initialize the internal counters used for each cut identifier.
StoreObjPtr< SoftwareTriggerResult > m_resultStoreObjectPointer
Store Object for storing the trigger decision.
std::unique_ptr< TFile > m_debugOutputFile
TFile to store the debug TTree (or a nullptr if we do not save the debug output).
std::unique_ptr< TTree > m_debugTTree
TTree to store the debug output (or a nullptr if we do not save the debug output).
StoreObjPtr< SoftwareTriggerVariables > m_debugOutputStoreObject
TTree living in the datastore for debug reasons.
Type-safe access to single objects in the data store.
Definition: StoreObjPtr.h:96
Abstract base class for different kinds of events.