Gaudi Framework, version v21r4

Home   Generated: 7 Sep 2009

Axis.h

Go to the documentation of this file.
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   public:
00033 
00034     typedef Axis self;
00035 
00036     static int toRootIndex(int index, int nbins) {
00037       if (index==AIDA::IAxis::OVERFLOW_BIN) return nbins+1;
00038       if (index==AIDA::IAxis::UNDERFLOW_BIN) return 0;
00039       return index+1;
00040     }
00041 
00042     static int toAidaIndex(int index, int bins) {
00043       if ( index == bins + 1 ) return AIDA::IAxis::OVERFLOW_BIN ;
00044       if ( index == 0 ) return AIDA::IAxis::UNDERFLOW_BIN ;
00045       return index - 1 ;
00046     }
00047 
00054     int rIndex(int index) const { return toRootIndex(index, bins());}
00055 
00062     int aIndex( int index ) const { return toAidaIndex(index, bins()); }
00063 
00064   public:
00065 
00066     Axis() : taxis_(0), fixed_(true)  {}
00067 
00068     explicit Axis(TAxis * itaxi, bool isfixed=true) : taxis_(itaxi), fixed_(isfixed){}
00069 
00070     void initialize(TAxis * itaxi, bool isfixed=true) {
00071       taxis_ = itaxi;
00072       fixed_ = isfixed;
00073     }
00074 
00076     virtual ~Axis()    {}
00077 
00083     virtual bool isFixedBinning() const { return fixed_;}
00084 
00090     virtual double lowerEdge() const { return taxis().GetXmin();}
00091 
00097     virtual double upperEdge() const { return taxis().GetXmax();}
00098 
00104     virtual int bins() const { return taxis().GetNbins();}
00105 
00112     virtual double binLowerEdge(int index) const { return taxis().GetBinLowEdge(rIndex(index));}
00119     virtual double binUpperEdge(int index) const { return taxis().GetBinUpEdge(rIndex(index));}
00120 
00127     virtual double binWidth(int index) const { return taxis().GetBinWidth(rIndex(index));}
00128 
00138     virtual int coordToIndex(double coord) const
00139     {
00140       return aIndex( taxis().FindBin(coord) );
00141     }
00142 
00146     TAxis & taxis() const { return *me().taxis_;}
00147 
00148   private:
00149 
00150   private:
00151 
00152     self & me() const { return const_cast<self&>(*this);}
00153 
00154 
00155     TAxis * taxis_;
00156     bool fixed_;
00157 
00158 
00159   }; // class
00160 
00161 } // namespace Gaudi
00162 
00163 #endif /* ifndef AIDA_IAXIS_H */

Generated at Mon Sep 7 18:05:48 2009 for Gaudi Framework, version v21r4 by Doxygen version 1.5.6 written by Dimitri van Heesch, © 1997-2004