Belle II Software development
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
46 m_timingPrefilter.LERtimeSinceLastInjectionMin = m_hltPrefilterParameters->getLERtimeSinceLastInjectionMin();
47 m_timingPrefilter.LERtimeSinceLastInjectionMax = m_hltPrefilterParameters->getLERtimeSinceLastInjectionMax();
48 m_timingPrefilter.HERtimeSinceLastInjectionMin = m_hltPrefilterParameters->getHERtimeSinceLastInjectionMin();
49 m_timingPrefilter.HERtimeSinceLastInjectionMax = m_hltPrefilterParameters->getHERtimeSinceLastInjectionMax();
50 m_timingPrefilter.LERtimeInBeamCycleMin = m_hltPrefilterParameters->getLERtimeInBeamCycleMin();
51 m_timingPrefilter.LERtimeInBeamCycleMax = m_hltPrefilterParameters->getLERtimeInBeamCycleMax();
52 m_timingPrefilter.HERtimeInBeamCycleMin = m_hltPrefilterParameters->getHERtimeInBeamCycleMin();
53 m_timingPrefilter.HERtimeInBeamCycleMax = m_hltPrefilterParameters->getHERtimeInBeamCycleMax();
54 m_timingPrefilter.prescale = m_hltPrefilterParameters->getHLTPrefilterPrescale();
55
56 // Parameters for HLTPrefilter in CDCECL state
57 m_cdceclPrefilter.nCDCHitsMax = m_hltPrefilterParameters->getCDCHitsMax();
58 m_cdceclPrefilter.nECLDigitsMax = m_hltPrefilterParameters->getECLDigitsMax();
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
78 m_decisions[TimingCut] = m_timingPrefilter.computeDecision();
79
81 m_decisions[CDCECLCut] = m_cdceclPrefilter.computeDecision();
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.
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
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:649
Abstract base class for different kinds of events.