| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

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

- File List
- File Members

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
10 #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 */