The Gaudi Framework  master (ff829712)
Loading...
Searching...
No Matches
Gaudi::Generic2D< INTERFACE, IMPLEMENTATION > Class Template Reference

Common AIDA implementation stuff for histograms and profiles using ROOT implementations. More...

#include <GaudiPI/Generic2D.h>

Inheritance diagram for Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >:
Collaboration diagram for Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >:

Public Types

typedef Generic2D< INTERFACE, IMPLEMENTATION > Base
 

Public Member Functions

 Generic2D ()=default
 
TObject * representation () const override
 ROOT object implementation.
 
void adoptRepresentation (TObject *rep) override
 Adopt ROOT histogram representation.
 
std::string title () const override
 Get the title of the object.
 
bool setTitle (const std::string &title) override
 Set the title of the object.
 
std::string name () const
 object name
 
bool setName (const std::string &newName)
 Set the name of the object.
 
AIDA::IAnnotation & annotation () override
 Access annotation object.
 
const AIDA::IAnnotation & annotation () const override
 Access annotation object (cons)
 
const AIDA::IAxis & xAxis () const override
 Return the X axis.
 
const AIDA::IAxis & yAxis () const override
 Return the Y axis.
 
virtual int rIndexX (int index) const
 operator methods
 
virtual int rIndexY (int index) const
 operator methods
 
int entries () const override
 Get the number or all the entries.
 
int allEntries () const override
 Get the number or all the entries, both in range and underflow/overflow bins of the IProfile.
 
int extraEntries () const override
 Get the number of entries in the underflow and overflow bins.
 
double sumBinHeights () const override
 Get the sum of in range bin heights in the IProfile.
 
double sumAllBinHeights () const override
 Get the sum of all the bins heights (including underflow and overflow bin).
 
double sumExtraBinHeights () const override
 Get the sum of the underflow and overflow bin height.
 
double minBinHeight () const override
 Get the minimum height of the in-range bins.
 
double maxBinHeight () const override
 Get the maximum height of the in-range bins.
 
double binMeanX (int indexX, int indexY) const override
 The weighted mean along x of a given bin.
 
double binMeanY (int indexX, int indexY) const override
 The weighted mean along y of a given bin.
 
int binEntries (int indexX, int indexY) const override
 The number of entries (ie the number of times fill was called for this bin).
 
int binEntriesX (int indexX) const override
 Equivalent to projectionX().binEntries(indexX).
 
int binEntriesY (int indexY) const override
 Equivalent to projectionY().binEntries(indexY).
 
double binHeight (int indexX, int indexY) const override
 Total height of the corresponding bin (ie the sum of the weights in this bin).
 
double binHeightX (int indexX) const override
 Equivalent to projectionX().binHeight(indexX).
 
double binHeightY (int indexY) const override
 Equivalent to projectionY().binHeight(indexY).
 
double binError (int indexX, int indexY) const override
 The error on this bin.
 
virtual double binRms (int indexX, int indexY) const
 The spread (RMS) of this bin.
 
double meanX () const override
 Returns the mean of the profile, as calculated on filling-time projected on the X axis.
 
double meanY () const override
 Returns the mean of the profile, as calculated on filling-time projected on the Y axis.
 
double rmsX () const override
 Returns the rms of the profile as calculated on filling-time projected on the X axis.
 
double rmsY () const override
 Returns the rms of the profile as calculated on filling-time projected on the Y axis.
 
int coordToIndexX (double coordX) const override
 Convenience method, equivalent to xAxis().coordToIndex(coord).
 
int coordToIndexY (double coordY) const override
 Convenience method, equivalent to yAxis().coordToIndex(coord).
 
virtual double equivalentBinEntries () const
 Number of equivalent entries, i.e. SUM[ weight ] ^ 2 / SUM[ weight^2 ]
 
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 given scale factor.
 
bool add (const INTERFACE &h) override
 Modifies this profile by adding the contents of profile to it.
 
bool reset () override
 
void * cast (const std::string &className) const override
 Introspection method.
 
const std::string & userLevelClassType () const
 The AIDA user-level unterface leaf class type.
 
int dimension () const override
 Get the Histogram's dimension.
 
std::ostream & print (std::ostream &s) const override
 Print (ASCII) the histogram into the output stream.
 
std::ostream & write (std::ostream &s) const override
 Write (ASCII) the histogram table into the output stream.
 
int write (const char *file_name) const override
 Write (ASCII) the histogram table into a file.
 
void * cast (const std::string &className) const
 
int binEntries (int indexX, int indexY) const
 
void adoptRepresentation (TObject *rep)
 Adopt ROOT histogram representation.
 
void * cast (const std::string &className) const
 
int binEntries (int idX, int idY) const
 
void adoptRepresentation (TObject *rep)
 Adopt ROOT histogram representation.
 
- Public Member Functions inherited from Gaudi::HistogramBase
virtual ~HistogramBase ()=default
 

Protected Member Functions

 Generic2D (IMPLEMENTATION *p)
 constructor
 

Protected Attributes

Axis m_xAxis
 X axis member.
 
Axis m_yAxis
 Y axis member.
 
AIDA::Annotation m_annotation
 Object annotations.
 
std::unique_ptr< IMPLEMENTATION > m_rep
 Reference to underlying implementation.
 
std::string m_classType
 class type
 
int m_sumEntries = 0
 cache sumEntries (allEntries) when setting contents since Root can't compute by himself
 

Detailed Description

template<class INTERFACE, class IMPLEMENTATION>
class Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >

Common AIDA implementation stuff for histograms and profiles using ROOT implementations.

Credits: This code is the result of some stripdown implementation of LCG/PI. Credits to them!

Author
M.Frank

Definition at line 45 of file Generic2D.h.

Member Typedef Documentation

◆ Base

template<class INTERFACE, class IMPLEMENTATION>
typedef Generic2D<INTERFACE, IMPLEMENTATION> Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::Base

Definition at line 47 of file Generic2D.h.

Constructor & Destructor Documentation

◆ Generic2D() [1/2]

template<class INTERFACE, class IMPLEMENTATION>
Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::Generic2D ( )
default

◆ Generic2D() [2/2]

template<class INTERFACE, class IMPLEMENTATION>
Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::Generic2D ( IMPLEMENTATION * p)
inlineprotected

constructor

Definition at line 53 of file Generic2D.h.

53: m_rep( p ) {}
Common AIDA implementation stuff for histograms and profiles using ROOT implementations.
Definition Generic2D.h:45
std::unique_ptr< IMPLEMENTATION > m_rep
Reference to underlying implementation.
Definition Generic2D.h:161

Member Function Documentation

◆ add()

template<class INTERFACE, class IMPLEMENTATION>
bool Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::add ( const INTERFACE & h)
override

Modifies this profile by adding the contents of profile to it.

Definition at line 297 of file Generic2D.h.

297 {
298 const Base* p = dynamic_cast<const Base*>( &hist );
299 if ( !p ) throw std::runtime_error( "Cannot add profile histograms of different implementations." );
300 m_rep->Add( p->m_rep.get() );
301 return true;
302 }
Generic2D< INTERFACE, IMPLEMENTATION > Base
Definition Generic2D.h:47

◆ adoptRepresentation() [1/3]

void Gaudi::Generic2D< AIDA::IHistogram2D, TH2D >::adoptRepresentation ( TObject * rep)
virtual

Adopt ROOT histogram representation.

Implements Gaudi::HistogramBase.

Definition at line 128 of file H2D.cpp.

128 {
129 TH2D* imp = dynamic_cast<TH2D*>( rep );
130 if ( !imp ) throw std::runtime_error( "Cannot adopt native histogram representation." );
131 m_rep.reset( imp );
132 m_xAxis.initialize( m_rep->GetXaxis(), true );
133 m_yAxis.initialize( m_rep->GetYaxis(), true );
134 const TArrayD* a = m_rep->GetSumw2();
135 if ( !a || ( a && a->GetSize() == 0 ) ) m_rep->Sumw2();
136 setTitle( m_rep->GetTitle() );
137 }
Axis m_xAxis
X axis member.
Definition Generic2D.h:155
Axis m_yAxis
Y axis member.
Definition Generic2D.h:157
bool setTitle(const std::string &title) override
Set the title of the object.
Definition Generic2D.h:169

