|
|
Go to the documentation of this file. 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;
const std::string shortLabel(unsigned int i) const
ConfigurableHisto * clone() const override
ConfigurableHisto(HType t, std::string name, edm::ParameterSet &iConfig)
void book(TFileDirectory *dir) override
const CachingVariable * y_
ConfigurableAxis(const edm::ParameterSet &par)
SplittingConfigurableHisto(const SplittingConfigurableHisto &master)
Log< level::Info, false > LogInfo
std::map< const Splitter *, THStack * > SubHistoStacks
const std::string & Label()
std::string dump(unsigned int indent=0) const
void insert(bool ok_to_replace, char const *, Entry const &)
def splitter(iterator, n)
std::vector< double > vBins_
virtual ConfigurableHisto * clone() const
bool exists(std::string const ¶meterName) const
checks if a parameter exists
const CachingVariable * w_
virtual void fill(const edm::Event &iEvent)
SubHistoStacks subHistoStacks_
Log< level::Error, false > LogError
const CachingVariable * z_
virtual ~ConfigurableHisto()
SplittingConfigurableHisto(HType t, std::string name, edm::ParameterSet &pset)
const CachingVariable * x_
std::vector< ConfigurableHisto * > subHistos_
ConfigurableHisto(const ConfigurableHisto &master)
T getParameter(std::string const &) const
bool compute(const edm::Event &iEvent) const
const std::string & name() const
void fill(const edm::Event &e) override
std::map< const Splitter *, std::vector< ConfigurableHisto * > > SubHistoMap
virtual void book(TFileDirectory *dir)
const std::string & label(unsigned int i) const
virtual unsigned int maxSlots() const
const Splitter * splitter_