Belle II Software  release-06-02-00
Bundle.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 #include <analysis/modules/CurlTagger/Bundle.h>
9 
10 #include <analysis/variables/VertexVariables.h>
11 
12 using namespace Belle2;
13 using namespace CurlTagger;
14 
15 Bundle::Bundle(bool isTruthBundle)
16 {
17  m_IsTruthBundle = isTruthBundle;
18  m_Gamma = 5; //From BN1079 - TODO check this gives best selection (what defines best?)
19 
20  if (m_IsTruthBundle) {
21  m_CurlLabel = "isTruthCurl";
22  m_SizeLabel = "truthBundleSize";
23  } else {
24  m_CurlLabel = "isCurl";
25  m_SizeLabel = "bundleSize";
26  }
27 }
28 
29 Bundle::~Bundle() = default;
30 
32 {
33  m_Particles.push_back(particle);
34 }
35 
36 Particle* Bundle::getParticle(unsigned int i)
37 {
38  return m_Particles[i];
39 }
40 
41 unsigned int Bundle::size()
42 {
43  return m_Particles.size();
44 }
45 
47 {
48  return TMath::Power(m_Gamma * Variable::particleDRho(particle), 2) + TMath::Power(Variable::particleDZ(particle), 2);
49 }
50 
52 {
53  return scaledImpactParam(iPart) < scaledImpactParam(jPart);
54 }
55 
57 {
58  //somewhat slow but should only be comparing 2-3 particles so shouldn't be a problem.
59  //std::sort (m_Particles.begin(), m_Particles.end(), compareParticles);
60  unsigned int bundleSize = size();
61  float lowestVal = 1e10;
62  unsigned int posLowestVal = 0;
63  for (unsigned int i = 0; i < bundleSize; i++) {
64  if (scaledImpactParam(m_Particles[i]) < lowestVal) {
65  lowestVal = scaledImpactParam(m_Particles[i]);
66  posLowestVal = i;
67  }
68  }
69 
70  for (unsigned int i = 0; i < bundleSize; i++) {
71  Particle* particle = m_Particles[i];
72  //std::cout << trackDist(particle) << std::endl;
73  if (i == posLowestVal) {continue;}
74  particle ->setExtraInfo(m_CurlLabel, 1);
75  }
76 }
77 
79 {
80  unsigned int bundleSize = size();
81  for (Particle* particle : m_Particles) {
82  particle -> setExtraInfo(m_SizeLabel, bundleSize);
83  }
84 }
85 
Bundle(bool isTruthBundle)
Constructor.
Definition: Bundle.cc:15
float scaledImpactParam(Particle *particle)
scaled impact parameter for selecting best track
Definition: Bundle.cc:46
void tagSizeInfo()
sets extraInfo with size of Bundle for particles in Bundle
Definition: Bundle.cc:78
std::string m_CurlLabel
label used to tag particles with curl info
Definition: Bundle.h:64
unsigned int size()
gets Bundle size
Definition: Bundle.cc:41
bool m_IsTruthBundle
flag for if the bundle is based on truth info, changes which labels are used
Definition: Bundle.h:61
bool compareParticles(Particle *iPart, Particle *jPart)
used to rank particles by scaledImpactParam - currently unused
Definition: Bundle.cc:51
Particle * getParticle(unsigned int i)
gets Particle from Bundle
Definition: Bundle.cc:36
std::vector< Particle * > m_Particles
particles in bundle
Definition: Bundle.h:70
std::string m_SizeLabel
label used to tag particles with Bundle size
Definition: Bundle.h:67
void addParticle(Particle *particle)
adds Particle to Bundle
Definition: Bundle.cc:31
double m_Gamma
dr scale factor
Definition: Bundle.h:55
void tagCurlInfo()
sets curl extra info for particles in Bundle
Definition: Bundle.cc:56
Class to store reconstructed particles.
Definition: Particle.h:74
Abstract base class for different kinds of events.