DAS
3.0
Das Analysis System
|
Generic meta-information for n-tuple (including speficities to Darwin).
Wrapper for TList
information typically stored in TTree::GetUserInfo()
. The list includes information such as:
flags
)git
),corrections
),history
)To initialise the meta information in a new TTree
, a config with flags is required:
To modify the meta information of an existing TTree
, only the tree is necessary, but the config may be compared to the existing meta information:
This is typically useful for reproducibility purposes, in the case where the config
was extracted from another TTree
at a more advanced stage.
A typical use case is to determine generic flags for the data processing:
The metainfo
can then be used like any other UserInfo
instance. Although one is entirely free to store any sort of information, it is important to keep in mind the minimal structure of the file (see above) and respect it as much as possible. For instance, to indicate an additional correction, the preferred way is the following:
#include <MetaInfo.h>
Classes | |
struct | IKnowWhatIAmDoing |
Public Member Functions | |
MetaInfo (const IKnowWhatIAmDoing &, bool git_init=true) | |
MetaInfo (TTree *t, const boost::property_tree::ptree &config, bool git_init=true) | |
MetaInfo (TTree *t, bool git_init=true) | |
MetaInfo (TList *l, bool git_init=true) | |
template<typename Ptr , typename ... Args> | |
MetaInfo (const Ptr &t, Args... args) | |
~MetaInfo () | |
void | Check (const boost::property_tree::ptree &) const |
template<unsigned h> | |
unsigned | Seed (std::pair< unsigned short, unsigned short > slice={1, 0}) const |
MetaInfo (const IKnowWhatIAmDoing &, bool git_init=true) | |
MetaInfo (TTree *t, const boost::property_tree::ptree &config, bool git_init=true) | |
MetaInfo (TTree *t, bool git_init=true) | |
MetaInfo (TList *l, bool git_init=true) | |
template<typename Ptr , typename ... Args> | |
MetaInfo (const Ptr &t, Args... args) | |
~MetaInfo () | |
void | Check (const boost::property_tree::ptree &) const |
template<unsigned h> | |
unsigned | Seed (std::pair< unsigned short, unsigned short > slice={1, 0}) const |
Public Member Functions inherited from UserInfo | |
template<typename... Args> | |
TList * | List (const char *key, Args... args) const |
TList * | List () const |
template<class T , typename... Args> | |
T | Get (const char *key, Args... args) const |
template<typename... Args> | |
bool | Find (const char *key, Args... args) const |
template<class T , typename... Args> | |
void | Set (const char *key, Args... args) const |
UserInfo (const char *="UserInfo") | |
UserInfo (const boost::property_tree::ptree &) | |
UserInfo (TList *) | |
UserInfo (TTree *) | |
UserInfo (TTree *, const boost::property_tree::ptree &) | |
~UserInfo () | |
void | Write () const |
bool | Empty () const |
boost::property_tree::ptree | Write (std::ostream &, Format=INFO) const |
boost::property_tree::ptree | Write (const std::filesystem::path &) const |
boost::property_tree::ptree | MkPtree (Format format=INFO) const |
void | ls () const |
template<typename... Args> | |
TList * | List (const char *key, Args... args) const |
TList * | List () const |
template<class T , typename... Args> | |
T | Get (const char *key, Args... args) const |
template<typename... Args> | |
bool | Find (const char *key, Args... args) const |
template<class T , typename... Args> | |
void | Set (const char *key, Args... args) const |
UserInfo (const char *="UserInfo") | |
UserInfo (const boost::property_tree::ptree &) | |
UserInfo (TList *) | |
UserInfo (TTree *) | |
UserInfo (TTree *, const boost::property_tree::ptree &) | |
~UserInfo () | |
void | Write () const |
bool | Empty () const |
boost::property_tree::ptree | Write (std::ostream &, Format=INFO) const |
boost::property_tree::ptree | Write (const std::filesystem::path &) const |
boost::property_tree::ptree | MkPtree (Format format=INFO) const |
void | ls () const |
Static Public Member Functions | |
static std::string | libgit2_version () |
static std::string | libgit2_version () |
Static Public Attributes | |
static std::map< std::string, std::string > | versions |
Private Member Functions | |
void | GitInit () |
void | PrintStatus () const |
bool | AllChangesCommitted () const |
void | SetupGit (bool) |
void | SetupVersions () |
void | UpdateList (const bool) const |
MetaInfo (bool, const char *) | |
MetaInfo (TTree *, const boost::property_tree::ptree &, bool, const char *) | |
MetaInfo (TTree *, bool, const char *) | |
MetaInfo (TList *, bool, const char *) | |
void | GitInit () |
void | PrintStatus () const |
bool | AllChangesCommitted () const |
void | SetupGit (bool) |
void | SetupVersions () |
void | UpdateList (const bool) const |
MetaInfo (bool, const char *) | |
MetaInfo (TTree *, const boost::property_tree::ptree &, bool, const char *) | |
MetaInfo (TTree *, bool, const char *) | |
MetaInfo (TList *, bool, const char *) | |
Static Private Member Functions | |
static int | get_one_status (const char *, unsigned int, void *) |
static int | get_one_status (const char *, unsigned int, void *) |
Private Attributes | |
git_repository * | repo |
int | git_error |
char | sha [16] |
const std::filesystem::path | origin |
Additional Inherited Members | |
Public Types inherited from UserInfo | |
enum | Format { INFO, JSON, XML, INFO, JSON, XML } |
enum | Format { INFO, JSON, XML, INFO, JSON, XML } |
Protected Member Functions inherited from UserInfo | |
boost::property_tree::ptree | MkPtree (TList *, Format=INFO) const |
boost::property_tree::ptree | MkPtree (TList *, Format=INFO) const |
|
private |
|
private |
Used internally to set the git repo location (last parameter).
|
private |
|
private |
|
inline |
Constsructor for first call ever. This creates a minimal MetaInfo.
This is a low-level constructor and the produced MetaInfo lacks some information:
|
inline |
Constsructor for first call ever, where the second parameter should be extracted from the config file or from the command line.
The preseed is taken from the config file or generated on the fly in a non-reproducible way. Use getMetaInfo
for see how to force the seed to a value from the config file.
t | `TTree` whose `UserInfo` will be populated |
config | input config (must include flags) |
|
inline |
Constsructor for call of existing n-tuple. By default, the git.complete
flag will be reset to false
. It should be set to true
after the event loop in the executable.
t | `TTree` whose `UserInfo` will be modified |
git_init | flag to init git repo |
|
inline |
Constsructor for direct call to a list (typically from a projection). By default, the git.complete
will be kept as it is.
l | `TList` that will be modified |
git_init | flag to init git repo |
|
inline |
~MetaInfo | ( | ) |
|
private |
Used internally to set the git repo location (last parameter).
|
private |
Used internally to set the git repo location (last parameter).
|
private |
Used internally to set the git repo location (last parameter).
|
private |
Used internally to set the git repo location (last parameter).
|
inline |
Constsructor for first call ever. This creates a minimal MetaInfo.
This is a low-level constructor and the produced MetaInfo lacks some information:
|
inline |
Constsructor for first call ever, where the second parameter should be extracted from the config file or from the command line.
The preseed is taken from the config file or generated on the fly in a non-reproducible way. Use getMetaInfo
for see how to force the seed to a value from the config file.
t | `TTree` whose `UserInfo` will be populated |
config | input config (must include flags) |
|
inline |
Constsructor for call of existing n-tuple. By default, the git.complete
flag will be reset to false
. It should be set to true
after the event loop in the executable.
t | `TTree` whose `UserInfo` will be modified |
git_init | flag to init git repo |
|
inline |
Constsructor for direct call to a list (typically from a projection). By default, the git.complete
will be kept as it is.
l | `TList` that will be modified |
git_init | flag to init git repo |
|
inline |
~MetaInfo | ( | ) |
Destructor (releases memory & shuts down Git).
|
private |
Function to check possibly uncommitted changes per file. It calls internally MetaInfo::get_one_status
with a foreach loop.
true
if all changes have been committed
|
private |
Function to check possibly uncommitted changes per file. It calls internally MetaInfo::get_one_status
with a foreach loop.
true
if all changes have been committed void Check | ( | const boost::property_tree::ptree & | config | ) | const |
Compare the meta information with the config given in argument. Either warnings or errors are thrown according to the severity of the inconsistencies. It also completes the records of successive commands.
void Check | ( | const boost::property_tree::ptree & | ) | const |
Compare the meta information with the config given in argument. Either warnings or errors are thrown according to the severity of the inconsistencies. It also completes the records of successive commands.
|
staticprivate |
Function to check if a file is ignored.
p | path to file |
data | pointer to `git_repository` |
|
staticprivate |
Function to check if a file is ignored.
|
private |
Inits and opens git repo, sets sha
to the value at running time.
|
private |
Inits and opens git repo, sets sha
to the value at running time.
|
static |
|
static |
|
private |
Mimicks git status
.
Adapted from this example. See also the documentation.
|
private |
Mimicks git status
.
Adapted from this example. See also the documentation.
|
inline |
Generate the seed in a reproducible way:
\[ s = h + (k+1) \times b \]
where
slice | variable part |
|
inline |
Generate the seed in a reproducible way:
\[ s = h + (k+1) \times b \]
where
slice | variable part |
|
private |
Fills in git information in the MetaInfo.
|
private |
Fills in git information in the MetaInfo.
|
private |
Fills in software version information in the MetaInfo.
|
private |
|
private |
Update list with present git information. The flags
and git
blocks are expected to be found, otherwise it crashes smoothly. Then it updates the Git information.
|
private |
Update list with present git information. The flags
and git
blocks are expected to be found, otherwise it crashes smoothly. Then it updates the Git information.
assumeComplete | should assume completeness (typically `false` for event loops) |
|
mutableprivate |
C-style error code from Git operations (see source code)
|
private |
path to local repo determined at compilation time
|
private |
pointer to local Git repo
|
private |
commit SHA at running time
|
static |
software version