Belle II Software  release-06-02-00
SelectorCut.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 #include <analysis/modules/CurlTagger/SelectorCut.h>
10 
11 //Root includes
12 #include "TVector3.h"
13 #include "TMath.h"
14 
15 using namespace Belle2;
16 using namespace CurlTagger;
17 
18 SelectorCut::SelectorCut(bool belleFlag)
19 {
20  if (belleFlag) {
21  //BN1079 cuts
22  m_magDiffPCut = 0.1;
23  m_sameChargePhiCut = 15;
25  } else {
26  // TODO - update these with actual values. Is this even worth if switching to MVA anyway?
27  m_magDiffPCut = 0.1;
28  m_sameChargePhiCut = 15;
30  }
31 
32 }
33 
34 SelectorCut::~SelectorCut() = default;
35 
36 std::vector<float> SelectorCut::getVariables(Particle* iPart, Particle* jPart)
37 {
38  float chargeProduct = iPart -> getCharge() * jPart -> getCharge();
39  float magDiffP = (iPart->getMomentum() - jPart->getMomentum()).Mag();
40  float phi = iPart->getMomentum().Angle(jPart->getMomentum());
41  return {chargeProduct, magDiffP, phi};
42 }
43 
45 {
46  //Selection from BN1079
47  std::vector<float> variables = getVariables(iPart, jPart);
48  float chargeProduct = variables[0];
49  float magDiffP = variables[1];
50  float phi = variables[2];
51 
52  if (magDiffP > m_magDiffPCut) {return 0.;}
53  if (chargeProduct > 0) {
54  if (phi < m_sameChargePhiCut * TMath::Pi() / 180) {return 1.;}
55  }
56  if (chargeProduct < 0) {
57  if (phi > m_oppositeChargePhiCut * TMath::Pi() / 180) {return 1.;}
58  }
59 
60  return 0.;
61 }
virtual std::vector< float > getVariables(Particle *iPart, Particle *jPart) override
returns vector of variables used by this selector.
Definition: SelectorCut.cc:36
double m_sameChargePhiCut
cut for angle between momenta of the two particles when they have the same charge
Definition: SelectorCut.h:44
SelectorCut(bool belleFlag)
Constructor.
Definition: SelectorCut.cc:18
double m_oppositeChargePhiCut
cut for angle between momenta of the two particles when they have the opposite charge
Definition: SelectorCut.h:47
double m_magDiffPCut
cut for momentum magnitude difference
Definition: SelectorCut.h:41
virtual float getResponse(Particle *iPart, Particle *jPart) override
Selector response that this pair of particles come from the same mc/actual particle.
Definition: SelectorCut.cc:44
Class to store reconstructed particles.
Definition: Particle.h:74
TVector3 getMomentum() const
Returns momentum vector.
Definition: Particle.h:488
Abstract base class for different kinds of events.