AnalysisTree
Loading...
Searching...
No Matches
Chain.test.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_CHAIN_TEST_HPP_
5#define ANALYSISTREE_INFRA_CHAIN_TEST_HPP_
6
7#include <gtest/gtest.h>
8
9#include <infra/Chain.hpp>
10
11namespace {
12
13using namespace AnalysisTree;
14
15TEST(Test_AnalysisTreeInfra, Test_Chain) {
16
17 auto* chain = new Chain({"fl_toy_mc.txt"}, {"tTree"});
18
19 EXPECT_EQ(chain->GetNtrees(), 1);
20 EXPECT_EQ(chain->GetEntries(), 1000);
21
22 chain->InitPointersToBranches({});
23 auto branches_map = chain->GetBranchPointers();
24
25 auto n_px = chain->Draw("SimParticles.px", "");
26 EXPECT_GT(n_px, 0);
27
28 auto* particles = std::get<Particles*>(chain->GetPointerToBranch("SimParticles"));
29 auto* tracks = std::get<TrackDetector*>(chain->GetPointerToBranch("RecTracks"));
30
31 for (ULong64_t i = 0; i < 10; ++i) {
32 chain->GetEntry(i);
33
34 const auto Ms = particles->GetNumberOfChannels();
35 const auto Mr = tracks->GetNumberOfChannels();
36
37 EXPECT_GT(Mr, 0);
38 EXPECT_GT(Ms, 0);
39 }
40}
41
42}// namespace
43
44#endif//ANALYSISTREE_INFRA_CHAIN_TEST_HPP_
Definition Chain.hpp:24
Cuts keep list of SimpleCuts. Logical AND is applied for all SimpleCut in the Cuts object.
Definition BranchConfig.cpp:10