◆ adoptRepresentation() [2/3]

void Gaudi::Generic2D< AIDA::IProfile2D, TProfile2D >::adoptRepresentation ( TObject * rep)
virtual

Adopt ROOT histogram representation.

Implements Gaudi::HistogramBase.

Definition at line 45 of file P2D.cpp.

45 {
46 TProfile2D* imp = dynamic_cast<TProfile2D*>( rep );
47 if ( !imp ) throw std::runtime_error( "Cannot adopt native histogram representation." );
48 m_rep.reset( imp );
49 m_xAxis.initialize( m_rep->GetXaxis(), true );
50 m_yAxis.initialize( m_rep->GetYaxis(), true );
51 setTitle( m_rep->GetTitle() );
52 }

◆ adoptRepresentation() [3/3]

template<class INTERFACE, class IMPLEMENTATION>
void Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::adoptRepresentation ( TObject * rep)
overridevirtual

Adopt ROOT histogram representation.

Implements Gaudi::HistogramBase.

◆ allEntries()

template<class INTERFACE, class IMPLEMENTATION>
int Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::allEntries ( ) const
override

Get the number or all the entries, both in range and underflow/overflow bins of the IProfile.

Definition at line 189 of file Generic2D.h.

189 {
190 return m_rep->GetEntries();
191 }

◆ annotation() [1/2]

template<class INTERFACE, class IMPLEMENTATION>
const AIDA::IAnnotation & Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::annotation ( ) const
inlineoverride

Access annotation object (cons)

Definition at line 71 of file Generic2D.h.

71{ return m_annotation; }
AIDA::Annotation m_annotation
Object annotations.
Definition Generic2D.h:159

◆ annotation() [2/2]

template<class INTERFACE, class IMPLEMENTATION>
AIDA::IAnnotation & Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::annotation ( )
inlineoverride

Access annotation object.

Definition at line 69 of file Generic2D.h.

69{ return m_annotation; }

◆ binEntries() [1/3]

int Gaudi::Generic2D< AIDA::IProfile2D, TProfile2D >::binEntries ( int idX,
int idY ) const

Definition at line 39 of file P2D.cpp.

39 {
40 int rBin = m_rep->GetBin( rIndexX( idX ), rIndexY( idY ) );
41 return int( m_rep->GetBinEntries( rBin ) + 0.5 );
42 }
virtual int rIndexX(int index) const
operator methods
Definition Generic2D.h:78
virtual int rIndexY(int index) const
operator methods
Definition Generic2D.h:80

◆ binEntries() [2/3]

int Gaudi::Generic2D< IHistogram2D, TH2D >::binEntries ( int indexX,
int indexY ) const

Definition at line 121 of file H2D.cpp.

121 {
122 if ( binHeight( indexX, indexY ) <= 0 ) return 0;
123 double xx = binHeight( indexX, indexY ) / binError( indexX, indexY );
124 return int( xx * xx + 0.5 );
125 }
double binError(int indexX, int indexY) const override
The error on this bin.
Definition Generic2D.h:262
double binHeight(int indexX, int indexY) const override
Total height of the corresponding bin (ie the sum of the weights in this bin).
Definition Generic2D.h:243

◆ binEntries() [3/3]

template<class INTERFACE, class IMPLEMENTATION>
int Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::binEntries ( int indexX,
int indexY ) const
override

The number of entries (ie the number of times fill was called for this bin).

◆ binEntriesX()

template<class INTERFACE, class IMPLEMENTATION>
int Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::binEntriesX ( int indexX) const
override

Equivalent to projectionX().binEntries(indexX).

Definition at line 229 of file Generic2D.h.

