Crombie Tools
Datacard.h
Go to the documentation of this file.
1
#ifndef CROMBIE_DATACARD_H
2
#define CROMBIE_DATACARD_H
3
4
#include <string>
5
6
#include "
crombie/Types.h
"
7
#include "
crombie/Plotter.h
"
8
#include "
crombie/Uncertainty.h
"
9
#include "
crombie/FileSystem.h
"
10
11
12
namespace
crombie
{
13
namespace
Datacard {
14
15
/**
16
@class DataCardInfo
17
Much of the information that is needed to write the datacard,
18
such as shape uncertainties, plot location, and bin contents for plots.
19
The flat uncertainties and rate params are missing from this.
20
*/
21
class
DataCardInfo
{
22
public
:
23
DataCardInfo
(
const
std::string&
dir
) : dir{dir} {}
24
const
std::string
dir
;
///< The directory storing the ROOT file and datacard
25
Types::map<Types::strings>
shapes
;
///< A list of shape uncertainties and which samples are affected
26
};
27
28
29
/// Dumps the histograms and extracts information needed for datacard using the output from Plotter
30
DataCardInfo
dumpplots
(
const
std::string&
dirname
,
31
const
std::set<std::string>& selections,
32
const
Uncertainty::UncertaintyInfo
& unc,
33
const
Plotter::MergeOut
& plots) {
34
35
DataCardInfo
output {dirname};
36
37
if
(not
FileSystem::exists
(dirname))
38
FileSystem::mkdirs
(dirname);
39
40
// Get the list of all the systematics
41
auto
systematics = unc.
systematics
();
42
43
// Loop through the selections
44
auto
i_plot = plots.begin();
45
for
(
auto
& sel : selections) {
46
while
(i_plot->first.find(sel) != 0) {
47
if
(++i_plot == plots.end())
48
i_plot = plots.begin();
49
}
50
// store the information for this plot
51
52
}
53
return
output;
54
}
55
56
}
57
}
58
59
#endif
src
include
crombie
Datacard.h
Generated on Tue Nov 3 2020 04:04:03 for Crombie Tools by
1.8.12