|
Gaudi Framework, version v22r2 |
| Home | Generated: Tue May 10 2011 |
AIDA implementation for 2 D histograms using ROOT THD2. More...


Public Member Functions | |
| Histogram3D () | |
| Standard Constructor. | |
| Histogram3D (TH3D *rep) | |
| Standard Constructor. | |
| virtual | ~Histogram3D () |
| Destructor. | |
| bool | fill (double x, double y, double z, double weight) |
| Fill bin content. | |
| virtual bool | setBinContents (int i, int j, int k, int entries, double height, double error, double centreX, double centreY, double centreZ) |
| Fast filling method for a given bin. It can be also the over/underflow bin. | |
| virtual bool | setRms (double rmsX, double rmsY, double rmsZ) |
| Sets the rms of the histogram. | |
| virtual bool | reset () |
| void * | cast (const std::string &className) const |
| Introspection method. | |
| void | copyFromAida (const AIDA::IHistogram3D &h) |
| Create new histogram from any AIDA based histogram. | |
| virtual const CLID & | clID () const |
| Retrieve reference to class defininition identifier. | |
Static Public Member Functions | |
| static const CLID & | classID () |
| Retrieve reference to class definition structure (static access) | |
Protected Attributes | |
| double | m_sumwx |
| double | m_sumwy |
| double | m_sumwz |
AIDA implementation for 2 D histograms using ROOT THD2.
Definition at line 25 of file H3D.cpp.
| Gaudi::Histogram3D::Histogram3D | ( | ) |
| Gaudi::Histogram3D::Histogram3D | ( | TH3D * | rep ) |
Standard Constructor.
Definition at line 109 of file H3D.cpp.
{
m_rep = 0;
adoptRepresentation(rep);
m_sumEntries = 0;
m_sumwx = 0;
m_sumwy = 0;
m_sumwz = 0;
m_rep->SetDirectory(0);
}
| virtual Gaudi::Histogram3D::~Histogram3D | ( | ) | [inline, virtual] |
| void * Gaudi::Histogram3D::cast | ( | const std::string & | className ) | const |
| static const CLID& Gaudi::Histogram3D::classID | ( | ) | [inline, static] |
Retrieve reference to class definition structure (static access)
Retrieve Pointer to class definition structure.
Reimplemented from DataObject.
Definition at line 47 of file H3D.cpp.
{ return Gaudi::Histogram3D::classID(); }
| virtual const CLID& Gaudi::Histogram3D::clID | ( | ) | const [inline, virtual] |
Retrieve reference to class defininition identifier.
Reimplemented from DataObject.
Definition at line 46 of file H3D.cpp.
{ return Gaudi::Histogram3D::classID(); }
| void Gaudi::Histogram3D::copyFromAida | ( | const AIDA::IHistogram3D & | h ) |
Create new histogram from any AIDA based histogram.
Definition at line 190 of file H3D.cpp.
{
delete m_rep;
// implement here the copy
const char* tit = h.title().c_str();
if (h.xAxis().isFixedBinning() && h.yAxis().isFixedBinning() && h.zAxis().isFixedBinning() ) {
m_rep = new TH3D(tit,tit,
h.xAxis().bins(), h.xAxis().lowerEdge(), h.xAxis().upperEdge(),
h.yAxis().bins(), h.yAxis().lowerEdge(), h.yAxis().upperEdge(),
h.zAxis().bins(), h.zAxis().lowerEdge(), h.zAxis().upperEdge() );
}
else {
Edges eX, eY, eZ;
for (int i =0; i < h.xAxis().bins(); ++i)
eX.push_back(h.xAxis().binLowerEdge(i));
// add also upperedges at the end
eX.push_back(h.xAxis().upperEdge() );
for (int i =0; i < h.yAxis().bins(); ++i)
eY.push_back(h.yAxis().binLowerEdge(i));
// add also upperedges at the end
eY.push_back(h.yAxis().upperEdge() );
for (int i =0; i < h.zAxis().bins(); ++i)
eZ.push_back(h.zAxis().binLowerEdge(i));
// add also upperedges at the end
eZ.push_back(h.zAxis().upperEdge() );
m_rep = new TH3D(tit,tit,eX.size()-1,&eX.front(),eY.size()-1,&eY.front(),eZ.size()-1,&eZ.front());
}
m_xAxis.initialize(m_rep->GetXaxis(),true);
m_yAxis.initialize(m_rep->GetYaxis(),true);
m_zAxis.initialize(m_rep->GetZaxis(),true);
const TArrayD* a = m_rep->GetSumw2();
if ( 0 == a || (a && a->GetSize()==0) ) m_rep->Sumw2();
m_sumEntries = 0;
m_sumwx = 0;
m_sumwy = 0;
m_sumwz = 0;
// statistics
double sumw = h.sumBinHeights();
double sumw2 = 0;
if (h.equivalentBinEntries() != 0)
sumw2 = ( sumw * sumw ) /h.equivalentBinEntries();
double sumwx = h.meanX()*h.sumBinHeights();
double sumwx2 = (h.meanX()*h.meanX() + h.rmsX()*h.rmsX() )*h.sumBinHeights();
double sumwy = h.meanY()*h.sumBinHeights();
double sumwy2 = (h.meanY()*h.meanY() + h.rmsY()*h.rmsY() )*h.sumBinHeights();
double sumwz = h.meanZ()*h.sumBinHeights();
double sumwz2 = (h.meanZ()*h.meanZ() + h.rmsZ()*h.rmsZ() )*h.sumBinHeights();
double sumwxy = 0;
double sumwxz = 0;
double sumwyz = 0;
// copy the contents in (AIDA underflow/overflow are -2,-1)
for (int i=-2; i < xAxis().bins(); ++i) {
for (int j=-2; j < yAxis().bins(); ++j) {
for (int k=-2; k < zAxis().bins(); ++k) {
m_rep->SetBinContent(rIndexX(i), rIndexY(j), rIndexZ(k), h.binHeight(i,j,k) );
m_rep->SetBinError(rIndexX(i), rIndexY(j), rIndexZ(k), h.binError(i,j,k) );
// calculate statistics
if ( i >= 0 && j >= 0 && k >= 0) {
sumwxy += h.binHeight(i,j,k)*h.binMeanX(i,j,k)*h.binMeanY(i,j,k);
sumwxz += h.binHeight(i,j,k)*h.binMeanX(i,j,k)*h.binMeanZ(i,j,k);
sumwyz += h.binHeight(i,j,k)*h.binMeanY(i,j,k)*h.binMeanZ(i,j,k);
}
}
}
}
// need to do set entries after setting contents otherwise root will recalulate them
// taking into account how many time SetBinContents() has been called
m_rep->SetEntries(h.allEntries());
// fill stat vector
std::vector<double> stat(11);
stat[0] = sumw;
stat[1] = sumw2;
stat[2] = sumwx;
stat[3] = sumwx2;
stat[4] = sumwy;
stat[5] = sumwy2;
stat[6] = sumwxy;
stat[7] = sumwz;
stat[8] = sumwz2;
stat[9] = sumwxz;
stat[10] = sumwyz;
m_rep->PutStats(&stat.front());
}
| bool Gaudi::Histogram3D::fill | ( | double | x, |
| double | y, | ||
| double | z, | ||
| double | weight | ||
| ) |
| bool Gaudi::Histogram3D::reset | ( | ) | [virtual] |
| bool Gaudi::Histogram3D::setBinContents | ( | int | i, |
| int | j, | ||
| int | k, | ||
| int | entries, | ||
| double | height, | ||
| double | error, | ||
| double | centreX, | ||
| double | centreY, | ||
| double | centreZ | ||
| ) | [virtual] |
Fast filling method for a given bin. It can be also the over/underflow bin.
Definition at line 120 of file H3D.cpp.
{
m_rep->SetBinContent(rIndexX(i), rIndexY(j), rIndexZ(k), height);
m_rep->SetBinError(rIndexX(i), rIndexY(j), rIndexZ(k), error);
// accumulate sum bin centers
if (i >=0 && j >= 0 && k >= 0) {
m_sumwx += centreX*height;
m_sumwy += centreY*height;
m_sumwz += centreZ*height;
}
m_sumEntries += entries;
return true;
}
| bool Gaudi::Histogram3D::setRms | ( | double | rmsX, |
| double | rmsY, | ||
| double | rmsZ | ||
| ) | [virtual] |
Sets the rms of the histogram.
Definition at line 163 of file H3D.cpp.
{
m_rep->SetEntries(m_sumEntries);
std::vector<double> stat(11);
// sum weights
stat[0] = sumBinHeights();
stat[1] = 0;
if (equivalentBinEntries() != 0)
stat[1] = ( sumBinHeights() * sumBinHeights() ) / equivalentBinEntries();
stat[2] = m_sumwx;
double meanX = 0;
if ( sumBinHeights() != 0 ) meanX = m_sumwx/ sumBinHeights();
stat[3] = ( meanX*meanX + rmsX*rmsX )* sumBinHeights();
stat[4] = m_sumwy;
double meanY = 0;
if ( sumBinHeights() != 0 ) meanY = m_sumwy/ sumBinHeights();
stat[5] = ( meanY*meanY + rmsY*rmsY )* sumBinHeights();
stat[6] = 0;
stat[7] = m_sumwz;
double meanZ = 0;
if ( sumBinHeights() != 0 ) meanZ = m_sumwz/ sumBinHeights();
stat[8] = ( meanZ*meanZ + rmsZ*rmsZ )* sumBinHeights();
// do not need to use sumwxy sumwxz and sumwyz
m_rep->PutStats(&stat.front());
return true;
}