28 if (events()->
empty()) {
30 return StatusCode::FAILURE;
40 const std::string& xtitle,
const std::string& ytitle) {
41 TH1D*
h =
new TH1D(path.c_str(), title.c_str(), binedges.size()-1, &binedges.front());
43 h->SetXTitle(xtitle.c_str());
44 h->SetYTitle(ytitle.c_str());
46 if (st.isFailure())
return 0;
51 const std::string& xtitle,
const std::string& ytitle) {
52 TH1D*
h =
new TH1D(path.c_str(), title.c_str(), numbins, low, high);
54 h->SetXTitle(xtitle.c_str());
55 h->SetYTitle(ytitle.c_str());
57 if (st.isFailure())
return 0;
63 const std::string& xtitle,
const std::string& ytitle) {
64 TProfile*
h =
new TProfile(path.c_str(), title.c_str(), binedges.size()-1, &binedges.front());
66 h->SetXTitle(xtitle.c_str());
67 h->SetYTitle(ytitle.c_str());
69 if (st.isFailure())
return 0;
74 const std::string& xtitle,
const std::string& ytitle) {
75 TProfile*
h =
new TProfile(path.c_str(), title.c_str(), numbins, low, high);
77 h->SetXTitle(xtitle.c_str());
78 h->SetYTitle(ytitle.c_str());
80 if (st.isFailure())
return 0;
86 const std::vector<double>& binedgesx,
const std::vector<double>& binedgesy,
87 const std::string& xtitle,
const std::string& ytitle,
const std::string& ztitle) {
88 TH2D*
h =
new TH2D(path.c_str(), title.c_str(), binedgesx.size()-1, &*binedgesx.begin(), binedgesy.size()-1, &binedgesy.front());
90 h->SetXTitle(xtitle.c_str());
91 h->SetYTitle(ytitle.c_str());
92 h->SetZTitle(ztitle.c_str());
94 if (st.isFailure())
return 0;
99 size_t numbinsx,
double xlow,
double xhigh,
100 size_t numbinsy,
double ylow,
double yhigh,
101 const std::string& xtitle,
const std::string& ytitle,
const std::string& ztitle) {
102 TH2D*
h =
new TH2D(path.c_str(), title.c_str(), numbinsx, xlow, xhigh, numbinsy, ylow, yhigh);
104 h->SetXTitle(xtitle.c_str());
105 h->SetYTitle(ytitle.c_str());
106 h->SetZTitle(ztitle.c_str());
108 if (st.isFailure())
return 0;
125 return dynamic_cast<TProfile*
>(
h);
#define ATH_MSG_WARNING(x)
#define CHECK(...)
Evaluate an expression and check for errors.
static const Attributes_t empty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Header file for AthHistogramAlgorithm.
const ServiceHandle< ITHistSvc > histSvc() const
Directly access the histogram service.
TProfile * profile(const std::string &key)
Retrieve a profile histogram.
TProfile * bookProfile1D(const std::string &name, const std::string &title, const std::vector< double > &binedges, const std::string &xtitle="", const std::string &ytitle="")
TH1 * histo(const std::string &key)
Retrieve a histogram (as TH1* base class pointer)
TH1D * bookHisto1D(const std::string &name, const std::string &title, const std::vector< double > &binedges, const std::string &xtitle="", const std::string &ytitle="")
virtual StatusCode analyze()=0
TH2D * bookHisto2D(const std::string &name, const std::string &title, const std::vector< double > &binedgesx, const std::vector< double > &binedgesy, const std::string &xtitle="", const std::string &ytitle="", const std::string &ztitle="")
StatusCode execute()
Per-event analysis routine: calls user-supplied analyze()
virtual StatusCode init()
ServiceHandle< ITHistSvc > m_histSvc
std::string m_histkey
Container name for the MC event collection to be analysed.
std::string fullhistopath(const std::string &localpath)
Get a histogram's full path, given the name local to the analysis.
StatusCode initialize()
Setup analysis tools and call user-supplied init()
GenAnalysis(const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode initialize() override
GenBase(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.