Belle II Software  release-08-01-10
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/svdROIFinder/SVDShaperDigitFilterModule.h>
10 #include <map>
11 
12 using namespace Belle2;
13 
14 //-----------------------------------------------------------------
15 // Register the Module
16 //-----------------------------------------------------------------
17 REG_MODULE(SVDShaperDigitFilter);
18 
19 //-----------------------------------------------------------------
20 // Implementation
21 //-----------------------------------------------------------------
22 
24 {
25  // Set module properties
26  setDescription("The module produce a StoreArray of SVDShaperDigit inside the ROIs.");
27 
28  // Parameter definitions
29  addParam("SVDShaperDigitsName", m_SVDShaperDigitsName, "The name of the StoreArray of SVDShaperDigits to be filtered",
30  std::string(""));
31  addParam("SVDShaperDigitsInsideROIName", m_SVDShaperDigitsInsideROIName, "The name of the StoreArray of Filtered SVDShaperDigits",
32  std::string("SVDShaperDigitsIN"));
33  addParam("SVDShaperDigitsOutsideROIName", m_SVDShaperDigitsOutsideROIName, "The name of the StoreArray of Filtered SVDShaperDigits",
34  std::string("SVDShaperDigitsOUT"));
35  addParam("ROIidsName", m_ROIidsName, "The name of the StoreArray of ROIs", std::string(""));
36  addParam("CreateOutside", m_CreateOutside, "Create the StoreArray of PXD pixel outside the ROIs", false);
37 
38 }
39 
41 {
42 }
43 
45 {
46 
48  m_ROIs.isRequired(m_ROIidsName);
49 
51  SVDShaperDigits.isRequired();
52  m_selectorIN.registerSubset(SVDShaperDigits, m_SVDShaperDigitsInsideROIName);
53  // m_selectorIN.inheritAllRelations();
54 
55  if (m_CreateOutside) {
56  m_selectorOUT.registerSubset(SVDShaperDigits, m_SVDShaperDigitsOutsideROIName);
57  // m_selectorOUT.inheritAllRelations();
58  }
59 }
60 
61 
63 {
64 
65  std::multimap< VxdID, ROIid > ROIids;
66 
67  for (auto ROI : m_ROIs)
68  ROIids.insert(std::pair<VxdID, ROIid> (ROI.getSensorID(), ROI));
69 
70  m_selectorIN.select([ROIids](const SVDShaperDigit * theSVDShaper) {
71  auto ROIidsRange = ROIids.equal_range(theSVDShaper->getSensorID()) ;
72  for (auto theROI = ROIidsRange.first ; theROI != ROIidsRange.second; theROI ++)
73  if (theROI->second.Contains(*theSVDShaper))
74  return true;
75 
76  return false;
77  });
78 
79  if (m_CreateOutside) {
80  m_selectorOUT.select([ROIids](const SVDShaperDigit * theSVDShaper) {
81  auto ROIidsRange = ROIids.equal_range(theSVDShaper->getSensorID()) ;
82  for (auto theROI = ROIidsRange.first ; theROI != ROIidsRange.second; theROI ++)
83  if (theROI->second.Contains(*theSVDShaper))
84  return false;
85 
86  return true;
87  });
88  }
89 
90 }
91 
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/ouside 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
REG_MODULE(arichBtest)
Register the Module.
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
Abstract base class for different kinds of events.