4 #pragma warning(disable:2259)
10 #pragma warning(disable:4996)
12 #include "GaudiKernel/DataObject.h"
13 #include "GaudiKernel/ObjectFactory.h"
16 #include "TProfile2D.h"
32 m_classType =
"IProfile2D";
33 m_rep->SetErrorOption(
"s");
34 m_rep->SetDirectory(
nullptr);
41 bool fill(
double x,
double y,
double z,
double weight)
override {
42 m_rep->Fill(x,y,z,weight);
46 const CLID&
clID()
const override {
return classID(); }
54 if (className ==
"AIDA::IProfile2D")
55 return const_cast<AIDA::IProfile2D*
>((AIDA::IProfile2D*)
this);
56 else if (className ==
"AIDA::IProfile")
57 return const_cast<AIDA::IProfile*
>((AIDA::IProfile*)
this);
58 else if (className ==
"AIDA::IBaseHistogram")
59 return const_cast<AIDA::IBaseHistogram*
>((AIDA::IBaseHistogram*)
this);
65 int rBin = m_rep->GetBin(rIndexX(idX),rIndexY(idY));
66 return int(m_rep->GetBinEntries(rBin)+0.5);
71 TProfile2D* imp =
dynamic_cast<TProfile2D*
>(rep);
72 if ( !imp )
throw std::runtime_error(
"Cannot adopt native histogram representation.");
74 m_xAxis.initialize(m_rep->GetXaxis(),
true);
75 m_yAxis.initialize(m_rep->GetYaxis(),
true);
76 setTitle(m_rep->GetTitle());
80 std::pair<DataObject*,AIDA::IProfile2D*>
Gaudi::createProf2D(
const std::string& title,
const Edges& eX,
const Edges& eY,
double ,
double ) {
82 auto p =
new Profile2D(
new TProfile2D(title.c_str(),title.c_str(),eX.size()-1,&eX.front(), eY.size()-1,&eY.front()));
86 std::pair<DataObject*,AIDA::IProfile2D*>
87 Gaudi::createProf2D(
const std::string& title,
int binsX,
double xlow,
double xup,
int binsY,
double ylow,
double yup,
double zlow,
double zup) {
88 auto p =
new Profile2D(
new TProfile2D(title.c_str(),title.c_str(),binsX,xlow,xup,binsY,ylow,yup,zlow,zup));
92 std::pair<DataObject*,AIDA::IProfile2D*>
Gaudi::createProf2D(
const AIDA::IProfile2D& hist) {
93 auto h = getRepresentation<AIDA::IProfile2D,TProfile2D>(hist);
94 auto n = (
h ?
new Profile2D(
new TProfile2D(*
h)) : nullptr );
100 rep->SetDirectory(
nullptr);
int m_sumEntries
cache sumEntries (allEntries) when setting contents since Root can't compute by himself ...
AIDA implementation for 2 D profiles using ROOT TProfile2D.
int binEntries(int indexX, int indexY) const override
The number of entries (ie the number of times fill was called for this bin).
std::pair< DataObject *, AIDA::IProfile2D * > createProf2D(const AIDA::IProfile2D &hist)
Copy constructor.
void adoptRepresentation(TObject *rep) override
Adopt ROOT histogram representation.
void * cast(const std::string &className) const
Introspection method.
std::string m_classType
class type
const CLID & clID() const override
Retrieve reference to class defininition identifier.
static const CLID & classID()
unsigned int CLID
Class ID definition.
Profile2D()
Default Constructor.
#define DECLARE_DATAOBJECT_FACTORY(x)
A DataObject is the base class of any identifiable object on any data store.
Helper functions to set/get the application return code.
bool fill(double x, double y, double z, double weight) override
Fill bin content.
Common AIDA implementation stuff for histograms and profiles using ROOT implementations.