![]() |
DAS
3.0
Das Analysis System
|
User-friendly handling of input and output n-tuples.
A flow consists of input and output path to n-tuples and of a slice:
The last two lines can be condensed as follows:
The steering is use for the verbosity and the friendship. Setting up branches reduces to the following:
Furthermore, as it is frequent to produce histograms along the n-tuple (e.g. control plots), a flow allows to sum on the fly a histogram:
#include <Flow.h>
Collaboration diagram for Flow:Public Member Functions | |
| std::string | DumpActiveBranches () const |
| Flow (int=none, const std::vector< std::filesystem::path > &={}) | |
| ~Flow () | |
| ChainSlice * | GetInputTree (const Slice, const std::string &="events") |
| ChainSlice * | GetInputTree (const std::string &="events") |
| template<typename THX = TH1, size_t N> | |
| std::array< std::unique_ptr< THX >, N > | GetInputHists (const std::array< std::string, N > &names={}) |
| template<typename THX = TH1, typename... Args> | |
| auto | GetInputHists (const Args... args) |
| template<typename THX = TH1> | |
| std::unique_ptr< THX > | GetInputHist (const std::string &name) |
| TTree * | GetOutputTree (std::shared_ptr< TFile >={}, const std::source_location=std::source_location::current()) |
| TTree * | GetOutputTree (const std::filesystem::path &, const std::source_location=std::source_location::current()) |
| void | SetOutputFile (std::shared_ptr< TFile > fOut) |
| TFile * | GetOutputFile () |
| std::pair< TFile *, TTree * > | GetOutput (const std::filesystem::path &, const std::source_location=std::source_location::current()) |
| template<typename T > | |
| T * | GetBranchReadOnly (const std::string &name, BranchMode mode=mandatory) |
| template<typename T > | |
| T * | GetBranchWriteOnly (const std::string &name) |
| template<typename T > | |
| T * | GetBranchReadWrite (const std::string &name, BranchMode mode=mandatory) |
| template<Plugin P, std::ranges::range R> | |
| std::vector< P * > | GetPlugins (R &&plugin_paths) |
| std::string | DumpActiveBranches () const |
| Flow (int=none, const std::vector< std::filesystem::path > &={}) | |
| ~Flow () | |
| ChainSlice * | GetInputTree (const Slice, const std::string &="events") |
| ChainSlice * | GetInputTree (const std::string &="events") |
| template<typename THX = TH1, size_t N> | |
| std::array< std::unique_ptr< THX >, N > | GetInputHists (const std::array< std::string, N > &names={}) |
| template<typename THX = TH1, typename... Args> | |
| auto | GetInputHists (const Args... args) |
| template<typename THX = TH1> | |
| std::unique_ptr< THX > | GetInputHist (const std::string &name) |
| TTree * | GetOutputTree (std::shared_ptr< TFile >={}, const std::source_location=std::source_location::current()) |
| TTree * | GetOutputTree (const std::filesystem::path &, const std::source_location=std::source_location::current()) |
| void | SetOutputFile (std::shared_ptr< TFile > fOut) |
| TFile * | GetOutputFile () |
| std::pair< TFile *, TTree * > | GetOutput (const std::filesystem::path &, const std::source_location=std::source_location::current()) |
| template<typename T > | |
| T * | GetBranchReadOnly (const std::string &name, BranchMode mode=mandatory) |
| template<typename T > | |
| T * | GetBranchWriteOnly (const std::string &name) |
| template<typename T > | |
| T * | GetBranchReadWrite (const std::string &name, BranchMode mode=mandatory) |
| template<Plugin P, std::ranges::range R> | |
| std::vector< P * > | GetPlugins (R &&plugin_paths) |
Private Member Functions | |
| template<typename T > | |
| requires std::is_compound< T >::value std::shared_ptr< T * > | branch_cast (std::any &a) |
| template<typename T > | |
| requires std::is_fundamental< T >::value std::shared_ptr< T > | branch_cast (std::any &a) |
| template<typename T > | |
| requires std::is_compound< T >::value T * | GetBranchAddress (std::shared_ptr< T * > ptr) |
| template<typename T > | |
| requires std::is_fundamental< T >::value T * | GetBranchAddress (std::shared_ptr< T > ptr) |
| template<typename T > | |
| T * | GetBranchAddress (const std::string &name) |
| template<typename T > | |
| T * | NoBranch (const std::string &name, BranchMode mode) |
| template<typename T > | |
| requires std::is_compound< T >::value std::shared_ptr< T * > | branch_cast (std::any &a) |
| template<typename T > | |
| requires std::is_fundamental< T >::value std::shared_ptr< T > | branch_cast (std::any &a) |
| template<typename T > | |
| requires std::is_compound< T >::value T * | GetBranchAddress (std::shared_ptr< T * > ptr) |
| template<typename T > | |
| requires std::is_fundamental< T >::value T * | GetBranchAddress (std::shared_ptr< T > ptr) |
| template<typename T > | |
| T * | GetBranchAddress (const std::string &name) |
| template<typename T > | |
| T * | NoBranch (const std::string &name, BranchMode mode) |
Private Attributes | |
| int | steering |
| std::vector< PluginLoader > | plugin_loaders |
| std::vector< std::filesystem::path > | inputs |
| std::unique_ptr< ChainSlice > | tIn |
| std::shared_ptr< TFile > | fOut |
| std::unique_ptr< TTree > | tOut |
| std::map< std::string, std::any > | branches |
| ~Flow | ( | ) |
Destructor.
Saves the output tree (if declared) to the output file (if open).
Constructor.
Determines the command in which Flow is called.
| ~Flow | ( | ) |
Destructor.
Saves the output tree (if declared) to the output file (if open).
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inline |
Returns a list of all active branches, formatted as a string.
|
inline |
Returns a list of all active branches, formatted as a string.
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inline |
Wrapper to initialise read-only branches.
The existence of the branch is checked before setting the address.
In practice, loading a branch whose contents should be accessed but not modified reduces to a single line:
< branch type (e.g. RecEvent, vector<RecJet>)
| name | branch name |
| mode | branch may not exist |
|
inline |
Wrapper to initialise read-only branches.
The existence of the branch is checked before setting the address.
In practice, loading a branch whose contents should be accessed but not modified reduces to a single line:
< branch type (e.g. RecEvent, vector<RecJet>)
| name | branch name |
| mode | branch may not exist |
|
inline |
Wrapper to initialise read-write branches.
In practice, setting up a branch to modify its contents reduces to a single line:
< branch type (e.g. RecEvent, vector<RecJet>)
| name | branch name |
| mode | branch may not exist |
|
inline |
Wrapper to initialise read-write branches.
In practice, setting up a branch to modify its contents reduces to a single line:
< branch type (e.g. RecEvent, vector<RecJet>)
| name | branch name |
| mode | branch may not exist |
|
inline |
Wrapper to initialise write-only branches.
In practice, setting up a new branch in a n-tuple reduces to a single line:
< branch type (e.g. RecEvent, vector<RecJet>)
| name | branch name |
|
inline |
Wrapper to initialise write-only branches.
In practice, setting up a new branch in a n-tuple reduces to a single line:
< branch type (e.g. RecEvent, vector<RecJet>)
| name | branch name |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
| ChainSlice * GetInputTree | ( | const Slice | slice, |
| const std::string & | name = "events" |
||
| ) |
Load chain from a list of files with non-empty trees.
internal path to TTree
| slice | number and index of slice |
| ChainSlice* GetInputTree | ( | const | Slice, |
| const std::string & | = "events" |
||
| ) |
Load chain from a list of files with non-empty trees.
internal path to TTree
| Slice | number and index of slice |
| ChainSlice * GetInputTree | ( | const std::string & | name = "events" | ) |
Load chain from a list of files with possibly empty trees.
internal path to TTree
| ChainSlice* GetInputTree | ( | const std::string & | = "events" | ) |
Load chain from a list of files with possibly empty trees.
internal path to TTree
| std::pair< TFile *, TTree * > GetOutput | ( | const std::filesystem::path & | fOutName, |
| const std::source_location | location = std::source_location::current() |
||
| ) |
Get both the output file and the output tree in one go.
upstream function
| fOutName | output directory |
| std::pair<TFile *, TTree *> GetOutput | ( | const std::filesystem::path & | , |
| const std::source_location | = std::source_location::current() |
||
| ) |
Get both the output file and the output tree in one go.
upstream function
|
inline |
Get a raw pointer to the output file.
|
inline |
Get a raw pointer to the output file.
| TTree* GetOutputTree | ( | const std::filesystem::path & | , |
| const std::source_location | = std::source_location::current() |
||
| ) |
Create an output TTree object.
upstream function
| TTree * GetOutputTree | ( | const std::filesystem::path & | fOutName, |
| const std::source_location | location = std::source_location::current() |
||
| ) |
Create an output TTree object.
upstream function
| fOutName | output directory |
| TTree* GetOutputTree | ( | std::shared_ptr< TFile > | = {}, |
| const std::source_location | = std::source_location::current() |
||
| ) |
Create an output TTree object.
If the TTree already exists, either clone the input TChain or define the input TChain as a friend of the new TTree. Else a brand new TTree is stored.
The title of the TTree is used to store (retrieve) the name of the present (previous) command. When loading a tree with friends, one can refer to old versions of the branches by prefixing them with the corresponding command name.
TTree::BuildIndex() to preserve the association despite skipped events? upstream function
| TTree * GetOutputTree | ( | std::shared_ptr< TFile > | fOut = {}, |
| const std::source_location | location = std::source_location::current() |
||
| ) |
Create an output TTree object.
If the TTree already exists, either clone the input TChain or define the input TChain as a friend of the new TTree. Else a brand new TTree is stored.
The title of the TTree is used to store (retrieve) the name of the present (previous) command. When loading a tree with friends, one can refer to old versions of the branches by prefixing them with the corresponding command name.
TTree::BuildIndex() to preserve the association despite skipped events? upstream function
| fOut | output file |
|
inline |
|
inline |
|
inlineprivate |
Wrapper either to return a nullptr or to throw an error.
|
inlineprivate |
Wrapper either to return a nullptr or to throw an error.
|
inline |
Set the output file where the output TTree should be saved.
|
inline |
Set the output file where the output TTree should be saved.
|
private |
pointers to mounted branches
|
private |
output ROOT file
|
private |
ROOT files or directories.
|
private |
|
private |
steering from Options, mostly useful for friends
|
private |
input chain
|
private |
output tree