AnalysisTree
Loading...
Searching...
No Matches
PlainTreeFiller.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_PLAINTREEFILLER_H_
5#define ANALYSISTREE_PLAINTREEFILLER_H_
6
7#include <utility>
8
9#include "AnalysisTask.hpp"
10#include "Detector.hpp"
11#include "Variable.hpp"
12
13namespace AnalysisTree {
14
15struct FIB {
16 float float_{-299.f};
17 int int_{-299};
18 bool bool_{false};
19 Types type_{Types::kNumberOfTypes};
20};
21
22class PlainTreeFiller : public AnalysisTask {
23 public:
24 PlainTreeFiller() = default;
25
26 void AddBranch(const std::string& branch_name);
27
28 void Init() override;
29 void Exec() override;
30 void Finish() override;
31
32 void SetOutputName(std::string file, std::string tree) {
33 file_name_ = std::move(file);
34 tree_name_ = std::move(tree);
35 }
36
37 void SetFieldsToIgnore(const std::vector<std::string>& fields_to_ignore);
38 void SetFieldsToPreserve(const std::vector<std::string>& fields_to_preserve);
39
40 void SetIsIgnoreDefaultFields(bool is = true) { is_ignore_defual_fields_ = is; }
41 void SetIsPrependLeavesWithBranchName(bool is = true) { is_prepend_leaves_with_branchname_ = is; }
42
43 protected:
44 TFile* file_{nullptr};
45 TTree* plain_tree_{nullptr};
46
47 std::string file_name_{"PlainTree.root"};
48 std::string tree_name_{"PlainTree"};
49 std::string branch_name_;
50
51 std::vector<FIB> vars_;
52 std::vector<std::string> fields_to_ignore_{};
53 std::vector<std::string> fields_to_preserve_{};
54
55 bool is_ignore_defual_fields_{false};
56 bool is_prepend_leaves_with_branchname_{true};
57};
58
59}// namespace AnalysisTree
60
61#endif//ANALYSISTREE_PLAINTREEFILLER_H_
Cuts keep list of SimpleCuts. Logical AND is applied for all SimpleCut in the Cuts object.
Definition BranchConfig.cpp:10
Definition PlainTreeFiller.hpp:15