Belle II Software light-2406-ragdoll
Belle2::ParticleListName Namespace Reference

Helper to deal with ParticleList names. More...

Functions

std::string antiParticleListName (const std::string &listName)
 Returns name of anti-particle-list corresponding to listName.
 

Detailed Description

Helper to deal with ParticleList names.

Own namespace because of CINT.

Function Documentation

◆ antiParticleListName()

std::string antiParticleListName ( const std::string &  listName)

Returns name of anti-particle-list corresponding to listName.

Throws std::runtime_error for invalid particle lists. If listName refers to a self-conjugated list, simply returns listName.

Ex: antiParticleListName("B+:somelabel") -> "B-:somelabel" antiParticleListName("gamma") -> "gamma"

User documentation is located at analysis/doc/DecayDescriptor.rst Please modify in accordingly to introduced changes.

Definition at line 17 of file ParticleListName.cc.

18{
19 DecayDescriptor decayDescriptor;
20 bool valid = decayDescriptor.init(listName);
21 if (!valid)
22 throw std::runtime_error("Invalid ParticleList name: '" + listName + "' Should be EVTPDLNAME[:LABEL], e.g. B+ or B+:mylist.");
23
24 int nProducts = decayDescriptor.getNDaughters();
25 if (nProducts > 0)
26 throw std::runtime_error("Invalid ParticleList name " + listName
27 + ". DecayString should not contain any daughters, only the mother particle.");
28
29 const DecayDescriptorParticle* mother = decayDescriptor.getMother();
30 const int pdgCode = mother->getPDGCode();
31
32 bool isSelfConjugatedParticle = !(EvtPDLUtil::hasAntiParticle(pdgCode));
33 if (isSelfConjugatedParticle)
34 return listName;
35 else
36 return EvtPDLUtil::antiParticleListName(pdgCode, mother->getLabel());
37}
Represents a particle in the DecayDescriptor.
int getPDGCode() const
Return PDG code.
std::string getLabel() const
The label of this particle, "default" returned, when no label set.
The DecayDescriptor stores information about a decay tree or parts of a decay tree.
std::string antiParticleListName(int pdgCode, const std::string &label)
Returns the name of the anti-particle ParticleList for particles with given pdg code and with given l...
Definition: EvtPDLUtil.cc:30
bool hasAntiParticle(int pdgCode)
Checks if the particle with given pdg code has an anti-particle or not.
Definition: EvtPDLUtil.cc:12