CombineHarvester
HistMapping.cc
Go to the documentation of this file.
1
#include "
CombineHarvester/CombineTools/interface/HistMapping.h
"
2
#include <string>
3
#include "boost/format.hpp"
4
5
namespace
ch
{
6
7
HistMapping::HistMapping
() : is_fake(false) {}
8
9
HistMapping::HistMapping
(std::string
const
& p, std::string
const
& c,
10
std::string
const
& pat, std::string
const
& s_pat)
11
:
process
(p), category(c), pattern(pat), syst_pattern(s_pat), is_fake(false) {}
12
13
bool
HistMapping::IsHist
()
const
{
14
if
(
pattern
.size() > 0 &&
pattern
.find(
':'
) ==
pattern
.npos) {
15
return
true
;
16
}
else
{
17
return
false
;
18
}
19
}
20
21
bool
HistMapping::IsPdf
()
const
{
22
if
(
pattern
.size() > 0 &&
pattern
.find(
':'
) !=
pattern
.npos) {
23
return
true
;
24
}
else
{
25
return
false
;
26
}
27
}
28
29
bool
HistMapping::IsData
()
const
{
30
if
(
pattern
.size() > 0 &&
pattern
.find(
':'
) !=
pattern
.npos) {
31
return
true
;
32
}
else
{
33
return
false
;
34
}
35
}
36
37
std::string
HistMapping::WorkspaceName
()
const
{
38
std::size_t colon =
pattern
.find_last_of(
':'
);
39
if
(colon !=
pattern
.npos) {
40
return
pattern
.substr(0, colon);
41
}
else
{
42
return
std::string();
43
}
44
}
45
std::string
HistMapping::WorkspaceObj
()
const
{
46
std::size_t colon =
pattern
.find_last_of(
':'
);
47
if
(colon !=
pattern
.npos) {
48
return
pattern
.substr(colon + 1);
49
}
else
{
50
return
std::string();
51
}
52
}
53
std::string
HistMapping::SystWorkspaceName
()
const
{
54
std::size_t colon =
syst_pattern
.find_last_of(
':'
);
55
if
(colon !=
syst_pattern
.npos) {
56
return
syst_pattern
.substr(0, colon);
57
}
else
{
58
return
std::string();
59
}
60
}
61
std::string
HistMapping::SystWorkspaceObj
()
const
{
62
std::size_t colon =
syst_pattern
.find_last_of(
':'
);
63
if
(colon !=
syst_pattern
.npos) {
64
return
syst_pattern
.substr(colon + 1);
65
}
else
{
66
return
std::string();
67
}
68
}
69
70
std::ostream&
operator<<
(std::ostream& out,
HistMapping
const
& val) {
71
out << boost::format(
"%-7s %-7s %-20s %-20s %-20s"
) % val.
process
%
72
val.
category
% (val.
file
.get() ? val.
file
->GetName() :
"0"
) %
73
val.
pattern
% val.
syst_pattern
;
74
return
out;
75
}
76
}
HistMapping.h
ch
Definition:
Algorithm.h:10
ch::operator<<
std::ostream & operator<<(std::ostream &out, HistMapping const &val)
Definition:
HistMapping.cc:70
ch::HistMapping
Definition:
HistMapping.h:10
ch::HistMapping::SystWorkspaceObj
std::string SystWorkspaceObj() const
Definition:
HistMapping.cc:61
ch::HistMapping::HistMapping
HistMapping()
Definition:
HistMapping.cc:7
ch::HistMapping::file
std::shared_ptr< TFile > file
Definition:
HistMapping.h:15
ch::HistMapping::category
std::string category
Definition:
HistMapping.h:12
ch::HistMapping::SystWorkspaceName
std::string SystWorkspaceName() const
Definition:
HistMapping.cc:53
ch::HistMapping::pattern
std::string pattern
Definition:
HistMapping.h:13
ch::HistMapping::IsData
bool IsData() const
Definition:
HistMapping.cc:29
ch::HistMapping::WorkspaceObj
std::string WorkspaceObj() const
Definition:
HistMapping.cc:45
ch::HistMapping::IsHist
bool IsHist() const
Definition:
HistMapping.cc:13
ch::HistMapping::process
std::string process
Definition:
HistMapping.h:11
ch::HistMapping::syst_pattern
std::string syst_pattern
Definition:
HistMapping.h:14
ch::HistMapping::IsPdf
bool IsPdf() const
Definition:
HistMapping.cc:21
ch::HistMapping::WorkspaceName
std::string WorkspaceName() const
Definition:
HistMapping.cc:37
ch::syst::process
Definition:
Systematics.h:36