All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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 #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() : taxis_(0) {}
68 
69  explicit Axis ( TAxis * itaxi ) : taxis_(itaxi) {}
70 
71  void initialize (TAxis * itaxi , bool ) { taxis_ = itaxi; }
72 
74  virtual ~Axis() {}
75 
81  virtual bool isFixedBinning() const
82  {
83  return 0 == taxis_ ? true : !taxis_->IsVariableBinSize() ;
84  }
85 
91  virtual double lowerEdge() const { return taxis().GetXmin();}
92 
98  virtual double upperEdge() const { return taxis().GetXmax();}
99 
105  virtual int bins() const { return taxis().GetNbins();}
106 
113  virtual double binLowerEdge(int index) const { return taxis().GetBinLowEdge(rIndex(index));}
120  virtual double binUpperEdge(int index) const { return taxis().GetBinUpEdge(rIndex(index));}
121 
128  virtual double binWidth(int index) const { return taxis().GetBinWidth(rIndex(index));}
129 
139  virtual int coordToIndex(double coord) const
140  {
141  return aIndex( taxis().FindBin(coord) );
142  }
143 
147  TAxis & taxis() const { return *me().taxis_;}
148 
149  private:
150 
151  private:
152 
153  self & me() const { return const_cast<self&>(*this);}
154 
155 
156  TAxis * taxis_;
157 
158  }; // class
159 
160 } // namespace Gaudi
161 
162 #endif /* ifndef AIDA_IAXIS_H */
int aIndex(int index) const
Convert a ROOT bin number on the axis to the AIDA bin number.
Definition: Axis.h:63
virtual double binLowerEdge(int index) const
Get the lower edge of the specified bin.
Definition: Axis.h:113
virtual double lowerEdge() const
Get the lower edge of the IAxis.
Definition: Axis.h:91
virtual bool isFixedBinning() const
Check if the IAxis has fixed binning, i.e.
Definition: Axis.h:81
static int toAidaIndex(int index, int bins)
Definition: Axis.h:43
self & me() const
Definition: Axis.h:153
Axis(TAxis *itaxi)
Definition: Axis.h:69
virtual int coordToIndex(double coord) const
Convert a coordinate on the axis to a bin number.
Definition: Axis.h:139
TAxis * taxis_
Definition: Axis.h:156
virtual double binUpperEdge(int index) const
Get the upper edge of the specified bin.
Definition: Axis.h:120
virtual double upperEdge() const
Get the upper edge of the IAxis.
Definition: Axis.h:98
Axis()
Definition: Axis.h:67
void initialize(TAxis *itaxi, bool)
Definition: Axis.h:71
virtual int bins() const
The number of bins (excluding underflow and overflow) on the IAxis.
Definition: Axis.h:105
static int toRootIndex(int index, int nbins)
Definition: Axis.h:37
virtual double binWidth(int index) const
Get the width of the specified bin.
Definition: Axis.h:128
This is a number of static methods for bootstrapping the Gaudi framework.
Definition: Bootstrap.h:14
virtual ~Axis()
Destructor.
Definition: Axis.h:74
An IAxis represents a binned histogram axis.
Definition: Axis.h:31
TAxis & taxis() const
Definition: Axis.h:147
int rIndex(int index) const
Convert a AIDA bin number on the axis to the ROOT bin number.
Definition: Axis.h:55