4997Double_t
NcTimestamp::Almanac(Double_t* dpsi,Double_t* deps,Double_t* eps,Double_t* dl,TString name,Double_t* el,Double_t* eb,Double_t* dr,Double_t* value,Int_t j)
5108 Double_t pi=acos(-1.);
5113 const Int_t nvals=11;
5114 Double_t val[nvals];
5120 for (Int_t i=0; i<nvals; i++)
5132 if (j>=0 && j<nvals) *value=val[j];
5135 td=
GetJD()-2451545.0;
5147 Double_t epsilon=84381.406-46.836769*tc-0.0001831*pow(tc,2)+0.00200340*pow(tc,3)-0.000000576*pow(tc,4)-0.0000000434*pow(tc,5);
5148 Double_t l=485868.249036+1717915923.2178*tc+31.8792*pow(tc,2)+0.051635*pow(tc,3)-0.00024470*pow(tc,4);
5149 Double_t lp=1287104.79305+129596581.0481*tc-0.5532*pow(tc,2)+0.000136*pow(tc,3)-0.00001149*pow(tc,4);
5150 Double_t f=335779.526232+1739527262.8478*tc-12.7512*pow(tc,2)-0.001037*pow(tc,3)+0.00000417*pow(tc,4);
5151 Double_t d=1072260.70369+1602961601.2090*tc-6.3706*pow(tc,2)+0.006593*pow(tc,3)-0.00003169*pow(tc,4);
5152 Double_t om=450160.398036-6962890.5431*tc+7.4722*pow(tc,2)+0.007702*pow(tc,3)-0.00005939*pow(tc,4);
5156 Double_t prec=5029.0966*tc+1.11113*pow(tc,2)-0.000006*pow(tc,3);
5158 if (eps) *eps=epsilon;
5162 Double_t fac=pi/(180.*3600.);
5171 Double_t phi[28]={om,2.*(f-d+om),2.*(f+om),2.*om,lp,lp+2.*(f-d+om),l,
5172 2.*f+om,l+2.*(f+om),2.*(f-d+om)-lp,2.*(f-d)+om,2.*(f+om)-l,2.*d-l,l+om,
5173 om-l,2.*(f+d+om)-l,l+2.*f+om,2.*(f-l)+om,2.*d,2.*(f+d+om),2.*(f-d+om-lp),
5174 2.*(d-l),2.*(l+d+om),l+2.*(f-d+om),2.*f+om-l,2.*l,2.*f,lp+om};
5175 Double_t s[28]={-17.2064161,-1.3170907,-0.2276413, 0.2074554, 0.1475877,-0.0516821, 0.0711159,
5176 -0.0387298,-0.0301461, 0.0215829, 0.0128227, 0.0123457, 0.0156994, 0.0063110,
5177 -0.0057976,-0.0059641,-0.0051613, 0.0045893, 0.0063384,-0.0038571, 0.0032481,
5178 -0.0047722,-0.0031046, 0.0028593, 0.0020441, 0.0029243, 0.0025887,-0.0014053};
5179 Double_t sd[28]={-0.0174666,-0.0001675,-0.0000234, 0.0000207,-0.0003633, 0.0001226, 0.0000073,
5180 -0.0000367,-0.0000036,-0.0000494, 0.0000137, 0.0000011, 0.0000010, 0.0000063,
5181 -0.0000063,-0.0000011,-0.0000042, 0.0000050, 0.0000011,-0.0000001, 0.0000000,
5182 0.0000000,-0.0000001, 0.0000000, 0.0000021, 0.0000000, 0.0000000,-0.0000025};
5183 Double_t cp[28]={ 0.0033386,-0.0013696, 0.0002796,-0.0000698, 0.0011817,-0.0000524,-0.0000872,
5184 0.0000380, 0.0000816, 0.0000111, 0.0000181, 0.0000019,-0.0000168, 0.0000027,
5185 -0.0000189, 0.0000149, 0.0000129, 0.0000031,-0.0000150, 0.0000158, 0.0000000,
5186 -0.0000018, 0.0000131,-0.0000001, 0.0000010,-0.0000074,-0.0000066, 0.0000079};
5187 Double_t c[28]= { 9.2052331, 0.5730336, 0.0978459,-0.0897492, 0.0073871, 0.0224386,-0.0006750,
5188 0.0200728, 0.0129025,-0.0095929,-0.0068982,-0.0053311,-0.0001235,-0.0033228,
5189 0.0031429, 0.0025543, 0.0026366,-0.0024236,-0.0001220, 0.0016452,-0.0013870,
5190 0.0000477, 0.0013238,-0.0012338,-0.0010758,-0.0000609,-0.0000550, 0.0008551};
5191 Double_t cd[28]={ 0.0009086,-0.0003015,-0.0000485, 0.0000470,-0.0000184,-0.0000677, 0.0000000,
5192 0.0000018,-0.0000063, 0.0000299,-0.0000009, 0.0000032, 0.0000000, 0.0000000,
5193 0.0000000,-0.0000011, 0.0000000,-0.0000010, 0.0000000,-0.0000011, 0.0000000,
5194 0.0000000,-0.0000011, 0.0000010, 0.0000000, 0.0000000, 0.0000000,-0.0000002};
5195 Double_t sp[28]={ 0.0015377,-0.0004587, 0.0001374,-0.0000291,-0.0001924,-0.0000174, 0.0000358,
5196 0.0000318, 0.0000367, 0.0000132, 0.0000039,-0.0000004, 0.0000082,-0.0000009,
5197 -0.0000075, 0.0000066, 0.0000078, 0.0000020, 0.0000029, 0.0000068, 0.0000000,
5198 -0.0000025, 0.0000059,-0.0000003,-0.0000003, 0.0000013, 0.0000011,-0.0000045};
5200 Double_t dp=0,de=0,da=0;
5201 for (Int_t i=0; i<28; i++)
5203 dp+=(s[i]+sd[i]*tc)*sin(phi[i])+cp[i]*cos(phi[i]);
5204 de+=(c[i]+cd[i]*tc)*cos(phi[i])+sp[i]*sin(phi[i]);
5207 da=dp*cos(epsilon)+0.00264096*sin(om)+0.00006352*sin(2.*om)
5208 +0.00001175*sin(2.*f-2.*d+3.*om)+0.00001121*sin(2.*f-2.*d+om)
5209 -0.00000455*sin(2.*f-2.*d+2.*om)+0.00000202*sin(2.*f+3.*om)+0.00000198*sin(2.*f+om)
5210 -0.00000172*sin(3.*om)-0.00000087*tc*sin(om);
5223 Double_t xdpsi,xdeps,xeps,xlambda,xbeta;
5224 Almanac(&xdpsi,&xdeps,&xeps,0,
"Sun",&xlambda,&xbeta);
5235 while (xlambda<0) { xlambda+=360.; }
5236 while (xlambda>360) { xlambda-=360.; }
5239 Double_t epsr=xeps*pi/180.;
5240 Double_t lambdar=xlambda*pi/180.;
5241 Double_t betar=xbeta*pi/180.;
5244 Double_t x=sin(lambdar)*cos(epsr)-tan(betar)*sin(epsr);
5245 Double_t y=cos(lambdar);
5247 if (x || y) alpha=atan2(x,y)*180./pi;
5249 while (alpha<0) { alpha+=360.; }
5250 while (alpha>360) { alpha-=360.; }
5253 Double_t L0=280.4664567+360007.6982779*tm+0.03032028*pow(tm,2)+pow(tm,3)/49931.-pow(tm,4)/15300.-pow(tm,5)/2000000.;
5255 while (L0<0) { L0+=360.; }
5256 while (L0>360) { L0-=360.; }
5259 Double_t eot=L0-0.0057183-alpha+xdpsi*cos(xeps*pi/180.);
5262 while (eot<-5) { eot+=360.; }
5263 while (eot>5) { eot-=360.; }
5269 if (value) *value=eot;
5312 Double_t aa0[8]={0.387098310,0.723329820,1.000001018,1.523679342,5.202603209,9.554909192,19.218446062,30.110386869};
5313 Double_t aa1[8]={0,0,0,0,0.0000001913,-0.0000021390,-0.0000000372,-0.0000001663};
5314 Double_t aa2[8]={0,0,0,0,0,0.000000004,0.00000000098,0.00000000069};
5315 Double_t aa3[8]={0,0,0,0,0,0,0,0};
5317 Double_t ea0[8]={0.20563175,0.00677192,0.01670863,0.09340065,0.04849793,0.05554814,0.04638122,0.00945575};
5318 Double_t ea1[8]={0.000020407,-0.000047765,-0.000042037,0.000090484,0.000163225,-0.000346641,-0.000027293,0.000006033};
5319 Double_t ea2[8]={-0.0000000283,0.0000000981,-0.0000001267,-0.0000000806,-0.0000004714,-0.0000006436,0.0000000789,0};
5320 Double_t ea3[8]={-0.00000000018,0.00000000046,0.00000000014,-0.00000000025,-0.00000000201,0.00000000340,0.00000000024,-0.00000000005};
5322 Double_t ia0[8]={7.004986,3.394662,0,1.849726,1.303267,2.488879,0.773197,1.769953};
5323 Double_t ia1[8]={0.0018215,0.0010037,0,-0.0006011,-0.0054965,-0.0037362,0.0007744,-0.0093082};
5324 Double_t ia2[8]={-0.00001810,-0.00000088,0,0.00001276,0.00000466,-0.00001519,0.00003749,-0.00000708};
5325 Double_t ia3[8]={0.000000056,-0.000000007,0,-0.000000007,-0.000000002,0.000000087,-0.000000092,0.000000027};
5327 Double_t oa0[8]={48.330893,76.679920,0,49.558093,100.464407,113.665503,74.005957,131.784057};
5328 Double_t oa1[8]={1.1861883,0.9011206,0,0.7720959,1.0209774,0.8770880,0.5211278,1.1022039};
5329 Double_t oa2[8]={0.00017542,0.00040618,0,0.00001557,0.00040315,-0.00012176,0.00133947,0.00025952};
5330 Double_t oa3[8]={0.000000215,-0.000000093,0,0.000002267,0.000000404,-0.000002249,0.000018484,-0.000000637};
5332 Double_t pa0[8]={77.456119,131.563703,102.937348,336.060234,14.331207,93.057237,173.005291,48.120276};
5333 Double_t pa1[8]={1.5564776,1.4022288,1.7195366,1.8410449,1.6126352,1.9637613,1.4863790,1.4262957};
5334 Double_t pa2[8]={0.00029544,-0.00107618,0.00045688,0.00013477,0.00103042,0.00083753,0.00021406,0.00038434};
5335 Double_t pa3[8]={0.000000009,-0.000005678,-0.000000018,0.000000536,-0.000004464,0.000004928,0.000000434,0.000000020};
5337 Double_t la0[8]={252.250906,181.979801,100.466457,355.433000,34.351519,50.077444,314.055005,304.348665};
5338 Double_t la1[8]={149474.0722491,58519.2130302,36000.7698278,19141.6964471,3036.3027748,1223.5110686,429.8640561,219.8833092};
5339 Double_t la2[8]={0.00030350,0.00031014,0.00030322,0.00031052,0.00022330,0.00051908,0.00030390,0.00030882};
5340 Double_t la3[8]={0.000000018,0.000000015,0.000000020,0.000000016,0.000000037,-0.000000030,0.000000026,0.000000018};
5342 TString names[10]={
"Mercury",
"Venus",
"Earth",
"Mars",
"Jupiter",
"Saturn",
"Uranus",
"Neptune",
"Sun",
"Moon"};
5346 for (Int_t jbody=0; jbody<10; jbody++)
5348 if (name.Contains(
"*")) geo=0;
5349 if (name.Contains(names[jbody].Data()))
5358 if (!geo && k==8)
return da;
5360 if (geo && k==2)
return da;
5376 if (!geo && k==9) k=2;
5391 lambda=218.32+481267.881*tc
5392 +6.29*sin((135.+477198.87*tc)*pi/180.)-1.27*sin((259.3-413335.36*tc)*pi/180.)
5393 +0.66*sin((235.7+890534.22*tc)*pi/180.)+0.21*sin((269.9+954397.74*tc)*pi/180.)
5394 -0.19*sin((357.5+35999.05*tc)*pi/180.)-0.11*sin((186.5+966404.03*tc)*pi/180.);
5395 beta=5.13*sin((93.3+483202.02*tc)*pi/180.)+0.28*sin((228.2+960400.89*tc)*pi/180.)
5396 -0.28*sin((318.3+6003.15*tc)*pi/180.)-0.17*sin((217.6-407332.21*tc)*pi/180.);
5397 Double_t plax=0.9508
5398 +0.0518*cos((135.+477198.87*tc)*pi/180.)+0.0095*cos((259.3-413335.36*tc)*pi/180.)
5399 +0.0078*cos((235.7+890534.22*tc)*pi/180.)+0.0028*cos((269.9+954397.74*tc)*pi/180.);
5400 r=1./sin(plax*pi/180.);
5405 while (lambda<0) { lambda+=360.; }
5406 while (lambda>360) { lambda-=360.; }
5426 a=aa0[k]+aa1[k]*tc+aa2[k]*pow(tc,2)+aa3[k]*pow(tc,3);
5427 e=ea0[k]+ea1[k]*tc+ea2[k]*pow(tc,2)+ea3[k]*pow(tc,3);
5428 inc=ia0[k]+ia1[k]*tc+ia2[k]*pow(tc,2)+ia3[k]*pow(tc,3);
5429 omega=oa0[k]+oa1[k]*tc+oa2[k]*pow(tc,2)+oa3[k]*pow(tc,3);
5430 lp=pa0[k]+pa1[k]*tc+pa2[k]*pow(tc,2)+pa3[k]*pow(tc,3);
5431 l=la0[k]+la1[k]*tc+la2[k]*pow(tc,2)+la3[k]*pow(tc,3);
5433 while (omega<0) { omega+=360.; }
5434 while (omega>360) { omega-=360.; }
5438 while (m<0) { m+=360.; }
5439 while (m>360) { m-=360.; }
5441 ec=(2.*e-(pow(e,3)/4.)+(5.*pow(e,5)/96.))*sin(m*pi/180.)+((5.*pow(e,2)/4.)-(11.*pow(e,4)/24.))*sin(2.*m*pi/180.)
5442 +((13.*pow(e,3)/12.)-(43.*pow(e,5)/64.))*sin(3.*m*pi/180.)+(103.*pow(e,4)*sin(4.*m*pi/180.)/96.)
5443 +(1097.*pow(e,5)*sin(5.*m*pi/180.)/960.);
5448 while (omega2<0) { omega2+=360.; }
5449 while (omega2>360) { omega2-=360.; }
5451 while (lp<0) { lp+=360.; }
5452 while (lp>360) { lp-=360.; }
5454 while (l<0) { l+=360.; }
5455 while (l>360) { l-=360.; }
5459 while (nu<0) { nu+=360.; }
5460 while (nu>360) { nu-=360.; }
5481 if (j>=0 && j<nvals) *value=val[j];
5484 r=a*(1.-e*e)/(1.+e*cos(nu*pi/180.));
5487 Double_t sinb=sin(inc*pi/180.)*sin((l-omega+ec)*pi/180.);
5492 Double_t arg=l-omega+ec;
5493 while (arg<0) { arg+=360.; }
5494 while (arg>360) { arg-=360.; }
5498 Double_t cosl=cos(arg*pi/180.)/cos(btrue);
5499 extra=acos(cosl)*180./pi;
5500 if (arg>180) extra=-extra;
5513 while (ltrue<0) { ltrue+=360.; }
5514 while (ltrue>360) { ltrue-=360.; }
5520 if (!geo || sun)
return da;
5533 Almanac(0,0,0,0,
"Earth*",&l0,&b0,&r0);
5535 Double_t x=r*cos(btrue*pi/180.)*cos(ltrue*pi/180.)-r0*cos(b0*pi/180.)*cos(l0*pi/180.);
5536 Double_t y=r*cos(btrue*pi/180.)*sin(ltrue*pi/180.)-r0*cos(b0*pi/180.)*sin(l0*pi/180.);
5537 Double_t z=r*sin(btrue*pi/180.)-r0*sin(b0*pi/180.);
5539 lambda=atan2(y,x)*180./pi;
5540 beta=atan2(z,sqrt(x*x+y*y))*180./pi;
5541 r=sqrt(x*x+y*y+z*z);
5543 while (lambda<0) { lambda+=360.; }
5544 while (lambda>360) { lambda-=360.; }