The Gaudi Framework  master (82fdf313)
Loading...
Searching...
No Matches
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
18namespace 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
125
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
double upperEdge() const override
Get the upper edge of the IAxis.
Definition Axis.h:83
double binLowerEdge(int index) const override
Get the lower edge of the specified bin.
Definition Axis.h:99
static int toRootIndex(int index, int nbins)
Definition Axis.h:30
int bins() const override
The number of bins (excluding underflow and overflow) on the IAxis.
Definition Axis.h:90
TAxis * taxis_
Definition Axis.h:136
int rIndex(int index) const
Convert a AIDA bin number on the axis to the ROOT bin number.
Definition Axis.h:48
static int toAidaIndex(int index, int bins)
Definition Axis.h:36
bool isFixedBinning() const override
Check if the IAxis has fixed binning, i.e.
Definition Axis.h:69
double lowerEdge() const override
Get the lower edge of the IAxis.
Definition Axis.h:76
Axis(TAxis *itaxi)
Definition Axis.h:60
int coordToIndex(double coord) const override
Convert a coordinate on the axis to a bin number.
Definition Axis.h:126
Axis()=default
double binWidth(int index) const override
Get the width of the specified bin.
Definition Axis.h:115
TAxis & taxis() const
Definition Axis.h:131
Axis & me() const
Definition Axis.h:134
double binUpperEdge(int index) const override
Get the upper edge of the specified bin.
Definition Axis.h:107
void initialize(TAxis *itaxi, bool)
Definition Axis.h:62
int aIndex(int index) const
Convert a ROOT bin number on the axis to the AIDA bin number.
Definition Axis.h:56
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Definition __init__.py:1