Belle II Software  release-05-01-25
EventsOfDoomBusterModule.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2019 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Marco Milesi
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #include <reconstruction/modules/EventsOfDoomBuster/EventsOfDoomBusterModule.h>
11 
12 #include <framework/logging/Logger.h>
13 
14 using namespace Belle2;
15 
16 REG_MODULE(EventsOfDoomBuster)
17 
19 {
20  setDescription(R"DOC(
21 Module that flags an event destined for doom at reconstruction,
22 * based on the size of selected hits/digits containers after the unpacking.
23 * This is meant to be registered in the path *after* the unpacking, but *before* reconstruction.
24 )DOC");
25 
26  addParam("nCDCHitsMax", m_nCDCHitsMax,
27 R"DOC(the max number of CDC hits for an event to be kept for reconstruction.
28 By default, no events are skipped based upon this requirement.)DOC", m_nCDCHitsMax);
29  addParam("nSVDShaperDigitsMax", m_nSVDShaperDigitsMax,
30  R"DOC(the max number of SVD shaper digits for an event to be kept for reconstruction.
31 By default, no events are skipped based upon this requirement.)DOC", m_nSVDShaperDigitsMax);
32 
33  setPropertyFlags(c_ParallelProcessingCertified);
34 }
35 
37 
39 {
40  m_eventInfo.isRequired();
41  m_cdcHits.isOptional();
42  m_svdShaperDigits.isOptional();
43 }
44 
45 
47 {
48  const unsigned int nCDCHits = m_cdcHits.isOptional() ? m_cdcHits.getEntries() : 0;
49  const unsigned int nSVDShaperDigits = m_svdShaperDigits.isOptional() ? m_svdShaperDigits.getEntries() : 0;
50 
51  B2DEBUG(20, "Event: " << m_eventInfo->getEvent() << " - nCDCHits: " << nCDCHits << ", nSVDShaperDigits: " << nSVDShaperDigits);
52 
53  const bool doomCDC = nCDCHits > m_nCDCHitsMax;
54  const bool doomSVD = nSVDShaperDigits > m_nSVDShaperDigitsMax;
55 
56  if (doomCDC) {
57  B2ERROR("Skip event --> Too much occupancy for reco!" <<
58  LogVar("event", m_eventInfo->getEvent()) <<
59  LogVar("run", m_eventInfo->getRun()) <<
60  LogVar("exp", m_eventInfo->getExperiment()) <<
61  LogVar("nCDCHits", nCDCHits) <<
62  LogVar("nCDCHitsMax", m_nCDCHitsMax));
63  }
64 
65  if (doomSVD) {
66  B2ERROR("Skip event --> Too much occupancy for reco!" <<
67  LogVar("event", m_eventInfo->getEvent()) <<
68  LogVar("run", m_eventInfo->getRun()) <<
69  LogVar("exp", m_eventInfo->getExperiment()) <<
70  LogVar("nSVDShaperDigits", nSVDShaperDigits) <<
71  LogVar("nSVDShaperDigitsMax", m_nSVDShaperDigitsMax));
72  }
73 
74  setReturnValue(doomCDC or doomSVD);
75 }
Belle2::EventsOfDoomBusterModule::m_eventInfo
StoreObjPtr< EventMetaData > m_eventInfo
Event Meta Data Store ObjPtr.
Definition: EventsOfDoomBusterModule.h:74
REG_MODULE
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:652
Belle2::EventsOfDoomBusterModule::m_svdShaperDigits
StoreArray< SVDShaperDigit > m_svdShaperDigits
SVDShaperDigits StoreArray.
Definition: EventsOfDoomBusterModule.h:78
Belle2::EventsOfDoomBusterModule::initialize
void initialize() final
Module initializer.
Definition: EventsOfDoomBusterModule.cc:36
Belle2::EventsOfDoomBusterModule::m_nSVDShaperDigitsMax
unsigned int m_nSVDShaperDigitsMax
The max number of SVD shaper digits for an event to be kept for reconstruction.
Definition: EventsOfDoomBusterModule.h:71
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::EventsOfDoomBusterModule::m_cdcHits
StoreArray< CDCHit > m_cdcHits
CDCHits StoreArray.
Definition: EventsOfDoomBusterModule.h:76
Belle2::EventsOfDoomBusterModule
Module that flags an event destined for doom at reconstruction, based on the size of selected hits/di...
Definition: EventsOfDoomBusterModule.h:42
LogVar
Class to store variables with their name which were sent to the logging service.
Definition: LogVariableStream.h:24
Belle2::EventsOfDoomBusterModule::m_nCDCHitsMax
unsigned int m_nCDCHitsMax
The max number of CDC hits for an event to be kept for reconstruction.
Definition: EventsOfDoomBusterModule.h:66
Belle2::Module::setReturnValue
void setReturnValue(int value)
Sets the return value for this module as integer.
Definition: Module.cc:222
Belle2::EventsOfDoomBusterModule::~EventsOfDoomBusterModule
virtual ~EventsOfDoomBusterModule() final
Default Destructor.
Belle2::EventsOfDoomBusterModule::event
void event() final
Flag each event.
Definition: EventsOfDoomBusterModule.cc:44