Belle II Software  release-05-02-19
ClusterMatcherModule.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2016 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Jo-Frederik Krohn *
7  * *
8  * This software is provided "as is" without any warranty. *
9  * **************************************************************************/
10 #include <reconstruction/modules/ClusterMatcher/ClusterMatcherModule.h>
11 
12 #include <framework/gearbox/Const.h>
13 
14 
15 #include <mdst/dataobjects/KLMCluster.h>
16 #include <mdst/dataobjects/ECLCluster.h>
17 #include <mdst/dataobjects/Cluster.h>
18 #include <mdst/dataobjects/KlId.h>
19 
20 
21 using namespace Belle2;
22 using namespace std;
23 
24 
25 REG_MODULE(ClusterMatcher);
26 
27 ClusterMatcherModule::ClusterMatcherModule(): Module() // constructor kan nkeine argumente nehmen
28 {
29  setDescription("Match KLM cluster to ECL Clusters within a certain cone.");
30 
33  addParam("coneInRad",
35  "Cone angle in rad, will be devided by 2 for the matching",
36  m_coneInRad);
37 }
38 
40 {
41 }
42 
44 {
45  // require existence of necessary datastore obj
46  m_klmClusters.isRequired();
47  m_eclClusters.isRequired();
48  m_eclClusters.registerRelationTo(m_klmClusters);
49 
50  m_Clusters.registerInDataStore();
51  m_klmClusters.registerRelationTo(m_Clusters);
52  m_eclClusters.registerRelationTo(m_Clusters);
53 
54 }//init
55 
56 
58 {
59  float angleDist;
60 
61  for (const ECLCluster& eclCluster : m_eclClusters) {
62 
63  const TVector3& eclClusterPos = eclCluster.getClusterPosition();
64 
65  Cluster* clusterecl = m_Clusters.appendNew();
66  //Once available we will have to set ECL likelihoods here as is done for KLM
67  eclCluster.addRelationTo(clusterecl);
68 
69  for (KLMCluster& klmcluster : m_klmClusters) {
70 
71  const TVector3& klmClusterPos = klmcluster.getClusterPosition();
72 
73  angleDist = eclClusterPos.Angle(klmClusterPos);
74 
75  if (angleDist < (m_coneInRad / 2.0)) {
76 
77  eclCluster.addRelationTo(&klmcluster, angleDist);
78  klmcluster.addRelationTo(clusterecl);
79  } else {
80  Cluster* clusterklm = m_Clusters.appendNew();
81  clusterklm->setLogLikelihood(
82  Const::KLM,
84  klmcluster.getRelatedTo<KlId>()->getKlId()
85  );
86  klmcluster.addRelationTo(clusterklm);
87  }
88  }//klmcluster loop
89 
90 
91  }// for ecl cluster in clusters
92 } // event
93 
94 
Belle2::Module::setDescription
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:216
Belle2::ECLCluster
ECL cluster data.
Definition: ECLCluster.h:39
KlId
Helper functions for all klid modules to improve readability of the code.
Definition: KlId.h:28
REG_MODULE
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:652
Belle2::Module::c_ParallelProcessingCertified
@ 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:82
Belle2::Cluster::setLogLikelihood
void setLogLikelihood(Const::EDetector det, const Const::Cluster &cluster, float logl)
Set log likelihood for a given detector and particle.
Definition: Cluster.cc:31
Belle2::Module
Base class for Modules.
Definition: Module.h:74
Belle2::Const::clusterKlong
static const Cluster clusterKlong
K^0_L cluster.
Definition: Const.h:541
Belle2::Module::setPropertyFlags
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
Definition: Module.cc:210
Belle2::Cluster
Class to collect log likelihoods from Clusters from ECL and KLM aimed for output to mdst includes fun...
Definition: Cluster.h:37
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::ClusterMatcherModule::m_Clusters
StoreArray< Cluster > m_Clusters
array of output Clusters
Definition: ClusterMatcherModule.h:70
Belle2::ClusterMatcherModule::event
virtual void event() override
process event
Definition: ClusterMatcherModule.cc:57
Belle2::ClusterMatcherModule::initialize
virtual void initialize() override
init
Definition: ClusterMatcherModule.cc:43
Belle2::ClusterMatcherModule::m_eclClusters
StoreArray< ECLCluster > m_eclClusters
Required array of input ECLClusters.
Definition: ClusterMatcherModule.h:66
Belle2::KLMCluster
KLM cluster data.
Definition: KLMCluster.h:38
Belle2::ClusterMatcherModule::~ClusterMatcherModule
virtual ~ClusterMatcherModule()
Destructor.
Definition: ClusterMatcherModule.cc:39
Belle2::ClusterMatcherModule::m_klmClusters
StoreArray< KLMCluster > m_klmClusters
Required array of input KLMClusters.
Definition: ClusterMatcherModule.h:67
Belle2::Module::addParam
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:562
Belle2::ClusterMatcherModule::ClusterMatcherModule
ClusterMatcherModule()
Constructor.
Definition: ClusterMatcherModule.cc:27
Belle2::ClusterMatcherModule::m_coneInRad
float m_coneInRad
cone angle for matching (whole cone)
Definition: ClusterMatcherModule.h:59