1 #ifndef ConfigurableAnalysis_ConfigurableHisto_H 2 #define ConfigurableAnalysis_ConfigurableHisto_H 92 yLabel =
yAxis.Label();
94 if (yAxisPSet.
exists(
"var"))
96 yVBin =
yAxis.variableSize();
103 bool xVBin =
xAxis.variableSize();
111 }
else if (
type() ==
h2) {
117 h_ =
dir->make<TH2F>(
121 h_ =
dir->make<TH2F>(
140 h_ =
dir->make<TProfile>(
158 h_->GetXaxis()->SetTitle(
xAxis.Label().c_str());
159 h_->SetYTitle(yLabel.c_str());
175 edm::LogInfo(
"ConfigurableHisto") <<
"could not compute the weight for: " <<
name_ <<
" with config:\n" 180 TProfile* pcast(
nullptr);
181 TH2* h2cast(
nullptr);
193 pcast =
dynamic_cast<TProfile*
>(
h_);
203 h2cast =
dynamic_cast<TH2*
>(
h_);
248 if (
pset.exists(
"splitters")) {
250 std::vector<std::string> splitters =
pset.getParameter<std::vector<std::string> >(
"splitters");
251 for (
unsigned int s = 0;
s != splitters.size(); ++
s) {
256 <<
"for: " <<
name_ <<
" the splitting variable: " << splitters[
s] <<
" is not a Splitter";
263 unsigned int mSlots =
splitter->maxSlots();
264 for (
unsigned int i = 0;
i != mSlots; ++
i) {
270 mPset.
insert(
true,
"title",
e);
284 <<
"for: " <<
name_ <<
" the splitting variable: " <<
v->name() <<
" is not a Splitter";
288 for (
unsigned int i = 0;
i != mSlots;
i++) {
293 mPset.
insert(
true,
"title",
e);
307 for (;
i != i_end; ++
i) {
308 for (
unsigned int h = 0;
h !=
i->second.size(); ++
h) {
309 i->second[
h]->book(
dir);
313 std::string sTitle =
"Stack histogram of " +
name_ +
" for splitter " +
i->first->name();
323 stack_ =
dir->make<THStack>(sName.c_str(), sTitle.c_str());
336 for (;
i != i_end; ++
i) {
343 if (slot >=
i->second.size()) {
345 <<
"slot index: " << slot <<
" is bigger than slots size: " <<
i->second.size()
346 <<
" from variable value: " << (*splitter)(
e);
350 i->second[slot]->fill(
e);
362 <<
"slot index: " << slot <<
" is bigger than slots size: " <<
subHistos_.size()
363 <<
" from variable value: " << (*splitter_)(
e);
375 for (;
i != i_end; ++
i) {
376 for (
unsigned int h = 0;
h !=
i->second.size();
h++) {
393 if (!
master.subHistoMap_.empty()) {
394 SubHistoMap::const_iterator
i =
master.subHistoMap_.begin();
395 SubHistoMap::const_iterator i_end =
master.subHistoMap_.end();
396 for (;
i != i_end; ++
i) {
397 const std::vector<ConfigurableHisto*>& masterHistos =
i->second;
398 std::vector<ConfigurableHisto*>& clonedHistos =
subHistoMap_[
i->first];
399 for (
unsigned int i = 0;
i != masterHistos.size();
i++) {
400 clonedHistos.push_back(masterHistos[
i]->
clone());
404 for (
unsigned int i = 0;
i !=
master.subHistos_.size();
i++) {
410 typedef std::map<const Splitter*, std::vector<ConfigurableHisto*> >
SubHistoMap;
def splitter(iterator, n)
T getParameter(std::string const &) const
const std::string shortLabel(unsigned int i) const
void book(TFileDirectory *dir) override
std::vector< double > vBins_
const Splitter * splitter_
bool exists(std::string const ¶meterName) const
checks if a parameter exists
SplittingConfigurableHisto(const SplittingConfigurableHisto &master)
void fill(const edm::Event &e) override
const std::string & Label()
void insert(bool ok_to_replace, char const *, Entry const &)
virtual ConfigurableHisto * clone() const
Log< level::Error, false > LogError
SplittingConfigurableHisto(HType t, std::string name, edm::ParameterSet &pset)
std::vector< ConfigurableHisto * > subHistos_
SubHistoStacks subHistoStacks_
virtual void fill(const edm::Event &iEvent)
ConfigurableHisto(HType t, std::string name, edm::ParameterSet &iConfig)
const CachingVariable * y_
const std::string & label(unsigned int i) const
virtual ~ConfigurableHisto()
ConfigurableHisto(const ConfigurableHisto &master)
const CachingVariable * x_
Log< level::Info, false > LogInfo
virtual void book(TFileDirectory *dir)
const CachingVariable * w_
std::map< const Splitter *, THStack * > SubHistoStacks
ConfigurableHisto * clone() const override
std::string dump(unsigned int indent=0) const
bool compute(const edm::Event &iEvent) const
const CachingVariable * z_
const std::string & name() const
virtual unsigned int maxSlots() const
std::map< const Splitter *, std::vector< ConfigurableHisto * > > SubHistoMap
ConfigurableAxis(const edm::ParameterSet &par)