#include #include "ptsrcinbandcalctools.h" #include "lightptsrclevsinband.h" #include "spherehealpix.h" PtSrcInBandCalTools::PtSrcInBandCalTools(LightPtSrcLevSInBand* pLightSource,MeanFreqLobe* pLob, LevSPanckBand thisBand) :pLightSrc(pLightSource), Band(thisBand) { pLobe=pLob; FreqMax=pLobe->maxFreq(); FreqMin=pLobe->minFreq(); pFilter=pLob->pRespShape; RAngComp = pLobe->lobeResol(); } double PtSrcInBandCalTools::compPixel(UnitVector& VP, UnitVector& VY) { double OuvAng=pLobe->AngleMax(); double thetaPointe=VP.Theta(); double PhiPointe=VP.Phi(); double ThetaMin=thetaPointe-OuvAng; if(ThetaMin<0.) ThetaMin=0.; double ThetaMax=thetaPointe+OuvAng; if(ThetaMax>M_PI) ThetaMax=M_PI; /* cout<< "test Passage"<deltaPhi2) deltaPhi=deltaPhi1; else deltaPhi=deltaPhi2; } double PhiMin=PhiPointe-deltaPhi; double PhiMax=PhiPointe+deltaPhi; /* // Useless! if((PhiMin<-M_PI)||(PhiMax>M_PI)) { PhiMin=-M_PI; PhiMax=M_PI; } */ double PowerTot=0.; const UnitVector VecBidon(ThetaMin,0.); multimap ::iterator iterlow=pLightSrc->MapOfPtSrc.lower_bound(VecBidon); const UnitVector VecBidon2(ThetaMax,0.); multimap ::iterator iterhigh=pLightSrc->MapOfPtSrc.upper_bound(VecBidon2); multimap ::iterator iter; double PhiSrc; // long compteur=0; // long compteur2=0; for(iter=iterlow; iter!=iterhigh; iter++) { PhiSrc=(*iter).first.Phi(); if( (PhiSrc>PhiMin) && (PhiSrcweigthAmpl((*iter).first,VP,VY); PowerTot+=(*iter).second.getPower(Band)*poid; // compteur++; // if (poid!=0.) compteur2++; } } return PowerTot; } double PtSrcInBandCalTools::CalcLobeSize(double frequency) // I KNOW! Awfully heavy. But It's the cost of generality. // This function should be called only once! { double AngMax=pLobe->AngleMax(); // On cherche la resolution healpix correspondante double x= 0.5*M_PI/RAngComp; long nlat=1; while (x>1.) {x/=2.; nlat*=2;} // On reserve une sphere pour en connaitres les coordonnŽes SphereHEALPix dummSphere(nlat); double SolidAngPixel = dummSphere.PixSolAngle(); long Nbtranch = dummSphere.NbThetaSlices()*AngMax/M_PI; double thetaStep=M_PI/Nbtranch+1.; TVector VecValues; TVector VecIndice; r_8 dumTheta; r_8 dumPhi; double AngSolid=0.; UnitVector VZ(0.,0.,1.); for(double ThetaAnn=0.5*thetaStep;ThetaAnnweigthAmpl(VInteg,VZ,VY)*SolidAngPixel; } } cout<::iterator iterlow=pLightSrc->MapOfPtSrc.lower_bound(VecBidon); const UnitVector VecBidon2(ThetaMax,0.); multimap ::iterator iterhigh=pLightSrc->MapOfPtSrc.upper_bound(VecBidon2); multimap ::iterator iter; double Power=0.; double PhiSrc; bool test; // long compteur=0; // long compteur2=0; for(iter=iterlow; iter!=iterhigh; iter++) { PhiSrc=(*iter).first.Phi(); test=(PhiSrc>PhiMin) && (PhiSrcweigthAmpl((*iter).first,VP,VY); Power+=(*iter).second.getPower(Band)*poid; // compteur++; // if (poid!=0.) compteur2++; } } return Power; } */