229 {
230 int n = 0;
231 for ( int iY = -2; iY < yAxis().bins(); ++iY ) n += binEntries( index, iY );
232 return n;
233 }
const AIDA::IAxis & yAxis() const override
Return the Y axis.
Definition Generic2D.h:76
int binEntries(int indexX, int indexY) const override
The number of entries (ie the number of times fill was called for this bin).

◆ binEntriesY()

template<class INTERFACE, class IMPLEMENTATION>
int Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::binEntriesY ( int indexY) const
override

Equivalent to projectionY().binEntries(indexY).

Definition at line 236 of file Generic2D.h.

236 {
237 int n = 0;
238 for ( int iX = -2; iX < xAxis().bins(); ++iX ) n += binEntries( iX, index );
239 return n;
240 }
const AIDA::IAxis & xAxis() const override
Return the X axis.
Definition Generic2D.h:74

◆ binError()

template<class INTERFACE, class IMPLEMENTATION>
double Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::binError ( int indexX,
int indexY ) const
override

The error on this bin.

Definition at line 262 of file Generic2D.h.

262 {
263 return m_rep->GetBinError( rIndexX( indexX ), rIndexY( indexY ) );
264 }

◆ binHeight()

template<class INTERFACE, class IMPLEMENTATION>
double Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::binHeight ( int indexX,
int indexY ) const
override

Total height of the corresponding bin (ie the sum of the weights in this bin).

Definition at line 243 of file Generic2D.h.

243 {
244 return m_rep->GetBinContent( rIndexX( indexX ), rIndexY( indexY ) );
245 }

◆ binHeightX()

template<class INTERFACE, class IMPLEMENTATION>
double Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::binHeightX ( int indexX) const
override

Equivalent to projectionX().binHeight(indexX).

Definition at line 248 of file Generic2D.h.

248 {
249 double s = 0;
250 for ( int iY = -2; iY < yAxis().bins(); ++iY ) { s += binHeight( index, iY ); }
251 return s;
252 }

◆ binHeightY()

template<class INTERFACE, class IMPLEMENTATION>
double Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::binHeightY ( int indexY) const
override

Equivalent to projectionY().binHeight(indexY).

Definition at line 255 of file Generic2D.h.

255 {
256 double s = 0;
257 for ( int iX = -2; iX < xAxis().bins(); ++iX ) s += binHeight( iX, index );
258 return s;
259 }

◆ binMeanX()

template<class INTERFACE, class IMPLEMENTATION>
double Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::binMeanX ( int indexX,
int indexY ) const
override

The weighted mean along x of a given bin.

Definition at line 219 of file Generic2D.h.

219 {
220 return m_rep->GetXaxis()->GetBinCenter( rIndexX( indexX ) );
221 }

◆ binMeanY()

template<class INTERFACE, class IMPLEMENTATION>
double Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::binMeanY ( int indexX,
int indexY ) const
override

The weighted mean along y of a given bin.

Definition at line 224 of file Generic2D.h.

224 {
225 return m_rep->GetYaxis()->GetBinCenter( rIndexY( indexY ) );
226 }

◆ binRms()

template<class INTERFACE, class IMPLEMENTATION>
double Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::binRms ( int indexX,
int indexY ) const
virtual

The spread (RMS) of this bin.

Definition at line 214 of file Generic2D.h.

214 {
215 return m_rep->GetBinError( rIndexX( indexX ), rIndexY( indexY ) );
216 }

◆ cast() [1/3]

void * Gaudi::Generic2D< IHistogram2D, TH2D >::cast ( const std::string & className) const

Definition at line 112 of file H2D.cpp.

112 {
113 if ( className == "AIDA::IHistogram2D" )
114 return (IHistogram2D*)this;
115 else if ( className == "AIDA::IHistogram" )
116 return (IHistogram*)this;
117 return nullptr;
118 }

◆ cast() [2/3]

void * Gaudi::Generic2D< AIDA::IProfile2D, TProfile2D >::cast ( const std::string & className) const

Definition at line 29 of file P2D.cpp.

