I’m already doing that, though, so that can’t be the whole explanation. The relevant constructors are excerpted here:
VASkyMap::VASkyMap() : pi(acos(-1.)),fBinSizeX(0.0), fBinSizeY(0.0), fOrigin_first(0.0), fOrigin_second(0.0), fFoVRadius(1.5), fMode(RADec_Coord)
{
fHist.SetDirectory(0);
fHist_smooth.SetDirectory(0);
}
VASkyMap::VASkyMap(const char* name, const char* title,
double originRA, double originDec, double fov,
double binsize, double fovRadius, CoordinateMode mode) :
pi(acos(-1.)),fBinSizeX(binsize), fBinSizeY(binsize), fOrigin_first(originRA),
fOrigin_second(originDec), fFoVRadius(fovRadius), fMode(mode)
{
// Stretch the bins in RA by 1/cos(dec), for dec<~84 deg. For sources above
// a declination of 84 deg, this will need to be revisited. Also stretch the
// FoV in RA - eg, at a dec of 60 deg, the array’s 3.5 deg FoV corresponds
// to 7.0 deg in RA. Assume that over the 3.5 deg range in Dec that the
// change in RA is symmetric, so that the FoV becomes an ellipse.
fOneOverCosDec = 1; // Don’t scale if we’re not in RA/DEC mode
if (fMode == RADec_Coord) {
double oneOverCosDec = 0.;
double fOrigin_RA = fOrigin_first;
double fOrigin_Dec = fOrigin_second;
if ( fOrigin_Dec < 1.47 && fOrigin_Dec > -1.47 ) {
oneOverCosDec = 1./cos(fOrigin_Dec);
} else {
oneOverCosDec = 10.;
}
fOneOverCosDec = oneOverCosDec;
}
fFoVX = fov*fOneOverCosDec; // Stretch X FoV
fFoVY = fov;
fbinsX=static_cast(floor(fFoVX/fBinSizeX+0.5));
fbinsY=static_cast(floor(fFoVY/fBinSizeY+0.5));
fXRange.fLo=fOrigin_first*(180./pi)-fFoVX/2;
fXRange.fHi=fXRange.fLo+fFoVX;
fYRange.fLo=fOrigin_second*(180./pi)-fFoVY/2;
fYRange.fHi=fYRange.fLo+fFoVY;
SetName(name);
fHist.SetDirectory(0);
fHist_smooth.SetDirectory(0);
TString histName(name);
histName += TString("_hist");
fHist.SetName(histName);
fHist.SetTitle(title);
fHist.SetBins(fbinsX, fXRange.fLo,fXRange.fHi,
fbinsY,fYRange.fLo,fYRange.fHi);
TString tmpName = histName + TString("_smooth");
fHist_smooth.SetName(tmpName);
fHist_smooth.SetTitle(title);
fHist_smooth.SetBins(fbinsX, fXRange.fLo,fXRange.fHi,
fbinsY,fYRange.fLo,fYRange.fHi);
cout << GetName() << " Coord Mode: " << fMode << "Scale: " << fOneOverCosDec << endl;
}
The header file is here:
#ifndef VASKYMAP_H_
#define VASKYMAP_H_
[includes snipped]
class VASkyMap : public TNamed
{
public :
enum CoordinateMode { Camera_Coord, RADec_Coord, Galactic_Coord };
VASkyMap();
VASkyMap(const char* name, const char* title,
double originRA, double originDec, double fov, double binsize,
double fovRadius = 1.5, CoordinateMode mode = RADec_Coord);
virtual ~VASkyMap();
// add a setter so the user can “fix” this offline if it was mis-set
void SetFoVRadius(double fovRadius) {fFoVRadius = fovRadius;}
void FillCoordinates(std::pair<double,double> pos,double w);
void FindBinPosition(std::pair<double,double> pos,int& x,int& y);
void Smooth(double radius);
void Draw(Option_t *option =""); // will be able to pass “smooth” as an option
void Gauss2DPlot();
void SetBinContent(std::pair<double,double> pos,double w);
virtual void SetBinContent( int xbin, int ybin, double w );
void SetBinError( int xbin, int ybin, double e );
double GetBinContent(std::pair<double,double> pos);
double GetBinContent( int xbin, int ybin );
double GetBinArea(int xbin, int ybin);
void SetTitle(const char *title) {fHist.SetTitle(title);}
TAxis *GetXaxis() {return fHist.GetXaxis();}
TAxis *GetYaxis() {return fHist.GetYaxis();}
int GetNbinsX() {return fHist.GetNbinsX();}
int GetNbinsY() {return fHist.GetNbinsY();}
TH2F *GetHistogram() {return &fHist;}
TH2F *GetSmoothedHistogram() {return &fHist_smooth;}
TF2 * Fit2D();
std::pair<double,double> GetBinCoordinates(int x,int y);
private :
double pi;
double fBinSizeX;
double fBinSizeY;
double fFoVX;
double fFoVY;
double fOrigin_first;
double fOrigin_second;
CoordinateMode fMode;
uint16_t fbinsX;
uint16_t fbinsY;
VARange fXRange;
VARange fYRange;
double fOneOverCosDec;
double fFoVRadius;
TH2F fHist;
TH2F fHist_smooth;
ClassDef(VASkyMap,1);
}; // class VASkyMap
#endif