15#include <AIDA/IProfile2D.h>
24# pragma clang diagnostic push
25# pragma clang diagnostic ignored "-Wsuggest-override"
26# pragma clang diagnostic ignored "-Winconsistent-missing-override"
27#elif defined( __GNUC__ )
28# pragma GCC diagnostic push
29# pragma GCC diagnostic ignored "-Wsuggest-override"
44 template <
class INTERFACE,
class IMPLEMENTATION>
67 bool setName(
const std::string& newName );
100 double binMeanX(
int indexX,
int indexY )
const override;
102 double binMeanY(
int indexX,
int indexY )
const override;
110 double binHeight(
int indexX,
int indexY )
const override;
116 double binError(
int indexX,
int indexY )
const override;
118 virtual double binRms(
int indexX,
int indexY )
const;
135 virtual bool scale(
double scaleFactor );
137 bool add(
const INTERFACE& h )
override;
141 void*
cast(
const std::string& className )
const override;
147 std::ostream&
print( std::ostream& s )
const override;
149 std::ostream&
write( std::ostream& s )
const override;
151 int write(
const char* file_name )
const override;
161 std::unique_ptr<IMPLEMENTATION>
m_rep;
168 template <
class INTERFACE,
class IMPLEMENTATION>
176 template <
class INTERFACE,
class IMPLEMENTATION>
178 m_rep->SetName( newName.c_str() );
183 template <
class INTERFACE,
class IMPLEMENTATION>
185 return m_rep->GetEntries();
188 template <
class INTERFACE,
class IMPLEMENTATION>
190 return m_rep->GetEntries();
193 template <
class INTERFACE,
class IMPLEMENTATION>
195 return m_rep->GetMinimum();
198 template <
class INTERFACE,
class IMPLEMENTATION>
200 return m_rep->GetMaximum();
203 template <
class INTERFACE,
class IMPLEMENTATION>
205 return m_rep->GetSumOfWeights();
208 template <
class INTERFACE,
class IMPLEMENTATION>
210 return m_rep->GetSum();
213 template <
class INTERFACE,
class IMPLEMENTATION>
218 template <
class INTERFACE,
class IMPLEMENTATION>
220 return m_rep->GetXaxis()->GetBinCenter(
rIndexX( indexX ) );
223 template <
class INTERFACE,
class IMPLEMENTATION>
225 return m_rep->GetYaxis()->GetBinCenter(
rIndexY( indexY ) );
228 template <
class INTERFACE,
class IMPLEMENTATION>
231 for (
int iY = -2; iY <
yAxis().bins(); ++iY ) n +=
binEntries( index, iY );
235 template <
class INTERFACE,
class IMPLEMENTATION>
238 for (
int iX = -2; iX <
xAxis().bins(); ++iX ) n +=
binEntries( iX, index );
242 template <
class INTERFACE,
class IMPLEMENTATION>
247 template <
class INTERFACE,
class IMPLEMENTATION>
250 for (
int iY = -2; iY <
yAxis().bins(); ++iY ) { s +=
binHeight( index, iY ); }
254 template <
class INTERFACE,
class IMPLEMENTATION>
257 for (
int iX = -2; iX <
xAxis().bins(); ++iX ) s +=
binHeight( iX, index );
261 template <
class INTERFACE,
class IMPLEMENTATION>
266 template <
class INTERFACE,
class IMPLEMENTATION>
268 return m_rep->GetMean( 1 );
271 template <
class INTERFACE,
class IMPLEMENTATION>
273 return m_rep->GetMean( 2 );
276 template <
class INTERFACE,
class IMPLEMENTATION>
278 return m_rep->GetRMS( 1 );
281 template <
class INTERFACE,
class IMPLEMENTATION>
283 return m_rep->GetRMS( 2 );
286 template <
class INTERFACE,
class IMPLEMENTATION>
288 return xAxis().coordToIndex( coord );
291 template <
class INTERFACE,
class IMPLEMENTATION>
293 return yAxis().coordToIndex( coord );
296 template <
class INTERFACE,
class IMPLEMENTATION>
298 const Base* p =
dynamic_cast<const Base*
>( &hist );
299 if ( !p )
throw std::runtime_error(
"Cannot add profile histograms of different implementations." );
304 template <
class INTERFACE,
class IMPLEMENTATION>
306 return binEntries( AIDA::IAxis::UNDERFLOW_BIN, AIDA::IAxis::UNDERFLOW_BIN ) +
307 binEntries( AIDA::IAxis::UNDERFLOW_BIN, AIDA::IAxis::OVERFLOW_BIN ) +
308 binEntries( AIDA::IAxis::OVERFLOW_BIN, AIDA::IAxis::UNDERFLOW_BIN ) +
309 binEntries( AIDA::IAxis::OVERFLOW_BIN, AIDA::IAxis::OVERFLOW_BIN );
312 template <
class INTERFACE,
class IMPLEMENTATION>
316 m_rep->GetStats( stats );
317 return stats[0] * stats[0] / stats[1];
320 template <
class INTERFACE,
class IMPLEMENTATION>
322 m_rep->Scale( scaleFactor );
326 template <
class INTERFACE,
class IMPLEMENTATION>
333 template <
class INTERFACE,
class IMPLEMENTATION>
336 m_rep->Print(
"all" );
341 template <
class INTERFACE,
class IMPLEMENTATION>
343 s << std::endl <<
"2D Histogram Table: " << std::endl;
344 s <<
"BinX, BinY, Height, Error " << std::endl;
345 for (
int i = 0; i <
xAxis().bins(); ++i ) {
346 for (
int j = 0; j <
yAxis().bins(); ++j ) {
356 template <
class INTERFACE,
class IMPLEMENTATION>
358 TFile* f = TFile::Open( file_name,
"RECREATE" );
359 Int_t nbytes =
m_rep->Write();
366# pragma clang diagnostic pop
367#elif defined( __GNUC__ )
368# pragma GCC diagnostic pop
Implementation of the AIDA IAnnotation interface class.
An IAxis represents a binned histogram axis.
virtual int rIndexX(int index) const
operator methods
int entries() const override
Get the number or all the entries.
Generic2D(IMPLEMENTATION *p)
constructor
double binError(int indexX, int indexY) const override
The error on this bin.
int coordToIndexX(double coordX) const override
Convenience method, equivalent to xAxis().coordToIndex(coord).
std::ostream & print(std::ostream &s) const override
Print (ASCII) the histogram into the output stream.
double sumExtraBinHeights() const override
Get the sum of the underflow and overflow bin height.
AIDA::IAnnotation & annotation() override
Access annotation object.
const AIDA::IAxis & xAxis() const override
Return the X axis.
int extraEntries() const override
Get the number of entries in the underflow and overflow bins.
int m_sumEntries
cache sumEntries (allEntries) when setting contents since Root can't compute by himself
void adoptRepresentation(TObject *rep) override
Adopt ROOT histogram representation.
double rmsY() const override
Returns the rms of the profile as calculated on filling-time projected on the Y axis.
const AIDA::IAxis & yAxis() const override
Return the Y axis.
double binHeightY(int indexY) const override
Equivalent to projectionY().binHeight(indexY).
std::unique_ptr< IMPLEMENTATION > m_rep
Reference to underlying implementation.
virtual double binRms(int indexX, int indexY) const
The spread (RMS) of this bin.
int binEntriesY(int indexY) const override
Equivalent to projectionY().binEntries(indexY).
const std::string & userLevelClassType() const
The AIDA user-level unterface leaf class type.
AIDA::Annotation m_annotation
Object annotations.
TObject * representation() const override
ROOT object implementation.
int binEntriesX(int indexX) const override
Equivalent to projectionX().binEntries(indexX).
std::ostream & write(std::ostream &s) const override
Write (ASCII) the histogram table into the output stream.
double maxBinHeight() const override
Get the maximum height of the in-range bins.
double meanY() const override
Returns the mean of the profile, as calculated on filling-time projected on the Y axis.
const AIDA::IAnnotation & annotation() const override
Access annotation object (cons)
virtual bool scale(double scaleFactor)
Scale the weights and the errors of all the IHistogram's bins (in-range and out-of-range ones) by a g...
double binMeanX(int indexX, int indexY) const override
The weighted mean along x of a given bin.
bool setName(const std::string &newName)
Set the name of the object.
double meanX() const override
Returns the mean of the profile, as calculated on filling-time projected on the X axis.
std::string name() const
object name
int binEntries(int indexX, int indexY) const override
The number of entries (ie the number of times fill was called for this bin).
int allEntries() const override
Get the number or all the entries, both in range and underflow/overflow bins of the IProfile.
Axis m_xAxis
X axis member.
double sumBinHeights() const override
Get the sum of in range bin heights in the IProfile.
double binHeightX(int indexX) const override
Equivalent to projectionX().binHeight(indexX).
double rmsX() const override
Returns the rms of the profile as calculated on filling-time projected on the X axis.
double minBinHeight() const override
Get the minimum height of the in-range bins.
int coordToIndexY(double coordY) const override
Convenience method, equivalent to yAxis().coordToIndex(coord).
int dimension() const override
Get the Histogram's dimension.
Axis m_yAxis
Y axis member.
bool add(const INTERFACE &h) override
Modifies this profile by adding the contents of profile to it.
std::string m_classType
class type
int write(const char *file_name) const override
Write (ASCII) the histogram table into a file.
double binHeight(int indexX, int indexY) const override
Total height of the corresponding bin (ie the sum of the weights in this bin).
double binMeanY(int indexX, int indexY) const override
The weighted mean along y of a given bin.
Generic2D< INTERFACE, IMPLEMENTATION > Base
virtual int rIndexY(int index) const
operator methods
void * cast(const std::string &className) const override
Introspection method.
virtual double equivalentBinEntries() const
Number of equivalent entries, i.e. SUM[ weight ] ^ 2 / SUM[ weight^2 ]
double sumAllBinHeights() const override
Get the sum of all the bins heights (including underflow and overflow bin).
bool setTitle(const std::string &title) override
Set the title of the object.
std::string title() const override
Get the title of the object.
Common base class for all histograms Use is solely functional to minimize dynamic_casts inside Histog...
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...