Belle II Software  release-06-01-15
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
49  StoreArray<PXDCluster> PXDClusters(m_PXDClustersName);
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
71  StoreArray<PXDCluster> PXDClusters(m_PXDClustersName);
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
The module produce a StoreArray of PXDCluster with specific properties.
void initialize() override final
Initialize the Module.
bool CheckCuts(const PXDCluster &thePXDCluster)
the actual check for cluster properties
void event() override final
This method is the core of the module.
The PXD Cluster class This class stores all information about reconstructed PXD clusters The position...
Definition: PXDCluster.h:30
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
#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.