Belle II Software  release-08-01-10
TestParticleFactory Class Reference

This is a class, which generates DataStore particles, according to the provided decay string e.g. More...

#include <TestParticleFactory.h>

Public Member Functions

const Belle2::ParticleproduceParticle (const std::string &decayString, const ROOT::Math::PxPyPzEVector &momentum, const ROOT::Math::XYZVector &vertex)
 Main method to produce particles. More...
 
Belle2::Particle::EParticleSourceObject getType (const Belle2::DecayDescriptorParticle *particleDescription)
 Helper method to get EParticleSourceObject from PDG code.
 
const Belle2::ParticlecreateParticle (const Belle2::DecayDescriptor *particleDescriptor, const ROOT::Math::PxPyPzEVector &momentum, const ROOT::Math::XYZVector &vertex)
 This method is used for recursion.
 
const Belle2::ParticlecreatePhoton (const ROOT::Math::PxPyPzEVector &momentum)
 Creates different photons for tests.
 
const Belle2::ParticlecreateCharged (const Belle2::DecayDescriptor *particleDescriptor, const ROOT::Math::PxPyPzEVector &momentum, const ROOT::Math::XYZVector &vertex)
 Creates different charged particles for tests.
 

Private Attributes

int m_photonIndex
 Used to differentiate photons from one another.
 

Detailed Description

This is a class, which generates DataStore particles, according to the provided decay string e.g.

"^K_S0 -> ^pi+ ^pi-". All particles are added to Belle2::StoreArray<Belle2::Particle> It is primarily used in the ROE tests.

Definition at line 27 of file TestParticleFactory.h.

Member Function Documentation

◆ produceParticle()

const Belle2::Particle* produceParticle ( const std::string &  decayString,
const ROOT::Math::PxPyPzEVector &  momentum,
const ROOT::Math::XYZVector &  vertex 
)
inline

Main method to produce particles.

For simplification, all particles are created with the same momentum and decay vertex. If for example "^K_S0 -> ^pi+ ^pi-" decay string is provided as an argument, the factory will produce two daughter pions with opposite charges first, and then these pions will be used to form mother K_S0 particle which will be returned. The decay string can have any complexity and all PDG codes of allowed and charges will be respected.

Definition at line 41 of file TestParticleFactory.h.

43  {
44  Belle2::DecayDescriptor* decaydescriptor = new Belle2::DecayDescriptor();
45  bool isString = decaydescriptor->init(decayString);
46  if (!isString) {
47  B2INFO("Decay string is not defined: " << decayString);
48  delete decaydescriptor;
49  return nullptr;
50  }
51  std::vector<std::string> strNames = decaydescriptor->getSelectionNames();
52  for (auto& name : strNames) {
53  B2INFO("Creation of particle: " << name);
54  }
55  // Recursive function
56  auto* result = createParticle(decaydescriptor, momentum, vertex);
57  delete decaydescriptor;
58  return result;
59  };
The DecayDescriptor stores information about a decay tree or parts of a decay tree.
bool init(const std::string &str)
Initialise the DecayDescriptor from given string.
std::vector< std::string > getSelectionNames()
Return list of human readable names of selected particles.
const Belle2::Particle * createParticle(const Belle2::DecayDescriptor *particleDescriptor, const ROOT::Math::PxPyPzEVector &momentum, const ROOT::Math::XYZVector &vertex)
This method is used for recursion.

The documentation for this class was generated from the following file: