Belle II Software  release-05-02-19
ParticleSubset.h
1 #pragma once
2 
3 #include <framework/datastore/SelectSubset.h>
4 #include <analysis/dataobjects/Particle.h>
5 
6 namespace Belle2 {
15  class ParticleSubset : public SelectSubset<Particle> {
16  public:
21  void removeParticlesNotInLists(const std::vector<std::string>& listNames);
22 
24  void select(std::function<bool (const Particle*)> f) {
25  const std::map<int, int>& oldToNewMap = copySetWithRelations(f);
26 
27  if (m_inheritToSelf) {
29  }
30 
31  if (m_reduceExistingSet) {
33  }
34 
35  fixParticles(oldToNewMap);
36 
37  fixParticleLists(oldToNewMap);
38  }
39 
40  protected:
42  void fixParticles(const std::map<int, int>& oldToNewMap);
43 
45  void fixParticleLists(const std::map<int, int>& oldToNewMap);
46 
48  static void fixVector(std::vector<int>& vec, const std::map<int, int>& oldToNewMap);
49 
50  };
52 }
Belle2::SelectSubset< Particle >::copyRelationsToSelf
void copyRelationsToSelf()
Copy any set -> set relations between selected objects.
Definition: SelectSubset.h:400
Belle2::SelectSubset
Class to create a subset of a given StoreArray together with the relations with other StoreArrays.
Definition: SelectSubset.h:203
Belle2::ParticleSubset::fixParticleLists
void fixParticleLists(const std::map< int, int > &oldToNewMap)
fix contents of particlelists by updating indices or removing entries.
Definition: ParticleSubset.cc:62
Belle2::ParticleSubset::fixParticles
void fixParticles(const std::map< int, int > &oldToNewMap)
fix daughter indices, reset m_arrayPointer
Definition: ParticleSubset.cc:49
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::SelectSubsetBase::m_inheritToSelf
bool m_inheritToSelf
If true, relations from set objects to set objects are copied.
Definition: SelectSubset.h:68
Belle2::ParticleSubset
Specialised SelectSubset<Particle> that also fixes daughter indices and all ParticleLists.
Definition: ParticleSubset.h:15
Belle2::SelectSubsetBase::m_reduceExistingSet
bool m_reduceExistingSet
If true, non-selected candidates are removed from m_set, m_subset only exists temporarily.
Definition: SelectSubset.h:70
Belle2::Particle
Class to store reconstructed particles.
Definition: Particle.h:77
Belle2::ParticleSubset::select
void select(std::function< bool(const Particle *)> f)
select Particles for which f returns true, discard others
Definition: ParticleSubset.h:24
Belle2::SelectSubset< Particle >::copySetWithRelations
std::map< int, int > copySetWithRelations(std::function< bool(const Particle *)> f)
Selects the elements, fill the subset and copies all the relations in which the set is involved.
Definition: SelectSubset.h:361
Belle2::SelectSubsetBase::swapSetsAndDestroyOriginal
void swapSetsAndDestroyOriginal()
Swap set and subset (+relations), and keep only the reduced set.
Definition: SelectSubset.cc:7
Belle2::ParticleSubset::removeParticlesNotInLists
void removeParticlesNotInLists(const std::vector< std::string > &listNames)
Removes all Particles that are not in one of the given ParticleLists (or daughters of Particles in th...
Definition: ParticleSubset.cc:21
Belle2::ParticleSubset::fixVector
static void fixVector(std::vector< int > &vec, const std::map< int, int > &oldToNewMap)
replace entries in vec via oldToNewMap, removing those not found.
Definition: ParticleSubset.cc:77