DAS
3.0
Das Analysis System
|
User-friendly handling of input and output n-tuples.
A flow consists of input and outputs 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>
Public Member Functions | |
std::string | DumpActiveBranches () const |
Flow (int=none, const std::vector< std::filesystem::path > &={}) | |
~Flow () | |
ChainSlice * | GetInputTree (std::vector< std::filesystem::path >, const Slice={1, 0}, const std::string &="events") |
ChainSlice * | GetInputTree (const Slice={1, 0}, 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) |
std::string | DumpActiveBranches () const |
Flow (int=none, const std::vector< std::filesystem::path > &={}) | |
~Flow () | |
ChainSlice * | GetInputTree (std::vector< std::filesystem::path >, const Slice={1, 0}, const std::string &="events") |
ChainSlice * | GetInputTree (const Slice={1, 0}, 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) |
Private Member Functions | |
template<typename T > | |
std::shared_ptr< T * > | GetBranch (const std::string &name) const |
template<typename T > | |
T * | NoBranch (const std::string &name, BranchMode mode) |
template<typename T > | |
std::shared_ptr< T * > | GetBranch (const std::string &name) const |
template<typename T > | |
T * | NoBranch (const std::string &name, BranchMode mode) |
Private Attributes | |
int | steering |
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).
|
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 |
Get address of branch address in a shared pointer.
< branch type < branch name
|
inlineprivate |
Get address of branch address in a shared pointer.
< branch type < branch name
|
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 = {1, 0} , |
const std::string & | name = "events" |
||
) |
Load chain from a list of files.
internal path to TTree
slice | number and index of slice |
ChainSlice* GetInputTree | ( | const | Slice = {1, 0} , |
const std::string & | = "events" |
||
) |
Load chain from a list of files.
internal path to TTree
Slice | number and index of slice |
ChainSlice * GetInputTree | ( | std::vector< std::filesystem::path > | inputs, |
const Slice | slice = {1, 0} , |
||
const std::string & | name = "events" |
||
) |
Load chain from a list of files.
internal path to TTree
inputs | ROOT files or directories |
slice | number and index of slice |
ChainSlice* GetInputTree | ( | std::vector< std::filesystem::path > | , |
const | Slice = {1, 0} , |
||
const std::string & | = "events" |
||
) |
Load chain from a list of files.
internal path to TTree
Slice | number and index of slice |
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 > | 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 |
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
|
inlineprivate |
|
inlineprivate |
|
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 |
steering from Options, mostly useful for friends
|
private |
input chain
|
private |
output tree