Belle II Software light-2406-ragdoll
DecayDescriptorParticle.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/DecayDescriptor/DecayDescriptorParticle.h>
10#include <analysis/DecayDescriptor/DecayStringParticle.h>
11#include <framework/logging/Logger.h>
12#include <boost/algorithm/string/erase.hpp>
13#include <boost/algorithm/string/replace.hpp>
14#include <TDatabasePDG.h>
15
16using namespace Belle2;
17using namespace std;
18using namespace boost::algorithm;
19
21 m_strName(""),
22 m_isSelected(false),
23 m_properties(0),
24 m_strLabel(""),
25 m_iPDGCode(0)
26{}
27
29{
30 // Set member variables from the information in the DecayStringParticle p
31 m_strName = p.m_strName;
32 if (!p.m_strSelector.empty()) {
33 m_isSelected = (p.m_strSelector.find('^') != std::string::npos);
34
35 if (p.m_strSelector.find('@') != std::string::npos)
37 if (p.m_strSelector.find("(misID)") != std::string::npos)
39 if (p.m_strSelector.find("(decay)") != std::string::npos)
41 }
42 if (!p.m_strLabel.empty()) m_strLabel = p.m_strLabel;
43 // Determine PDG code using the particle names defined in evt.pdl
44 TParticlePDG* particle = TDatabasePDG::Instance()->GetParticle(m_strName.c_str());
45 if (!particle) {
46 B2WARNING("Particle not in evt.pdl file! " << m_strName);
47 return false;
48 }
49 m_iPDGCode = particle->PdgCode();
50 return true;
51}
52
54{
55 string strNameSimple(m_strName);
56 erase_all(strNameSimple, "anti-");
57 erase_all(strNameSimple, "+");
58 erase_all(strNameSimple, "-");
59 erase_all(strNameSimple, "/");
60 erase_all(strNameSimple, "(");
61 erase_all(strNameSimple, ")");
62 replace_all(strNameSimple, "*", "ST");
63 replace_all(strNameSimple, "'", "p");
64 return strNameSimple;
65}
std::string getNameSimple() const
Return the name from getName() without + - * or anti-.
std::string m_strLabel
Label of this particle to distinguish e.g.
bool m_isSelected
Is particle selected?
bool init(const DecayStringParticle &p)
initialise member variables from std::string member variables contained in a DecayStringParticle stru...
std::string m_strName
evt.pdl name of the particle.
int m_iPDGCode
PDG code of the decaying particle.
@ c_IsUnspecified
Ordinary particles.
Definition: Particle.h:118
@ c_IsIgnoreDecayInFlight
Is the particle MC matched with the ignore DecayInFlight flag set?
Definition: Particle.h:126
@ c_IsIgnoreMisID
Is the particle MC matched with the ignore MisID flag set?
Definition: Particle.h:125
Abstract base class for different kinds of events.
Definition: ClusterUtils.h:24
STL namespace.
Holds the information of a particle in the decay string.