Belle II Software development
CDCHitFilterModule.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 <cdc/modules/cdcHitFilter/CDCHitFilterModule.h>
10#include <cdc/dataobjects/CDCHit.h>
11
12using namespace Belle2;
13using namespace CDC;
14
15//-----------------------------------------------------------------
16// Register the Module
17//-----------------------------------------------------------------
18REG_MODULE(CDCHitFilter);
19
20//-----------------------------------------------------------------
21// Implementation
22//-----------------------------------------------------------------
23
25 Module()
26{
27
28 //Set module properties
29 setDescription("Filter CDCHits");
30
31 addParam("inputCDCHitListName", m_inputCDCHitListName,
32 "Name of the CDCHit List to filter", std::string(""));
33 addParam("outputCDCHitListName", m_outputCDCHitListName,
34 "Name of the CDCHit list, which will contain the hits passing all filter criteria",
35 std::string(""));
36
37 // Limit hits to parts of the CDC, useful if not the whole CDC
38 // is defined in the packer/unpacker mapping file
39 addParam("filterSuperLayer", m_filterSuperLayer,
40 "Only perform digitization for a specific super layer or for all, if the value is -1",
41 -1);
42 addParam("filterWireMax", m_filterWireMax,
43 "Only perform digitization up to a specific number of wire or for all wires, if the value is -1",
44 -1);
45 addParam("filterLayerMax", m_filterLayerMax,
46 "Only perform digitization for a specific layer or for all, if the value is -1",
47 -1);
48}
49
51{
52}
53
55{
57 m_outputCDCHits.registerInDataStore(m_outputCDCHitListName);
58}
59
61{
62
63 for (auto const& hit : m_inputCDCHits) {
64 // check if filtering for super-layers, layers or wires is active
65 if ((m_filterSuperLayer >= 0)
66 && (m_filterSuperLayer != hit.getISuperLayer())) {
67 continue;
68 }
69 if ((m_filterLayerMax >= 0) && (m_filterLayerMax <= hit.getILayer())) {
70 continue;
71 }
72 if ((m_filterWireMax >= 0) && (m_filterWireMax <= hit.getIWire())) {
73 continue;
74 }
75
76 m_outputCDCHits.appendNew(hit);
77 }
78}
CDCHitFilterModule()
Constructor of the module.
int m_filterSuperLayer
Only perform digitization for a specific super layer or for all, if the value is -1.
StoreArray< CDCHit > m_inputCDCHits
Input CDCHit array.
void initialize() override
Initializes the Module.
void event() override
Begin run action.
std::string m_outputCDCHitListName
Name of the CDCHit list, which will contain the hits passing all filter criteria.
virtual ~CDCHitFilterModule()
Destructor of the module.
StoreArray< CDCHit > m_outputCDCHits
Output (filtered) CDCHit array.
int m_filterWireMax
Only perform digitization for a specific wire or for all, if the value is -1.
int m_filterLayerMax
Only perform digitization up to a specific layer or for all, if the value is -1.
std::string m_inputCDCHitListName
Name of the CDCHit List to filter.
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 addParam(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Definition: Module.h:560
#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.