Loading [MathJax]/extensions/tex2jax.js
Go to the documentation of this file.
15 #include <AIDA/IProfile1D.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>
59 void*
cast(
const std::string& cl )
const override;
65 std::string
title()
const override {
return m_annotation.value(
"Title" ); }
67 bool setTitle(
const std::string& title )
override;
69 std::string
name()
const {
return m_annotation.value(
"Name" ); }
71 bool setName(
const std::string& newName );
73 AIDA::IAnnotation&
annotation()
override {
return m_annotation; }
75 const AIDA::IAnnotation&
annotation()
const override {
return m_annotation; }
79 const Axis&
axis()
const override {
return m_axis; }
82 int entries()
const override {
return m_rep->GetEntries(); }
84 int allEntries()
const override {
return m_rep->GetEntries(); }
92 double sumBinHeights()
const override {
return m_rep->GetSumOfWeights(); }
98 double minBinHeight()
const override {
return m_rep->GetMinimum(); }
106 virtual bool scale(
double scaleFactor );
110 bool add(
const INTERFACE& profile )
override;
120 double mean()
const override {
return m_rep->GetMean(); }
122 double rms()
const override {
return m_rep->GetRMS(); }
124 int coordToIndex(
double coord )
const override {
return axis().coordToIndex( coord ); }
128 std::ostream&
print( std::ostream&
s )
const override;
130 std::ostream&
write( std::ostream&
s )
const override;
132 int write(
const char* file_name )
const override;
140 std::unique_ptr<IMPLEMENTATION>
m_rep;
144 int m_sumEntries{ 0 };
147 template <
class INTERFACE,
class IMPLEMENTATION>
149 m_rep->SetTitle( title.c_str() );
150 if ( !annotation().addItem(
"Title", title ) ) m_annotation.setValue(
"Title", title );
151 if ( !annotation().addItem(
"title", title ) ) annotation().setValue(
"title", title );
155 template <
class INTERFACE,
class IMPLEMENTATION>
157 m_rep->SetName( newName.c_str() );
158 m_annotation.setValue(
"Name", newName );
162 template <
class INTERFACE,
class IMPLEMENTATION>
164 return m_rep->GetBinError( rIndex(
index ) );
167 template <
class INTERFACE,
class IMPLEMENTATION>
169 return m_rep->GetBinCenter( rIndex(
index ) );
172 template <
class INTERFACE,
class IMPLEMENTATION>
174 return m_rep->GetBinContent( rIndex(
index ) );
177 template <
class INTERFACE,
class IMPLEMENTATION>
179 return m_rep->GetBinError( rIndex(
index ) );
182 template <
class INTERFACE,
class IMPLEMENTATION>
184 return binEntries( AIDA::IAxis::UNDERFLOW_BIN ) + binEntries( AIDA::IAxis::OVERFLOW_BIN );
186 template <
class INTERFACE,
class IMPLEMENTATION>
193 template <
class INTERFACE,
class IMPLEMENTATION>
195 if ( sumBinHeights() <= 0 )
return 0;
197 m_rep->GetStats( stats );
198 return stats[0] * stats[0] / stats[1];
201 template <
class INTERFACE,
class IMPLEMENTATION>
203 m_rep->Scale( scaleFactor );
207 template <
class INTERFACE,
class IMPLEMENTATION>
211 m_rep->Add( p->
m_rep.get() );
214 throw std::runtime_error(
"Cannot add profile histograms of different implementations." );
217 template <
class INTERFACE,
class IMPLEMENTATION>
220 m_rep->Print(
"all" );
225 template <
class INTERFACE,
class IMPLEMENTATION>
227 s <<
"\n1D Histogram Table: " << std::endl;
228 s <<
"Bin, Height, Error " << std::endl;
229 for (
int i = 0; i < axis().bins(); ++i )
230 s << binMean( i ) <<
", " << binHeight( i ) <<
", " << binError( i ) << std::endl;
236 template <
class INTERFACE,
class IMPLEMENTATION>
238 TFile* f = TFile::Open( file_name,
"RECREATE" );
239 Int_t nbytes = m_rep->Write();
246 # pragma clang diagnostic pop
247 #elif defined( __GNUC__ )
248 # pragma GCC diagnostic pop
int coordToIndex(double coord) const override
Get the bin number corresponding to a given coordinate along the x axis.
std::unique_ptr< IMPLEMENTATION > m_rep
Reference to underlying implementation.
virtual double binRms(int index) const
double binError(int index) const override
The error of a given bin.
bool setName(const std::string &newName)
Set the name of the object.
Generic1D< INTERFACE, IMPLEMENTATION > Base
double sumAllBinHeights() const override
Get the sum of all the bins heights (including underflow and overflow bin).
void adoptRepresentation(TObject *rep) override
Adopt ROOT histogram representation.
TObject * representation() const override
ROOT object implementation.
const Axis & axis() const override
Get the x axis of the IHistogram1D.
const AIDA::IAnnotation & annotation() const override
Access annotation object (cons)
int entries() const override
Get the number or all the entries.
Axis & axis()
Access to axis object.
Implementation of the AIDA IAnnotation interface class.
AIDA::Annotation m_annotation
Object annotations.
std::string title() const override
Get the title of the object.
virtual int rIndex(int index) const
operator methods
double rms() const override
The RMS of the whole IHistogram1D.
int allEntries() const override
Get the number or all the entries, both in range and underflow/overflow bins of the IProfile.
Generic1D(IMPLEMENTATION *p)
constructor
double binHeight(int index) const override
Total height of the corresponding bin (ie the sum of the weights in this bin).
bool add(const INTERFACE &profile) override
Modifies this IProfile1D by adding the contents of profile to it.
double sumBinHeights() const override
Get the sum of in range bin heights in the IProfile.
int dimension() const override
Get the Histogram's dimension.
std::ostream & write(std::ostream &s) const override
Write (ASCII) the histogram table into the output stream.
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
double mean() const override
The mean of the whole IHistogram1D.
double sumExtraBinHeights() const override
Get the sum of the underflow and overflow bin height.
int write(const char *file_name) const override
Write (ASCII) the histogram table into a file.
An IAxis represents a binned histogram axis.
virtual const std::string & userLevelClassType() const
The AIDA user-level unterface leaf class type.
void * cast(const std::string &cl) const override
Manual cast by class name.
int extraEntries() const override
Get the number of entries in the underflow and overflow bins.
bool reset() override
Reset the Histogram; as if just created.
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...
int binEntries(int index) const override
Number of entries in the corresponding bin (ie the number of times fill was called for this bin).
bool setTitle(const std::string &title) override
Set the title of the object.
double maxBinHeight() const override
Get the maximum height of the in-range bins.
std::string name() const
object name
std::ostream & print(std::ostream &s) const override
Print (ASCII) the histogram into the output stream.
Generic1D()=default
Default constructor.
double minBinHeight() const override
Get the minimum height of the in-range bins.
size_t index(const Gaudi::ParticleProperty *property, const Gaudi::Interfaces::IParticlePropertySvc *service)
helper utility for mapping of Gaudi::ParticleProperty object into non-negative integral sequential id...
AIDA::IAnnotation & annotation() override
Access annotation object.
virtual double equivalentBinEntries() const
Number of equivalent entries, i.e. SUM[ weight ] ^ 2 / SUM[ weight^2 ]
double binMean(int index) const override
The weighted mean of a bin.