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
15class PlainTreeFiller : public AnalysisTask {
16 public:
17 PlainTreeFiller() = default;
18
19 void AddBranch(const std::string& branch_name);
20
21 void Init() override;
22 void Exec() override;
23 void Finish() override;
24
25 void SetOutputName(std::string file, std::string tree) {
26 file_name_ = std::move(file);
27 tree_name_ = std::move(tree);
28 }
29
30 void SetFieldsToIgnore(const std::vector<std::string>& fields_to_ignore);
31 void SetFieldsToPreserve(const std::vector<std::string>& fields_to_preserve);
32
33 void SetIsIgnoreDefaultFields(bool is = true) { is_ignore_defual_fields_ = is; }
34 void SetIsPrependLeavesWithBranchName(bool is = true) { is_prepend_leaves_with_branchname_ = is; }
35
36 protected:
37 TFile* file_{nullptr};
38 TTree* plain_tree_{nullptr};
39
40 std::string file_name_{"PlainTree.root"};
41 std::string tree_name_{"PlainTree"};
42 std::string branch_name_;
43
44 std::vector<float> vars_{};
45 std::vector<std::string> fields_to_ignore_{};
46 std::vector<std::string> fields_to_preserve_{};
47
48 bool is_ignore_defual_fields_{false};
49 bool is_prepend_leaves_with_branchname_{true};
50};
51
52}// namespace AnalysisTree
53
54#endif//ANALYSISTREE_PLAINTREEFILLER_H_
Cuts keep list of SimpleCuts. Logical AND is applied for all SimpleCut in the Cuts object.
Definition BranchConfig.cpp:10