Belle II Software  release-05-02-19
SVDShaperDigitFilterModule.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2013 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Paoloni *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #include <tracking/modules/svdROIFinder/SVDShaperDigitFilterModule.h>
12 #include <map>
13 
14 using namespace Belle2;
15 using namespace std;
16 
17 //-----------------------------------------------------------------
18 // Register the Module
19 //-----------------------------------------------------------------
20 REG_MODULE(SVDShaperDigitFilter)
21 
22 //-----------------------------------------------------------------
23 // Implementation
24 //-----------------------------------------------------------------
25 
27 {
28  // Set module properties
29  setDescription("The module produce a StoreArray of SVDShaperDigit inside the ROIs.");
30 
31  // Parameter definitions
32  addParam("SVDShaperDigitsName", m_SVDShaperDigitsName, "The name of the StoreArray of SVDShaperDigits to be filtered",
33  std::string(""));
34  addParam("SVDShaperDigitsInsideROIName", m_SVDShaperDigitsInsideROIName, "The name of the StoreArray of Filtered SVDShaperDigits",
35  std::string("SVDShaperDigitsIN"));
36  addParam("SVDShaperDigitsOutsideROIName", m_SVDShaperDigitsOutsideROIName, "The name of the StoreArray of Filtered SVDShaperDigits",
37  std::string("SVDShaperDigitsOUT"));
38  addParam("ROIidsName", m_ROIidsName, "The name of the StoreArray of ROIs", std::string(""));
39  addParam("CreateOutside", m_CreateOutside, "Create the StoreArray of PXD pixel outside the ROIs", false);
40 
41 }
42 
44 {
45 }
46 
48 {
49 
50  m_SVDShaperDigits.isRequired(m_SVDShaperDigitsName);
51  m_ROIs.isRequired(m_ROIidsName);
52 
53  StoreArray<SVDShaperDigit> SVDShaperDigits(m_SVDShaperDigitsName);
54  SVDShaperDigits.isRequired();
55  m_selectorIN.registerSubset(SVDShaperDigits, m_SVDShaperDigitsInsideROIName);
56  // m_selectorIN.inheritAllRelations();
57 
58  if (m_CreateOutside) {
59  m_selectorOUT.registerSubset(SVDShaperDigits, m_SVDShaperDigitsOutsideROIName);
60  // m_selectorOUT.inheritAllRelations();
61  }
62 }
63 
64 
66 {
67 
68  multimap< VxdID, ROIid > ROIids;
69 
70  for (auto ROI : m_ROIs)
71  ROIids.insert(pair<VxdID, ROIid> (ROI.getSensorID() , ROI));
72 
73  m_selectorIN.select([ROIids](const SVDShaperDigit * theSVDShaper) {
74  auto ROIidsRange = ROIids.equal_range(theSVDShaper->getSensorID()) ;
75  for (auto theROI = ROIidsRange.first ; theROI != ROIidsRange.second; theROI ++)
76  if (theROI->second.Contains(*theSVDShaper))
77  return true;
78 
79  return false;
80  });
81 
82  if (m_CreateOutside) {
83  m_selectorOUT.select([ROIids](const SVDShaperDigit * theSVDShaper) {
84  auto ROIidsRange = ROIids.equal_range(theSVDShaper->getSensorID()) ;
85  for (auto theROI = ROIidsRange.first ; theROI != ROIidsRange.second; theROI ++)
86  if (theROI->second.Contains(*theSVDShaper))
87  return false;
88 
89  return true;
90  });
91  }
92 
93 }
94 
REG_MODULE
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:652
Belle2::SVDShaperDigit::getSensorID
VxdID getSensorID() const
Get the sensor ID.
Definition: SVDShaperDigit.h:116
Belle2::SVDShaperDigitFilterModule::initialize
void initialize() override
register new SVDSShaperDigits store arrays (inside/ouside ROIs)
Definition: SVDShaperDigitFilterModule.cc:47
Belle2::SVDShaperDigitFilterModule
The module produce a StoreArray of SVDShaperDigit inside the ROIs.
Definition: SVDShaperDigitFilterModule.h:41
Belle2::SVDShaperDigit
The SVD ShaperDigit class.
Definition: SVDShaperDigit.h:46
Belle2::Module
Base class for Modules.
Definition: Module.h:74
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::SVDShaperDigitFilterModule::event
void event() override
Filtering of digits inside/outside ROIs.
Definition: SVDShaperDigitFilterModule.cc:65
Belle2::SVDShaperDigitFilterModule::~SVDShaperDigitFilterModule
~SVDShaperDigitFilterModule()
Destructor.
Definition: SVDShaperDigitFilterModule.cc:43
Belle2::StoreArray
Accessor to arrays stored in the data store.
Definition: ECLMatchingPerformanceExpertModule.h:33