Belle II Software development
TRGGRLInjectionVetoFromOverlayModule.cc
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#include <trg/grl/modules/TRGGRLInjectionVetoFromOverlay/TRGGRLInjectionVetoFromOverlayModule.h>
10
11using namespace Belle2;
12
13REG_MODULE(TRGGRLInjectionVetoFromOverlay);
14
16{
17 setDescription("Module for adding to MC samples the information about the TRG injection veto from "
18 "beam background overlay files.");
20 addParam("TRGGRLInfoName", m_TRGGRLInfoName, "Name of the TRGGRLInfo object", std::string("TRGGRLObjects"));
21 addParam("extensionName", m_extensionName,
22 "Name added to default branch names", std::string("_beamBG"));
23}
24
30
32{
33 if (not m_TRGInputBits.isValid())
34 B2FATAL("TRGGDLInputBits database object is not available");
35}
36
38{
39 if (!m_TRGGRLInfoFromSimulation.isValid() or !m_TRGSummaryFromOverlay.isValid())
40 return;
41 try {
42 for (const std::string& inputBitName : m_inputBitNames) {
43 // Set the relevant input lines according to what is written in the BGO event
44 const unsigned int inputBitNumber = m_TRGInputBits->getinbitnum(inputBitName.c_str());
45 const bool inputBitAnswer = m_TRGSummaryFromOverlay->testInput(inputBitName.c_str());
46 m_TRGGRLInfoFromSimulation->setInputBits(inputBitNumber, inputBitAnswer);
47 }
48 } catch (const std::exception&) {
49 // TRGSummary methods can throw out_of_range, runtime_error and invalid_argument exceptions
50 // Also: the methods already print a warning or an error before throwing the exception,
51 // so it's not necessary to report anything here: let's simply return
52 return;
53 }
54}
void setDescription(const std::string &description)
Sets the description of the module.
Definition Module.cc:214
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
Definition Module.cc:208
Module()
Constructor.
Definition Module.cc:30
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
Definition Module.h:80
StoreObjPtr< TRGGRLInfo > m_TRGGRLInfoFromSimulation
TRGGRLInfo object from MC simulation.
const std::array< std::string, 4 > m_inputBitNames
Array of L1 input bit names to overlay.
StoreObjPtr< TRGSummary > m_TRGSummaryFromOverlay
TRGSummary object from beam background overlay.
std::string m_extensionName
Extension name for branches from beam background overlay.
DBObjPtr< TRGGDLDBInputBits > m_TRGInputBits
TRGGDLInputBits database object.
void addParam(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Definition Module.h:559
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition Module.h:649
Abstract base class for different kinds of events.