DAS  3.0
Das Analysis System
EventObjectBranchFlattener< T >

Description

template<typename T>
class Darwin::Physics::EventObjectBranchFlattener< T >

Wrapper for flat branches for gen- or rec-level event-type objects.

Todo:
Project more variables.
Todo:
Project more variables.

#include <Flattener.h>

+ Inheritance diagram for EventObjectBranchFlattener< T >:
+ Collaboration diagram for EventObjectBranchFlattener< T >:

Public Member Functions

template<typename Ret >
void Add (Tools::Flow &flow, const std::string &name, const std::function< Ret(const T &)> &f)
 
 EventObjectBranchFlattener (Tools::Flow &flow, const Variation &v, const std::string &nameIn, const std::string &nameOut)
 
void Fill () override
 
void Clear () override
 
virtual ~EventObjectBranchFlattener ()=default
 
template<typename Ret >
void Add (Tools::Flow &flow, const std::string &name, const std::function< Ret(const T &)> &f)
 
 EventObjectBranchFlattener (Tools::Flow &flow, const Variation &v, const std::string &nameIn, const std::string &nameOut)
 
void Fill () override
 
void Clear () override
 
virtual ~EventObjectBranchFlattener ()=default
 
- Public Member Functions inherited from BranchFlattener
virtual ~BranchFlattener ()=default
 
virtual ~BranchFlattener ()=default
 

Private Attributes

T * branchIn
 
std::list< std::unique_ptr< DT::SelfAwareBranch< const T & > > > branchesOut
 

Additional Inherited Members

- Protected Member Functions inherited from BranchFlattener
 BranchFlattener (const Variation &v)
 
 BranchFlattener (const Variation &v)
 
- Protected Attributes inherited from BranchFlattener
Variation v
 

Constructor & Destructor Documentation

◆ EventObjectBranchFlattener() [1/2]

EventObjectBranchFlattener ( Tools::Flow flow,
const Variation v,
const std::string &  nameIn,
const std::string &  nameOut 
)
inline

Generic class to project vectors of a given scaled object.

Parameters
nameIne.g. genEvent, recEvent
nameOute.g. Generator, ... (NANOAOD)
151  : BranchFlattener(v), branchIn(nullptr)
152  {
153  using namespace std;
154 
155  branchIn = flow.GetBranchReadOnly<T>(nameIn, DT::facultative);
156  if (!branchIn) return;
157 
158  Add<double>(flow, nameOut, [this](const T& obj) { return obj.Weight(this->v); });
159  }

◆ ~EventObjectBranchFlattener() [1/2]

virtual ~EventObjectBranchFlattener ( )
virtualdefault

◆ EventObjectBranchFlattener() [2/2]

EventObjectBranchFlattener ( Tools::Flow flow,
const Variation v,
const std::string &  nameIn,
const std::string &  nameOut 
)
inline

Generic class to project vectors of a given scaled object.

Parameters
nameIne.g. genEvent, recEvent
nameOute.g. Generator, ... (NANOAOD)
151  : BranchFlattener(v), branchIn(nullptr)
152  {
153  using namespace std;
154 
155  branchIn = flow.GetBranchReadOnly<T>(nameIn, DT::facultative);
156  if (!branchIn) return;
157 
158  Add<double>(flow, nameOut, [this](const T& obj) { return obj.Weight(this->v); });
159  }

◆ ~EventObjectBranchFlattener() [2/2]

virtual ~EventObjectBranchFlattener ( )
virtualdefault

Member Function Documentation

◆ Add() [1/2]

void Add ( Tools::Flow flow,
const std::string &  name,
const std::function< Ret(const T &)> &  f 
)
inline

Helper to add a new self-aware input branch.

141  {
142  branchesOut.emplace_back(std::make_unique<DT::SelfAwarePlainBranch<Ret, const T&>>(flow, name, f));
143  }

◆ Add() [2/2]

void Add ( Tools::Flow flow,
const std::string &  name,
const std::function< Ret(const T &)> &  f 
)
inline

Helper to add a new self-aware input branch.

141  {
142  branchesOut.emplace_back(std::make_unique<DT::SelfAwarePlainBranch<Ret, const T&>>(flow, name, f));
143  }

◆ Clear() [1/2]

void Clear ( )
inlineoverridevirtual

Clear output branches.

Implements BranchFlattener.

172  {
173  for (const auto& br: branchesOut)
174  br->Clear();
175  }

◆ Clear() [2/2]

void Clear ( )
inlineoverridevirtual

Clear output branches.

Implements BranchFlattener.

172  {
173  for (const auto& br: branchesOut)
174  br->Clear();
175  }

◆ Fill() [1/2]

void Fill ( )
inlineoverridevirtual

Fill output branches.

Implements BranchFlattener.

164  {
165  for (const auto& br: branchesOut)
166  br->Fill(*branchIn);
167  }

◆ Fill() [2/2]

void Fill ( )
inlineoverridevirtual

Fill output branches.

Implements BranchFlattener.

164  {
165  for (const auto& br: branchesOut)
166  br->Fill(*branchIn);
167  }

Member Data Documentation

◆ branchesOut

std::list< std::unique_ptr< DT::SelfAwareBranch< const T & > > > branchesOut
private

container for output branches

◆ branchIn

T * branchIn
private

input structured branch (e.g. in Darwin format)


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.f
f
Definition: Ntupliser_cfg.py:324
Darwin::Physics::EventObjectBranchFlattener::branchIn
T * branchIn
input structured branch (e.g. in Darwin format)
Definition: Flattener.h:130
Darwin::Tools::SelfAwarePlainBranch
Type for a plain-type branch that knows how to fill itself.
Definition: SelfAwareBranch.h:44
Darwin::Physics::BranchFlattener::v
Variation v
Definition: Flattener.h:42
Darwin::Physics::EventObjectBranchFlattener::branchesOut
std::list< std::unique_ptr< DT::SelfAwareBranch< const T & > > > branchesOut
container for output branches
Definition: Flattener.h:132
Darwin::Physics::BranchFlattener::BranchFlattener
BranchFlattener(const Variation &v)
Definition: Flattener.h:43
Darwin::Tools::facultative
@ facultative
mounting branch is facultative
Definition: Flow.h:33