Belle II Software  release-05-02-19
PruneDataStoreModule.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010-2016 Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Thomas Hauth *
7  * *
8  **************************************************************************/
9 
10 #pragma once
11 
12 #include <framework/core/Module.h>
13 #include <string>
14 #include <vector>
15 #include <regex>
16 
17 namespace Belle2 {
34  class PruneDataStoreModule: public Module {
35 
36  public:
37 
40 
42  virtual ~PruneDataStoreModule() = default;
43 
45  void initialize() override;
46 
48  void event() override;
49 
50  protected:
51 
55  std::regex compileAndCatch(std::string& regexString) const;
56 
58  std::vector<std::string> m_matchEntries;
59 
65  std::vector<std::string> m_keepEntriesImplicit = {{ "EventMetaData" }};
66 
71  bool m_keepMatchedEntries = true;
72 
74  std::vector < std::regex > m_compiled_regex;
75 
77  std::vector < std::regex > m_compiled_regex_implicit;
78 
79  };
81 } // end namespace Belle2
Belle2::PruneDataStoreModule::m_keepEntriesImplicit
std::vector< std::string > m_keepEntriesImplicit
Branches to always keep because the are required by the framework to properly work with the datastore...
Definition: PruneDataStoreModule.h:72
Belle2::PruneDataStoreModule::~PruneDataStoreModule
virtual ~PruneDataStoreModule()=default
Virtual Constructor to prevent memory leaks.
Belle2::PruneDataStoreModule::m_keepMatchedEntries
bool m_keepMatchedEntries
If true, all entries matched by the RegEx expression are kept.
Definition: PruneDataStoreModule.h:78
Belle2::PruneDataStoreModule::compileAndCatch
std::regex compileAndCatch(std::string &regexString) const
Compile a regex expression and catch the exception if the regex string is not valid.
Definition: PruneDataStoreModule.cc:61
Belle2::PruneDataStoreModule::initialize
void initialize() override
Prepare regex checks.
Definition: PruneDataStoreModule.cc:49
Belle2::PruneDataStoreModule::event
void event() override
Prune datastore.
Definition: PruneDataStoreModule.cc:72
Belle2::PruneDataStoreModule::m_compiled_regex_implicit
std::vector< std::regex > m_compiled_regex_implicit
Caching the regex expression for the keep check.
Definition: PruneDataStoreModule.h:84
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::PruneDataStoreModule::m_matchEntries
std::vector< std::string > m_matchEntries
Storing the option of branches to keep.
Definition: PruneDataStoreModule.h:65
Belle2::PruneDataStoreModule::PruneDataStoreModule
PruneDataStoreModule()
Constructor.
Definition: PruneDataStoreModule.cc:19
Belle2::PruneDataStoreModule::m_compiled_regex
std::vector< std::regex > m_compiled_regex
Caching the regex expression for the keep check.
Definition: PruneDataStoreModule.h:81