DAS  3.0
Das Analysis System
SelfAwarePlainBranch< U, Args >

Description

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

Type for a plain-type branch that knows how to fill itself.

Given a DT::Flow flow object:

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

is effectively equivalent to

auto br = flow.SetBranchWriteOnly<int>("branch");
*br = filler(42);

#include <SelfAwareBranch.h>

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

Public Member Functions

 SelfAwarePlainBranch (Tools::Flow &flow, const std::string &name, std::function< U(Args...)> setter)
 
void Fill (Args... args) override
 
void Clear () override
 
 SelfAwarePlainBranch (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

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

Constructor & Destructor Documentation

◆ SelfAwarePlainBranch() [1/2]

SelfAwarePlainBranch ( Tools::Flow flow,
const std::string &  name,
std::function< U(Args...)>  setter 
)
inline
Parameters
namebranch name
setteroperation
51  : ptr(flow.GetBranchWriteOnly<U>(name))
52  , setter(setter) { }

◆ SelfAwarePlainBranch() [2/2]

SelfAwarePlainBranch ( Tools::Flow flow,
const std::string &  name,
std::function< U(Args...)>  setter 
)
inline
Parameters
namebranch name
setteroperation
51  : ptr(flow.GetBranchWriteOnly<U>(name))
52  , setter(setter) { }

Member Function Documentation

◆ Clear() [1/2]

void Clear ( )
inlineoverridevirtual

Implements SelfAwareBranch< Args... >.

54 { *ptr = std::nan("NaN"); }

◆ Clear() [2/2]

void Clear ( )
inlineoverridevirtual

Implements SelfAwareBranch< Args... >.

54 { *ptr = std::nan("NaN"); }

◆ Fill() [1/2]

void Fill ( Args...  args)
inlineoverridevirtual

Implements SelfAwareBranch< Args... >.

53 { *ptr = setter(args...); }

◆ Fill() [2/2]

void Fill ( Args...  args)
inlineoverridevirtual

Implements SelfAwareBranch< Args... >.

53 { *ptr = setter(args...); }

Member Data Documentation

◆ ptr

U * ptr
private

for NANOAOD-lile tree, expect Bool_t, Char_t, UChar_t, UInt, ...

◆ 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
Darwin::Tools::SelfAwarePlainBranch::setter
std::function< U(Args...)> setter
Definition: SelfAwareBranch.h:46
Ntupliser_cfg.args
args
Definition: Ntupliser_cfg.py:11
Darwin::Tools::SelfAwarePlainBranch::ptr
U * ptr
for NANOAOD-lile tree, expect Bool_t, Char_t, UChar_t, UInt, ...
Definition: SelfAwareBranch.h:45