Belle II Software development
PruneDataStoreModule.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#include <string>
13#include <vector>
14#include <regex>
15
16namespace Belle2 {
31
32 public:
33
36
38 virtual ~PruneDataStoreModule() = default;
39
41 void initialize() override;
42
44 void event() override;
45
46 protected:
47
51 std::regex compileAndCatch(std::string& regexString) const;
52
54 std::vector<std::string> m_matchEntries;
55
61 std::vector<std::string> m_keepEntriesImplicit = {{ "EventMetaData" }};
62
68
70 std::vector < std::regex > m_compiled_regex;
71
73 std::vector < std::regex > m_compiled_regex_implicit;
74
75 };
77} // end namespace Belle2
Base class for Modules.
Definition: Module.h:72
Clears the content of the DataStore while it keeps entries matching the regex expression in the match...
void initialize() override
Prepare regex checks.
void event() override
Prune datastore.
std::vector< std::string > m_keepEntriesImplicit
Branches to always keep because the are required by the framework to properly work with the datastore...
std::vector< std::regex > m_compiled_regex_implicit
Caching the regex expression for the keep check.
bool m_keepMatchedEntries
If true, all entries matched by the RegEx expression are kept.
virtual ~PruneDataStoreModule()=default
Virtual Constructor to prevent memory leaks.
std::vector< std::regex > m_compiled_regex
Caching the regex expression for the keep check.
std::vector< std::string > m_matchEntries
Storing the option of branches to keep.
std::regex compileAndCatch(std::string &regexString) const
Compile a regex expression and catch the exception if the regex string is not valid.
Abstract base class for different kinds of events.