Belle II Software release-09-00-07
HLTPrefilterModule.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 <hlt/modules/HLTPrefilter/HLTPrefilterModule.h>
10#include <hlt/dbobjects/HLTPrefilterParameters.h>
11
12#include <framework/dataobjects/EventMetaData.h>
13#include <framework/logging/Logger.h>
14#include <mdst/dataobjects/TRGSummary.h>
15
16using namespace Belle2;
17
18REG_MODULE(HLTPrefilter);
19
20// -------------------- HLTPrefilterModule --------------------
22{
23 // Set module properties
24 setDescription(R"DOC(
25This module filters the injection background based on predefined selections.
26* This is meant to be registered in the path *after* the unpacking, but *before* HLT processing.
27)DOC");
28
30}
31
33
35{
36 m_eventInfo.isRequired();
37 m_trgSummary.isOptional();
38}
39
41{
42 if (!m_hltPrefilterParameters.isValid())
43 B2FATAL("HLTPrefilter parameters are not available.");
44
45 // Parameters for HLTPrefilter in timing state
54 m_timingPrefilter.prescale = m_hltPrefilterParameters->getHLTPrefilterPrescale();
55
56 // Parameters for HLTPrefilter in CDCECL state
59 m_cdceclPrefilter.prescale = m_hltPrefilterParameters->getHLTPrefilterPrescale();
60
61 // Get prefilter state (cut on timing/CDC-ECL occupancy) for operation
62 m_HLTPrefilterState = static_cast<HLTPrefilterState>(m_hltPrefilterParameters->getHLTPrefilterState());
63}
64
66{
67 bool inActiveInjectionVeto = false;
68 try {
69 if (m_trgSummary->testInput("passive_veto") == 1 && m_trgSummary->testInput("cdcecl_veto") == 0)
70 inActiveInjectionVeto = true;
71 } catch (const std::exception&) {}
72
73 m_decisions.clear();
74
75 if (inActiveInjectionVeto) {
76
79
82
83 }
84
85 // Logging
86 if (m_decisions[TimingCut])
87 B2ERROR("Skip event --> HLTPrefilter tagged this event to be from injection strips" <<
88 LogVar("event", m_eventInfo->getEvent()) <<
89 LogVar("run", m_eventInfo->getRun()) <<
90 LogVar("exp", m_eventInfo->getExperiment()));
91
92 if (m_decisions[CDCECLCut])
93 B2ERROR("Skip event --> HLTPrefilter tagged this event with high CDC-ECL occupancy" <<
94 LogVar("event", m_eventInfo->getEvent()) <<
95 LogVar("run", m_eventInfo->getRun()) <<
96 LogVar("exp", m_eventInfo->getExperiment()));
97
98 // Return only the prefilter condition set by the parameter
99 if (m_HLTPrefilterState == TimingCut)
100 setReturnValue(m_decisions[TimingCut]);
101 else if (m_HLTPrefilterState == CDCECLCut)
102 setReturnValue(m_decisions[CDCECLCut]);
103}
virtual ~HLTPrefilterModule() final
Default Destructor.
HLTPrefilterModule()
Module constructor.
void initialize() final
Module initializer.
void beginRun() final
Called when entering a new run.
StoreObjPtr< TRGSummary > m_trgSummary
Trigger summary Store ObjPtr.
StoreObjPtr< EventMetaData > m_eventInfo
Event Meta Data Store ObjPtr.
void event() final
Flag each event.
HLTPrefilterState
enumeration for HLTPrefilter state
HLTPrefilterState m_HLTPrefilterState
Instance for prefilter cut state.
DBObjPtr< HLTPrefilterParameters > m_hltPrefilterParameters
HLTprefilterParameters Database OjbPtr.
std::map< HLTPrefilterState, bool > m_decisions
Decision results.
HLTPrefilter::TimingCutState m_timingPrefilter
Helper instance for timing based prefilter.
HLTPrefilter::CDCECLCutState m_cdceclPrefilter
Helper instance for CDC-ECL occupancy based prefilter.
uint32_t nECLDigitsMax
Maximum threshold for ECL Digits.
Definition: HLTPrefilter.h:113
uint32_t nCDCHitsMax
Define thresholds for variables.
Definition: HLTPrefilter.h:111
unsigned int prescale
Prescale for accepting HLTPrefilter lines, by default we randomly accept 1 out of every 1000 events.
Definition: HLTPrefilter.h:115
double LERtimeSinceLastInjectionMin
Define thresholds for variables.
Definition: HLTPrefilter.h:46
double HERtimeInBeamCycleMax
Maximum threshold of timeInBeamCycle for LER injection.
Definition: HLTPrefilter.h:60
double HERtimeSinceLastInjectionMin
Minimum threshold of timeSinceLastInjection for HER injection.
Definition: HLTPrefilter.h:50
double HERtimeSinceLastInjectionMax
Maximum threshold of timeSinceLastInjection for HER injection.
Definition: HLTPrefilter.h:52
double LERtimeSinceLastInjectionMax
Maximum threshold of timeSinceLastInjection for LER injection.
Definition: HLTPrefilter.h:48
double HERtimeInBeamCycleMin
Minimum threshold of timeInBeamCycle for HER injection.
Definition: HLTPrefilter.h:58
double LERtimeInBeamCycleMax
Maximum threshold of timeInBeamCycle for LER injection.
Definition: HLTPrefilter.h:56
unsigned int prescale
Prescale for accepting HLTPrefilter lines, by default we randomly accept 1 out of every 1000 events.
Definition: HLTPrefilter.h:62
double LERtimeInBeamCycleMin
Minimum threshold of timeInBeamCycle for LER injection.
Definition: HLTPrefilter.h:54
Base class for Modules.
Definition: Module.h:72
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
void setReturnValue(int value)
Sets the return value for this module as integer.
Definition: Module.cc:220
@ 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
Class to store variables with their name which were sent to the logging service.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:650
Abstract base class for different kinds of events.