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#include <reconstruction/modules/ClusterMatcher/ClusterMatcherModule.h>
9
10#include <framework/gearbox/Const.h>
11
12
13#include <mdst/dataobjects/KLMCluster.h>
14#include <mdst/dataobjects/ECLCluster.h>
15#include <mdst/dataobjects/Cluster.h>
16#include <mdst/dataobjects/KlId.h>
17
18#include <Math/VectorUtil.h>
19
20using namespace Belle2;
21using namespace std;
22
23
24REG_MODULE(ClusterMatcher);
25
26ClusterMatcherModule::ClusterMatcherModule(): Module() // constructor kan nkeine argumente nehmen
27{
28 setDescription("Match KLM cluster to ECL Clusters within a certain cone.");
29
32 addParam("coneInRad",
34 "Cone angle in rad, will be devided by 2 for the matching",
36}
37
39{
40}
41
43{
44 // require existence of necessary datastore obj
45 m_klmClusters.isRequired();
46 m_eclClusters.isRequired();
47 m_eclClusters.registerRelationTo(m_klmClusters);
48
49 m_Clusters.registerInDataStore();
50 m_klmClusters.registerRelationTo(m_Clusters);
51 m_eclClusters.registerRelationTo(m_Clusters);
52
53}//init
54
55
57{
58 float angleDist;
59
60 for (const ECLCluster& eclCluster : m_eclClusters) {
61
62 const ROOT::Math::XYZVector& eclClusterPos = eclCluster.getClusterPosition();
63
64 Cluster* clusterecl = m_Clusters.appendNew();
65 //Once available we will have to set ECL likelihoods here as is done for KLM
66 eclCluster.addRelationTo(clusterecl);
67
68 for (KLMCluster& klmcluster : m_klmClusters) {
69
70 const ROOT::Math::XYZVector& klmClusterPos = klmcluster.getClusterPosition();
71
72 angleDist = ROOT::Math::VectorUtil::Angle(eclClusterPos, klmClusterPos);
73
74 if (angleDist < (m_coneInRad / 2.0)) {
75
76 eclCluster.addRelationTo(&klmcluster, angleDist);
77 klmcluster.addRelationTo(clusterecl);
78 } else {
79 Cluster* clusterklm = m_Clusters.appendNew();
80 clusterklm->setLogLikelihood(
81 Const::KLM,
83 (klmcluster.getRelatedTo<KlId>() != nullptr) ? klmcluster.getRelatedTo<KlId>()->getKlId() : std::numeric_limits<float>::quiet_NaN()
84 );
85 klmcluster.addRelationTo(clusterklm);
86 }
87 }//klmcluster loop
88
89
90 }// for ecl cluster in clusters
91} // event
92
93
StoreArray< KLMCluster > m_klmClusters
Required array of input KLMClusters.
virtual void initialize() override
init
virtual void event() override
process event
virtual ~ClusterMatcherModule()
Destructor.
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
void setLogLikelihood(Const::EDetector det, const Const::Cluster &cluster, float logl)
Set log likelihood for a given detector and particle.
Definition: Cluster.cc:29
static const Cluster clusterKlong
K^0_L cluster.
Definition: Const.h:667
ECL cluster data.
Definition: ECLCluster.h:27
KLM cluster data.
Definition: KLMCluster.h:28
Klong identifcation (KlId) datastore object to store results from KlId calculations.
Definition: KlId.h:23
double getKlId() const
get the klong classifier output
Definition: KlId.cc:29
Base class for Modules.
Definition: Module.h:72
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
@ 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:560
#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.
STL namespace.