00001
00002
00004 #ifndef __Omap__
00005 #define __Omap__
00006 #include "CUtils.h"
00007 #include "TMath.h"
00008 #include "TH2D.h"
00009
00010 using namespace std;
00011
00018 class Omap: public TH2D {
00019
00020 public:
00021 friend class Otile;
00022 friend class Oqplane;
00023
00024 private:
00025
00026
00027 Omap();
00028 virtual ~Omap(void);
00029
00030 void SetBins(const double aQ,
00031 const double aFrequencyMin, const double aFrequencyMax,
00032 const int aTimeRange, const double aMismatchStep);
00033
00034 inline double GetTimeRange(void){
00035 return GetXaxis()->GetBinUpEdge(GetNbinsX())-GetXaxis()->GetBinLowEdge(1);
00036 };
00037 inline double GetTimeMin(void){
00038 return GetXaxis()->GetBinLowEdge(1);
00039 };
00040 inline double GetTimeMax(void){
00041 return GetXaxis()->GetBinUpEdge(GetNbinsX());
00042 };
00043 inline double GetFrequencyMin(void){
00044 return GetYaxis()->GetBinLowEdge(1);
00045 };
00046 inline double GetFrequencyMax(void){
00047 return GetYaxis()->GetBinUpEdge(GetNbinsY());
00048 };
00049 inline int GetNBands(void){
00050 return GetNbinsY();
00051 };
00052 inline long int GetNTiles(void){
00053 return Ntiles;
00054 };
00055 inline int GetBandIndex(const double aFrequency){
00056 return GetYaxis()->FindBin(aFrequency)-1;
00057 };
00058 inline double GetBandFrequency(const int aBandIndex){
00059 return bandCenter[aBandIndex];
00060 };
00061 inline double GetBandStart(const int aBandIndex){
00062 return GetYaxis()->GetBinLowEdge(aBandIndex+1);
00063 };
00064 inline double GetBandEnd(const int aBandIndex){
00065 return GetYaxis()->GetBinUpEdge(aBandIndex+1);
00066 };
00067 inline double GetBandWidth(const int aBandIndex){
00068 return GetYaxis()->GetBinWidth(aBandIndex+1);
00069 };
00070 inline double GetTileDuration(const int aBandIndex){
00071 return GetXaxis()->GetBinWidth(1)*bandMultiple[aBandIndex];
00072 };
00073 inline int GetBandNtiles(const int aBandIndex){
00074 return GetNbinsX()/bandMultiple[aBandIndex];
00075 };
00076
00077 inline double GetTileTimeStart(const int aTimeTileIndex, const int aBandIndex){
00078 return GetXaxis()->GetBinLowEdge(aTimeTileIndex*bandMultiple[aBandIndex]+1);
00079 };
00080 inline double GetTileTimeEnd(const int aTimeTileIndex, const int aBandIndex){
00081 return GetXaxis()->GetBinUpEdge((aTimeTileIndex+1)*bandMultiple[aBandIndex]);
00082 };
00083 inline double GetTileTime(const int aTimeTileIndex, const int aBandIndex){
00084 return (GetTileTimeStart(aTimeTileIndex,aBandIndex) + GetTileTimeEnd(aTimeTileIndex,aBandIndex)) / 2.0;
00085 };
00086 inline int GetTimeTileIndex(const int aBandIndex, const double aTime){
00087 return (int)floor((aTime-GetTimeMin())/GetTileDuration(aBandIndex));
00088 };
00089
00090 inline double GetTileContent(const int aTimeTileIndex, const int aBandIndex){
00091 return TH2::GetBinContent(aTimeTileIndex*bandMultiple[aBandIndex]+1,aBandIndex+1);
00092 };
00093 inline void SetTileContent(const int aTimeTileIndex, const int aBandIndex, const double aContent){
00094 int tstart=aTimeTileIndex*bandMultiple[aBandIndex]+1;
00095 int tend=tstart+bandMultiple[aBandIndex];
00096 for(int t=tstart; t<tend; t++) TH2::SetBinContent(t,aBandIndex+1,aContent);
00097 };
00098
00099 long int Ntiles;
00100 double *bandCenter;
00101 int *bandMultiple;
00102
00103 ClassDef(Omap,0)
00104 };
00105
00106
00107 #endif
00108
00109