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
13/* Basf2 headers. */
14#include <framework/logging/Logger.h>
15#include <svd/dataobjects/SVDShaperDigit.h>
16#include <framework/dataobjects/EventMetaData.h>
17#include <cdc/dataobjects/CDCHit.h>
18#include <reconstruction/dbobjects/EventsOfDoomParameters.h>
19
20using namespace Belle2;
21
22REG_MODULE(EventsOfDoomBuster);
23
25{
26 setDescription(R"DOC(
27Module that flags an event destined for doom at reconstruction,
28* based on the size of selected hits/digits containers after the unpacking.
29* This is meant to be registered in the path *after* the unpacking, but *before* reconstruction.
30)DOC");
31
33}
34
36
38{
39 m_eventInfo.isRequired();
40 m_cdcHits.isOptional();
41 m_svdShaperDigits.isOptional();
42}
43
45{
46 if (!m_eventsOfDoomParameters.isValid())
47 B2FATAL("EventsOfDoom parameters are not available.");
48 m_nCDCHitsMax = m_eventsOfDoomParameters->getNCDCHitsMax();
49 m_nSVDShaperDigitsMax = m_eventsOfDoomParameters->getNSVDShaperDigitsMax();
50}
51
53{
54 const uint32_t nCDCHits = m_cdcHits.isOptional() ? m_cdcHits.getEntries() : 0;
55 const uint32_t nSVDShaperDigits = m_svdShaperDigits.isOptional() ? m_svdShaperDigits.getEntries() : 0;
56
57 B2DEBUG(20, "Event: " << m_eventInfo->getEvent() << " - nCDCHits: " << nCDCHits << ", nSVDShaperDigits: " << nSVDShaperDigits);
58
59 const bool doomCDC = nCDCHits > m_nCDCHitsMax;
60 const bool doomSVD = nSVDShaperDigits > m_nSVDShaperDigitsMax;
61
62 if (doomCDC) {
63 B2ERROR("Skip event --> Too much occupancy from CDC for reconstruction!" <<
64 LogVar("event", m_eventInfo->getEvent()) <<
65 LogVar("run", m_eventInfo->getRun()) <<
66 LogVar("exp", m_eventInfo->getExperiment()) <<
67 LogVar("nCDCHits", nCDCHits) <<
68 LogVar("nCDCHitsMax", m_nCDCHitsMax));
69 }
70
71 if (doomSVD) {
72 B2ERROR("Skip event --> Too much occupancy from SVD for reconstruction!" <<
73 LogVar("event", m_eventInfo->getEvent()) <<
74 LogVar("run", m_eventInfo->getRun()) <<
75 LogVar("exp", m_eventInfo->getExperiment()) <<
76 LogVar("nSVDShaperDigits", nSVDShaperDigits) <<
77 LogVar("nSVDShaperDigitsMax", m_nSVDShaperDigitsMax));
78 }
79
80 setReturnValue(doomCDC or doomSVD);
81}
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.
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:649
Abstract base class for different kinds of events.