29 {
30 return className == "AIDA::IProfile2D"
31 ? const_cast<AIDA::IProfile2D*>( static_cast<const AIDA::IProfile2D*>( this ) )
32 : className == "AIDA::IProfile" ? const_cast<AIDA::IProfile*>( static_cast<const AIDA::IProfile*>( this ) )
33 : className == "AIDA::IBaseHistogram"
35 : nullptr;
36 }

◆ cast() [3/3]

template<class INTERFACE, class IMPLEMENTATION>
void * Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::cast ( const std::string & className) const
override

Introspection method.

◆ coordToIndexX()

template<class INTERFACE, class IMPLEMENTATION>
int Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::coordToIndexX ( double coordX) const
override

Convenience method, equivalent to xAxis().coordToIndex(coord).

Definition at line 287 of file Generic2D.h.

287 {
288 return xAxis().coordToIndex( coord );
289 }

◆ coordToIndexY()

template<class INTERFACE, class IMPLEMENTATION>
int Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::coordToIndexY ( double coordY) const
override

Convenience method, equivalent to yAxis().coordToIndex(coord).

Definition at line 292 of file Generic2D.h.

292 {
293 return yAxis().coordToIndex( coord );
294 }

◆ dimension()

template<class INTERFACE, class IMPLEMENTATION>
int Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::dimension ( ) const
inlineoverride

Get the Histogram's dimension.

Definition at line 145 of file Generic2D.h.

145{ return 2; }

◆ entries()

template<class INTERFACE, class IMPLEMENTATION>
int Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::entries ( ) const
override

Get the number or all the entries.

Definition at line 184 of file Generic2D.h.

184 {
185 return m_rep->GetEntries();
186 }

◆ equivalentBinEntries()

template<class INTERFACE, class IMPLEMENTATION>
double Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::equivalentBinEntries ( ) const
virtual

Number of equivalent entries, i.e. SUM[ weight ] ^ 2 / SUM[ weight^2 ]

Definition at line 313 of file Generic2D.h.

313 {
314 if ( sumBinHeights() <= 0 ) return 0;
315 Stat_t stats[11]; // cover up to 3D...
316 m_rep->GetStats( stats );
317 return stats[0] * stats[0] / stats[1];
318 }
double sumBinHeights() const override
Get the sum of in range bin heights in the IProfile.
Definition Generic2D.h:204

◆ extraEntries()

template<class INTERFACE, class IMPLEMENTATION>
int Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::extraEntries ( ) const
override

◆ maxBinHeight()

template<class INTERFACE, class IMPLEMENTATION>
double Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::maxBinHeight ( ) const
override

Get the maximum height of the in-range bins.

Definition at line 199 of file Generic2D.h.

199 {
200 return m_rep->GetMaximum();
201 }

◆ meanX()

template<class INTERFACE, class IMPLEMENTATION>
double Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::meanX ( ) const
override

Returns the mean of the profile, as calculated on filling-time projected on the X axis.

Definition at line 267 of file Generic2D.h.

267 {
268 return m_rep->GetMean( 1 );
269 }

◆ meanY()

template<class INTERFACE, class IMPLEMENTATION>
double Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::meanY ( ) const
override

Returns the mean of the profile, as calculated on filling-time projected on the Y axis.

Definition at line 272 of file Generic2D.h.

272 {
273 return m_rep->GetMean( 2 );
274 }

◆ minBinHeight()

template<class INTERFACE, class IMPLEMENTATION>
double Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::minBinHeight ( ) const
override

Get the minimum height of the in-range bins.

Definition at line 194 of file Generic2D.h.

194 {
195 return m_rep->GetMinimum();
196 }

◆ name()

template<class INTERFACE, class IMPLEMENTATION>
std::string Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::name ( ) const
inline

object name

Definition at line 65 of file Generic2D.h.

65{ return m_annotation.value( "Name" ); }

◆ print()

template<class INTERFACE, class IMPLEMENTATION>
std::ostream & Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::print ( std::ostream & s) const
overridevirtual

Print (ASCII) the histogram into the output stream.

bin contents and errors are printed for all bins including under and overflows

Implements Gaudi::HistogramBase.

