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:
69 const static DecayDescriptor& s_NULL;
70
72 operator DecayDescriptor* ()
73 {
74 return m_isNULL ? nullptr : this;
75 }
78
81
84
86 std::vector<std::vector<std::pair<int, std::string>>> getHierarchyOfSelected();
87
89 std::vector<std::vector<std::pair<int, std::string>>> getHierarchyOfSelected(const std::vector<std::pair<int, std::string>>&
90 currentPath);
91
94 bool init(const std::string& str);
95
99 bool init(const DecayString& s);
100
107 int match(const Particle* p) {return match<Particle>(p, -1);}
108
110 int match(const MCParticle* p) {return match<MCParticle>(p, -1);}
111
114
116 void resetMatch();
117
119 std::vector<const Particle*> getSelectionParticles(const Particle* particle);
123 std::vector<std::string> getSelectionNames();
126 std::vector<int> getSelectionPDGCodes();
129 {
130 return &m_mother;
131 }
133 int getNDaughters() const
134 {
135 return m_daughters.size();
136 }
138 const DecayDescriptor* getDaughter(int i) const
139 {
140 return (i < getNDaughters()) ? &(m_daughters[i]) : nullptr;
141 }
143 int getProperty() const
144 {
145 return m_properties;
146 }
149 {
151 }
154 {
156 }
158 bool isIgnoreMassive() const
159 {
161 }
163 bool isIgnoreNeutrino() const
164 {
166 }
168 bool isIgnoreGamma() const
169 {
171 }
173 bool isIgnoreBrems() const
174 {
176 }
177
179 bool isSelfConjugated() const;
180
182 bool isInitOK() const
183 {
184 return m_isInitOK;
185 }
186
190 std::vector<const Particle*>& selparticles,
191 std::vector<std::string>& selnames);
192 };
193
195}
196
Represents a particle in the DecayDescriptor.
The DecayDescriptor stores information about a decay tree or parts of a decay tree.
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.
static const DecayDescriptor & s_NULL
Singleton object representing NULL.
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.