DAS  3.0
Das Analysis System
SelfAwareVectorBranch< U, Args >

Description

template<typename U, typename... Args>
class Darwin::Tools::SelfAwareVectorBranch< U, Args >

Type for a vector branch that knows how to fill itself.

Given a DT::Flow flow object:

auto filler = [](int i) -> int { return i*2;};
SelfAwareVectorBranch<int> br(flow, "branch", filler);
br.Fill(42);
br.Fill(43);

is effectively equivalent to

auto br = flow.SetBranchWriteOnly<vector<int>>("branch");
br->push_back(filler(42));
br->push_back(filler(43));

#include <SelfAwareBranch.h>

+ Inheritance diagram for SelfAwareVectorBranch< U, Args >:
+ Collaboration diagram for SelfAwareVectorBranch< U, Args >:

Public Member Functions

 SelfAwareVectorBranch (Tools::Flow &flow, const std::string &name, std::function< U(Args...)> setter)
 
void Fill (Args... args) override
 
void Clear () override
 
 SelfAwareVectorBranch (Tools::Flow &flow, const std::string &name, std::function< U(Args...)> setter)
 
void Fill (Args... args) override
 
void Clear () override
 
- Public Member Functions inherited from SelfAwareBranch< Args... >
virtual ~SelfAwareBranch ()=default
 
virtual ~SelfAwareBranch ()=default
 

Private Attributes

std::vector< U > * ptr
 
std::function< U(Args...)> setter
 

Constructor & Destructor Documentation

◆ SelfAwareVectorBranch() [1/2]

SelfAwareVectorBranch ( Tools::Flow flow,
const std::string &  name,
std::function< U(Args...)>  setter 
)
inline
Parameters
namebranch name
setteroperation
81  : ptr(flow.GetBranchWriteOnly<std::vector<U>>(name))
82  , setter(setter) { }

◆ SelfAwareVectorBranch() [2/2]

SelfAwareVectorBranch ( Tools::Flow flow,
const std::string &  name,
std::function< U(Args...)>  setter 
)
inline
Parameters
namebranch name
setteroperation
81  : ptr(flow.GetBranchWriteOnly<std::vector<U>>(name))
82  , setter(setter) { }

Member Function Documentation

◆ Clear() [1/2]

void Clear ( )
inlineoverridevirtual

Implements SelfAwareBranch< Args... >.

84 { ptr->clear(); }

◆ Clear() [2/2]

void Clear ( )
inlineoverridevirtual

Implements SelfAwareBranch< Args... >.

84 { ptr->clear(); }

◆ Fill() [1/2]

void Fill ( Args...  args)
inlineoverridevirtual

Implements SelfAwareBranch< Args... >.

83 { ptr->push_back(setter(args...)); }

◆ Fill() [2/2]

void Fill ( Args...  args)
inlineoverridevirtual

Implements SelfAwareBranch< Args... >.

83 { ptr->push_back(setter(args...)); }

Member Data Documentation

◆ ptr

std::vector< U > * ptr
private

◆ setter

std::function< U(Args...)> setter
private

The documentation for this class was generated from the following file:
DYToLL_M-50_13TeV_pythia8_cff_GEN_SIM_RECOBEFMIX_DIGI_L1_DIGI2RAW_L1Reco_RECO.name
name
Definition: DYToLL_M-50_13TeV_pythia8_cff_GEN_SIM_RECOBEFMIX_DIGI_L1_DIGI2RAW_L1Reco_RECO.py:48
Ntupliser_cfg.args
args
Definition: Ntupliser_cfg.py:11
Darwin::Tools::SelfAwareVectorBranch::setter
std::function< U(Args...)> setter
Definition: SelfAwareBranch.h:76
Darwin::Tools::SelfAwareVectorBranch::ptr
std::vector< U > * ptr
Definition: SelfAwareBranch.h:75