Belle II Software
development
MetadataService.h
1
/**************************************************************************
2
* basf2 (Belle II Analysis Software Framework) *
3
* Author: The Belle II Collaboration *
4
* *
5
* See git log for contributors and copyright holders. *
6
* This file is licensed under LGPL-3.0, see LICENSE.md. *
7
**************************************************************************/
8
9
#pragma once
10
11
#include <string>
12
#include <nlohmann/json.hpp>
13
14
15
namespace
Belle2
{
21
class
FileMetaData;
22
27
class
MetadataService
{
28
29
public
:
30
36
static
MetadataService
&
Instance
();
37
43
void
setJsonFileName
(
const
std::string& fileName) {
m_fileName
= fileName;
writeJson
();};
44
48
void
addRootOutputFile
(
const
std::string& fileName,
const
FileMetaData
* metaData =
nullptr
);
49
53
void
addNtuple
(
const
std::string& fileName);
54
58
void
addBasf2Status
(
const
std::string& message =
""
);
59
63
void
addModuleCallsCount
();
64
68
void
finishBasf2
(
bool
success =
true
);
69
70
private
:
71
72
std::string
m_fileName
;
73
nlohmann::json
m_json
;
74
double
m_basf2StartTime
;
79
MetadataService
();
80
84
MetadataService
(
const
MetadataService
&) =
delete
;
85
89
MetadataService
&
operator=
(
const
MetadataService
&) =
delete
;
90
94
void
writeJson
();
95
96
};
97
99
}
//end of namespace Belle2
Belle2::FileMetaData
Metadata information about a file.
Definition:
FileMetaData.h:29
Belle2::MetadataService
This class provides a service for writing metadata about the basf2 execution and about output files t...
Definition:
MetadataService.h:27
Belle2::MetadataService::writeJson
void writeJson()
Serialize the current json content to the json file.
Definition:
MetadataService.cc:126
Belle2::MetadataService::MetadataService
MetadataService(const MetadataService &)=delete
Disable/Hide the copy constructor.
Belle2::MetadataService::m_basf2StartTime
double m_basf2StartTime
the start time of basf2
Definition:
MetadataService.h:74
Belle2::MetadataService::addModuleCallsCount
void addModuleCallsCount()
Add the metadata of number of calls of all modules.
Definition:
MetadataService.cc:99
Belle2::MetadataService::addBasf2Status
void addBasf2Status(const std::string &message="")
Add metadata of basf2 status.
Definition:
MetadataService.cc:75
Belle2::MetadataService::setJsonFileName
void setJsonFileName(const std::string &fileName)
Set the name of the json metadata file.
Definition:
MetadataService.h:43
Belle2::MetadataService::m_fileName
std::string m_fileName
The name of the json file.
Definition:
MetadataService.h:72
Belle2::MetadataService::MetadataService
MetadataService()
Constructor.
Definition:
MetadataService.cc:21
Belle2::MetadataService::addNtuple
void addNtuple(const std::string &fileName)
Add the metadata of any ntuple file.
Definition:
MetadataService.cc:57
Belle2::MetadataService::addRootOutputFile
void addRootOutputFile(const std::string &fileName, const FileMetaData *metaData=nullptr)
Add the metadata of a root output file.
Definition:
MetadataService.cc:32
Belle2::MetadataService::m_json
nlohmann::json m_json
The json object.
Definition:
MetadataService.h:73
Belle2::MetadataService::operator=
MetadataService & operator=(const MetadataService &)=delete
Disable/Hide the copy assignment operator.
Belle2::MetadataService::Instance
static MetadataService & Instance()
Static method to get a reference to the MetadataService instance.
Definition:
MetadataService.cc:26
Belle2::MetadataService::finishBasf2
void finishBasf2(bool success=true)
Add metadata for basf2 completion.
Definition:
MetadataService.cc:118
Belle2
Abstract base class for different kinds of events.
Definition:
MillepedeAlgorithm.h:17
framework
core
include
MetadataService.h
Generated on Fri Nov 8 2024 02:37:10 for Belle II Software by
1.9.6