1 #ifndef CommonTools_Utils_ExpressionHisto_h
2 #define CommonTools_Utils_ExpressionHisto_h
45 bool fill(
const T& element,
double weight = 1.0, uint32_t
i = 0);
59 :
min(iConfig.
template getUntrackedParameter<double>(
"min")),
60 max(iConfig.
template getUntrackedParameter<double>(
"max")),
65 iConfig.
template getUntrackedParameter<bool>(
"lazyParsing",
false)) {
66 int32_t itemsToPlot = iConfig.template getUntrackedParameter<int32_t>(
"itemsToPlot", -1);
67 if (itemsToPlot <= 0) {
81 hist =
new TH1F*[nhistos];
82 char buff[1024], baff[1024];
84 for (uint32_t
i = 0;
i < nhistos;
i++) {
85 if (strstr(
name.c_str(),
"%d") !=
nullptr) {
86 snprintf(buff, 1024,
name.c_str(),
i + 1);
88 snprintf(buff, 1024,
"%s [#%d]",
name.c_str(),
i + 1);
93 snprintf(baff, 1024,
"%s [#%d]",
description.c_str(),
i + 1);
102 template <
typename T>
105 hist[0]->Fill(
function(element), weight);
106 else if (i < nhistos)
107 hist[
i]->Fill(
function(element), weight);
T * make(const Args &...args) const
make new ROOT object
ExpressionHisto(const edm::ParameterSet &iConfig)
bool fill(const T &element, double weight=1.0, uint32_t i=0)
void initialize(TFileDirectory &fs)