Belle II Software development
DecayDescriptor.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 <analysis/DecayDescriptor/DecayString.h>
12#include <analysis/DecayDescriptor/DecayDescriptorParticle.h>
13#include <analysis/dataobjects/Particle.h>
14
15#include <vector>
16#include <string>
17
18namespace Belle2 {
23 class MCParticle;
24
33 private:
40 std::vector<DecayDescriptor> m_daughters;
46 template <class T>
47 int match(const T* p, int iDaughter_p);
62 std::vector<std::vector<std::pair<int, std::string>>> m_hierarchy;
63
66
67 public:
68
70 operator DecayDescriptor* ()
71 {
72 return m_isNULL ? nullptr : this;
73 }
74
76
79
82
84 std::vector<std::vector<std::pair<int, std::string>>> getHierarchyOfSelected();
85
87 std::vector<std::vector<std::pair<int, std::string>>> getHierarchyOfSelected(const std::vector<std::pair<int, std::string>>&
88 currentPath);
89
92 bool init(const std::string& str);
93
97 bool init(const DecayString& s);
98
105 int match(const Particle* p) {return match<Particle>(p, -1);}
106
108 int match(const MCParticle* p) {return match<MCParticle>(p, -1);}
109
112
114 void resetMatch();
115
117 std::vector<const Particle*> getSelectionParticles(const Particle* particle);
121 std::vector<std::string> getSelectionNames();
124 std::vector<int> getSelectionPDGCodes();
127 {
128 return &m_mother;
129 }
130
131 int getNDaughters() const
132 {
133 return m_daughters.size();
134 }
135
136 const DecayDescriptor* getDaughter(int i) const
137 {
138 return (i < getNDaughters()) ? &(m_daughters[i]) : nullptr;
139 }
140
141 int getProperty() const
142 {
143 return m_properties;
144 }
145
150
155
156 bool isIgnoreMassive() const
157 {
159 }
160
165
166 bool isIgnoreGamma() const
167 {
169 }
170
171 bool isIgnoreBrems() const
172 {
174 }
175
177 bool isSelfConjugated() const;
178
180 bool isInitOK() const
181 {
182 return m_isInitOK;
183 }
184
188 std::vector<const Particle*>& selparticles,
189 std::vector<std::string>& selnames);
190 };
191
193}
194
Represents a particle in the DecayDescriptor.
DecayDescriptor()
Default ctor.
bool isIgnoreBrems() const
Check if added Brems gammas shall be ignored.
bool isIgnoreRadiatedPhotons() const
Check if additional radiated photons shall be ignored.
bool init(const std::string &str)
Initialise the DecayDescriptor from given string.
bool isSelfConjugated() const
Is the decay or the particle self conjugated.
const DecayDescriptor * getDaughter(int i) const
return i-th daughter (0 based index).
DecayDescriptor & operator=(const DecayDescriptor &)=default
Want the default assignment operator.
DecayDescriptorParticle m_mother
Mother of the decay ('left side').
bool m_isInitOK
Is this object initialized correctly?
bool getSelectionParticlesAndNames(const Particle *particle, std::vector< const Particle * > &selparticles, std::vector< std::string > &selnames)
Takes as input argument a (reconstructed) Particle, tries to match with this DecayDescriptorElement a...
bool isIgnoreNeutrino() const
Check if missing neutrinos shall be ignored.
std::vector< int > getSelectionPDGCodes()
Return list of PDG codes of selected particles.
bool isInitOK() const
Check if the object initialized correctly.
int match(const MCParticle *p)
See match(const Particle* p).
int match(const Particle *p)
Check if the DecayDescriptor matches with the given Particle.
int getMatchedDaughter()
Particle daughter ID set by previous call of match(const Particle*) function.
int getNDaughters() const
return number of direct daughters.
int getProperty() const
return property of the particle.
void resetMatch()
Reset results from previous call of the match() function.
bool m_isNULL
Is this the NULL object?
bool isIgnoreMassive() const
Check if missing massive final state particles shall be ignored.
std::vector< std::vector< std::pair< int, std::string > > > getHierarchyOfSelected()
Function to get hierarchy of selected particles and their names (for python use)
bool isIgnoreGamma() const
Check if missing gammas shall be ignored.
std::vector< std::string > getSelectionNames()
Return list of human readable names of selected particles.
std::vector< DecayDescriptor > m_daughters
Direct daughters of the decaying particle.
std::vector< std::vector< std::pair< int, std::string > > > m_hierarchy
Collection of hierarchy paths of selected particles.
std::vector< const Particle * > getSelectionParticles(const Particle *particle)
Get a vector of pointers with selected daughters in the decay tree.
int m_iDaughter_p
ID of the Daughter Particle* matched to this DecayDescriptor.
int match(const T *p, int iDaughter_p)
Internally called by match(Particle*) and match(MCParticle*) function.
bool isIgnoreIntermediate() const
Check if intermediate resonances/particles shall be ignored.
const DecayDescriptorParticle * getMother() const
return mother.
int m_properties
Particle property.
DecayDescriptor(const DecayDescriptor &)=default
Want the default copy ctor.
A Class to store the Monte Carlo particle information.
Definition MCParticle.h:32
Class to store reconstructed particles.
Definition Particle.h:76
@ c_IsIgnoreNeutrino
Is the particle MC matched with the ignore missing neutrino flag set?
Definition Particle.h:124
@ c_IsIgnoreRadiatedPhotons
Is the particle MC matched with the ignore radiated photon flag set?
Definition Particle.h:121
@ c_IsIgnoreGamma
Is the particle MC matched with the ignore missing gamma flag set?
Definition Particle.h:125
@ c_IsIgnoreBrems
Is the particle MC matched with the ignore added Brems gamma flag set?
Definition Particle.h:126
@ c_IsIgnoreIntermediate
Is the particle MC matched with the ignore intermediate resonances flag set?
Definition Particle.h:122
@ c_IsIgnoreMassive
Is the particle MC matched with the ignore missing massive particle flag set?
Definition Particle.h:123
boost::variant< boost::recursive_wrapper< DecayStringDecay >, DecayStringParticle > DecayString
The DecayStringElement can be either a DecayStringDecay or a vector of mother particles.
Definition DecayString.h:23
Abstract base class for different kinds of events.