| The Gaudi Framework v32r1 (f65d50dc)

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 GAUDICOMMONSVC_AXIS_H
8 #define GAUDICOMMONSVC_AXIS_H 1
9
10 // This file is part of the AIDA library
11 // Copyright (C) 2002 by the AIDA team. All rights reserved.
12 // This library is free software and under the terms of the
13 // GNU Library General Public License described in the LGPL.txt
14
15 #include "AIDA/IAxis.h"
16
17 #include "TAxis.h"
18
19 namespace Gaudi {
20
29 class Axis : public AIDA::IAxis {
30 public:
31 static int toRootIndex( int index, int nbins ) {
32 if ( index == AIDA::IAxis::OVERFLOW_BIN ) return nbins + 1;
33 if ( index == AIDA::IAxis::UNDERFLOW_BIN ) return 0;
34 return index + 1;
35 }
36
37 static int toAidaIndex( int index, int bins ) {
38 if ( index == bins + 1 ) return AIDA::IAxis::OVERFLOW_BIN;
39 if ( index == 0 ) return AIDA::IAxis::UNDERFLOW_BIN;
40 return index - 1;
41 }
42
49 int rIndex( int index ) const { return toRootIndex( index, bins() ); }
50
57 int aIndex( int index ) const { return toAidaIndex( index, bins() ); }
58
59 public:
60 Axis() = default;
61 explicit Axis( TAxis* itaxi ) : taxis_( itaxi ) {}
62
63 void initialize( TAxis* itaxi, bool ) { taxis_ = itaxi; }
64
70 bool isFixedBinning() const override { return 0 == taxis_ ? true : !taxis_->IsVariableBinSize(); }
71
77 double lowerEdge() const override { return taxis().GetXmin(); }
78
84 double upperEdge() const override { return taxis().GetXmax(); }
85
91 int bins() const override { return taxis().GetNbins(); }
92
100 double binLowerEdge( int index ) const override { return taxis().GetBinLowEdge( rIndex( index ) ); }
108 double binUpperEdge( int index ) const override { return taxis().GetBinUpEdge( rIndex( index ) ); }
109
116 double binWidth( int index ) const override { return taxis().GetBinWidth( rIndex( index ) ); }
117
127 int coordToIndex( double coord ) const override { return aIndex( taxis().FindBin( coord ) ); }
128
132 TAxis& taxis() const { return *me().taxis_; }
133
134 private:
135 Axis& me() const { return const_cast<Axis&>( *this ); }
136
137 TAxis* taxis_ = nullptr;
138
139 }; // class
140
141 } // namespace Gaudi
142
143 #endif // GAUDICOMMONSVC_AXIS_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:57
Gaudi::Axis::coordToIndex
int coordToIndex(double coord) const override
Convert a coordinate on the axis to a bin number.
Definition: Axis.h:127
Gaudi::Axis::binLowerEdge
double binLowerEdge(int index) const override
Get the lower edge of the specified bin.
Definition: Axis.h:100
Gaudi::Axis::me
Axis & me() const
Definition: Axis.h:135
Gaudi::Axis::toAidaIndex
static int toAidaIndex(int index, int bins)
Definition: Axis.h:37
Gaudi::Axis::isFixedBinning
bool isFixedBinning() const override
Check if the IAxis has fixed binning, i.e.
Definition: Axis.h:70
Gaudi::Axis::Axis
Axis(TAxis *itaxi)
Definition: Axis.h:61
Gaudi::Axis::binUpperEdge
double binUpperEdge(int index) const override
Get the upper edge of the specified bin.
Definition: Axis.h:108
Gaudi::Axis::Axis
Axis()=default
Gaudi::Axis::taxis_
TAxis * taxis_
Definition: Axis.h:137
Gaudi::Axis::lowerEdge
double lowerEdge() const override
Get the lower edge of the IAxis.
Definition: Axis.h:77
Gaudi::Axis::binWidth
double binWidth(int index) const override
Get the width of the specified bin.
Definition: Axis.h:116
Gaudi::Axis::bins
int bins() const override
The number of bins (excluding underflow and overflow) on the IAxis.
Definition: Axis.h:91
Gaudi::Axis::initialize
void initialize(TAxis *itaxi, bool)
Definition: Axis.h:63
Gaudi::Axis::toRootIndex
static int toRootIndex(int index, int nbins)
Definition: Axis.h:31
Gaudi::Axis::rIndex
int rIndex(int index) const
Convert a AIDA bin number on the axis to the ROOT bin number.
Definition: Axis.h:49
Gaudi
Header file for std:chrono::duration-based Counters.
Definition: __init__.py:1
Gaudi::Axis
An IAxis represents a binned histogram axis.
Definition: Axis.h:29
Gaudi::Axis::upperEdge
double upperEdge() const override
Get the upper edge of the IAxis.
Definition: Axis.h:84
Gaudi::Axis::taxis
TAxis & taxis() const
Definition: Axis.h:132