1 #ifndef ConfigurableAnalysis_ConfigurableHisto_H
2 #define ConfigurableAnalysis_ConfigurableHisto_H
77 if (yAxisPSet.
exists(
"var"))
79 yVBin=yAxis.variableSize();
86 bool xVBin=xAxis.variableSize();
93 xAxis.nBin(), xAxis.xBins());
96 xAxis.nBin(),xAxis.Min(),xAxis.Max());
103 xAxis.nBin(),xAxis.xBins(),
107 xAxis.nBin(),xAxis.xBins(),
112 xAxis.nBin(),xAxis.Min(),xAxis.Max(),
116 xAxis.nBin(),xAxis.Min(),xAxis.Max(),
127 h_=dir->
make<TProfile>(
name_.c_str(),title.c_str(),
128 xAxis.nBin(), xAxis.xBins(),
132 h_=dir->
make<TProfile>(
name_.c_str(),title.c_str(),
133 xAxis.nBin(),xAxis.Min(),xAxis.Max(),
144 h_->GetXaxis()->SetTitle(xAxis.Label().c_str());
145 h_->SetYTitle(yLabel.c_str());
179 pcast=
dynamic_cast<TProfile*
>(
h_);
188 h2cast=
dynamic_cast<TH2*
>(
h_);
232 if (pset.
exists(
"splitters")){
234 std::vector<std::string> splitters = pset.
getParameter<std::vector<std::string> >(
"splitters");
235 for (
unsigned int s=0;
s!=splitters.size();++
s){
239 edm::LogError(
"SplittingConfigurableHisto")<<
"for: "<<
name_<<
" the splitting variable: "<<splitters[
s]<<
" is not a Splitter";
246 unsigned int mSlots=splitter->
maxSlots();
247 for (
unsigned int i=0;
i!=mSlots;++
i){
253 mPset.
insert(
true,
"title",e);
265 edm::LogError(
"SplittingConfigurableHisto")<<
"for: "<<
name_<<
" the splitting variable: "<<v->
name()<<
" is not a Splitter";
270 for (
unsigned int i=0;
i!=mSlots;
i++){
275 mPset.
insert(
true,
"title",e);
289 for (;i!=i_end;++
i){
for (
unsigned int h=0;
h!=i->second.size();++
h){
290 i->second[
h]->book(dir);}
293 std::string sTitle=
"Stack histogram of "+
name_+
" for splitter "+i->first->name();
301 stack_ = dir->
make<THStack>(sName.c_str(),sTitle.c_str());
317 if (!splitter)
continue;
318 if (!splitter->
compute(e))
continue;
319 unsigned int slot=(
unsigned int) (*splitter)(
e);
320 if (slot>=i->second.size()){
321 edm::LogError(
"SplittingConfigurableHisto")<<
"slot index: "<<slot<<
" is bigger than slots size: "<<i->second.size()<<
" from variable value: "<<(*splitter)(
e);
324 i->second[slot]->fill(e);
332 unsigned int slot=(
unsigned int) (*
splitter_)(
e);
334 edm::LogError(
"SplittingConfigurableHisto")<<
"slot index: "<<slot<<
" is bigger than slots size: "<<
subHistos_.size() <<
" from variable value: "<<(*splitter_)(
e);
346 for (
unsigned int h=0;
h!=i->second.size();
h++){
364 SubHistoMap::const_iterator i_end=master.
subHistoMap_.end();
366 const std::vector<ConfigurableHisto*> & masterHistos=i->second;
367 std::vector<ConfigurableHisto*> & clonedHistos=
subHistoMap_[i->first];
368 for (
unsigned int i=0;i!=masterHistos.size();i++){clonedHistos.push_back(masterHistos[i]->
clone());}
375 typedef std::map<const Splitter *, std::vector<ConfigurableHisto* > >
SubHistoMap;
T getParameter(std::string const &) const
std::string dump(unsigned int indent=0) const
std::vector< double > vBins_
const Splitter * splitter_
SplittingConfigurableHisto(const SplittingConfigurableHisto &master)
const std::string & Label()
bool exists(std::string const ¶meterName) const
checks if a parameter exists
void fill(const edm::Event &e)
virtual ConfigurableHisto * clone() const
void insert(bool ok_to_replace, char const *, Entry const &)
std::map< const Splitter *, THStack * > SubHistoStacks
SplittingConfigurableHisto(HType t, std::string name, edm::ParameterSet &pset)
SubHistoStacks subHistoStacks_
virtual void fill(const edm::Event &iEvent)
ConfigurableHisto(HType t, std::string name, edm::ParameterSet &iConfig)
const CachingVariable * y_
std::vector< ConfigurableHisto * > subHistos_
std::map< const Splitter *, std::vector< ConfigurableHisto * > > SubHistoMap
void book(TFileDirectory *dir)
const std::string shortLabel(unsigned int i) const
virtual ~ConfigurableHisto()
virtual unsigned int maxSlots() const
ConfigurableHisto(const ConfigurableHisto &master)
const std::string & label(unsigned int i) const
const CachingVariable * x_
virtual void book(TFileDirectory *dir)
const CachingVariable * w_
bool compute(const edm::Event &iEvent) const
T * make() const
make new ROOT object
const CachingVariable * z_
ConfigurableHisto * clone() const
const std::string & name() const
ConfigurableAxis(edm::ParameterSet par)