Belle II Software light-2406-ragdoll
ECLCluster.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/* Own header. */
10#include <mdst/dataobjects/ECLCluster.h>
11
12/* Basf2 headers. */
13#include <framework/logging/Logger.h>
14
15/* ROOT headers. */
16#include <TMatrixD.h>
17
18/* C++ headers. */
19#include <bitset>
20
21using namespace Belle2;
22
24{
25 // check if cluster has the requested hypothesis
26 if (!hasHypothesis(hypothesis)) {
27 B2ERROR("This cluster does not support the requested hypothesis,"
28 << LogVar(" it has the nPhotons hypothesis (y/n = 1/0): ", hasHypothesis(ECLCluster::EHypothesisBit::c_nPhotons))
29 << LogVar(" and it has the neutralHadron hypothesis (y/n = 1/0): ", hasHypothesis(ECLCluster::EHypothesisBit::c_neutralHadron))
30 << LogVar(" You requested the hypothesis bitmask: ", std::bitset<16>(static_cast<unsigned short>(hypothesis)).to_string()));
31 return std::numeric_limits<double>::quiet_NaN();
32 }
33
34 // return the sensible answers
35 if (hypothesis == ECLCluster::EHypothesisBit::c_nPhotons) return exp(m_logEnergy);
36 else if (hypothesis == ECLCluster::EHypothesisBit::c_neutralHadron) return exp(m_logEnergyRaw);
37 else {
38 // throw error if the cluster is not supported
39 B2ERROR("EHypothesisBit is not supported yet: " << static_cast<unsigned short>(hypothesis));
40 return std::numeric_limits<double>::quiet_NaN();
41 };
42}
43
44ROOT::Math::XYZVector ECLCluster::getClusterPosition() const
45{
46 const double cluster_x = getR() * sin(getTheta()) * cos(getPhi());
47 const double cluster_y = getR() * sin(getTheta()) * sin(getPhi());
48 const double cluster_z = getR() * cos(getTheta());
49 return ROOT::Math::XYZVector(cluster_x, cluster_y, cluster_z);
50}
51
53{
54 TMatrixDSym covmatecl(3);
55 covmatecl(0, 0) = m_sqrtcovmat_00 * m_sqrtcovmat_00;
56 covmatecl(1, 0) = m_covmat_10;
57 covmatecl(1, 1) = m_sqrtcovmat_11 * m_sqrtcovmat_11;
58 covmatecl(2, 0) = m_covmat_20;
59 covmatecl(2, 1) = m_covmat_21;
60 covmatecl(2, 2) = m_sqrtcovmat_22 * m_sqrtcovmat_22;
61
62 //make symmetric
63 for (int i = 0; i < 3; i++)
64 for (int j = 0; j < i ; j++)
65 covmatecl(j, i) = covmatecl(i, j);
66 return covmatecl;
67}
68
69
71{
72 const double theta = getTheta();
73
74 if (theta < 0.2164208) return 0; // < 12.4deg
75 if (theta < 0.5480334) return 1; // < 31.4deg
76 if (theta < 0.561996) return 11; // < 32.2deg
77 if (theta < 2.2462387) return 2; // < 128.7
78 if (theta < 2.2811453) return 13; // < 130.7
79 if (theta < 2.7070057) return 3; // < 155.1
80 else return 0;
81}
bool hasHypothesis(EHypothesisBit bitmask) const
Return if specific hypothesis bit is set.
Definition: ECLCluster.h:351
Double32_t m_sqrtcovmat_22
Covariance matrix 22, sigma_theta, between 0 and 50 mrad.
Definition: ECLCluster.h:410
TMatrixDSym getCovarianceMatrix3x3() const
Return TMatrixDsym 3x3 covariance matrix for E, Phi and Theta.
Definition: ECLCluster.cc:52
double getPhi() const
Return Corrected Phi of Shower (radian).
Definition: ECLCluster.h:304
Double32_t m_sqrtcovmat_11
Covariance matrix 11, sigma_phi, between 0 and 50 mrad.
Definition: ECLCluster.h:401
double getR() const
Return R.
Definition: ECLCluster.h:310
Double32_t m_sqrtcovmat_00
Covariance entry 00 sigma_E (1% to 25% between 10 MeV and 8 GeV)
Definition: ECLCluster.h:395
Double32_t m_covmat_20
Covariance matrix 20, not used yet.
Definition: ECLCluster.h:404
Double32_t m_covmat_10
Covariance matrix 10, not used yet.
Definition: ECLCluster.h:398
int getDetectorRegion() const
Return detector region: 0: below acceptance, 1: FWD, 2: BRL, 3: BWD, 11: FWDGAP, 13: BWDGAP.
Definition: ECLCluster.cc:70
Double32_t m_logEnergy
< Log.
Definition: ECLCluster.h:461
Double32_t m_covmat_21
Covariance matrix 21, not used yet.
Definition: ECLCluster.h:407
double getEnergy(EHypothesisBit hypothesis) const
Return Energy (GeV).
Definition: ECLCluster.cc:23
ROOT::Math::XYZVector getClusterPosition() const
Return ROOT::Math::XYZVector on cluster position (x,y,z)
Definition: ECLCluster.cc:44
Double32_t m_logEnergyRaw
Log.
Definition: ECLCluster.h:464
double getTheta() const
Return Corrected Theta of Shower (radian).
Definition: ECLCluster.h:307
EHypothesisBit
The hypothesis bits for this ECLCluster (Connected region (CR) is split using this hypothesis.
Definition: ECLCluster.h:31
@ c_nPhotons
CR is split into n photons (N1)
@ c_neutralHadron
CR is reconstructed as a neutral hadron (N2)
Class to store variables with their name which were sent to the logging service.
Abstract base class for different kinds of events.
Definition: ClusterUtils.h:24