Belle II Software  release-08-01-10
PXDClusterPropFilterModule.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 <pxd/modules/pxdReconstruction/PXDClusterPropFilterModule.h>
10 #include <map>
11 
12 using namespace Belle2;
13 using namespace std;
14 
15 //-----------------------------------------------------------------
16 // Register the Module
17 //-----------------------------------------------------------------
18 REG_MODULE(PXDClusterPropFilter);
19 
20 //-----------------------------------------------------------------
21 // Implementation
22 //-----------------------------------------------------------------
23 
25 {
26  // Set module properties
27  setDescription("The module produce a StoreArray of PXDClusters with specific cuts on properties.");
28 
29  // Parameter definitions
30  addParam("PXDClustersName", m_PXDClustersName, "The name of the StoreArray of PXDClusters to be filtered", std::string(""));
31  addParam("PXDClustersInsideCutsName", m_PXDClustersInsideCutsName, "The name of the StoreArray of Filtered PXDClusters inside cuts",
32  std::string("PXDClustersIN"));
33  addParam("PXDClustersOutsideCutsName", m_PXDClustersOutsideCutsName,
34  "The name of the StoreArray of Filtered PXDClusters outside cuts",
35  std::string("PXDClustersOUT"));
36  addParam("CreateInside", m_CreateInside, "Create the StoreArray of PXD clusters inside of cuts", true);
37  addParam("CreateOutside", m_CreateOutside, "Create the StoreArray of PXD clusters outside of cuts", false);
38 
39  addParam("minCharge", m_minCharge, "minimum charge, including value", 0.0);
40  addParam("maxCharge", m_maxCharge, "maximum charge, excluding value", 9999.0);
41  addParam("minSize", m_minSize, "minimum size, including value", 1);
42  addParam("maxSize", m_maxSize, "maximum size, excluding value", 99);
43 }
44 
46 {
47 
48  // We have to change it once the hardware type clusters are well defined
50  PXDClusters.isRequired();
51 
52  if (m_CreateInside) {
53  m_selectorIN.registerSubset(PXDClusters, m_PXDClustersInsideCutsName);
54  m_selectorIN.inheritAllRelations();
55  }
56  if (m_CreateOutside) {
57  m_selectorOUT.registerSubset(PXDClusters, m_PXDClustersOutsideCutsName);
58  m_selectorOUT.inheritAllRelations();
59  }
60 }
61 
63 {
64  return cluster.getSize() >= m_minSize && cluster.getSize() < m_maxSize &&
65  cluster.getCharge() >= m_minCharge && cluster.getCharge() < m_maxCharge;
66 }
67 
69 {
70  // Perform filtering
73  if (m_CreateInside) {
74  m_selectorIN.select([this](const PXDCluster * thePxdCluster) {
75  return CheckCuts(*thePxdCluster); // the cluster has interesting Properties.
76  });
77  }
78 
79  if (m_CreateOutside) {
80  m_selectorOUT.select([this](const PXDCluster * thePxdCluster) {
81  return ! CheckCuts(*thePxdCluster); // the cluster has NO interesting Properties.
82  });
83  }
84 }
Base class for Modules.
Definition: Module.h:72
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
double m_maxCharge
maximum charge, excluding value
int m_maxSize
maximum size, excluding value
void initialize() override final
Initialize the Module.
bool CheckCuts(const PXDCluster &thePXDCluster)
the actual check for cluster properties
SelectSubset< PXDCluster > m_selectorOUT
selector of the subset of PXDClusters NOT contained in the ROIs
int m_minSize
minimum size, including value
void event() override final
This method is the core of the module.
std::string m_PXDClustersName
The name of the StoreArray of PXDClusters to be filtered.
bool m_CreateInside
if set, create list of inside cuts
double m_minCharge
minimum charge, including value
SelectSubset< PXDCluster > m_selectorIN
selector of the subset of PXDClusters contained in the ROIs
PXDClusterPropFilterModule()
Constructor: Sets the description, the properties and the parameters of the module.
std::string m_PXDClustersOutsideCutsName
The name of the StoreArray of Filtered PXDClusters outside cuts.
bool m_CreateOutside
if set, create list of outside cuts
std::string m_PXDClustersInsideCutsName
The name of the StoreArray of Filtered PXDClusters inside cuts.
The PXD Cluster class This class stores all information about reconstructed PXD clusters The position...
Definition: PXDCluster.h:30
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.