4#ifndef ANALYSISTREE_INFRA_VARIANTMAGIC_HPP_
5#define ANALYSISTREE_INFRA_VARIANTMAGIC_HPP_
14#include "Variable.hpp"
19 template<
typename Entity>
20 size_t get_id(Entity* d)
const {
return d->GetId(); }
21 template<
typename Entity>
22 size_t operator()(Entity* d)
const {
return get_id<Entity>(d); }
27 template<
typename Entity>
28 ChannelPointer get_channel(Entity* d)
const {
return ChannelPointer(&(d->Channel(i_channel_))); }
29 template<
typename Entity>
30 ChannelPointer operator()(Entity* d)
const {
return get_channel<Entity>(d); }
35 template<
typename Entity>
36 void clear_channels(Entity* d)
const { d->ClearChannels(); }
37 template<
typename Entity>
38 void operator()(Entity* d)
const { clear_channels<Entity>(d); }
43 template<
typename Entity>
44 void new_channel(Entity* d)
const {
45 auto channel = d->AddChannel();
46 channel->Init(*config_);
48 template<
typename Entity>
49 void operator()(Entity* d)
const { new_channel<Entity>(d); }
54 template<
typename T1,
typename T2>
55 void copy_content(T1* ch1, T2* ch2)
const {
58 template<
typename T1,
typename T2>
62 template<
typename T1,
typename T2>
63 void operator()(T1* ch1, T2* ch2)
const { copy_content<T1, T2>(ch1, ch2); }
69 template<
typename Entity>
70 double get_field(Entity* d)
const {
return d->template GetField<T>(id_); }
71 template<
typename Entity>
72 double operator()(Entity* d)
const {
return get_field<Entity>(d); }
79 template<
typename Entity>
80 void set_field(Entity* d)
const { d->template SetField<T>(value_, id_); }
81 template<
typename Entity>
82 void operator()(Entity* d)
const { set_field<Entity>(d); }
89 size_t get_n_channels(Det* d)
const {
return d->GetNumberOfChannels(); }
90 template<
typename Entity>
91 size_t operator()(Entity* d)
const {
return get_n_channels<Entity>(d); }
97 int set_branch_address(Det*& d)
const {
return tree_->SetBranchAddress(name_.c_str(), &d); }
98 template<
typename Entity>
99 int operator()(Entity*& d)
const {
return set_branch_address<Entity>(d); }
100 TTree* tree_{
nullptr};
A class to store configuration of the Container.
Definition BranchConfig.hpp:118
A class to store any number of integers, floats and bools.
Definition Container.hpp:18
Definition Particle.hpp:11
A class for a generic track with determined momentum.
Definition Track.hpp:22
Cuts keep list of SimpleCuts. Logical AND is applied for all SimpleCut in the Cuts object.
Definition BranchConfig.cpp:10
Definition VariantMagic.hpp:34
Definition VariantMagic.hpp:53
Definition VariantMagic.hpp:25
Definition VariantMagic.hpp:67
Definition VariantMagic.hpp:18
Definition VariantMagic.hpp:87
Definition VariantMagic.hpp:41
Definition VariantMagic.hpp:94
Definition VariantMagic.hpp:77