Belle II Software  release-08-01-10
MCDecayFinderModule.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 #include <framework/core/Module.h>
11 #include <analysis/modules/MCDecayFinder/DecayTree.h>
12 #include <analysis/DecayDescriptor/DecayDescriptor.h>
13 #include <analysis/dataobjects/ParticleList.h>
14 #include <analysis/dataobjects/ParticleExtraInfoMap.h>
15 #include <framework/datastore/StoreObjPtr.h>
16 #include <framework/datastore/StoreArray.h>
17 #include <mdst/dataobjects/MCParticle.h>
18 
19 namespace Belle2 {
27  class MCDecayFinderModule : public Module {
28  private:
29 
31  std::string m_strDecay;
32  std::string m_listName;
33  std::string m_antiListName;
35  bool m_writeOut;
36  std::string m_particleStore;
46  public:
52  virtual void initialize() override;
54  virtual void event() override;
56  DecayTree<MCParticle>* match(const MCParticle* mcp, const DecayDescriptor* d, bool isCC, int& arrayIndex);
60  void appendParticles(const MCParticle* gen, std::vector<const MCParticle*>& children);
63 
65  void countMaxDepthOfNest(const DecayDescriptor* d, int& depth);
67  bool performMCMatching(const DecayTree<MCParticle>* decay, const DecayDescriptor* dd);
71  Particle* createParticleRecursively(const MCParticle* mcp, bool skipNonPrimaryDaughters);
73  void addUniqueParticleToList(Particle* newParticle);
74  };
76 }
The DecayDescriptor stores information about a decay tree or parts of a decay tree.
This is a helper class for the MCDecayFinderModule.
Definition: DecayTree.h:20
Find decays in MCParticle list matching a given DecayString.
Particle * createParticleRecursively(const MCParticle *mcp, bool skipNonPrimaryDaughters)
Create a Particle from the given MCParticle appending all daughters of the MCParticle.
bool m_isSelfConjugatedParticle
Is the particle list for a self-conjugated particle.
std::string m_antiListName
Name of output anti-particle list.
DecayTree< MCParticle > * match(const MCParticle *mcp, const DecayDescriptor *d, bool isCC, int &arrayIndex)
Search for MCParticles matching the given DecayString.
Particle * buildParticleFromDecayTree(const DecayTree< MCParticle > *decay, const DecayDescriptor *dd)
Build a Particle from the given DecayTree and DecayDescriptor.
int getNDaughtersRecursive(const DecayDescriptor *d)
Recursively get number of daughters of given DecayDescriptor.
virtual void initialize() override
Initialises the module.
bool performMCMatching(const DecayTree< MCParticle > *decay, const DecayDescriptor *dd)
Perform the MCMatching on the Particle built from the given DecayTree and DecayDescriptor.
virtual void event() override
Method called for each event.
StoreArray< MCParticle > m_mcparticles
StoreArray of MCParticles.
std::string m_listName
Name of output particle list.
StoreArray< Particle > m_particles
StoreArray of Particles.
int write(DecayTree< MCParticle > *decay)
Create Particle from matched MCParticle and write to Particle list.
StoreObjPtr< ParticleList > m_outputList
output particle list
std::string m_strDecay
Decay string to build the decay descriptor.
std::string m_particleStore
name of Particle store array
void appendParticles(const MCParticle *gen, std::vector< const MCParticle * > &children)
Recursively gather all MC daughters of gen.
void addUniqueParticleToList(Particle *newParticle)
Add a new Particle into the output ParticleList if it does not exist already.
bool m_appendAllDaughters
if true, all daughters are appended
bool m_skipNonPrimaryDaughters
toggle skip of secondary MC daughters
StoreObjPtr< ParticleList > m_antiOutputList
output anti-particle list
DecayDescriptor m_decaydescriptor
Decay descriptor of decays to look for.
bool m_writeOut
toggle output particle list btw.
void countMaxDepthOfNest(const DecayDescriptor *d, int &depth)
Count the max depth of nest from the given DecayDescriptor.
StoreObjPtr< ParticleExtraInfoMap > m_extraInfoMap
object pointer to ParticleExtraInfoMaps
A Class to store the Monte Carlo particle information.
Definition: MCParticle.h:32
Base class for Modules.
Definition: Module.h:72
Class to store reconstructed particles.
Definition: Particle.h:75
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113
Type-safe access to single objects in the data store.
Definition: StoreObjPtr.h:96
Abstract base class for different kinds of events.