Belle II Software  release-08-01-10
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 "TMath.h"
13 
14 using namespace Belle2;
15 using namespace CurlTagger;
16 
17 SelectorCut::SelectorCut(bool belleFlag)
18 {
19  if (belleFlag) {
20  //BN1079 cuts
21  m_magDiffPCut = 0.1;
22  m_sameChargePhiCut = 15;
24  } else {
25  // TODO - update these with actual values. Is this even worth if switching to MVA anyway?
26  m_magDiffPCut = 0.1;
27  m_sameChargePhiCut = 15;
29  }
30 
31 }
32 
33 SelectorCut::~SelectorCut() = default;
34 
35 std::vector<float> SelectorCut::getVariables(Particle* iPart, Particle* jPart)
36 {
37  float chargeProduct = iPart -> getCharge() * jPart -> getCharge();
38  float magDiffP = (iPart->getMomentum() - jPart->getMomentum()).R();
39  float phi = acos(iPart->getMomentum().Unit().Dot(jPart->getMomentum().Unit()));
40  return {chargeProduct, magDiffP, phi};
41 }
42 
44 {
45  //Selection from BN1079
46  std::vector<float> variables = getVariables(iPart, jPart);
47  float chargeProduct = variables[0];
48  float magDiffP = variables[1];
49  float phi = variables[2];
50 
51  if (magDiffP > m_magDiffPCut) {return 0.;}
52  if (chargeProduct > 0) {
53  if (phi < m_sameChargePhiCut * TMath::Pi() / 180) {return 1.;}
54  }
55  if (chargeProduct < 0) {
56  if (phi > m_oppositeChargePhiCut * TMath::Pi() / 180) {return 1.;}
57  }
58 
59  return 0.;
60 }
double R
typedef autogenerated by FFTW
virtual std::vector< float > getVariables(Particle *iPart, Particle *jPart) override
returns vector of variables used by this selector.
Definition: SelectorCut.cc:35
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:17
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:43
Class to store reconstructed particles.
Definition: Particle.h:75
ROOT::Math::XYZVector getMomentum() const
Returns momentum vector.
Definition: Particle.h:526
Abstract base class for different kinds of events.