|
DAS
3.0
Das Analysis System
|
|
typedef std::pair< unsigned, unsigned > | Slice |
|
|
enum | BranchMode { mandatory,
facultative,
mandatory,
facultative
} |
|
enum | Mode {
none = 0b000000,
config = 0b000001,
split = 0b000010,
fill = 0b000100,
Friend = 0b001000,
syst = 0b010000,
verbose = 0b100000,
none = 0b000000,
config = 0b000001,
split = 0b000010,
fill = 0b000100,
Friend = 0b001000,
syst = 0b010000,
verbose = 0b100000
} |
|
enum | BranchMode { mandatory,
facultative,
mandatory,
facultative
} |
|
enum | Mode {
none = 0b000000,
config = 0b000001,
split = 0b000010,
fill = 0b000100,
Friend = 0b001000,
syst = 0b010000,
verbose = 0b100000,
none = 0b000000,
config = 0b000001,
split = 0b000010,
fill = 0b000100,
Friend = 0b001000,
syst = 0b010000,
verbose = 0b100000
} |
|
|
optional< bool > | getBool (string s) |
|
template<typename ... Args> |
void | FromPT2MetaInfo (const pt::ptree &elements, const MetaInfo &metainfo, ostream &cout, Args... args) |
|
void | forceMetaInfo (const fs::path &input, const fs::path &output, const int steering) |
|
int | getMetaInfo (vector< fs::path > inputs, const fs::path &output) |
|
int | initMetaInfo (const pt::ptree &config) |
|
template<int thousand = 1024> |
const char * | GetHumanReadableSize (long double size) |
|
Long64_t | GetSize (TBranch *br) |
|
Long64_t | loopBranches (TObjArray *branches, size_t factor, int nIndent=0) |
|
void | printBranches (vector< fs::path > inputs, const int steering) |
|
void | printDarwinSoftwareVersion () |
|
void | printEntries (vector< fs::path > inputs, const int steering) |
|
void | CollectFriends (const TTree *tree, set< string > &printed, const int steering, string indent="") |
|
void | CollectChainFriends (const TChain *chain, set< string > &printed, const int steering, string indent="") |
|
void | printFriends (vector< fs::path > inputs, const int steering) |
|
void | printHist (vector< fs::path > inputs, const pt::ptree &config, const int steering) |
|
int | printMetaInfo (vector< fs::path > inputs, const pt::ptree &config) |
|
void | StandardInit () |
|
std::vector< std::filesystem::path > | GetROOTfiles (std::vector< std::filesystem::path > inputs) |
|
template<typename THX = TH1> |
std::unique_ptr< THX > | GetHist (std::vector< std::filesystem::path > inputs, const std::string &name="h") |
|
std::string | GetFirstTreeLocation (const std::filesystem::path &input) |
|
std::shared_ptr< TFile > | GetOutputFile (const std::filesystem::path &, const std::source_location=std::source_location::current()) |
|
std::ostream & | operator<< (std::ostream &Stream, const Darwin::Tools::Slice &slice) |
|
static std::ostream | dev_null (nullptr) |
|
std::unique_ptr< TFile > | GetOutput (std::filesystem::path output, const std::string &name) |
|
std::vector< const char * > | tokenize (const char *str) |
|
static std::ostream | dev_null (nullptr) |
|
Classes and functions related to the framework.
Utilities enabling better support for friend chains in a TTree
.
SPDX-License-Idendifier: GPL-3.0-or-later SPDX-FileCopyrightText: Louis Moureaux louis.nosp@m..mou.nosp@m.reaux.nosp@m.@cer.nosp@m.n.ch
◆ Slice
typedef std::pair< unsigned, unsigned > Slice |
current slice (>=0) / total number of slices (>0)
◆ BranchMode [1/2]
Enumerator |
---|
mandatory | mounting branch is mandatory
|
facultative | mounting branch is facultative
|
mandatory | mounting branch is mandatory
|
facultative | mounting branch is facultative
|
◆ BranchMode [2/2]
Enumerator |
---|
mandatory | mounting branch is mandatory
|
facultative | mounting branch is facultative
|
mandatory | mounting branch is mandatory
|
facultative | mounting branch is facultative
|
◆ Mode [1/2]
Enumerator |
---|
none | default (for simple executables)
|
config | activate -c option to provide config file
|
split | activate -k and -j to define slice
|
fill | activate -f to fill the tree
|
Friend | activate -F to only fill the new branches
|
syst | activate -s to systematic uncertainties
|
verbose | bit for debug mode (-v is always available)
|
none | default (for simple executables)
|
config | activate -c option to provide config file
|
split | activate -k and -j to define slice
|
fill | activate -f to fill the tree
|
Friend | activate -F to only fill the new branches
|
syst | activate -s to systematic uncertainties
|
verbose | bit for debug mode (-v is always available)
|
◆ Mode [2/2]
Enumerator |
---|
none | default (for simple executables)
|
config | activate -c option to provide config file
|
split | activate -k and -j to define slice
|
fill | activate -f to fill the tree
|
Friend | activate -F to only fill the new branches
|
syst | activate -s to systematic uncertainties
|
verbose | bit for debug mode (-v is always available)
|
none | default (for simple executables)
|
config | activate -c option to provide config file
|
split | activate -k and -j to define slice
|
fill | activate -f to fill the tree
|
Friend | activate -F to only fill the new branches
|
syst | activate -s to systematic uncertainties
|
verbose | bit for debug mode (-v is always available)
|
◆ CollectChainFriends()
void Darwin::Tools::CollectChainFriends |
( |
const TChain * |
chain, |
|
|
set< string > & |
printed, |
|
|
const int |
steering, |
|
|
string |
indent = "" |
|
) |
| |
Retrieve and prints the elements in the chain and their friends recursively.
- Parameters
-
chain | chain to collect friends from |
printed | files already printed |
steering | bitfield from `Options::steering()` |
indent | spaces to show the distance from the original tree |
34 for (
const auto &obj : *chain->GetListOfFiles()) {
35 auto element =
dynamic_cast<TChainElement*
>(obj);
38 auto full_name = element->GetTitle() + string(
"?#") + element->GetName();
41 cout <<
indent <<
"[chain] " << full_name;
45 TTree *tree =
nullptr;
46 unique_ptr<TFile> file(TFile::Open(element->GetTitle()));
47 if (file && !file->IsZombie()) {
48 tree = file->Get<TTree>(element->GetName());
50 BOOST_THROW_EXCEPTION(Exceptions::BadInput(
51 Form(
"Tree %s not found", element->GetName()), file));
53 BOOST_THROW_EXCEPTION(Exceptions::BadInput(
"File not found", file));
57 if (printed.count(full_name) == 0) {
58 printed.insert(full_name);
61 cout <<
indent <<
" [see above]" << endl;
◆ CollectFriends()
void CollectFriends |
( |
const TTree * |
tree, |
|
|
set< string > & |
printed, |
|
|
const int |
steering, |
|
|
string |
indent |
|
) |
| |
Retrieve and prints the name and the friends.
When called on a long chain of friends, the output can include a very large number of files. To avoid printing too many lines, each file is printed only once. The printed
argument keeps track of files already printed.
- Parameters
-
tree | tree (or chain) to collect friends from |
printed | files already printed |
steering | bitflied from `Options::steering()` |
indent | spaces to show the distance from the original tree |
83 if (
const auto chain =
dynamic_cast<const TChain*
>(tree); chain)
86 auto friends = tree->GetListOfFriends();
89 if (friends ==
nullptr)
return;
91 if (steering &
verbose) friends->Print();
94 for (TObject * obj: *friends) {
95 auto buddy =
dynamic_cast<TFriendElement*
>(obj);
97 cout <<
indent <<
"[friend] ";
98 if (
auto sliced =
dynamic_cast<SlicedFriendElement*
>(obj); sliced)
100 cout << buddy->GetName()
101 <<
"[" << sliced->GetBegin() <<
":" << sliced->GetEnd() <<
"]";
104 cout << buddy->GetTitle() <<
" " << buddy->GetName();
◆ dev_null() [1/2]
static std::ostream Darwin::Tools::dev_null |
( |
nullptr |
| ) |
|
|
static |
to redirect output stream to nowhere
◆ dev_null() [2/2]
static std::ostream Darwin::Tools::dev_null |
( |
nullptr |
| ) |
|
|
static |
to redirect output stream to nowhere
◆ forceMetaInfo()
void Darwin::Tools::forceMetaInfo |
( |
const fs::path & |
input, |
|
|
const fs::path & |
output, |
|
|
const int |
steering |
|
) |
| |
Force content of all TTree::UserInfo()
and TList
found in the topmost directory of the root file. This method is to be used as a last resort, and certainly not in the context of reproducible results.
- Parameters
-
input | input config file (INFO, JSON, XML) |
output | ROOT file |
steering | parameters obtained from explicit options |
98 if (
input.extension() ==
".json")
100 else if (
input.extension() ==
".xml")
106 unique_ptr<TFile> fOut(TFile::Open(output.c_str(),
"UPDATE"));
107 auto t = unique_ptr<TTree>(fOut->Get<TTree>(location.c_str()));
109 BOOST_THROW_EXCEPTION(
DE::BadInput(
"The tree can't be found in this file.", fOut));
111 t->GetUserInfo()->Clear();
114 MetaInfo metainfo(t,
false);
116 metainfo.Set<
bool>(
"git",
"reproducible",
false);
117 if (metainfo.Find(
"history")) {
118 TList * history = metainfo.List(
"history");
119 metainfo.List()->Remove(history);
◆ FromPT2MetaInfo()
void Darwin::Tools::FromPT2MetaInfo |
( |
const pt::ptree & |
elements, |
|
|
const MetaInfo & |
metainfo, |
|
|
ostream & |
cout, |
|
|
Args... |
args |
|
) |
| |
Sets whatever is in the input config file into the metainfo of a TTree
.
- Parameters
-
elements | from config file |
metainfo | target metainfo (will be modified) |
cout | overrides standard output |
args | key chain |
56 if constexpr (
sizeof...(Args) < 10)
57 for (const auto& element: elements) {
58 const char *
key = element.first.c_str();
59 const auto& value = element.second.get_value<
string>();
62 if constexpr (
sizeof...(Args) > 0)
63 (cout << ... <<
args) <<
' ';
64 cout <<
def <<
key <<
" \"" << value <<
'"' << endl;
68 auto match = [&value](
const string& reg) {
69 return regex_match( value, regex(reg) );
71 if (
auto isBool =
getBool(value); isBool)
72 metainfo.Set<
bool>(
args...,
key, *isBool);
73 else if (
match(
"-?[0-9]+"))
74 metainfo.Set<
int>(
args...,
key, stoi(value));
75 else if (
match(
"-?[0-9]+([\\.][0-9]+)?"))
76 metainfo.Set<
float>(
args...,
key, stof(value));
77 else if (element.second.size() == 0) {
79 if constexpr (
sizeof...(Args) > 0)
80 metainfo.Set<
string>(
args...,
string(
key));
83 metainfo.Set<
string>(
args...,
key, value);
◆ getBool()
optional<bool> Darwin::Tools::getBool |
( |
string |
s | ) |
|
Translates a string into a boolean if possible.
36 static const array<string,4> trueStr {
"true",
"on",
"ktrue",
"yes"},
37 falseStr {
"false",
"off",
"kfalse",
"no"};
38 if (
auto it = find(trueStr.begin(), trueStr.end(), s);
40 return make_optional<bool>(
true);
41 if (
auto it = find(falseStr.begin(), falseStr.end(), s);
43 return make_optional<bool>(
false);
◆ GetFirstTreeLocation()
std::string GetFirstTreeLocation |
( |
const std::filesystem::path & |
input | ) |
|
one input ROOT file
Look for a tree in the input file (stop at the first found one).
- Note
- in principle, we take the risk of not looking at the same
TTree
as all other executables, but this is unlikely in practice
- Parameters
-
66 unique_ptr<TFile> fIn(TFile::Open(
input.c_str(),
"READ"));
67 if (!fIn || !fIn->IsOpen() || fIn->IsZombie() || !fs::exists(
input))
68 BOOST_THROW_EXCEPTION( fs::filesystem_error(
"Failed to open input file",
69 input, make_error_code(std::errc::io_error)) );
71 function<string(TDirectory *)> loop;
72 loop = [&loop](TDirectory * d) ->
string {
75 for (
const auto&& obj: *(d->GetListOfKeys())) {
76 auto const key =
dynamic_cast<TKey*
>(obj);
77 if (
dynamic_cast<TTree *
>(
key->ReadObj()) ==
nullptr)
continue;
78 return obj->GetName();
82 for (
const auto&& obj: *(d->GetListOfKeys())) {
83 auto const key =
dynamic_cast<TKey*
>(obj);
84 auto dd =
dynamic_cast<TDirectory *
>(
key->ReadObj());
85 if (dd ==
nullptr)
continue;
86 if (
auto location = loop(dd); !location.empty())
87 return Form(
"%s/%s", dd->GetName(), location.c_str());
93 string location = loop(fIn.get());
95 BOOST_THROW_EXCEPTION(
DE::BadInput(
"No `TTree` could be found in the input file.", fIn) );
◆ GetHist()
std::unique_ptr< THX > GetHist |
( |
std::vector< std::filesystem::path > |
inputs, |
|
|
const std::string & |
name = "h" |
|
) |
| |
|
inline |
Load a histogram from a list of files.
- Todo:
- what if the file had already been opened?? will it be closed prematurely?
- Todo:
- what if the file had already been opened?? will it be closed prematurely?
- Todo:
- what if the file had already been opened?? will it be closed prematurely?
- Parameters
-
inputs | ROOT files or directories |
name | internal path to ROOT histogram |
45 namespace fs = filesystem;
50 auto fIn = make_unique<TFile>(
input.c_str(),
"READ");
52 unique_ptr<THX> h(fIn->Get<THX>(
name.c_str()));
55 BOOST_THROW_EXCEPTION(
DE::BadInput(Form(
"`%s` cannot be found in (one of) the "
56 " file(s).",
name.c_str()), fIn));
62 sum->SetDirectory(
nullptr);
◆ GetHumanReadableSize()
const char* Darwin::Tools::GetHumanReadableSize |
( |
long double |
size | ) |
|
From an absolute number of bytes to human readable size in KB, MB, GB, etc.
< https://en.wikipedia.org/wiki/Byte
- Parameters
-
31 static const array levels = {
'\0',
'K',
'M',
'G',
'T',
'P',
'E',
'Z',
'Y'};
32 auto level = levels.begin();
33 while (level != prev(levels.end())
34 && size >
static_cast<long double>(thousand)) {
38 return Form(
"%.0Lf%c", size, *level);
◆ getMetaInfo()
int Darwin::Tools::getMetaInfo |
( |
vector< fs::path > |
inputs, |
|
|
const fs::path & |
output |
|
) |
| |
Print content of the first TTree::UserInfo()
found in the root file.
- Parameters
-
inputs | input ROOT files |
output | output config file (INFO, JSON, XML) |
31 const size_t N =
inputs.size();
33 vector<size_t> hashes(N,0);
38 for (
size_t i = 0; i < N; ++i) {
41 unique_ptr<TFile> fIn(TFile::Open(
inputs[i].c_str(),
"READ"));
43 BOOST_THROW_EXCEPTION(
DE::BadInput(
"Can't open the file.", fIn));
46 auto t = unique_ptr<TTree>(
dynamic_cast<TTree*
>(fIn->Get<TTree>(location.c_str())));
48 BOOST_THROW_EXCEPTION(
DE::BadInput(
"The tree can't be found in this file.", fIn));
51 MetaInfo mi(t,
false);
62 bool identical =
true;
64 for (
size_t i = 0; i < N; ++i) {
65 ss <<
inputs[i] <<
'\t' << hex << hashes[i] <<
'\n';
67 identical &= hashes[i-1] == hashes[i];
70 if (identical)
return EXIT_SUCCESS;
◆ GetOutput()
std::unique_ptr<TFile> Darwin::Tools::GetOutput |
( |
std::filesystem::path |
output, |
|
|
const std::string & |
name |
|
) |
| |
20 const auto fname = output;
21 output +=
"?reproducible="; output +=
name;
22 std::unique_ptr<TFile>
f(TFile::Open(output.c_str(),
"RECREATE"));
23 if (!
f || !
f->IsOpen() ||
f->IsZombie() || !fs::exists(
fname))
24 BOOST_THROW_EXCEPTION( fs::filesystem_error(
"Failed to open output file",
25 output, make_error_code(std::errc::io_error)) );
◆ GetOutputFile()
std::shared_ptr< TFile > GetOutputFile |
( |
const std::filesystem::path & |
, |
|
|
const std::source_location |
= std::source_location::current() |
|
) |
| |
Shortcut to create a reproducible output file (see ROOT Doxygen for details)
upstream function
- Parameters
-
102 string title = fs::path(location.file_name()).stem();
103 auto output_rep = output.string() +
"?reproducible="s + title;
104 auto fOut = make_shared<TFile>(output_rep.c_str(),
"RECREATE");
105 if (!fOut->IsOpen() || fOut->IsZombie() || !fs::exists(output)) {
107 BOOST_THROW_EXCEPTION( fs::filesystem_error(
"Failed to open output file",
108 output, make_error_code(errc::io_error)) );
110 fOut->SetTitle(title.c_str());
◆ GetROOTfiles()
std::vector< std::filesystem::path > GetROOTfiles |
( |
std::vector< std::filesystem::path > |
inputs | ) |
|
ROOT files or directories.
In case directories are given as inputs, instead of files, this function looks for all ROOT files in those directories (and subdirectories, iteratively).
- Parameters
-
inputs | ROOT files or directories |
39 vector<fs::path> root_inputs;
40 root_inputs.reserve(
inputs.size());
44 if (fs::is_directory(
input)) {
45 for (
const auto &entry : fs::recursive_directory_iterator(
46 input, fs::directory_options::follow_directory_symlink)) {
47 if (fs::is_regular_file(entry) && entry.path().extension() ==
".root") {
48 root_inputs.push_back(entry);
52 else if (
input.extension() ==
".root")
53 root_inputs.push_back(
input);
56 sort(root_inputs.begin(), root_inputs.end(),
57 [](
const fs::path& a,
const fs::path& b) {
58 return strnatcmp(a.c_str(), b.c_str()) < 0;
◆ GetSize()
Long64_t Darwin::Tools::GetSize |
( |
TBranch * |
br | ) |
|
Adapted from ROOT example
45 TMemFile
f(
"buffer",
"CREATE");
46 auto fcurrent = br->GetTree()->GetCurrentFile();
48 auto settings = fcurrent->GetCompressionSettings();
49 f.SetCompressionSettings(settings);
51 f.WriteObject(br,
"thisbranch");
52 TKey *
key =
f.GetKey(
"thisbranch");
53 Long64_t size =
key->GetNbytes();
55 Long64_t basket = br->GetZipBytes();
56 if (basket == 0) basket = br->GetTotBytes();
◆ initMetaInfo()
int Darwin::Tools::initMetaInfo |
( |
const pt::ptree & |
config | ) |
|
Writes a minimal MetaInfo to standard output.
- Parameters
-
config | config, with `flags` and `corrections` at least |
24 auto formatStr =
config.get<
string>(
"format");
25 MetaInfo::Format format;
26 if (formatStr ==
"info")
27 format = MetaInfo::INFO;
28 else if (formatStr ==
"json")
29 format = MetaInfo::JSON;
30 else if (formatStr ==
"xml")
31 format = MetaInfo::XML;
33 BOOST_THROW_EXCEPTION( std::invalid_argument(
34 "Unknown MetaInfo format \"" + formatStr +
"\"") );
36 MetaInfo(MetaInfo::IKnowWhatIAmDoing{}).Write(cout, format);
◆ loopBranches()
Long64_t Darwin::Tools::loopBranches |
( |
TObjArray * |
branches, |
|
|
size_t |
factor, |
|
|
int |
nIndent = 0 |
|
) |
| |
Adapted from ROOT example
- Parameters
-
branches | list of (sub)branches |
factor | correction factor for #files in `TChain` |
nIndent | level of indentation |
67 size_t n = branches->GetEntries();
69 for (
size_t i = 0; i < n; ++i) {
70 auto br =
dynamic_cast<TBranch*
>(branches->At(i));
73 string branchname(nIndent,
' ');
74 branchname += br->GetName();
75 cout << left << setw(40) << branchname
78 TObjArray * subbranches = br->GetListOfBranches();
◆ operator<<()
Prints the current slice and the total number of slices.
26 Stream << slice.second <<
'/' << slice.first;
◆ printBranches()
void Darwin::Tools::printBranches |
( |
vector< fs::path > |
inputs, |
|
|
const int |
steering |
|
) |
| |
Adapted from ROOT example
- Parameters
-
inputs | input ROOT files |
steering | bitfield from `Options::steering()` |
91 size_t factor =
inputs.size();
93 Flow flow(steering,
inputs);
94 auto tIn = flow.GetInputTree();
95 TObjArray * branches = tIn->GetListOfBranches();
◆ printDarwinSoftwareVersion()
void Darwin::Tools::printDarwinSoftwareVersion |
( |
| ) |
|
Print the versions of the various pieces of software. Each software appears on a new line. Tought for exception handling in Python code and for Doxygen.
18 for (
auto const& v: MetaInfo::versions)
19 cout << v.first <<
' ' << v.second <<
'\n';
◆ printEntries()
void Darwin::Tools::printEntries |
( |
vector< fs::path > |
inputs, |
|
|
const int |
steering |
|
) |
| |
Get total number of entries in input ROOT file(s) or directory, and prints it directly to the terminal.
- Parameters
-
inputs | input ROOT files |
steering | bitfield from `Options::steering()` |
27 Flow flow(steering,
inputs);
28 auto tIn = flow.GetInputTree({1, 0}, location);
29 cout << tIn->GetEntries() << endl;
31 catch (boost::wrapexcept<std::invalid_argument>& e) {
◆ printFriends()
void Darwin::Tools::printFriends |
( |
vector< fs::path > |
inputs, |
|
|
const int |
steering |
|
) |
| |
Prints the recursive list of friends to the input n-tuple.
- Parameters
-
inputs | input ROOT files |
steering | bitfield from `Options::steering()` |
121 Flow flow(steering,
inputs);
122 auto chain = flow.GetInputTree({1, 0}, location);
◆ printHist()
void Darwin::Tools::printHist |
( |
vector< fs::path > |
inputs, |
|
|
const pt::ptree & |
config, |
|
|
const int |
steering |
|
) |
| |
Print the content of a 1D histogram in columns.
Convention: index lowEdge upEdge content error
- Parameters
-
inputs | input ROOT files |
config | config handled with `Darwin::Tools::options` |
steering | bitfield from `Options::steering()` |
30 Flow flow(steering,
inputs);
31 auto h = flow.GetInputHist(
config.get<
string>(
"hist"));
32 if (h->GetDimension() > 1)
33 BOOST_THROW_EXCEPTION(
DE::BadInput(
"The desired histogram is not 1D",
34 TFile(
inputs.front().c_str()) ));
35 int N = h->GetNbinsX();
36 for (
int i = 0; i <= N+1; ++i) {
37 double low = h->GetBinLowEdge(i),
38 up = h->GetBinLowEdge(i+1),
39 content = h->GetBinContent(i),
40 error = h->GetBinError(i);
41 if (error == 0 && content == 0)
continue;
45 if (i == 0) cout <<
"underflow";
46 else if (i == N+1) cout <<
"overflow";
51 if (i == 0) cout <<
"-inf";
56 if (i > N) cout <<
"+inf";
60 cout << setw(15) << content
◆ printMetaInfo()
int Darwin::Tools::printMetaInfo |
( |
vector< fs::path > |
inputs, |
|
|
const pt::ptree & |
config |
|
) |
| |
Print the value(s) corresponding to a given key in the first given input ROOT file.
If no value / subtree is found, the command fails and exits. If multiple entries are found, they are all printed. Only the first subtree is displayed.
The INFO format allows a key to have a value and a child. Since the JSON format does not allow that, we assume here that this case does not happen.
- Parameters
-
inputs | input ROOT files |
config | config, with `flags` and `corrections` at least |
41 unique_ptr<TFile> fIn(TFile::Open(
inputs.front().c_str(),
"READ"));
43 BOOST_THROW_EXCEPTION(
DE::BadInput(
"Can't open the file.", fIn));
46 auto t = unique_ptr<TTree>(
dynamic_cast<TTree*
>(fIn->Get<TTree>(location.c_str())));
48 BOOST_THROW_EXCEPTION(
DE::BadInput(
"The tree can't be found in this file.", fIn));
51 MetaInfo metainfo(t,
false);
52 auto ptree = metainfo.MkPtree();
55 auto value = ptree.get<
string>(
key);
57 cout << value << endl;
61 auto child = ptree.get_child_optional(
key);
63 for (
auto& el: *child) {
64 string key = el.first,
65 val = el.second.get_value<
string>();
66 if (!
key.empty()) cout <<
key <<
' ';
67 if (!val.empty()) cout << val;
◆ StandardInit()
Standard initialisation for ROOT.
"Now you own all histogram objects and you will need to delete them, for in- stance through the use of std::unique_ptr
. You can still set the directory of a histogram by calling SetDirectory()
once it has been created."
32 TH1::SetDefaultSumw2();
33 TH1::AddDirectory(kFALSE);
◆ tokenize()
std::vector<const char *> Darwin::Tools::tokenize |
( |
const char * |
str | ) |
|
|
inline |
Tokenize a C-style string into a vector of C-style string with space as delimiter. It is especially useful in tests where the command is hard-coded.
17 std::cout <<
"\e[1m" << str <<
"\e[0m" << std::endl;
20 char *
cmd =
new char[strlen(str)+1];
24 std::vector<const char *>
args;
25 for (
char * arg = strtok(
cmd,
" ");
27 arg = strtok(NULL,
" "))
28 args.push_back(std::move(arg));
name
Definition: DYToLL_M-50_13TeV_pythia8_cff_GEN_SIM_RECOBEFMIX_DIGI_L1_DIGI2RAW_L1Reco_RECO.py:48
cerr
Definition: Ntupliser_cfg.py:93
fname
Definition: jercExample.py:88
static bool verbose
Definition: Step.h:40
static const char * def
Definition: Step.h:36
args
Definition: Ntupliser_cfg.py:11
f
Definition: Ntupliser_cfg.py:256
string key
Definition: jercExample.py:109
Handling of exceptions.
Definition: darwin.h:36
static const char * red
Definition: Step.h:34
cmd
Definition: Core-cfgcmd.txt:1
config
Definition: Ntupliser_cfg.py:264
input
Definition: DYToLL_M-50_13TeV_pythia8_cff_GEN_SIM_RECOBEFMIX_DIGI_L1_DIGI2RAW_L1Reco_RECO.py:35
indent
Definition: Ntupliser_cfg.py:256
def inputs
Definition: jercExample.py:118
DAS::FourVector match(const DAS::FourVector &jet, const std::vector< DAS::FourVector > *hltJets)
Definition: match.h:7
static const char * bold
Definition: Step.h:35