Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  master (d98a2936)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Axis.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 // AID-GENERATED
3 // =========================================================================
4 // This class was generated by AID - Abstract Interface Definition
5 // DO NOT MODIFY, but use the org.freehep.aid.Aid utility to regenerate it.
6 // =========================================================================
7 #pragma once
8 
9 // This file is part of the AIDA library
10 // Copyright (C) 2002 by the AIDA team. All rights reserved.
11 // This library is free software and under the terms of the
12 // GNU Library General Public License described in the LGPL.txt
13 
14 #include <AIDA/IAxis.h>
15 
16 #include <TAxis.h>
17 
18 namespace Gaudi {
19 
28  class Axis : public AIDA::IAxis {
29  public:
30  static int toRootIndex( int index, int nbins ) {
31  if ( index == AIDA::IAxis::OVERFLOW_BIN ) return nbins + 1;
32  if ( index == AIDA::IAxis::UNDERFLOW_BIN ) return 0;
33  return index + 1;
34  }
35 
36  static int toAidaIndex( int index, int bins ) {
37  if ( index == bins + 1 ) return AIDA::IAxis::OVERFLOW_BIN;
38  if ( index == 0 ) return AIDA::IAxis::UNDERFLOW_BIN;
39  return index - 1;
40  }
41 
48  int rIndex( int index ) const { return toRootIndex( index, bins() ); }
49 
56  int aIndex( int index ) const { return toAidaIndex( index, bins() ); }
57 
58  public:
59  Axis() = default;
60  explicit Axis( TAxis* itaxi ) : taxis_( itaxi ) {}
61 
62  void initialize( TAxis* itaxi, bool ) { taxis_ = itaxi; }
63 
69  bool isFixedBinning() const override { return 0 == taxis_ ? true : !taxis_->IsVariableBinSize(); }
70 
76  double lowerEdge() const override { return taxis().GetXmin(); }
77 
83  double upperEdge() const override { return taxis().GetXmax(); }
84 
90  int bins() const override { return taxis().GetNbins(); }
91 
99  double binLowerEdge( int index ) const override { return taxis().GetBinLowEdge( rIndex( index ) ); }
107  double binUpperEdge( int index ) const override { return taxis().GetBinUpEdge( rIndex( index ) ); }
108 
115  double binWidth( int index ) const override { return taxis().GetBinWidth( rIndex( index ) ); }
116 
126  int coordToIndex( double coord ) const override { return aIndex( taxis().FindBin( coord ) ); }
127 
131  TAxis& taxis() const { return *me().taxis_; }
132 
133  private:
134  Axis& me() const { return const_cast<Axis&>( *this ); }
135 
136  TAxis* taxis_ = nullptr;
137 
138  }; // class
139 
140 } // namespace Gaudi
Gaudi::Axis::Axis
Axis()=default
Gaudi::Axis::Axis
Axis(TAxis *itaxi)
Definition: Axis.h:60
Gaudi::Axis::upperEdge
double upperEdge() const override
Get the upper edge of the IAxis.
Definition: Axis.h:83
Gaudi::Axis::toAidaIndex
static int toAidaIndex(int index, int bins)
Definition: Axis.h:36
Gaudi::Axis::binWidth
double binWidth(int index) const override
Get the width of the specified bin.
Definition: Axis.h:115
Gaudi::Axis::binUpperEdge
double binUpperEdge(int index) const override
Get the upper edge of the specified bin.
Definition: Axis.h:107
Gaudi::Axis::initialize
void initialize(TAxis *itaxi, bool)
Definition: Axis.h:62
Gaudi::Axis::me
Axis & me() const
Definition: Axis.h:134
Gaudi
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Definition: __init__.py:1
Gaudi::Axis
An IAxis represents a binned histogram axis.
Definition: Axis.h:28
Gaudi::Axis::lowerEdge
double lowerEdge() const override
Get the lower edge of the IAxis.
Definition: Axis.h:76
Gaudi::Axis::taxis
TAxis & taxis() const
Definition: Axis.h:131
Gaudi::Axis::aIndex
int aIndex(int index) const
Convert a ROOT bin number on the axis to the AIDA bin number.
Definition: Axis.h:56
Gaudi::Axis::binLowerEdge
double binLowerEdge(int index) const override
Get the lower edge of the specified bin.
Definition: Axis.h:99
Gaudi::Axis::bins
int bins() const override
The number of bins (excluding underflow and overflow) on the IAxis.
Definition: Axis.h:90
Gaudi::Axis::isFixedBinning
bool isFixedBinning() const override
Check if the IAxis has fixed binning, i.e.
Definition: Axis.h:69
Gaudi::Axis::coordToIndex
int coordToIndex(double coord) const override
Convert a coordinate on the axis to a bin number.
Definition: Axis.h:126
Gaudi::Axis::toRootIndex
static int toRootIndex(int index, int nbins)
Definition: Axis.h:30
Gaudi::ParticleProperties::index
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...
Definition: IParticlePropertySvc.cpp:39
Gaudi::Axis::taxis_
TAxis * taxis_
Definition: Axis.h:136
Gaudi::Axis::rIndex
int rIndex(int index) const
Convert a AIDA bin number on the axis to the ROOT bin number.
Definition: Axis.h:48