4 #pragma warning(disable:2259)
10 #pragma warning(disable:4996)
16 #include "TProfile2D.h"
31 m_classType =
"IProfile2D";
32 m_rep =
new TProfile2D();
33 m_rep->SetErrorOption(
"s");
34 m_rep->SetDirectory(0);
42 bool fill(
double x,
double y,
double z,
double weight) {
43 m_rep->Fill(x,y,z,weight);
47 virtual const CLID&
clID()
const {
return classID(); }
55 if (className ==
"AIDA::IProfile2D")
56 return const_cast<AIDA::IProfile2D*
>((AIDA::IProfile2D*)
this);
57 else if (className ==
"AIDA::IProfile")
58 return const_cast<AIDA::IProfile*
>((AIDA::IProfile*)
this);
59 else if (className ==
"AIDA::IBaseHistogram")
60 return const_cast<AIDA::IBaseHistogram*
>((AIDA::IBaseHistogram*)
this);
66 int rBin = m_rep->GetBin(rIndexX(idX),rIndexY(idY));
67 return int(m_rep->GetBinEntries(rBin)+0.5);
72 TProfile2D* imp =
dynamic_cast<TProfile2D*
>(rep);
74 if ( m_rep )
delete m_rep;
76 m_xAxis.initialize(m_rep->GetXaxis(),
true);
77 m_yAxis.initialize(m_rep->GetYaxis(),
true);
78 setTitle(m_rep->GetTitle());
81 throw std::runtime_error(
"Cannot adopt native histogram representation.");
85 std::pair<DataObject*,AIDA::IProfile2D*>
Gaudi::createProf2D(
const std::string& title,
const Edges& eX,
const Edges& eY,
double ,
double ) {
87 Profile2D* p =
new Profile2D(
new TProfile2D(title.c_str(),title.c_str(),eX.size()-1,&eX.front(), eY.size()-1,&eY.front()));
88 return std::pair<DataObject*,AIDA::IProfile2D*>(p,p);
91 std::pair<DataObject*,AIDA::IProfile2D*>
92 Gaudi::createProf2D(
const std::string& title,
int binsX,
double xlow,
double xup,
int binsY,
double ylow,
double yup,
double zlow,
double zup) {
93 Profile2D* p =
new Profile2D(
new TProfile2D(title.c_str(),title.c_str(),binsX,xlow,xup,binsY,ylow,yup,zlow,zup));
94 return std::pair<DataObject*,AIDA::IProfile2D*>(p,p);
97 std::pair<DataObject*,AIDA::IProfile2D*>
Gaudi::createProf2D(
const AIDA::IProfile2D& hist) {
98 TProfile2D *h = getRepresentation<AIDA::IProfile2D,TProfile2D>(hist);
99 Profile2D *
n = h ?
new Profile2D(
new TProfile2D(*h)) : 0;
100 return std::pair<DataObject*,AIDA::IProfile2D*>(
n,
n);
106 rep->SetDirectory(0);
int m_sumEntries
cache sumEntries (allEntries) when setting contents since Root can't compute by himself ...
virtual const CLID & clID() const
Retrieve reference to class defininition identifier.
bool fill(double x, double y, double z, double weight)
Fill bin content.
AIDA implementation for 2 D profiles using ROOT TProfile2D.
virtual int binEntries(int indexX, int indexY) const
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 * cast(const std::string &className) const
Introspection method.
std::string m_classType
class type
unsigned int CLID
Class ID definition.
virtual ~Profile2D()
Destructor.
#define DECLARE_DATAOBJECT_FACTORY(x)
static const CLID & classID()
This is a number of static methods for bootstrapping the Gaudi framework.
Profile2D()
Default Constructor.
A DataObject is the base class of any identifiable object on any data store.
virtual void adoptRepresentation(TObject *rep)
Adopt ROOT histogram representation.
IMPLEMENTATION * m_rep
Reference to underlying implementation.
Common AIDA implementation stuff for histograms and profiles using ROOT implementations.