#include "machdefs.h" #include "toimanager.h" #include "pexceptions.h" #include "ctimer.h" #include "toi2map.h" //////////////////////////////////////////////////////////////////////// TOI2Map::TOI2Map(SphereHEALPix* sph,SphereHEALPix* wsph) : mSph(sph), mWSph(wsph), mWSphInternal(false) { SetEquinox(); SetCoorIn(); SetCoorOut(); SetTestFlag(); SetTestMin(); SetTestMax(); if(mSph->NbPixels()<1) { cout<<"TOI2Map::TOI2Map() Bad number of pixels in sphere mSph " <NbPixels()<SetPixels(0.); int nlat = mSph->SizeIndex(); if(mWSph==NULL) { mWSph = new SphereHEALPix(nlat); mWSphInternal = true; } else { mWSphInternal = false; if(nlat != mWSph->SizeIndex()) mWSph->Resize(nlat); } if(mWSph->NbPixels()<1) { cout<<"TOI2Map::TOI2Map() Bad number of pixels in sphere mWSph " <NbPixels()<SetPixels(0); } TOI2Map::~TOI2Map() { if(mWSph && !mWSphInternal) delete mWSph; } //////////////////////////////////////////////////////////////////////// void TOI2Map::Print(ostream & os) { os<<"TOI2Map::Print -- Sphere NLat = "<SizeIndex()<sne) { cout<<"TOI2Map::run() - Bad sample interval"<mValMax) continue; // sphere phi entre [0,2*Pi] en radians // sphere theta entre [0,Pi] en radians double phi=-1.,theta; CoordConvertToStd(mTypCoorIn,coord1,coord2); if(mTypCoorIn&TypCoordEq && mTypCoorOut&TypCoordGal) { // Eq -> Gal EqtoGal(mjd,coord1,coord2,&coord1,&coord2); phi = coord1 * M_PI/180.; } else if(mTypCoorIn&TypCoordGal && mTypCoorOut&TypCoordEq) { // Gal -> Eq GaltoEq(mjd,coord1,coord2,&coord1,&coord2); phi = coord1 * M_PI/12.; } else if(mTypCoorOut&TypCoordGal) { // Gal -> Gal phi = coord1 * M_PI/180.; } else if(mTypCoorOut&TypCoordEq) { // Eq -> Eq phi = coord1 * M_PI/12.; } theta = (90.-coord2) * M_PI/180.; if(phi<0. || phi>=2*M_PI) continue; if(theta<0. || theta>=M_PI) continue; int_4 ipix = mSph->PixIndexSph(theta,phi); (*mSph)(ipix) += bolo; ((*mWSph)(ipix)) += 1; mNSnFill++; } // Remplissage des spheres for(int_4 i=0;iNbPixels();i++) { r_8 wf = (*mWSph)(i); if( wf > 0. ) { mNpixFill++; (*mSph)(i) /= wf; } int_4 nf = int_4(wf); if(nf>=NFILL) nf=NFILL-1; NFill[nf]++; } cout<<"TOI2Map::run(): mNpixTot="<NbPixels() <<" mNpixFill="< FracSky="<NbPixels()<<"%" <<" NFill["<