AnalysisTree
Toggle main menu visibility
Loading...
Searching...
No Matches
infra
Task.hpp
1
/* Copyright (C) 2019-2021 GSI, Universität Tübingen
2
SPDX-License-Identifier: GPL-3.0-only
3
Authors: Viktor Klochkov, Ilya Selyuzhenkov */
4
#ifndef ANALYSISTREE_INFRA_TASK_HPP_
5
#define ANALYSISTREE_INFRA_TASK_HPP_
6
7
#include <set>
8
9
#include "Configuration.hpp"
10
#include "Constants.hpp"
11
#include "EventHeader.hpp"
12
13
#include "Chain.hpp"
14
#include "Cuts.hpp"
15
16
class
TChain;
17
class
TTree;
18
class
TFile;
19
20
namespace
AnalysisTree
{
21
22
class
Configuration
;
23
class
DataHeader
;
24
25
class
Task {
26
27
public
:
28
Task() =
default
;
29
virtual
~Task() =
default
;
30
31
virtual
void
Init() = 0;
32
virtual
void
Exec() = 0;
33
virtual
void
Finish() = 0;
34
35
void
PreInit();
36
37
void
SetInConfiguration(
const
Configuration
* config) { config_ = config; }
38
void
SetDataHeader(
const
DataHeader
* data_header) { data_header_ = data_header; }
39
40
void
SetInputBranchNames(
const
std::set<std::string>& br) { in_branches_ = br; }
41
42
ANALYSISTREE_ATTR_NODISCARD
const
std::set<std::string>& GetInputBranchNames()
const
{
return
in_branches_; }
43
44
ANALYSISTREE_ATTR_NODISCARD
bool
IsGoodEvent(
const
EventHeader
& event_header)
const
{
45
return
event_cuts_ ==
nullptr
|| event_cuts_->Apply(event_header);
46
}
47
48
ANALYSISTREE_ATTR_NODISCARD
bool
IsGoodEvent(
const
Chain
& t)
const
;
49
50
void
SetEventCuts(
Cuts
* cuts) {
51
if
(cuts->GetBranches().size() != 1) {
52
throw
std::runtime_error(
"Event cuts on only 1 branch are allowed at the moment!"
);
53
}
54
event_cuts_ = cuts;
55
}
56
57
void
AddInputBranch(
const
std::string& name) { in_branches_.emplace(name); }
58
59
protected
:
60
const
Configuration
* config_{
nullptr
};
61
const
DataHeader
* data_header_{
nullptr
};
62
63
Cuts
* event_cuts_{
nullptr
};
64
65
std::set<std::string> in_branches_{};
66
bool
is_init_{
false
};
67
68
ClassDef(Task, 0);
69
};
70
71
}
// namespace AnalysisTree
72
73
#endif
//ANALYSISTREE_INFRA_TASK_HPP_
AnalysisTree::Chain
Definition
Chain.hpp:24
AnalysisTree::Configuration
A class to store configuration of the whole AnalysisTree object.
Definition
Configuration.hpp:58
AnalysisTree::Cuts
Cuts holds list of SimpleCuts and provides Apply function which subsequently applies cuts.
Definition
Cuts.hpp:25
AnalysisTree::DataHeader
Definition
DataHeader.hpp:19
AnalysisTree::EventHeader
Definition
EventHeader.hpp:18
AnalysisTree
Cuts keep list of SimpleCuts. Logical AND is applied for all SimpleCut in the Cuts object.
Definition
BranchConfig.cpp:10
Generated by
1.17.0