Belle II Software  release-06-00-14
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 
19 using namespace Belle2;
20 using namespace std;
21 
22 
23 REG_MODULE(ClusterMatcher);
24 
25 ClusterMatcherModule::ClusterMatcherModule(): Module() // constructor kan nkeine argumente nehmen
26 {
27  setDescription("Match KLM cluster to ECL Clusters within a certain cone.");
28 
31  addParam("coneInRad",
33  "Cone angle in rad, will be devided by 2 for the matching",
34  m_coneInRad);
35 }
36 
38 {
39 }
40 
42 {
43  // require existence of necessary datastore obj
44  m_klmClusters.isRequired();
45  m_eclClusters.isRequired();
46  m_eclClusters.registerRelationTo(m_klmClusters);
47 
48  m_Clusters.registerInDataStore();
49  m_klmClusters.registerRelationTo(m_Clusters);
50  m_eclClusters.registerRelationTo(m_Clusters);
51 
52 }//init
53 
54 
56 {
57  float angleDist;
58 
59  for (const ECLCluster& eclCluster : m_eclClusters) {
60 
61  const TVector3& eclClusterPos = eclCluster.getClusterPosition();
62 
63  Cluster* clusterecl = m_Clusters.appendNew();
64  //Once available we will have to set ECL likelihoods here as is done for KLM
65  eclCluster.addRelationTo(clusterecl);
66 
67  for (KLMCluster& klmcluster : m_klmClusters) {
68 
69  const TVector3& klmClusterPos = klmcluster.getClusterPosition();
70 
71  angleDist = eclClusterPos.Angle(klmClusterPos);
72 
73  if (angleDist < (m_coneInRad / 2.0)) {
74 
75  eclCluster.addRelationTo(&klmcluster, angleDist);
76  klmcluster.addRelationTo(clusterecl);
77  } else {
78  Cluster* clusterklm = m_Clusters.appendNew();
79  clusterklm->setLogLikelihood(
80  Const::KLM,
82  klmcluster.getRelatedTo<KlId>()->getKlId()
83  );
84  klmcluster.addRelationTo(clusterklm);
85  }
86  }//klmcluster loop
87 
88 
89  }// for ecl cluster in clusters
90 } // event
91 
92 
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:548
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:27
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.