Belle II Software development
ClusterMatcherModule.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 <reconstruction/modules/ClusterMatcher/ClusterMatcherModule.h>
10
11#include <mdst/dataobjects/KLMCluster.h>
12#include <mdst/dataobjects/ECLCluster.h>
13#include <mdst/dataobjects/Cluster.h>
14
15#include <Math/VectorUtil.h>
16
17using namespace Belle2;
18
19REG_MODULE(ClusterMatcher);
20
22{
23 setDescription("Match KLM cluster to ECL Clusters within a certain cone.");
25 addParam("coneInRad",
27 "Cone angle in rad, will be devided by 2 internally for the matching",
29}
30
32{
33 m_klmClusters.isRequired();
34 m_eclClusters.isRequired();
35 m_eclClusters.registerRelationTo(m_klmClusters);
36 m_Clusters.registerInDataStore();
37 m_klmClusters.registerRelationTo(m_Clusters);
38 m_eclClusters.registerRelationTo(m_Clusters);
39}
40
41
43{
44 for (const ECLCluster& eclCluster : m_eclClusters) {
45 const ROOT::Math::XYZVector& eclClusterPos = eclCluster.getClusterPosition();
46 const Cluster* clusterecl = m_Clusters.appendNew();
47 eclCluster.addRelationTo(clusterecl);
48 for (KLMCluster& klmcluster : m_klmClusters) {
49 const ROOT::Math::XYZVector& klmClusterPos = klmcluster.getClusterPosition();
50 const float angleDist = ROOT::Math::VectorUtil::Angle(eclClusterPos, klmClusterPos);
51 if (angleDist < (m_coneInRad / 2.0)) {
52 eclCluster.addRelationTo(&klmcluster, angleDist);
53 klmcluster.addRelationTo(clusterecl);
54 } else {
55 const Cluster* clusterklm = m_Clusters.appendNew();
56 klmcluster.addRelationTo(clusterklm);
57 }
58 } // KLMClusters loop
59 } // ECLClusters loop
60}
61
62
StoreArray< KLMCluster > m_klmClusters
Required array of input KLMClusters.
void initialize() override
Initialize.
StoreArray< ECLCluster > m_eclClusters
Required array of input ECLClusters.
float m_coneInRad
Cone angle for matching (whole cone)
StoreArray< Cluster > m_Clusters
Array of output Clusters.
Class to collect log likelihoods from Clusters from ECL and KLM aimed for output to mdst includes fun...
Definition Cluster.h:26
ECL cluster data.
Definition ECLCluster.h:27
KLM cluster data.
Definition KLMCluster.h:29
void setDescription(const std::string &description)
Sets the description of the module.
Definition Module.cc:214
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
Definition Module.cc:208
Module()
Constructor.
Definition Module.cc:30
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
Definition Module.h:80
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:559
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition Module.h:649
Abstract base class for different kinds of events.