Belle II Software development
SVDShaperDigitFilterModule.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 <tracking/modules/roiFinding/svd/SVDShaperDigitFilterModule.h>
10#include <tracking/dataobjects/ROIid.h>
11
12#include <map>
13
14using namespace Belle2;
15
16//-----------------------------------------------------------------
17// Register the Module
18//-----------------------------------------------------------------
19REG_MODULE(SVDShaperDigitFilter);
20
21//-----------------------------------------------------------------
22// Implementation
23//-----------------------------------------------------------------
24
26{
27 // Set module properties
28 setDescription("The module produce a StoreArray of SVDShaperDigit inside the ROIs.");
29
30 // Parameter definitions
31 addParam("SVDShaperDigitsName", m_SVDShaperDigitsName, "The name of the StoreArray of SVDShaperDigits to be filtered",
32 std::string(""));
33 addParam("SVDShaperDigitsInsideROIName", m_SVDShaperDigitsInsideROIName, "The name of the StoreArray of Filtered SVDShaperDigits",
34 std::string("SVDShaperDigitsIN"));
35 addParam("SVDShaperDigitsOutsideROIName", m_SVDShaperDigitsOutsideROIName, "The name of the StoreArray of Filtered SVDShaperDigits",
36 std::string("SVDShaperDigitsOUT"));
37 addParam("ROIidsName", m_ROIidsName, "The name of the StoreArray of ROIs", std::string(""));
38 addParam("CreateOutside", m_CreateOutside, "Create the StoreArray of PXD pixel outside the ROIs", false);
39
40}
41
43{
44}
45
47{
48
50 m_ROIs.isRequired(m_ROIidsName);
51
53 SVDShaperDigits.isRequired();
54 m_selectorIN.registerSubset(SVDShaperDigits, m_SVDShaperDigitsInsideROIName);
55 // m_selectorIN.inheritAllRelations();
56
57 if (m_CreateOutside) {
58 m_selectorOUT.registerSubset(SVDShaperDigits, m_SVDShaperDigitsOutsideROIName);
59 // m_selectorOUT.inheritAllRelations();
60 }
61}
62
63
65{
66
67 std::multimap< VxdID, ROIid > ROIids;
68
69 for (auto ROI : m_ROIs)
70 ROIids.insert(std::pair<VxdID, ROIid> (ROI.getSensorID(), ROI));
71
72 m_selectorIN.select([ROIids](const SVDShaperDigit * theSVDShaper) {
73 auto ROIidsRange = ROIids.equal_range(theSVDShaper->getSensorID()) ;
74 for (auto theROI = ROIidsRange.first ; theROI != ROIidsRange.second; theROI ++)
75 if (theROI->second.Contains(*theSVDShaper))
76 return true;
77
78 return false;
79 });
80
81 if (m_CreateOutside) {
82 m_selectorOUT.select([ROIids](const SVDShaperDigit * theSVDShaper) {
83 auto ROIidsRange = ROIids.equal_range(theSVDShaper->getSensorID()) ;
84 for (auto theROI = ROIidsRange.first ; theROI != ROIidsRange.second; theROI ++)
85 if (theROI->second.Contains(*theSVDShaper))
86 return false;
87
88 return true;
89 });
90 }
91
92}
93
Base class for Modules.
Definition: Module.h:72
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
SelectSubset< SVDShaperDigit > m_selectorIN
selector of the subset of SVDShaperDigits contained in the ROIs
void initialize() override
register new SVDSShaperDigits store arrays (inside/outside ROIs)
void event() override
Filtering of digits inside/outside ROIs.
std::string m_SVDShaperDigitsOutsideROIName
The name of the StoreArray of Filtered SVDShaperDigits.
SelectSubset< SVDShaperDigit > m_selectorOUT
selector of the subset of SVDShaperDigits NOT contained in the ROIs
StoreArray< SVDShaperDigit > m_SVDShaperDigits
The SVDShaperDigits to be filtered.
std::string m_ROIidsName
The name of the StoreArray of ROIs.
SVDShaperDigitFilterModule()
Constructor: Sets the description, the properties and the parameters of the module.
bool m_CreateOutside
if set, create list of outside pixels, too
std::string m_SVDShaperDigitsInsideROIName
The name of the StoreArray of Filtered SVDShaperDigits.
std::string m_SVDShaperDigitsName
The name of the StoreArray of SVDShaperDigits to be filtered.
StoreArray< ROIid > m_ROIs
rois store array
The SVD ShaperDigit class.
VxdID getSensorID() const
Get the sensor ID.
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113
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.