#include <CommonTools/Utils/interface/ExpressionHisto.h>
Public Member Functions | |
ExpressionHisto (const edm::ParameterSet &iConfig) | |
bool | fill (const T &element, double weight=1.0, uint32_t i=0) |
void | initialize (TFileDirectory &fs) |
~ExpressionHisto () | |
Private Attributes | |
std::string | description |
StringObjectFunction< T > | function |
TH1F ** | hist |
double | max |
double | min |
std::string | name |
int | nbins |
uint32_t | nhistos |
bool | separatePlots |
Description: Histogram tool using expressions
Usage: <usage>
Definition at line 34 of file ExpressionHisto.h.
ExpressionHisto< T >::ExpressionHisto | ( | const edm::ParameterSet & | iConfig | ) |
Definition at line 58 of file ExpressionHisto.h.
References ExpressionHisto< T >::nhistos, and ExpressionHisto< T >::separatePlots.
: min(iConfig.template getUntrackedParameter<double>("min")), max(iConfig.template getUntrackedParameter<double>("max")), nbins(iConfig.template getUntrackedParameter<int>("nbins")), name(iConfig.template getUntrackedParameter<std::string>("name")), description(iConfig.template getUntrackedParameter<std::string>("description")), function(iConfig.template getUntrackedParameter<std::string>("plotquantity"), iConfig.template getUntrackedParameter<bool>("lazyParsing", false)) { int32_t itemsToPlot = iConfig.template getUntrackedParameter<int32_t>("itemsToPlot", -1); if (itemsToPlot <= 0) { nhistos = 1; separatePlots = false; } else { nhistos = itemsToPlot; separatePlots = true; } }
ExpressionHisto< T >::~ExpressionHisto | ( | ) |
Definition at line 75 of file ExpressionHisto.h.
{ }
bool ExpressionHisto< T >::fill | ( | const T & | element, |
double | weight = 1.0 , |
||
uint32_t | i = 0 |
||
) |
Plot the quantity for the specified element and index. Returns true if the quantity has been plotted, false otherwise. A return value of "false" means "please don't send any more elements". The default "i = 0" is to keep backwards compatibility with usages outside HistoAnalyzer
Definition at line 103 of file ExpressionHisto.h.
References root::function(), estimatePileup::hist, and i.
void ExpressionHisto< T >::initialize | ( | TFileDirectory & | fs | ) |
Definition at line 79 of file ExpressionHisto.h.
References idDealer::description, estimatePileup::hist, i, TFileDirectory::make(), max(), min, mergeVDriftHistosByStation::name, and RecoTauCommonJetSelections_cfi::nbins.
Referenced by HistoAnalyzer< C >::HistoAnalyzer().
{ hist = new TH1F*[nhistos]; char buff[1024],baff[1024]; if (separatePlots) { for (uint32_t i = 0; i < nhistos; i++) { if (strstr(name.c_str(), "%d") != 0) { snprintf(buff, 1024, name.c_str(), i+1); } else { snprintf(buff, 1024, "%s [#%d]", name.c_str(), i+1); } if (strstr(description.c_str(), "%d") != 0) { snprintf(baff, 1024, description.c_str(), i+1); } else { snprintf(baff, 1024, "%s [#%d]", description.c_str(), i+1); } hist[i] = fs.make<TH1F>(buff,baff,nbins,min,max); } } else { hist[0] = fs.make<TH1F>(name.c_str(),description.c_str(),nbins,min,max); } }
std::string ExpressionHisto< T >::description [private] |
Definition at line 50 of file ExpressionHisto.h.
StringObjectFunction<T> ExpressionHisto< T >::function [private] |
Definition at line 54 of file ExpressionHisto.h.
TH1F** ExpressionHisto< T >::hist [private] |
Definition at line 53 of file ExpressionHisto.h.
double ExpressionHisto< T >::max [private] |
Definition at line 48 of file ExpressionHisto.h.
double ExpressionHisto< T >::min [private] |
Definition at line 48 of file ExpressionHisto.h.
std::string ExpressionHisto< T >::name [private] |
Definition at line 50 of file ExpressionHisto.h.
int ExpressionHisto< T >::nbins [private] |
Definition at line 49 of file ExpressionHisto.h.
uint32_t ExpressionHisto< T >::nhistos [private] |
Definition at line 51 of file ExpressionHisto.h.
Referenced by ExpressionHisto< T >::ExpressionHisto().
bool ExpressionHisto< T >::separatePlots [private] |
Definition at line 52 of file ExpressionHisto.h.
Referenced by ExpressionHisto< T >::ExpressionHisto().