Go to the documentation of this file.
   11 #ifndef GAUDISVC_GENERIC1D_H 
   12 #define GAUDISVC_GENERIC1D_H 1 
   16 #include <AIDA/IProfile1D.h> 
   25 #  pragma clang diagnostic push 
   26 #  pragma clang diagnostic ignored "-Wsuggest-override" 
   27 #  pragma clang diagnostic ignored "-Winconsistent-missing-override" 
   28 #elif defined( __GNUC__ ) 
   29 #  pragma GCC diagnostic push 
   30 #  pragma GCC diagnostic ignored "-Wsuggest-override" 
   45   template <
class INTERFACE, 
class IMPLEMENTATION>
 
   74     AIDA::IAnnotation& 
annotation()
 override { 
return m_annotation; }
 
   76     const AIDA::IAnnotation& 
annotation()
 const override { 
return m_annotation; }
 
   80     const Axis& 
axis()
 const override { 
return m_axis; }
 
   83     int entries()
 const override { 
return m_rep->GetEntries(); }
 
   85     int allEntries()
 const override { 
return m_rep->GetEntries(); }
 
   93     double sumBinHeights()
 const override { 
return m_rep->GetSumOfWeights(); }
 
   99     double minBinHeight()
 const override { 
return m_rep->GetMinimum(); }
 
  107     virtual bool scale( 
double scaleFactor );
 
  111     bool add( 
const INTERFACE& profile ) 
override;
 
  121     double mean()
 const override { 
return m_rep->GetMean(); }
 
  123     double rms()
 const override { 
return m_rep->GetRMS(); }
 
  125     int coordToIndex( 
double coord )
 const override { 
return axis().coordToIndex( coord ); }
 
  133     int write( 
const char* file_name ) 
const override;
 
  145     int m_sumEntries{ 0 };
 
  148   template <
class INTERFACE, 
class IMPLEMENTATION>
 
  150     m_rep->SetTitle( title.
c_str() );
 
  151     if ( !annotation().addItem( 
"Title", title ) ) m_annotation.setValue( 
"Title", title );
 
  152     if ( !annotation().addItem( 
"title", title ) ) annotation().setValue( 
"title", title );
 
  156   template <
class INTERFACE, 
class IMPLEMENTATION>
 
  158     m_rep->SetName( newName.
c_str() );
 
  159     m_annotation.setValue( 
"Name", newName );
 
  163   template <
class INTERFACE, 
class IMPLEMENTATION>
 
  165     return m_rep->GetBinError( rIndex( 
index ) );
 
  168   template <
class INTERFACE, 
class IMPLEMENTATION>
 
  170     return m_rep->GetBinCenter( rIndex( 
index ) );
 
  173   template <
class INTERFACE, 
class IMPLEMENTATION>
 
  175     return m_rep->GetBinContent( rIndex( 
index ) );
 
  178   template <
class INTERFACE, 
class IMPLEMENTATION>
 
  180     return m_rep->GetBinError( rIndex( 
index ) );
 
  183   template <
class INTERFACE, 
class IMPLEMENTATION>
 
  185     return binEntries( AIDA::IAxis::UNDERFLOW_BIN ) + binEntries( AIDA::IAxis::OVERFLOW_BIN );
 
  187   template <
class INTERFACE, 
class IMPLEMENTATION>
 
  194   template <
class INTERFACE, 
class IMPLEMENTATION>
 
  196     if ( sumBinHeights() <= 0 ) 
return 0;
 
  198     m_rep->GetStats( stats );
 
  199     return stats[0] * stats[0] / stats[1];
 
  202   template <
class INTERFACE, 
class IMPLEMENTATION>
 
  204     m_rep->Scale( scaleFactor );
 
  208   template <
class INTERFACE, 
class IMPLEMENTATION>
 
  215     throw std::runtime_error( 
"Cannot add profile histograms of different implementations." );
 
  218   template <
class INTERFACE, 
class IMPLEMENTATION>
 
  221     m_rep->Print( 
"all" );
 
  226   template <
class INTERFACE, 
class IMPLEMENTATION>
 
  230     for ( 
int i = 0; i < axis().bins(); ++i )
 
  231       s << binMean( i ) << 
", " << binHeight( i ) << 
", " << binError( i ) << 
std::endl;
 
  237   template <
class INTERFACE, 
class IMPLEMENTATION>
 
  239     TFile* f      = TFile::Open( file_name, 
"RECREATE" );
 
  240     Int_t  nbytes = m_rep->Write();
 
  247 #  pragma clang diagnostic pop 
  248 #elif defined( __GNUC__ ) 
  249 #  pragma GCC diagnostic pop 
  252 #endif // AIDAROOT_GENERIC1D_H 
  
 
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.