Belle II Software  release-08-01-10
SVDSpacePointSNRFractionSelector.h
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 #pragma once
10 
11 #include <TObject.h>
12 #include <vector>
13 
14 namespace Belle2 {
21  class SVDSpacePointSNRFractionSelector : public TObject {
22 
23  public:
24 
27 
29  bool passSNRFractionSelection(const std::vector<float>& inputU,
30  const std::vector<float>& inputV) const
31  {
32  if (inputU.size() < 3 || inputV.size() < 3) {
33  B2ERROR("The size of input vectors for SVDSpacePointSNRFractionSelector::passSNRFractionSelection is invalid. " <<
34  "It must be grater than 2, but inputU.size() = " << inputU.size() << ", inputV.size() = " << inputV.size());
35  return false;
36  }
37 
38  const float totalSNR_U = inputU[0] + inputU[1] + inputU[2];
39  const float fraction0_U = inputU[0] / totalSNR_U;
40  const float fraction1_U = inputU[1] / totalSNR_U;
41 
42  if (fraction0_U > m_fraction0_max) return false;
43  if (fraction1_U < m_fraction1_min && fraction0_U > m_fraction0_max_for_fraction1_cut) return false;
44 
45  const float totalSNR_V = inputV[0] + inputV[1] + inputV[2];
46  const float fraction0_V = inputV[0] / totalSNR_V;
47  const float fraction1_V = inputV[1] / totalSNR_V;
48 
49  if (fraction0_V > m_fraction0_max) return false;
50  if (fraction1_V < m_fraction1_min && fraction0_V > m_fraction0_max_for_fraction1_cut) return false;
51 
52  return true;
53  };
54 
56  void setFraction0Max(float fraction0_max) {m_fraction0_max = fraction0_max;};
58  void setFraction1Min(float fraction1_min) {m_fraction1_min = fraction1_min;};
60  void setFraction0MaxForFraction1Cut(float fraction0_max_for_fraction1_cut)
61  {m_fraction0_max_for_fraction1_cut = fraction0_max_for_fraction1_cut;};
62 
64  float getFraction0Max() const {return m_fraction0_max;};
66  float getFraction1Min() const {return m_fraction1_min;};
69 
70 
71  private:
72  float m_fraction0_max = 0.45;
73  float m_fraction1_min = 0.30;
77 
79  };
81 }
class to contain the cut on SVDSpacePoint
float getFraction0MaxForFraction1Cut() const
Get max of SNR0 fraction that is used together with SNR1 fraction cut
void setFraction0MaxForFraction1Cut(float fraction0_max_for_fraction1_cut)
Set max of SNR0 fraction that is used together with SNR1 fraction cut
bool passSNRFractionSelection(const std::vector< float > &inputU, const std::vector< float > &inputV) const
Determine if the combination of U and V clusters passes the SNR fraction cuts.
float m_fraction0_max_for_fraction1_cut
Max of SNR0 fraction that is used together with SNR1 fraction cut.
void setFraction0Max(float fraction0_max)
Set max of SNR0 fraction
float getFraction0Max() const
Get max of SNR0 fraction
float getFraction1Min() const
Get min of SNR1 fraction
void setFraction1Min(float fraction1_min)
Set min of SNR1 fraction
Abstract base class for different kinds of events.