|
Gaudi Framework, version v21r9 |
| Home | Generated: 3 May 2010 |
00001 // -*- C++ -*- 00002 // AID-GENERATED 00003 // ========================================================================= 00004 // This class was generated by AID - Abstract Interface Definition 00005 // DO NOT MODIFY, but use the org.freehep.aid.Aid utility to regenerate it. 00006 // ========================================================================= 00007 #ifndef GAUDISVC__IAXIS_H 00008 #define GAUDISVC__IAXIS_H 1 00010 #include "AIDA_visibility_hack.h" 00011 00012 // This file is part of the AIDA library 00013 // Copyright (C) 2002 by the AIDA team. All rights reserved. 00014 // This library is free software and under the terms of the 00015 // GNU Library General Public License described in the LGPL.txt 00016 00017 #include "AIDA/IAxis.h" 00018 00019 #include "TAxis.h" 00020 00021 namespace Gaudi { 00022 00031 class Axis : public AIDA::IAxis 00032 { 00033 public: 00034 00035 typedef Axis self; 00036 00037 static int toRootIndex(int index, int nbins) { 00038 if (index==AIDA::IAxis::OVERFLOW_BIN) return nbins+1; 00039 if (index==AIDA::IAxis::UNDERFLOW_BIN) return 0; 00040 return index+1; 00041 } 00042 00043 static int toAidaIndex(int index, int bins) { 00044 if ( index == bins + 1 ) return AIDA::IAxis::OVERFLOW_BIN ; 00045 if ( index == 0 ) return AIDA::IAxis::UNDERFLOW_BIN ; 00046 return index - 1 ; 00047 } 00048 00055 int rIndex(int index) const { return toRootIndex(index, bins());} 00056 00063 int aIndex( int index ) const { return toAidaIndex(index, bins()); } 00064 00065 public: 00066 00067 Axis() : taxis_(0) {} 00068 00069 explicit Axis ( TAxis * itaxi ) : taxis_(itaxi) {} 00070 00071 void initialize (TAxis * itaxi , bool ) { taxis_ = itaxi; } 00072 00074 virtual ~Axis() {} 00075 00081 virtual bool isFixedBinning() const 00082 { 00083 return 0 == taxis_ ? true : !taxis_->IsVariableBinSize() ; 00084 } 00085 00091 virtual double lowerEdge() const { return taxis().GetXmin();} 00092 00098 virtual double upperEdge() const { return taxis().GetXmax();} 00099 00105 virtual int bins() const { return taxis().GetNbins();} 00106 00113 virtual double binLowerEdge(int index) const { return taxis().GetBinLowEdge(rIndex(index));} 00120 virtual double binUpperEdge(int index) const { return taxis().GetBinUpEdge(rIndex(index));} 00121 00128 virtual double binWidth(int index) const { return taxis().GetBinWidth(rIndex(index));} 00129 00139 virtual int coordToIndex(double coord) const 00140 { 00141 return aIndex( taxis().FindBin(coord) ); 00142 } 00143 00147 TAxis & taxis() const { return *me().taxis_;} 00148 00149 private: 00150 00151 private: 00152 00153 self & me() const { return const_cast<self&>(*this);} 00154 00155 00156 TAxis * taxis_; 00157 00158 }; // class 00159 00160 } // namespace Gaudi 00161 00162 #endif /* ifndef AIDA_IAXIS_H */