Belle II Software  release-06-02-00
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 using namespace std;
14 
15 //-----------------------------------------------------------------
16 // Register the Module
17 //-----------------------------------------------------------------
18 REG_MODULE(SVDShaperDigitFilter)
19 
20 //-----------------------------------------------------------------
21 // Implementation
22 //-----------------------------------------------------------------
23 
25 {
26  // Set module properties
27  setDescription("The module produce a StoreArray of SVDShaperDigit inside the ROIs.");
28 
29  // Parameter definitions
30  addParam("SVDShaperDigitsName", m_SVDShaperDigitsName, "The name of the StoreArray of SVDShaperDigits to be filtered",
31  std::string(""));
32  addParam("SVDShaperDigitsInsideROIName", m_SVDShaperDigitsInsideROIName, "The name of the StoreArray of Filtered SVDShaperDigits",
33  std::string("SVDShaperDigitsIN"));
34  addParam("SVDShaperDigitsOutsideROIName", m_SVDShaperDigitsOutsideROIName, "The name of the StoreArray of Filtered SVDShaperDigits",
35  std::string("SVDShaperDigitsOUT"));
36  addParam("ROIidsName", m_ROIidsName, "The name of the StoreArray of ROIs", std::string(""));
37  addParam("CreateOutside", m_CreateOutside, "Create the StoreArray of PXD pixel outside the ROIs", false);
38 
39 }
40 
42 {
43 }
44 
46 {
47 
48  m_SVDShaperDigits.isRequired(m_SVDShaperDigitsName);
49  m_ROIs.isRequired(m_ROIidsName);
50 
51  StoreArray<SVDShaperDigit> SVDShaperDigits(m_SVDShaperDigitsName);
52  SVDShaperDigits.isRequired();
53  m_selectorIN.registerSubset(SVDShaperDigits, m_SVDShaperDigitsInsideROIName);
54  // m_selectorIN.inheritAllRelations();
55 
56  if (m_CreateOutside) {
57  m_selectorOUT.registerSubset(SVDShaperDigits, m_SVDShaperDigitsOutsideROIName);
58  // m_selectorOUT.inheritAllRelations();
59  }
60 }
61 
62 
64 {
65 
66  multimap< VxdID, ROIid > ROIids;
67 
68  for (auto ROI : m_ROIs)
69  ROIids.insert(pair<VxdID, ROIid> (ROI.getSensorID() , ROI));
70 
71  m_selectorIN.select([ROIids](const SVDShaperDigit * theSVDShaper) {
72  auto ROIidsRange = ROIids.equal_range(theSVDShaper->getSensorID()) ;
73  for (auto theROI = ROIidsRange.first ; theROI != ROIidsRange.second; theROI ++)
74  if (theROI->second.Contains(*theSVDShaper))
75  return true;
76 
77  return false;
78  });
79 
80  if (m_CreateOutside) {
81  m_selectorOUT.select([ROIids](const SVDShaperDigit * theSVDShaper) {
82  auto ROIidsRange = ROIids.equal_range(theSVDShaper->getSensorID()) ;
83  for (auto theROI = ROIidsRange.first ; theROI != ROIidsRange.second; theROI ++)
84  if (theROI->second.Contains(*theSVDShaper))
85  return false;
86 
87  return true;
88  });
89  }
90 
91 }
92 
Base class for Modules.
Definition: Module.h:72
The module produce a StoreArray of SVDShaperDigit inside the ROIs.
void initialize() override
register new SVDSShaperDigits store arrays (inside/ouside ROIs)
void event() override
Filtering of digits inside/outside ROIs.
The SVD ShaperDigit class.
VxdID getSensorID() const
Get the sensor ID.
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113
#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.