| The Gaudi Framework v27r1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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 #ifndef GAUDISVC__IAXIS_H
8 #define GAUDISVC__IAXIS_H 1
9 #include "AIDA_visibility_hack.h"
11
12 // This file is part of the AIDA library
13 // Copyright (C) 2002 by the AIDA team. All rights reserved.
14 // This library is free software and under the terms of the
15 // GNU Library General Public License described in the LGPL.txt
16
17 #include "AIDA/IAxis.h"
18
19 #include "TAxis.h"
20
21 namespace Gaudi {
22
31 class Axis : public AIDA::IAxis
32 {
33 public:
34
35 typedef Axis self;
36
37 static int toRootIndex(int index, int nbins) {
38 if (index==AIDA::IAxis::OVERFLOW_BIN) return nbins+1;
39 if (index==AIDA::IAxis::UNDERFLOW_BIN) return 0;
40 return index+1;
41 }
42
43 static int toAidaIndex(int index, int bins) {
44 if ( index == bins + 1 ) return AIDA::IAxis::OVERFLOW_BIN ;
45 if ( index == 0 ) return AIDA::IAxis::UNDERFLOW_BIN ;
46 return index - 1 ;
47 }
48
55 int rIndex(int index) const { return toRootIndex(index, bins());}
56
63 int aIndex( int index ) const { return toAidaIndex(index, bins()); }
64
65 public:
66
67 Axis() = default;
68
69 explicit Axis ( TAxis * itaxi ) : taxis_(itaxi) {}
70
71 void initialize (TAxis * itaxi , bool ) { taxis_ = itaxi; }
72
74 ~Axis() override = default;
75
81 bool isFixedBinning() const override
82 {
83 return 0 == taxis_ ? true : !taxis_->IsVariableBinSize() ;
84 }
85
91 double lowerEdge() const override { return taxis().GetXmin();}
92
98 double upperEdge() const override { return taxis().GetXmax();}
99
105 int bins() const override { return taxis().GetNbins();}
106
113 double binLowerEdge(int index) const override { return taxis().GetBinLowEdge(rIndex(index));}
120 double binUpperEdge(int index) const override { return taxis().GetBinUpEdge(rIndex(index));}
121
128 double binWidth(int index) const override { return taxis().GetBinWidth(rIndex(index));}
129
139 int coordToIndex(double coord) const override
140 {
141 return aIndex( taxis().FindBin(coord) );
142 }
143
147 TAxis & taxis() const { return *me().taxis_;}
148
149 private:
150
151 self & me() const { return const_cast<self&>(*this);}
152
153
154 TAxis * taxis_ = nullptr;
155
156 }; // class
157
158 } // namespace Gaudi
159
160 #endif /* ifndef AIDA_IAXIS_H */
Gaudi::Axis::aIndex
int aIndex(int index) const
Convert a ROOT bin number on the axis to the AIDA bin number.
Definition: Axis.h:63
Gaudi::Axis::coordToIndex
int coordToIndex(double coord) const override
Convert a coordinate on the axis to a bin number.
Definition: Axis.h:139
AIDA_visibility_hack.h
Gaudi::Axis::binLowerEdge
double binLowerEdge(int index) const override
Get the lower edge of the specified bin.
Definition: Axis.h:113
Gaudi::Axis::toAidaIndex
static int toAidaIndex(int index, int bins)
Definition: Axis.h:43
Gaudi::Axis::isFixedBinning
bool isFixedBinning() const override
Check if the IAxis has fixed binning, i.e.
Definition: Axis.h:81
Gaudi::Axis::me
self & me() const
Definition: Axis.h:151
Gaudi::Axis::Axis
Axis(TAxis *itaxi)
Definition: Axis.h:69
Gaudi::Axis::~Axis
~Axis() override=default
Destructor.
Gaudi::Axis::binUpperEdge
double binUpperEdge(int index) const override
Get the upper edge of the specified bin.
Definition: Axis.h:120
Gaudi::Axis::Axis
Axis()=default
Gaudi::Axis::taxis_
TAxis * taxis_
Definition: Axis.h:154
Gaudi::Axis::lowerEdge
double lowerEdge() const override
Get the lower edge of the IAxis.
Definition: Axis.h:91
Gaudi::Axis::binWidth
double binWidth(int index) const override
Get the width of the specified bin.
Definition: Axis.h:128
Gaudi::Axis::bins
int bins() const override
The number of bins (excluding underflow and overflow) on the IAxis.
Definition: Axis.h:105
Gaudi::Axis::initialize
void initialize(TAxis *itaxi, bool)
Definition: Axis.h:71
Gaudi::Axis::toRootIndex
static int toRootIndex(int index, int nbins)
Definition: Axis.h:37
Gaudi
Helper functions to set/get the application return code.
Definition: __init__.py:1
Gaudi::Axis
An IAxis represents a binned histogram axis.
Definition: Axis.h:31
Gaudi::Axis::upperEdge
double upperEdge() const override
Get the upper edge of the IAxis.
Definition: Axis.h:98
Gaudi::Axis::taxis
TAxis & taxis() const
Definition: Axis.h:147
Gaudi::Axis::rIndex
int rIndex(int index) const
Convert a AIDA bin number on the axis to the ROOT bin number.
Definition: Axis.h:55