Belle II Software development
RecordingFilter.dcl.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#pragma once
9
10#include <tracking/trackFindingCDC/filters/base/FilterOnVarSet.dcl.h>
11
12#include <tracking/trackFindingCDC/utilities/MayBePtr.h>
13
14#include <tracking/trackFindingCDC/numerics/Weight.h>
15
16#include <string>
17#include <memory>
18
19namespace Belle2 {
24 class ModuleParamList;
25
26 namespace TrackFindingCDC {
27 class Recorder;
28
33 template<class AFilter>
34 class Recording : public OnVarSet<AFilter> {
35
36 private:
39
40 public:
42 using Object = typename AFilter::Object;
43
44 private:
47
48 public:
50 Recording(std::unique_ptr<AVarSet> varSet,
51 const std::string& defaultRootFileName = "records.root",
52 const std::string& defaultTreeName = "records");
53
56
58 void exposeParameters(ModuleParamList* moduleParamList, const std::string& prefix) override;
59
61 void initialize() override;
62
64 void terminate() override;
65
66 public:
68 Weight operator()(const Object& obj) final;
69
70 protected:
72 MayBePtr<AFilter> getSkimFilter() const;
73
75 void setSkimFilter(std::unique_ptr<AFilter> skimFilter);
76
77 private:
79 std::unique_ptr<Recorder> m_recorder;
80
83
85 std::string m_param_treeName;
86
89
91 std::unique_ptr<AFilter> m_skimFilter = nullptr;
92 };
93
95 template<class AVarSet>
96 class RecordingFilter: public Recording<Filter<typename AVarSet::Object> > {
97
98 private:
101
102 public:
104 using Object = typename AVarSet::Object;
105
106 public:
108 explicit RecordingFilter(const std::string& defaultRootFileName = "records.root",
109 const std::string& defaultTreeName = "records");
110
113 };
114 }
116}
The Module parameter list class.
Object Object
Object type from which variables shall be extracted.
Definition: BaseVarSet.h:37
Filter adapter to make a filter work on a set of variables.
Convience template to create a recording filter for a set of variables.
typename AVarSet::Object Object
Type of the object to be analysed.
Filter adapter to make a filter work on a set of variables and record the observed instances on invok...
Weight m_param_returnWeight
Returns Weight when this filter is called.
void initialize() override
Initialize the recorder before event processing.
void terminate() override
Initialize the recorder after event processing.
std::string m_param_rootFileName
Name of the ROOT file to which shall be written.
Weight operator()(const Object &obj) final
Function to evaluate the cluster for its backgroundness.
~Recording()
Default destructor.
MayBePtr< AFilter > getSkimFilter() const
Getter for the skim filter to select objects to be recorded.
std::unique_ptr< AFilter > m_skimFilter
Skimming filter to select a subset of objects to be recorded.
typename AFilter::Object Object
Type of the object to be analysed.
void setSkimFilter(std::unique_ptr< AFilter > skimFilter)
Setter for the skim filter to select objects to be recorded.
std::string m_param_treeName
Name of Tree to be written.
std::unique_ptr< Recorder > m_recorder
Recorder to write all variable sets of the encountered objects.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) override
Expose the set of parameters of the filter to the module parameter list.
Abstract base class for different kinds of events.