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