Belle II Software  release-06-00-14
ParticleLoaderModule.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 
11 #include <framework/core/Module.h>
12 
13 #include <analysis/DecayDescriptor/DecayDescriptor.h>
14 
15 // framework - DataStore
16 #include <framework/datastore/StoreArray.h>
17 #include <framework/datastore/StoreObjPtr.h>
18 
19 // dataobjects
20 #include <mdst/dataobjects/V0.h>
21 #include <mdst/dataobjects/ECLCluster.h>
22 #include <mdst/dataobjects/KLMCluster.h>
23 #include <mdst/dataobjects/MCParticle.h>
24 #include <mdst/dataobjects/Track.h>
25 #include <mdst/dataobjects/PIDLikelihood.h>
26 
27 #include <analysis/dataobjects/RestOfEvent.h>
28 #include <analysis/dataobjects/Particle.h>
29 #include <analysis/dataobjects/ParticleList.h>
30 #include <analysis/dataobjects/ParticleExtraInfoMap.h>
31 #include <analysis/dataobjects/EventExtraInfo.h>
32 
33 #include <vector>
34 #include <tuple>
35 #include <string>
36 #include <memory>
37 
38 namespace Belle2 {
77  class ParticleLoaderModule : public Module {
78 
83  typedef std::tuple<int, std::string, std::string, bool> PList;
87  enum PListIndex {
88  c_PListPDGCode, c_PListName, c_AntiPListName, c_IsPListSelfConjugated
89  };
90 
91  public:
92 
97 
102  virtual void initialize() override;
103 
107  virtual void event() override;
108 
113  virtual void terminate() override;
114 
115  private:
116 
120  void mcParticlesToParticles();
121 
126 
130  void tracksToParticles();
131 
136 
140  void v0sToParticles();
141 
145  void roeToParticles();
146 
150  void addROEToParticleList(RestOfEvent* roe, int mdstIndex, int pdgCode = 0, bool isSelfConjugatedParticle = true);
151 
155  bool isValidPDGCode(const int pdgCode);
156 
160  void appendDaughtersRecursive(Particle* mother);
161 
176  bool m_useROEs;
180  std::vector<std::string> m_decayStrings;
182  std::vector<PList> m_MCParticles2Plists;
183  std::vector<PList> m_Tracks2Plists;
184  std::vector<PList> m_V02Plists;
185  std::vector<PList> m_ROE2Plists;
186  std::vector<PList>
189  bool m_writeOut;
192  std::string m_roeMaskName;
198  false;
200  std::vector<int> m_chargeZeroTrackCounts;
201  std::vector<int> m_sameChargeDaughtersV0Counts;
202  };
203 
205 } // Belle2 namespace
The DecayDescriptor stores information about a decay tree or parts of a decay tree.
Base class for Modules.
Definition: Module.h:72
Loads MDST dataobjects as Particle objects to the StoreArray<Particle> and collects them in specified...
std::vector< PList > m_ECLKLMClusters2Plists
Collection of PLists that will collect Particles created from ECLClusters and KLMClusters.
StoreArray< TrackFitResult > m_trackfitresults
StoreArray of TrackFitResults.
std::tuple< int, std::string, std::string, bool > PList
tuple for collecting everything we know about the ParticlList to be created.
std::vector< std::string > m_decayStrings
Input decay strings specifying the particles being created/loaded.
int m_trackHypothesis
pdg code for track hypothesis that should be used to create the particle
StoreArray< KLMCluster > m_klmclusters
StoreArray of KLMCluster.
std::vector< int > m_sameChargeDaughtersV0Counts
internally used to count the number of V0s with same charge daughters
StoreArray< V0 > m_v0s
StoreArray of V0s.
std::string m_sourceParticleListName
Particle list name from which we need to get related ROEs.
void mdstToParticle()
Loads specified MSDT object as Particle to StoreArray<Particle>
PListIndex
Enum for describing each element in the above tuple.
StoreArray< MCParticle > m_mcparticles
StoreArray of MCParticles.
StoreArray< Particle > m_particles
StoreArray of Particles.
std::string m_roeMaskName
ROE mask name to load.
StoreObjPtr< ParticleExtraInfoMap > m_particleExtraInfoMap
object pointer to extra info map
bool m_addDaughters
toggle addition of the bottom part of the particle's decay chain
StoreArray< PIDLikelihood > m_pidlikelihoods
StoreArray of PIDLikelihoods.
bool m_skipNonPrimaryDaughters
toggle skip of secondary MC daughters
StoreArray< Track > m_tracks
StoreArray of Tracks.
bool m_enforceFitHypothesis
If true, a Particle is only created if a track fit with the particle hypothesis passed to the Particl...
std::vector< PList > m_ROE2Plists
Collection of PLists that will collect Particles created from V0.
StoreArray< RestOfEvent > m_roes
StoreArray of ROEs.
std::vector< PList > m_MCParticles2Plists
Collection of PLists that will collect Particles created from MCParticles.
std::vector< PList > m_V02Plists
Collection of PLists that will collect Particles created from V0.
DecayDescriptor m_decaydescriptor
Decay descriptor for parsing the user specified DecayString.
bool m_writeOut
toggle particle list btw.
std::vector< int > m_chargeZeroTrackCounts
internally used to count number of tracks with charge zero
std::vector< PList > m_Tracks2Plists
Collection of PLists that will collect Particles created from Tracks.
StoreObjPtr< EventExtraInfo > m_eventExtraInfo
object pointer to event extra info
StoreArray< ECLCluster > m_eclclusters
StoreArray of ECLCluster.
bool m_useROEs
Switch to load ROE as Particle.
bool m_useMissing
Use missing momentum to build a particle.
bool m_useMCParticles
Load MCParticle as Particle instead of the corresponding MDST dataobject.
Class to store reconstructed particles.
Definition: Particle.h:74
This is a general purpose class for collecting reconstructed MDST data objects that are not used in r...
Definition: RestOfEvent.h:57
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:95
void mcParticlesToParticles()
Loads specified MCParticles as Particle to StoreArray<Particle>
void v0sToParticles()
Loads V0 object as Particle of specified type to StoreArray<Particle> and adds it to the ParticleList...
void roeToParticles()
Loads ROE object as Particle of specified type to StoreArray<Particle> and adds it to the ParticleLis...
virtual void initialize() override
Initialize the Module.
void addROEToParticleList(RestOfEvent *roe, int mdstIndex, int pdgCode=0, bool isSelfConjugatedParticle=true)
Helper method to load ROE object as Particle.
virtual void event() override
Event processor.
bool isValidPDGCode(const int pdgCode)
returns true if the PDG code determined from the decayString is valid
virtual void terminate() override
Terminate the Module.
void tracksToParticles()
Loads Track object as Particle to StoreArray<Particle> and adds it to the ParticleList.
void appendDaughtersRecursive(Particle *mother)
recursively append bottom of a particle's decay chain (daughters of mother, granddaughters of daughte...
void eclAndKLMClustersToParticles()
Loads ECLCluster and KLMCluster object as Particle to StoreArray<Particle> and adds it to the Particl...
Abstract base class for different kinds of events.