Belle II Software  release-05-01-25
DecayDescriptorParticle.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Christian Oswald, Yo Sato *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #include <analysis/DecayDescriptor/DecayDescriptorParticle.h>
12 #include <analysis/DecayDescriptor/DecayStringParticle.h>
13 #include <framework/logging/Logger.h>
14 #include <boost/algorithm/string/erase.hpp>
15 #include <boost/algorithm/string/replace.hpp>
16 #include <TDatabasePDG.h>
17 
18 using namespace Belle2;
19 using namespace std;
20 using namespace boost::algorithm;
21 
23  m_strName(""),
24  m_isSelected(false),
25  m_properties(0),
26  m_strLabel(""),
27  m_iPDGCode(0)
28 {}
29 
31 {
32  // Set member variables from the information in the DecayStringParticle p
33  m_strName = p.m_strName;
34  if (!p.m_strSelector.empty()) {
35  m_isSelected = (p.m_strSelector.find('^') != std::string::npos);
36 
37  if (p.m_strSelector.find('@') != std::string::npos)
38  m_properties |= Particle::PropertyFlags::c_IsUnspecified;
39  if (p.m_strSelector.find("(misID)") != std::string::npos)
40  m_properties |= Particle::PropertyFlags::c_IsIgnoreMisID;
41  if (p.m_strSelector.find("(decay)") != std::string::npos)
42  m_properties |= Particle::PropertyFlags::c_IsIgnoreDecayInFlight;
43  }
44  if (!p.m_strLabel.empty()) m_strLabel = p.m_strLabel;
45  // Determine PDG code using the particle names defined in evt.pdl
46  TParticlePDG* particle = TDatabasePDG::Instance()->GetParticle(m_strName.c_str());
47  if (!particle) {
48  B2WARNING("Particle not in evt.pdl file! " << m_strName);
49  return false;
50  }
51  m_iPDGCode = particle->PdgCode();
52  return true;
53 }
54 
56 {
57  string strNameSimple(m_strName);
58  erase_all(strNameSimple, "anti-");
59  erase_all(strNameSimple, "+");
60  erase_all(strNameSimple, "-");
61  erase_all(strNameSimple, "/");
62  erase_all(strNameSimple, "(");
63  erase_all(strNameSimple, ")");
64  replace_all(strNameSimple, "*", "ST");
65  replace_all(strNameSimple, "'", "p");
66  return strNameSimple;
67 }
Belle2::DecayDescriptorParticle::DecayDescriptorParticle
DecayDescriptorParticle()
Default ctor.
Definition: DecayDescriptorParticle.cc:22
Belle2::DecayDescriptorParticle::m_iPDGCode
int m_iPDGCode
PDG code of the decaying particle.
Definition: DecayDescriptorParticle.h:48
Belle2::DecayStringParticle
Holds the information of a particle in the decay string.
Definition: DecayStringParticle.h:32
Belle2::DecayDescriptorParticle::m_properties
int m_properties
Particle property.
Definition: DecayDescriptorParticle.h:44
Belle2::DecayDescriptorParticle::getNameSimple
std::string getNameSimple() const
Return the name from getName() without + - * or anti-.
Definition: DecayDescriptorParticle.cc:55
Belle2::DecayDescriptorParticle::m_strLabel
std::string m_strLabel
Label of this particle to distinguish e.g.
Definition: DecayDescriptorParticle.h:46
Belle2::DecayDescriptorParticle::m_isSelected
bool m_isSelected
Is particle selected?
Definition: DecayDescriptorParticle.h:42
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::DecayDescriptorParticle::m_strName
std::string m_strName
evt.pdl name of the particle.
Definition: DecayDescriptorParticle.h:40
Belle2::DecayDescriptorParticle::init
bool init(const DecayStringParticle &p)
initialise member variables from std::string member variables contained in a DecayStringParticle stru...
Definition: DecayDescriptorParticle.cc:30