// ArchTOIPipe (C) CEA/DAPNIA/SPP IN2P3/LAL // Eric Aubourg // Christophe Magneville // Reza Ansari // $Id: toi2map.cc,v 1.25 2002-05-16 20:39:52 ansari Exp $ #include "machdefs.h" #include "toimanager.h" #include "pexceptions.h" #include "ctimer.h" #include "toi2map.h" // La valeur "Pi" doit etre celle de smathconst.h a cause du test sur theta #include "smathconst.h" //////////////////////////////////////////////////////////////////////// TOI2Map::TOI2Map(PixelMap* map,PixelMap* wmap) : mMap(map), mWMap(wmap), mWMapInternal(false), totnscount(0) { SetEquinox(); SetCoorIn(); SetCoorMap(); SetTestFlag(); SetTestMin(); SetTestMax(); if(mMap->NbPixels()<1) { cout<<"TOI2Map::TOI2Map() Bad number of pixels in sphere mMap " <NbPixels()<SetPixels(0.); int nlat = mMap->SizeIndex(); string typmap = mMap->TypeOfMap(); if(mWMap==NULL) { // We would need a cloning function in maps. $$TBD$$ $CHECK$ if (typmap == "LOCAL") { mWMap = new LocalMap(*(LocalMap*)mMap); } else if (typmap == "RING") { mWMap = new SphereHEALPix(nlat); } else { cout << "TOI2Map::TOI2Map() cannot handle map of type " << typmap << endl; throw ParmError("TOI2Map::TOI2Map() - bad type of map"); } mWMapInternal = true; } else { mWMapInternal = false; if(nlat != mWMap->SizeIndex()) { cout<<"TOI2Map::TOI2Map() Bad size for sphere mWMap, does not " <<"correspond to mMap : "<SizeIndex()<<", "<SizeIndex()< *)mWMap)->Resize(nlat); cout<<"Resize have been done..."<NbPixels()<1) { cout<<"TOI2Map::TOI2Map() Bad number of pixels in sphere mWMap " <NbPixels()<SetPixels(0); } TOI2Map::~TOI2Map() { if(mWMap && mWMapInternal) delete mWMap; } //////////////////////////////////////////////////////////////////////// void TOI2Map::Print(::ostream & os) { os<<"TOI2Map::Print -- Map type " << mMap->TypeOfMap() << " SizeIndex = "<SizeIndex()<sne) { cout<<"TOI2Map::run() - Bad sample interval"<=i0+bufsz) { i0 = s; int nget = (sne-s+1mValMax) continue; // sphere phi entre [0,2*Pi] en radians // sphere theta entre [0,Pi] en radians double phi=-1.; CoordConvertToStd(mTypCoorIn,&coord1,&coord2); if(mTypCoorIn&TypCoordEq && mTypCoorMap&TypCoordGal) { // Eq -> Gal EqtoGal(mjd,coord1,coord2,&coord1,&coord2); phi = coord1 * Pi/180.; } else if(mTypCoorIn&TypCoordGal && mTypCoorMap&TypCoordEq) { // Gal -> Eq GaltoEq(mjd,coord1,coord2,&coord1,&coord2); phi = coord1 * Pi/12.; } else if(mTypCoorMap&TypCoordGal) { // Gal -> Gal phi = coord1 * Pi/180.; } else if(mTypCoorMap&TypCoordEq) { // Eq -> Eq phi = coord1 * Pi/12.; } ToCoLat(&coord2,TypUniteD); double theta = coord2 * Pi/180.; if(phi<0. | phi>=2*Pi || theta<0. || theta>Pi) {BadCoorRange++; continue;} int_4 ipix = mMap->PixIndexSph(theta,phi); (*mMap)(ipix) += bolo; ((*mWMap)(ipix)) += 1; mNSnFill++; } cout<<"TOI2Map::run(): Fin de boucle sur les sampleNum"<NbPixels();i++) { r_8 wf = (*mWMap)(i); if(wf>0.) {mNpixFill++; (*mMap)(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["<