Definition at line 334 of file Generic2D.h.

334 {
336 m_rep->Print( "all" );
337 return s;
338 }

◆ representation()

template<class INTERFACE, class IMPLEMENTATION>
TObject * Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::representation ( ) const
inlineoverridevirtual

ROOT object implementation.

Implements Gaudi::HistogramBase.

Definition at line 57 of file Generic2D.h.

57{ return m_rep.get(); }

◆ reset()

template<class INTERFACE, class IMPLEMENTATION>
bool Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::reset ( )
override

Definition at line 327 of file Generic2D.h.

327 {
328 m_sumEntries = 0;
329 m_rep->Reset();
330 return true;
331 }
int m_sumEntries
cache sumEntries (allEntries) when setting contents since Root can't compute by himself
Definition Generic2D.h:165

◆ rIndexX()

template<class INTERFACE, class IMPLEMENTATION>
virtual int Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::rIndexX ( int index) const
inlinevirtual

operator methods

Definition at line 78 of file Generic2D.h.

78{ return m_xAxis.rIndex( index ); }

◆ rIndexY()

template<class INTERFACE, class IMPLEMENTATION>
virtual int Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::rIndexY ( int index) const
inlinevirtual

operator methods

Definition at line 80 of file Generic2D.h.

80{ return m_yAxis.rIndex( index ); }

◆ rmsX()

template<class INTERFACE, class IMPLEMENTATION>
double Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::rmsX ( ) const
override

Returns the rms of the profile as calculated on filling-time projected on the X axis.

Definition at line 277 of file Generic2D.h.

277 {
278 return m_rep->GetRMS( 1 );
279 }

◆ rmsY()

template<class INTERFACE, class IMPLEMENTATION>
double Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::rmsY ( ) const
override

Returns the rms of the profile as calculated on filling-time projected on the Y axis.

Definition at line 282 of file Generic2D.h.

282 {
283 return m_rep->GetRMS( 2 );
284 }

◆ scale()

template<class INTERFACE, class IMPLEMENTATION>
bool Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::scale ( double scaleFactor)
virtual

Scale the weights and the errors of all the IHistogram's bins (in-range and out-of-range ones) by a given scale factor.

Definition at line 321 of file Generic2D.h.

321 {
322 m_rep->Scale( scaleFactor );
323 return true;
324 }

◆ setName()

template<class INTERFACE, class IMPLEMENTATION>
bool Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::setName ( const std::string & newName)

Set the name of the object.

Definition at line 177 of file Generic2D.h.

177 {
178 m_rep->SetName( newName.c_str() );
179 m_annotation.setValue( "Name", newName );
180 return true;
181 }

◆ setTitle()

template<class INTERFACE, class IMPLEMENTATION>
bool Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::setTitle ( const std::string & title)
override

Set the title of the object.

Definition at line 169 of file Generic2D.h.

169 {
170 m_rep->SetTitle( title.c_str() );
171 if ( !annotation().addItem( "Title", title ) ) m_annotation.setValue( "Title", title );
172 if ( !annotation().addItem( "title", title ) ) annotation().setValue( "title", title );
173 return true;
174 }
AIDA::IAnnotation & annotation() override
Access annotation object.
Definition Generic2D.h:69
std::string title() const override
Get the title of the object.
Definition Generic2D.h:61

◆ sumAllBinHeights()

template<class INTERFACE, class IMPLEMENTATION>
double Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::sumAllBinHeights ( ) const
override

Get the sum of all the bins heights (including underflow and overflow bin).

Definition at line 209 of file Generic2D.h.

209 {
210 return m_rep->GetSum();
211 }

◆ sumBinHeights()

template<class INTERFACE, class IMPLEMENTATION>
double Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::sumBinHeights ( ) const
override

Get the sum of in range bin heights in the IProfile.

Definition at line 204 of file Generic2D.h.

204 {
205 return m_rep->GetSumOfWeights();
206 }

◆ sumExtraBinHeights()

template<class INTERFACE, class IMPLEMENTATION>
double Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::sumExtraBinHeights ( ) const
inlineoverride

