Belle II Software development
EventsOfDoomBusterModule.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/* Own header. */
10#include <reconstruction/modules/EventsOfDoomBuster/EventsOfDoomBusterModule.h>
11
12/* Basf2 headers. */
13#include <framework/logging/Logger.h>
14
15using namespace Belle2;
16
17REG_MODULE(EventsOfDoomBuster);
18
20{
21 setDescription(R"DOC(
22Module that flags an event destined for doom at reconstruction,
23* based on the size of selected hits/digits containers after the unpacking.
24* This is meant to be registered in the path *after* the unpacking, but *before* reconstruction.
25)DOC");
26
28}
29
31
33{
34 m_eventInfo.isRequired();
35 m_cdcHits.isOptional();
36 m_svdShaperDigits.isOptional();
37}
38
40{
41 if (!m_eventsOfDoomParameters.isValid())
42 B2FATAL("EventsOfDoom parameters are not available.");
43 m_nCDCHitsMax = m_eventsOfDoomParameters->getNCDCHitsMax();
44 m_nSVDShaperDigitsMax = m_eventsOfDoomParameters->getNSVDShaperDigitsMax();
45}
46
48{
49 const uint32_t nCDCHits = m_cdcHits.isOptional() ? m_cdcHits.getEntries() : 0;
50 const uint32_t nSVDShaperDigits = m_svdShaperDigits.isOptional() ? m_svdShaperDigits.getEntries() : 0;
51
52 B2DEBUG(20, "Event: " << m_eventInfo->getEvent() << " - nCDCHits: " << nCDCHits << ", nSVDShaperDigits: " << nSVDShaperDigits);
53
54 const bool doomCDC = nCDCHits > m_nCDCHitsMax;
55 const bool doomSVD = nSVDShaperDigits > m_nSVDShaperDigitsMax;
56
57 if (doomCDC) {
58 B2ERROR("Skip event --> Too much occupancy from CDC for reconstruction!" <<
59 LogVar("event", m_eventInfo->getEvent()) <<
60 LogVar("run", m_eventInfo->getRun()) <<
61 LogVar("exp", m_eventInfo->getExperiment()) <<
62 LogVar("nCDCHits", nCDCHits) <<
63 LogVar("nCDCHitsMax", m_nCDCHitsMax));
64 }
65
66 if (doomSVD) {
67 B2ERROR("Skip event --> Too much occupancy from SVD for reconstruction!" <<
68 LogVar("event", m_eventInfo->getEvent()) <<
69 LogVar("run", m_eventInfo->getRun()) <<
70 LogVar("exp", m_eventInfo->getExperiment()) <<
71 LogVar("nSVDShaperDigits", nSVDShaperDigits) <<
72 LogVar("nSVDShaperDigitsMax", m_nSVDShaperDigitsMax));
73 }
74
75 setReturnValue(doomCDC or doomSVD);
76}
virtual ~EventsOfDoomBusterModule() final
Default Destructor.
uint32_t m_nCDCHitsMax
The max number of CDC hits for an event to be kept for reconstruction.
void initialize() final
Module initializer.
void beginRun() final
Called when entering a new run.
uint32_t m_nSVDShaperDigitsMax
The max number of SVD shaper digits for an event to be kept for reconstruction.
StoreObjPtr< EventMetaData > m_eventInfo
Event Meta Data Store ObjPtr.
void event() final
Flag each event.
DBObjPtr< EventsOfDoomParameters > m_eventsOfDoomParameters
EventsOfDoomParameters Database OjbPtr.
StoreArray< SVDShaperDigit > m_svdShaperDigits
SVDShaperDigits StoreArray.
StoreArray< CDCHit > m_cdcHits
CDCHits StoreArray.
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.