Get the sum of the underflow and overflow bin height.

Definition at line 93 of file Generic2D.h.

93{ return sumAllBinHeights() - sumBinHeights(); }
double sumAllBinHeights() const override
Get the sum of all the bins heights (including underflow and overflow bin).
Definition Generic2D.h:209

◆ title()

template<class INTERFACE, class IMPLEMENTATION>
std::string Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::title ( ) const
inlineoverride

Get the title of the object.

Definition at line 61 of file Generic2D.h.

61{ return m_annotation.value( "Title" ); }

◆ userLevelClassType()

template<class INTERFACE, class IMPLEMENTATION>
const std::string & Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::userLevelClassType ( ) const
inline

The AIDA user-level unterface leaf class type.

Definition at line 143 of file Generic2D.h.

143{ return m_classType; }
std::string m_classType
class type
Definition Generic2D.h:163

◆ write() [1/2]

template<class INTERFACE, class IMPLEMENTATION>
int Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::write ( const char * file_name) const
overridevirtual

Write (ASCII) the histogram table into a file.

Implements Gaudi::HistogramBase.

Definition at line 357 of file Generic2D.h.

357 {
358 TFile* f = TFile::Open( file_name, "RECREATE" );
359 Int_t nbytes = m_rep->Write();
360 f->Close();
361 return nbytes;
362 }

◆ write() [2/2]

template<class INTERFACE, class IMPLEMENTATION>
std::ostream & Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::write ( std::ostream & s) const
overridevirtual

Write (ASCII) the histogram table into the output stream.

Implements Gaudi::HistogramBase.

Definition at line 342 of file Generic2D.h.

342 {
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 ) {
347 s << binMeanX( i, j ) << ", " << binMeanY( i, j ) << ", " << binHeight( i, j ) << ", " << binError( i, j )
348 << std::endl;
349 }
350 }
351 s << std::endl;
352 return s;
353 }
double binMeanX(int indexX, int indexY) const override
The weighted mean along x of a given bin.
Definition Generic2D.h:219
double binMeanY(int indexX, int indexY) const override
The weighted mean along y of a given bin.
Definition Generic2D.h:224

◆ xAxis()

template<class INTERFACE, class IMPLEMENTATION>
const AIDA::IAxis & Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::xAxis ( ) const
inlineoverride

Return the X axis.

Definition at line 74 of file Generic2D.h.

74{ return m_xAxis; }

◆ yAxis()

template<class INTERFACE, class IMPLEMENTATION>
const AIDA::IAxis & Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::yAxis ( ) const
inlineoverride

Return the Y axis.

Definition at line 76 of file Generic2D.h.

76{ return m_yAxis; }

Member Data Documentation

◆ m_annotation

template<class INTERFACE, class IMPLEMENTATION>
AIDA::Annotation Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::m_annotation
mutableprotected

Object annotations.

Definition at line 159 of file Generic2D.h.

◆ m_classType

template<class INTERFACE, class IMPLEMENTATION>
std::string Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::m_classType
protected

class type

Definition at line 163 of file Generic2D.h.

◆ m_rep

template<class INTERFACE, class IMPLEMENTATION>
std::unique_ptr<IMPLEMENTATION> Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::m_rep
protected

Reference to underlying implementation.

Definition at line 161 of file Generic2D.h.

◆ m_sumEntries

template<class INTERFACE, class IMPLEMENTATION>
int Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::m_sumEntries = 0
protected

cache sumEntries (allEntries) when setting contents since Root can't compute by himself

Definition at line 165 of file Generic2D.h.

◆ m_xAxis

template<class INTERFACE, class IMPLEMENTATION>
Axis Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::m_xAxis
protected

X axis member.

Definition at line 155 of file Generic2D.h.

◆ m_yAxis

template<class INTERFACE, class IMPLEMENTATION>
Axis Gaudi::Generic2D< INTERFACE, IMPLEMENTATION >::m_yAxis
protected

Y axis member.

Definition at line 157 of file Generic2D.h.


The documentation for this class was generated from the following file: