1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 ///////////////////////////////////////////////////////////////////////////
20 // Virtual lab to correlate measurements with astrophysical phenomena.
22 // This class is derived from TTask, but the only reason for this
23 // is to enable this class to serve as a base class for other TTask
24 // derived classes (e.g. AliEventSelector) without the need for
25 // multiple virtual inheritance.
26 // So, this AliAstrolab class itself does not provide any TTask
27 // related functionality.
29 // The lab can be given a terrestrial location via the usual longitude
30 // and latitude specifications.
31 // Since this class is derived from AliTimestamp, a lab can also be
32 // given a specific timestamp. Together with the terrestrial location
33 // this provides access to local (sidereal) times etc...
34 // In addition to the usual astronomical reference frames, a local
35 // lab reference frame can also be specified. Together with the lab's
36 // timestamp this uniquely defines all the coordinate transformations
37 // between the various reference frames.
38 // These lab characteristics allow a space-time correlation of lab
39 // observations with external (astrophysical) phenomena.
41 // Observations are entered as generic signals containing a position,
42 // reference frame specification and a timestamp.
43 // These observations can then be analysed in various reference frames
44 // via the available GET functions.
46 // Various external (astrophysical) phenomena may be entered as
47 // so-called reference signals.
48 // This class provides facilities (e.g. MatchRefSignal) to check
49 // correlations of the stored measurement with these reference signals.
53 // gSystem->Load("ralice");
55 // AliAstrolab lab("IceCube","The South Pole Neutrino Observatory");
56 // lab.SetLabPosition(0,-90,"deg"); // South Pole
58 // lab.SetLocalFrame(90,180,90,270,0,0); // Local frame has X-axis to the North
60 // lab.Data(1,"dms"); // Print laboratory parameters
62 // // Enter some observed event to be investigated
64 // ts.SetUT(1989,7,30,8,14,23,738504,0);
65 // Float_t vec[3]={1,23.8,118.65};
67 // r.SetVector(vec,"sph","deg");
68 // lab.SetSignal(&r,"loc","M",&ts,0,"Event10372");
70 // // Enter some reference signals
71 // Float_t alpha=194818.0;
72 // Float_t delta=84400.;
73 // lab.SetSignal(alpha,delta,"B",1950,"M",-1,"Altair");
76 // lab.SetSignal(alpha,delta,"B",1950,"M",-1,"NGP");
79 // lab.SetSignal(alpha,delta,"J",2000,"M",-1,"Sirius");
82 // lab.SetSignal(alpha,delta,"J",2000,"M",-1,"Polaris");
85 // lab.SetSignal(alpha,delta,"J",2000,"M",-1,"Aldebaran");
87 // Float_t b=-35.8903;
88 // Float_t pos[3]={1,90.-b,l};
89 // r.SetVector(pos,"sph","deg");
90 // lab.SetUT(1989,7,30,8,14,16,0,0);
91 // lab.SetSignal(&r,"gal","M",0,-1,"GRB890730");
93 // // List all stored objects
94 // lab.ListSignals("equ","M",5);
96 // // Determine minimal space and time differences with reference signals
99 // da=lab.GetDifference(0,"deg",dt,"s",1,&ia,&it);
100 // cout << " Minimal differences damin (deg) : " << da << " dtmin (s) : " << dt
101 // << " damin-index : " << ia << " dtmin-index : " << it << endl;
102 // cout << " damin for "; lab->PrintSignal("equ","T",&ts,5,ia); cout << endl;
103 // cout << " dtmin for "; lab->PrintSignal("equ","T",&ts,5,it); cout << endl;
105 // // Search for space and time match with the reference signals
108 // TArrayI* arr=lab.MatchRefSignal(da,"deg",dt,"s");
112 // for (Int_t i=0; i<arr->GetSize(); i++)
115 // cout << " Match found for index : " << index << endl;
116 // cout << " Corresponding ref. object "; lab->PrintSignal("equ","T",&ts,5,index); cout << endl;
121 //--- Author: Nick van Eijndhoven 15-mar-2007 Utrecht University
122 //- Modified: NvE $Date$ Utrecht University
123 ///////////////////////////////////////////////////////////////////////////
125 #include "AliAstrolab.h"
126 #include "Riostream.h"
128 ClassImp(AliAstrolab) // Class implementation to enable ROOT I/O
130 AliAstrolab::AliAstrolab(const char* name,const char* title) : TTask(name,title),AliTimestamp()
132 // Default constructor
141 ///////////////////////////////////////////////////////////////////////////
142 AliAstrolab::~AliAstrolab()
144 // Destructor to delete all allocated memory.
162 ///////////////////////////////////////////////////////////////////////////
163 AliAstrolab::AliAstrolab(const AliAstrolab& t) : TTask(t),AliTimestamp(t)
170 if (t.fXsig) fXsig=new AliSignal(*(t.fXsig));
174 Int_t size=t.fRefs->GetSize();
175 fRefs=new TObjArray(size);
176 for (Int_t i=0; i<size; i++)
178 AliSignal* sx=(AliSignal*)t.fRefs->At(i);
179 if (sx) fRefs->AddAt(sx->Clone(),i);
186 ///////////////////////////////////////////////////////////////////////////
187 void AliAstrolab::Data(Int_t mode,TString u)
189 // Provide lab information.
191 // "mode" indicates the mode of the timestamp info (see AliTimestamp::Date).
193 // The string argument "u" allows to choose between different angular units
194 // in case e.g. a spherical frame is selected.
195 // u = "rad" : angles provided in radians
196 // "deg" : angles provided in degrees
197 // "dms" : angles provided in ddd:mm:ss.sss
198 // "hms" : angles provided in hh:mm:ss.sss
200 // The defaults are mode=1 and u="deg".
202 const char* name=GetName();
203 const char* title=GetTitle();
204 cout << " *" << ClassName() << "::Data*";
205 if (strlen(name)) cout << " Name : " << GetName();
206 if (strlen(title)) cout << " Title : " << GetTitle();
210 GetLabPosition(l,b,"deg");
211 cout << " Lab position longitude : "; PrintAngle(l,"deg",u,2);
212 cout << " latitude : "; PrintAngle(b,"deg",u,2);
214 cout << " Lab time offset w.r.t. UT : "; PrintTime(fToffset,12); cout << endl;
216 // UT and Local time info
219 ///////////////////////////////////////////////////////////////////////////
220 void AliAstrolab::SetLabPosition(Ali3Vector& p)
222 // Set the lab position in the terrestrial coordinates.
223 // The right handed reference frame is defined such that the North Pole
224 // corresponds to a polar angle theta=0 and the Greenwich meridian corresponds
225 // to an azimuth angle phi=0, with phi increasing eastwards.
227 fLabPos.SetPosition(p);
229 // Determine local time offset in fractional hours w.r.t. UT.
231 p.GetVector(vec,"sph","deg");
235 ///////////////////////////////////////////////////////////////////////////
236 void AliAstrolab::SetLabPosition(Double_t l,Double_t b,TString u)
238 // Set the lab position in the terrestrial longitude (l) and latitude (b).
239 // Positions north of the equator have b>0, whereas b<0 indicates
240 // locations south of the equator.
241 // Positions east of Greenwich have l>0, whereas l<0 indicates
242 // locations west of Greenwich.
244 // The string argument "u" allows to choose between different angular units
245 // u = "rad" : angles provided in radians
246 // "deg" : angles provided in degrees
247 // "dms" : angles provided in dddmmss.sss
248 // "hms" : angles provided in hhmmss.sss
250 // The default is u="deg".
252 Double_t r=1,theta=0,phi=0;
254 l=ConvertAngle(l,u,"deg");
255 b=ConvertAngle(b,u,"deg");
262 Double_t p[3]={r,theta,phi};
263 fLabPos.SetPosition(p,"sph","deg");
265 // Local time offset in fractional hours w.r.t. UT.
268 ///////////////////////////////////////////////////////////////////////////
269 AliPosition AliAstrolab::GetLabPosition() const
271 // Provide the lab position in the terrestrial coordinates.
272 // The right handed reference frame is defined such that the North Pole
273 // corresponds to a polar angle theta=0 and the Greenwich meridian corresponds
274 // to an azimuth angle phi=0, with phi increasing eastwards.
278 ///////////////////////////////////////////////////////////////////////////
279 void AliAstrolab::GetLabPosition(Double_t& l,Double_t& b,TString u) const
281 // Provide the lab position in the terrestrial longitude (l) and latitude (b).
282 // Positions north of the equator have b>0, whereas b<0 indicates
283 // locations south of the equator.
284 // Positions east of Greenwich have l>0, whereas l<0 indicates
285 // locations west of Greenwich.
287 // The string argument "u" allows to choose between different angular units
288 // u = "rad" : angles provided in radians
289 // "deg" : angles provided in degrees
291 // The default is u="deg".
293 Double_t pi=acos(-1.);
296 if (u=="rad") offset=pi/2.;
299 fLabPos.GetPosition(p,"sph",u);
303 ///////////////////////////////////////////////////////////////////////////
304 Double_t AliAstrolab::GetLT()
306 // Provide the Lab's local time in fractional hours.
307 // A mean solar day lasts 24h (i.e. 86400s).
309 // In case a hh:mm:ss format is needed, please use the Convert() facility.
311 Double_t h=GetLT(fToffset);
314 ///////////////////////////////////////////////////////////////////////////
315 Double_t AliAstrolab::GetLMST()
317 // Provide the Lab's Local Mean Sidereal Time (LMST) in fractional hours.
318 // A sidereal day corresponds to 23h 56m 04.09s (i.e. 86164.09s) mean solar time.
319 // The definition of GMST is such that a sidereal clock corresponds with
320 // 24 sidereal hours per revolution of the Earth.
321 // As such, local time offsets w.r.t. UT and GMST can be treated similarly.
323 // In case a hh:mm:ss format is needed, please use the Convert() facility.
325 Double_t h=GetLMST(fToffset);
328 ///////////////////////////////////////////////////////////////////////////
329 Double_t AliAstrolab::GetLAST()
331 // Provide the Lab's Local Apparent Sidereal Time (LAST) in fractional hours.
332 // A sidereal day corresponds to 23h 56m 04.09s (i.e. 86164.09s) mean solar time.
333 // The definition of GMST and GAST is such that a sidereal clock corresponds with
334 // 24 sidereal hours per revolution of the Earth.
335 // As such, local time offsets w.r.t. UT, GMST and GAST can be treated similarly.
337 // In case a hh:mm:ss format is needed, please use the Convert() facility.
339 Double_t h=GetLAST(fToffset);
342 ///////////////////////////////////////////////////////////////////////////
343 void AliAstrolab::PrintAngle(Double_t a,TString in,TString out,Int_t ndig) const
345 // Printing of angles in various formats.
347 // The input argument "a" denotes the angle to be printed.
348 // The string arguments "in" and "out" specify the angular I/O formats.
350 // in = "rad" : input angle provided in radians
351 // "deg" : input angle provided in degrees
352 // "dms" : input angle provided in dddmmss.sss
353 // "hms" : input angle provided in hhmmss.sss
355 // out = "rad" : output angle provided in radians
356 // "deg" : output angle provided in degrees
357 // "dms" : output angle provided in dddmmss.sss
358 // "hms" : output angle provided in hhmmss.sss
360 // The argument "ndig" specifies the number of digits for the fractional
361 // part (e.g. ndig=6 for "dms" corresponds to micro-arcsecond precision).
362 // No rounding will be performed, so an arcsecond count of 3.473 with ndig=1
363 // will appear as 03.4 on the output.
364 // Due to computer accuracy, precision on the pico-arcsecond level may get lost.
366 // The default is ndig=1.
368 // Note : The angle info is printed without additional spaces or "endline".
369 // This allows the print to be included in various composite output formats.
371 Double_t b=ConvertAngle(a,in,out);
373 if (out=="deg" || out=="rad")
375 cout.setf(ios::fixed,ios::floatfield);
376 cout << setprecision(ndig) << b << " " << out.Data();
377 cout.unsetf(ios::fixed);
381 Double_t epsilon=1.e-12; // Accuracy in (arc)seconds
382 Int_t word=0,ddd=0,hh=0,mm=0,ss=0;
394 s=fabs(b)-Double_t(ddd*10000+mm*100+ss);
416 if (b<0) cout << "-";
417 cout << ddd << "d " << mm << "' " << ss << "."
418 << setfill('0') << setw(ndig) << sfrac << "\"";
430 s=fabs(b)-Double_t(hh*10000+mm*100+ss);
452 if (b<0) cout << "-";
453 cout << hh << "h " << mm << "m " << ss << "."
454 << setfill('0') << setw(ndig) << sfrac << "s";
458 ///////////////////////////////////////////////////////////////////////////
459 void AliAstrolab::SetSignal(Ali3Vector* r,TString frame,TString mode,AliTimestamp* ts,Int_t jref,TString name)
461 // Store a signal as specified by the position r and the timestamp ts.
462 // The position is stored in International Celestial Reference System (ICRS) coordinates.
463 // The ICRS is a fixed, time independent frame and as such provides a unique reference
464 // frame without the need of specifying any epoch etc...
465 // The ICRS coordinate definitions match within 20 mas with the mean ones of the J2000.0
466 // equatorial system. Nevertheless, to obtain the highest accuracy, the slight
467 // coordinate correction between J2000 and ICRS is performed here via the
468 // so-called frame bias matrix.
469 // For further details see the U.S. Naval Observatory (USNO) circular 179 (2005),
470 // which is available on http://aa.usno,navy.mil/publications/docs/Circular_179.pdf.
472 // The input parameter "frame" allows the user to specify the frame to which
473 // the components of r refer. Available options are :
475 // frame = "equ" ==> Equatorial coordinates with right ascension (a) and declination (d),
476 // where the "sph" components of r correspond to theta=(pi/2)-d and phi=a.
477 // "gal" ==> Galactic coordinates with longitude (l) and lattitude (b).
478 // where the "sph" components of r correspond to theta=(pi/2)-b and phi=l.
479 // "ecl" ==> Ecliptic coordinates with longitude (l) and lattitude (b),
480 // where the "sph" components of r correspond to theta=(pi/2)-b and phi=l.
481 // "hor" ==> Horizontal coordinates at the AliAstrolab location, where the "sph"
482 // components of r correspond to theta=zenith angle and phi=pi-azimuth.
483 // "icr" ==> ICRS coordinates with longitude (l) and lattitude (b),
484 // where the "sph" components of r correspond to theta=(pi/2)-b and phi=l.
485 // "loc" ==> Local coordinates at the AliAstrolab location, where the "sph"
486 // components of r correspond to the usual theta and phi angles.
488 // In case the coordinates are the equatorial right ascension and declination (a,d),
489 // they can represent so-called "mean" and "true" values.
490 // The distinction between these two representations is the following :
492 // mean values : (a,d) are only corrected for precession and not for nutation
493 // true values : (a,d) are corrected for both precession and nutation
495 // The input parameter "mode" allows the user to specifiy either "mean" or "true"
496 // values for the input in case of equatorial (a,d) coordinates.
498 // mode = "M" --> Input coordinates are the mean values
499 // "T" --> Input coordinates are the true values
501 // The input parameter "jref" allows the user to store so-called "reference" signals.
502 // These reference signals may be used to check space-time event coincidences with the
503 // stored measurement (e.g. coincidence of the measurement with transient phenomena).
505 // jref = 0 --> Storage of the measurement
506 // j --> Storage of a reference signal at the j-th position (j=1 is first)
507 // < 0 --> Add a reference signal at the next available position
509 // Via the input argument "name" the user can give the stored signal also a name.
511 // The default values are jref=0 and name="".
513 // Note : In case ts=0 the current timestamp of the lab will be taken.
525 if (frame!="equ" && frame!="gal" && frame!="ecl" && frame!="hor" && frame!="icr" && frame!="loc")
535 if (frame=="equ" && mode!="M" && mode!="m" && mode!="T" && mode!="t")
545 if (!ts) ts=(AliTimestamp*)this;
547 Double_t vec[3]={1,0,0};
548 vec[1]=r->GetX(2,"sph","rad");
549 vec[2]=r->GetX(3,"sph","rad");
551 q.SetVector(vec,"sph","rad");
555 if (!jref) // Storage of the measurement
559 fXsig=new AliSignal();
565 if (name != "") fXsig->SetName(name);
566 fXsig->SetTitle("Event in ICRS coordinates");
567 fXsig->SetTimestamp(*ts);
569 else // Storage of a reference signal
573 fRefs=new TObjArray();
576 // Expand array size if needed
577 if (jref>0 && jref>=fRefs->GetSize()) fRefs->Expand(jref+1);
578 sxref=new AliSignal();
579 if (name != "") sxref->SetName(name);
580 sxref->SetTitle("Reference event in ICRS coordinates");
581 sxref->SetTimestamp(*ts);
586 // Convert to horizontal coordinates
587 q=q.GetUnprimed(&fL);
590 SetSignal(&q,"hor",mode,ts,jref);
596 // Convert to "mean" values at specified epoch
597 if (mode=="T" || mode=="t")
600 q=q.GetUnprimed(&fN);
603 // Convert to "mean" values at J2000
605 q=q.GetUnprimed(&fP);
607 // Convert to ICRS values
608 if (!fBias) SetBmatrix();
609 q=q.GetUnprimed(&fB);
614 // Convert to J2000 equatorial mean coordinates
615 if (fGal != 2) SetGmatrix("J");
616 q=q.GetUnprimed(&fG);
618 // Convert to ICRS values
619 if (!fBias) SetBmatrix();
620 q=q.GetUnprimed(&fB);
625 // Convert to mean equatorial values at specified epoch
627 q=q.GetUnprimed(&fE);
629 // Convert to "mean" values at J2000
631 q=q.GetUnprimed(&fP);
633 // Convert to ICRS values
634 if (!fBias) SetBmatrix();
635 q=q.GetUnprimed(&fB);
640 // Convert to "true" equatorial values at the specified timestamp
642 q=q.GetUnprimed(&fH);
644 // Convert to "mean" values at specified timestamp
646 q=q.GetUnprimed(&fN);
648 // Convert to "mean" values at J2000
650 q=q.GetUnprimed(&fP);
652 // Convert to ICRS values
653 if (!fBias) SetBmatrix();
654 q=q.GetUnprimed(&fB);
657 // Store the signal in ICRS coordinates
658 if (!jref) // Storage of a regular signal
660 fXsig->SetPosition(q);
662 else // Storage of a reference signal
664 sxref->SetPosition(q);
671 fRefs->AddAt(sxref,jref-1);
675 ///////////////////////////////////////////////////////////////////////////
676 void AliAstrolab::SetSignal(Double_t a,Double_t d,TString s,Double_t e,TString mode,Int_t jref,TString name)
678 // Store a signal with right ascension (a) and declination (d) given for epoch e.
679 // The position is stored in International Celestial Reference System (ICRS) coordinates.
680 // The ICRS is a fixed, time independent frame and as such provides a unique reference
681 // frame without the need of specifying any epoch etc...
682 // The ICRS coordinate definitions match within 20 mas the mean ones of the J2000.0
683 // equatorial system. Nevertheless, to obtain the highest accuracy, the slight
684 // coordinate correction between J2000 and ICRS is performed here via the
685 // so-called frame bias matrix.
686 // For further details see the U.S. Naval Observatory (USNO) circular 179 (2005),
687 // which is available on http://aa.usno,navy.mil/publications/docs/Circular_179.pdf.
689 // The coordinates (a,d) can represent so-called "mean" and "true" values.
690 // The distinction between these two representations is the following :
692 // mean values : (a,d) are only corrected for precession and not for nutation
693 // true values : (a,d) are corrected for both precession and nutation
695 // The input parameter "mode" allows the user to specifiy either "mean" or "true"
696 // values for the input (a,d) coordinates.
698 // a : Right ascension in hhmmss.sss
699 // d : Declination in dddmmss.sss
700 // s = "B" --> Besselian reference epoch.
701 // "J" --> Julian reference epoch.
702 // e : Reference epoch for the input coordinates (e.g. 1900, 1950, 2000,...)
703 // mode = "M" --> Input coordinates are the mean values
704 // "T" --> Input coordinates are the true values
706 // The input parameter "jref" allows the user to store so-called "reference" signals.
707 // These reference signals may be used to check space-time event coincidences with the
708 // stored measurement (e.g. coincidence of the measurement with transient phenomena).
710 // jref = 0 --> Storage of the measurement
711 // j --> Storage of a reference signal at the j-th position (j=1 is first)
712 // < 0 --> Add a reference signal at the next available position
714 // Via the input argument "name" the user can give the stored signal also a name.
716 // The default values are jref=0 and name="".
718 if (s!="B" && s!="b" && s!="J" && s!="j")
728 if (mode!="M" && mode!="m" && mode!="T" && mode!="t")
738 // Convert coordinates to fractional degrees.
739 a=ConvertAngle(a,"hms","deg");
740 d=ConvertAngle(d,"dms","deg");
747 Double_t vec[3]={1.,90.-d,a};
748 r.SetVector(vec,"sph","deg");
750 SetSignal(&r,"equ",mode,&tx,jref,name);
752 ///////////////////////////////////////////////////////////////////////////
753 void AliAstrolab::SetSignal(Double_t a,Double_t d,TString mode,AliTimestamp* ts,Int_t jref,TString name)
755 // Store a signal with right ascension (a) and declination (d) given for timestamp ts.
756 // The position is stored in International Celestial Reference System (ICRS) coordinates.
757 // The ICRS is a fixed, time independent frame and as such provides a unique reference
758 // frame without the need of specifying any epoch etc...
759 // The ICRS coordinate definitions match within 20 mas the mean ones of the J2000.0
760 // equatorial system. Nevertheless, to obtain the highest accuracy, the slight
761 // coordinate correction between J2000 and ICRS is performed here via the
762 // so-called frame bias matrix.
763 // For further details see the U.S. Naval Observatory (USNO) circular 179 (2005),
764 // which is available on http://aa.usno,navy.mil/publications/docs/Circular_179.pdf.
766 // The coordinates (a,d) can represent so-called "mean" and "true" values.
767 // The distinction between these two representations is the following :
769 // mean values : (a,d) are only corrected for precession and not for nutation
770 // true values : (a,d) are corrected for both precession and nutation
772 // The input parameter "mode" allows the user to specifiy either "mean" or "true"
773 // values for the input (a,d) coordinates.
775 // a : Right ascension in hhmmss.sss
776 // d : Declination in dddmmss.sss
777 // mode = "M" --> Input coordinates are the mean values
778 // "T" --> Input coordinates are the true values
780 // The input parameter "jref" allows the user to store so-called "reference" signals.
781 // These reference signals may be used to check space-time event coincidences with the
782 // stored measurement (e.g. coincidence of the measurement with transient phenomena).
784 // jref = 0 --> Storage of the measurement
785 // j --> Storage of a reference signal at the j-th position (j=1 is first)
786 // < 0 --> Add a reference signal at the next available position
788 // Via the input argument "name" the user can give the stored signal also a name.
790 // The default values are jref=0 and name="".
792 // Note : In case ts=0 the current timestamp of the lab will be taken.
794 // Convert coordinates to fractional degrees.
795 a=ConvertAngle(a,"hms","deg");
796 d=ConvertAngle(d,"dms","deg");
799 Double_t vec[3]={1.,90.-d,a};
800 r.SetVector(vec,"sph","deg");
802 SetSignal(&r,"equ",mode,ts,jref,name);
804 ///////////////////////////////////////////////////////////////////////////
805 AliSignal* AliAstrolab::GetSignal(Ali3Vector& r,TString frame,TString mode,AliTimestamp* ts,Int_t jref)
807 // Provide the user specified coordinates of a signal at the specific timestamp ts.
808 // The coordinates are returned via the vector argument "r".
809 // In addition also a pointer to the stored signal object is provided.
810 // In case no stored signal was available or one of the input arguments was
811 // invalid, the returned pointer will be 0.
813 // The input parameter "frame" allows the user to specify the frame to which
814 // the components of r refer. Available options are :
816 // frame = "equ" ==> Equatorial coordinates with right ascension (a) and declination (d),
817 // where the "sph" components of r correspond to theta=(pi/2)-d and phi=a.
818 // "gal" ==> Galactic coordinates with longitude (l) and lattitude (b).
819 // where the "sph" components of r correspond to theta=(pi/2)-b and phi=l.
820 // "ecl" ==> Ecliptic coordinates with longitude (l) and lattitude (b),
821 // where the "sph" components of r correspond to theta=(pi/2)-b and phi=l.
822 // "hor" ==> Horizontal coordinates at the AliAstrolab location, where the "sph"
823 // components of r correspond to theta=zenith angle and phi=pi-azimuth.
824 // "icr" ==> ICRS coordinates with longitude (l) and lattitude (b),
825 // where the "sph" components of r correspond to theta=(pi/2)-b and phi=l.
826 // "loc" ==> Local coordinates at the AliAstrolab location, where the "sph"
827 // components of r correspond to the usual theta and phi angles.
829 // In case the coordinates are the equatorial right ascension and declination (a,d),
830 // they can represent so-called "mean" and "true" values.
831 // The distinction between these two representations is the following :
833 // mean values : (a,d) are only corrected for precession and not for nutation
834 // true values : (a,d) are corrected for both precession and nutation
836 // The input parameter "mode" allows the user to specifiy either "mean" or "true"
837 // values for the input in case of equatorial (a,d) coordinates.
839 // mode = "M" --> Input coordinates are the mean values
840 // "T" --> Input coordinates are the true values
842 // The input parameter "jref" allows the user to access so-called "reference" signals.
843 // These reference signals may be used to check space-time event coincidences with the
844 // stored measurement (e.g. coincidence of the measurement with transient phenomena).
846 // jref = 0 --> Access to the measurement
847 // j --> Access to the reference signal at the j-th position (j=1 is first)
849 // Default value is jref=0.
851 // Note : In case ts=0 the current timestamp of the lab will be taken.
855 if (frame!="equ" && frame!="gal" && frame!="ecl" && frame!="hor" && frame!="icr" && frame!="loc") return 0;
857 if (frame=="equ" && mode!="M" && mode!="m" && mode!="T" && mode!="t") return 0;
859 AliSignal* sx=GetSignal(jref);
863 if (!ts) ts=(AliTimestamp*)this;
866 sx->GetPosition(vec,"sph","rad");
868 q.SetVector(vec,"sph","rad");
876 // Convert from ICRS to equatorial J2000 coordinates
877 if (!fBias) SetBmatrix();
882 // Precess to specified timestamp
884 ts1.SetEpoch(2000,"J");
887 // Nutation correction if requested
888 if (mode=="T" || mode=="t") Nutate(q,ts);
893 // Convert from equatorial J2000 to galactic
894 if (fGal != 2) SetGmatrix("J");
900 // Precess to specified timestamp
902 ts1.SetEpoch(2000,"J");
905 // Convert from equatorial to ecliptic coordinates
912 // Precess to specified timestamp
914 ts1.SetEpoch(2000,"J");
917 // Nutation correction
920 // Convert from equatorial to horizontal coordinates
927 // Get the signal in horizontal coordinates
928 GetSignal(q,"hor",mode,ts);
930 // Convert from horizontal local-frame coordinates
937 ///////////////////////////////////////////////////////////////////////////
938 AliSignal* AliAstrolab::GetSignal(Ali3Vector& r,TString frame,TString mode,AliTimestamp* ts,TString name)
940 // Provide the user specified coordinates of the signal with the specified
941 // name at the specific timestamp ts.
942 // The coordinates are returned via the vector argument "r".
943 // In addition also a pointer to the stored signal object is provided.
944 // In case no such stored signal was available or one of the input arguments was
945 // invalid, the returned pointer will be 0.
947 // The input parameter "frame" allows the user to specify the frame to which
948 // the components of r refer. Available options are :
950 // frame = "equ" ==> Equatorial coordinates with right ascension (a) and declination (d),
951 // where the "sph" components of r correspond to theta=(pi/2)-d and phi=a.
952 // "gal" ==> Galactic coordinates with longitude (l) and lattitude (b).
953 // where the "sph" components of r correspond to theta=(pi/2)-b and phi=l.
954 // "ecl" ==> Ecliptic coordinates with longitude (l) and lattitude (b),
955 // where the "sph" components of r correspond to theta=(pi/2)-b and phi=l.
956 // "hor" ==> Horizontal coordinates at the AliAstrolab location, where the "sph"
957 // components of r correspond to theta=zenith angle and phi=pi-azimuth.
958 // "icr" ==> ICRS coordinates with longitude (l) and lattitude (b),
959 // where the "sph" components of r correspond to theta=(pi/2)-b and phi=l.
960 // "loc" ==> Local coordinates at the AliAstrolab location, where the "sph"
961 // components of r correspond to the usual theta and phi angles.
963 // In case the coordinates are the equatorial right ascension and declination (a,d),
964 // they can represent so-called "mean" and "true" values.
965 // The distinction between these two representations is the following :
967 // mean values : (a,d) are only corrected for precession and not for nutation
968 // true values : (a,d) are corrected for both precession and nutation
970 // The input parameter "mode" allows the user to specifiy either "mean" or "true"
971 // values for the input in case of equatorial (a,d) coordinates.
973 // mode = "M" --> Input coordinates are the mean values
974 // "T" --> Input coordinates are the true values
976 // Note : In case ts=0 the current timestamp of the lab will be taken.
979 Int_t j=GetSignalIndex(name);
980 if (j>=0) sx=GetSignal(r,frame,mode,ts,j);
983 ///////////////////////////////////////////////////////////////////////////
984 AliSignal* AliAstrolab::GetSignal(Double_t& a,Double_t& d,TString mode,AliTimestamp* ts,Int_t jref)
986 // Provide precession (and nutation) corrected right ascension (a) and
987 // declination (d) of the stored signal object at the specified timestamp.
988 // In addition also a pointer to the stored signal object is provided.
989 // In case no stored signal was available or one of the input arguments was
990 // invalid, the returned pointer will be 0.
992 // The coordinates (a,d) can represent so-called "mean" and "true" values.
993 // The distinction between these two representations is the following :
995 // mean values : (a,d) are only corrected for precession and not for nutation
996 // true values : (a,d) are corrected for both precession and nutation
998 // The input parameter "mode" allows the user to select either
999 // "mean" or "true" values for (a,d).
1001 // The correction methods used are the new IAU 2000 ones as described in the
1002 // U.S. Naval Observatory (USNO) circular 179 (2005), which is available on
1003 // http://aa.usno,navy.mil/publications/docs/Circular_179.pdf.
1005 // a : Right ascension in hhmmss.sss
1006 // d : Declination in dddmmss.sss
1007 // mode = "M" --> Output coordinates are the mean values
1008 // "T" --> Output coordinates are the true values
1009 // ts : Timestamp at which the corrected coordinate values are requested.
1011 // The input parameter "jref" allows the user to access so-called "reference" signals.
1012 // These reference signals may be used to check space-time event coincidences with the
1013 // stored regular signal (e.g. coincidence of the stored signal with transient phenomena).
1015 // jref = 0 --> Access to the measurement
1016 // j --> Access to the reference signal at the j-th position (j=1 is first)
1018 // Default value is jref=0.
1020 // Note : In case ts=0 the current timestamp of the lab will be taken.
1026 AliSignal* sx=GetSignal(r,"equ",mode,ts,jref);
1030 // Retrieve the requested (a,d) values
1032 r.GetVector(vec,"sph","deg");
1053 // Convert coordinates to appropriate format
1054 a=ConvertAngle(a,"deg","hms");
1055 d=ConvertAngle(d,"deg","dms");
1059 ///////////////////////////////////////////////////////////////////////////
1060 AliSignal* AliAstrolab::GetSignal(Double_t& a,Double_t& d,TString mode,AliTimestamp* ts,TString name)
1062 // Provide precession (and nutation) corrected right ascension (a) and
1063 // declination (d) of the stored signal object with the specified name
1064 // at the specific timestamp ts.
1065 // In addition also a pointer to the stored signal object is provided.
1066 // In case no stored signal was available or one of the input arguments was
1067 // invalid, the returned pointer will be 0.
1069 // The coordinates (a,d) can represent so-called "mean" and "true" values.
1070 // The distinction between these two representations is the following :
1072 // mean values : (a,d) are only corrected for precession and not for nutation
1073 // true values : (a,d) are corrected for both precession and nutation
1075 // The input parameter "mode" allows the user to select either
1076 // "mean" or "true" values for (a,d).
1078 // The correction methods used are the new IAU 2000 ones as described in the
1079 // U.S. Naval Observatory (USNO) circular 179 (2005), which is available on
1080 // http://aa.usno,navy.mil/publications/docs/Circular_179.pdf.
1082 // a : Right ascension in hhmmss.sss
1083 // d : Declination in dddmmss.sss
1084 // mode = "M" --> Output coordinates are the mean values
1085 // "T" --> Output coordinates are the true values
1086 // ts : Timestamp at which the corrected coordinate values are requested.
1087 // name : Name of the requested signal object
1089 // Note : In case ts=0 the current timestamp of the lab will be taken.
1092 Int_t j=GetSignalIndex(name);
1093 if (j>=0) sx=GetSignal(a,d,mode,ts,j);
1096 ///////////////////////////////////////////////////////////////////////////
1097 AliSignal* AliAstrolab::GetSignal(Double_t& a,Double_t& d,TString s,Double_t e,TString mode,Int_t jref)
1099 // Provide precession (and nutation) corrected right ascension (a) and
1100 // declination (d) of the stored signal object at the specified epoch e.
1101 // In addition also a pointer to the stored signal object is provided.
1102 // In case no stored signal was available or one of the input arguments was
1103 // invalid, the returned pointer will be 0.
1105 // The coordinates (a,d) can represent so-called "mean" and "true" values.
1106 // The distinction between these two representations is the following :
1108 // mean values : (a,d) are only corrected for precession and not for nutation
1109 // true values : (a,d) are corrected for both precession and nutation
1111 // The input parameter "mode" allows the user to specifiy either "mean" or "true"
1112 // values for the input (a,d) coordinates.
1114 // a : Right ascension in hhmmss.sss
1115 // d : Declination in dddmmss.sss
1116 // s = "B" --> Besselian reference epoch.
1117 // "J" --> Julian reference epoch.
1118 // e : Reference epoch for the input coordinates (e.g. 1900, 1950, 2000,...)
1119 // mode = "M" --> Input coordinates are the mean values
1120 // "T" --> Input coordinates are the true values
1122 // The input parameter "jref" allows the user to access so-called "reference" signals.
1123 // These reference signals may be used to check space-time event coincidences with the
1124 // stored measurement (e.g. coincidence of the measurement with transient phenomena).
1126 // jref = 0 --> Access to the measurement
1127 // j --> Access to the reference signal at the j-th position (j=1 is first)
1129 // Default value is jref=0.
1134 if (s!="B" && s!="b" && s!="J" && s!="j") return 0;
1136 if (mode!="M" && mode!="m" && mode!="T" && mode!="t") return 0;
1138 // Convert coordinates to fractional degrees.
1139 a=ConvertAngle(a,"hms","deg");
1140 d=ConvertAngle(d,"dms","deg");
1146 AliSignal* sx=GetSignal(a,d,mode,&tx,jref);
1149 ///////////////////////////////////////////////////////////////////////////
1150 AliSignal* AliAstrolab::GetSignal(Double_t& a,Double_t& d,TString s,Double_t e,TString mode,TString name)
1152 // Provide precession (and nutation) corrected right ascension (a) and
1153 // declination (d) of the stored signal object with the specified name
1154 // at the specific epoch e.
1155 // In addition also a pointer to the stored signal object is provided.
1156 // In case no stored signal was available or one of the input arguments was
1157 // invalid, the returned pointer will be 0.
1159 // The coordinates (a,d) can represent so-called "mean" and "true" values.
1160 // The distinction between these two representations is the following :
1162 // mean values : (a,d) are only corrected for precession and not for nutation
1163 // true values : (a,d) are corrected for both precession and nutation
1165 // The input parameter "mode" allows the user to specifiy either "mean" or "true"
1166 // values for the input (a,d) coordinates.
1168 // a : Right ascension in hhmmss.sss
1169 // d : Declination in dddmmss.sss
1170 // s = "B" --> Besselian reference epoch.
1171 // "J" --> Julian reference epoch.
1172 // e : Reference epoch for the input coordinates (e.g. 1900, 1950, 2000,...)
1173 // mode = "M" --> Input coordinates are the mean values
1174 // "T" --> Input coordinates are the true values
1175 // name : Name of the requested signal object
1178 Int_t j=GetSignalIndex(name);
1179 if (j>=0) sx=GetSignal(a,d,s,e,mode,j);
1182 ///////////////////////////////////////////////////////////////////////////
1183 AliSignal* AliAstrolab::GetSignal(Int_t jref)
1185 // Provide the pointer to a stored signal object.
1187 // The input parameter "jref" allows the user to access so-called "reference" signals.
1188 // These reference signals may be used to check space-time event coincidences with the
1189 // stored measurement (e.g. coincidence of the measurement with transient phenomena).
1191 // jref = 0 --> Access to the measurement
1192 // j --> Access to the reference signal at the j-th position (j=1 is first)
1194 // Default value is jref=0.
1203 if (jref>0 && jref<fRefs->GetSize()) sx=(AliSignal*)fRefs->At(jref-1);
1207 ///////////////////////////////////////////////////////////////////////////
1208 AliSignal* AliAstrolab::GetSignal(TString name)
1210 // Provide the pointer to the stored signal object with the specified name.
1213 Int_t j=GetSignalIndex(name);
1214 if (j>=0) sx=GetSignal(j);
1217 ///////////////////////////////////////////////////////////////////////////
1218 void AliAstrolab::RemoveRefSignal(Int_t j,Int_t compress)
1220 // Remove the reference signal which was stored at the j-th position (j=1 is first).
1221 // Note : j=0 means that all stored reference signals will be removed.
1222 // j<0 allows array compression (see below) without removing any signals.
1224 // The "compress" parameter allows compression of the ref. signal storage array.
1226 // compress = 1 --> Array will be compressed
1227 // 0 --> Array will not be compressed
1229 // Note : Compression of the storage array means that the indices of the
1230 // reference signals in the storage array will change.
1234 // Clearing of the complete storage
1242 // Removing a specific reference signal
1243 if (j>0 && j<fRefs->GetSize())
1245 TObject* obj=fRefs->RemoveAt(j-1);
1246 if (obj) delete obj;
1249 // Compression of the storage array
1250 if (compress) fRefs->Compress();
1252 ///////////////////////////////////////////////////////////////////////////
1253 void AliAstrolab::RemoveRefSignal(TString name,Int_t compress)
1255 // Remove the reference signal with the specified name.
1257 // The "compress" parameter allows compression of the ref. signal storage array.
1259 // compress = 1 --> Array will be compressed
1260 // 0 --> Array will not be compressed
1262 // Note : Compression of the storage array means that the indices of the
1263 // reference signals in the storage array will change.
1265 Int_t j=GetSignalIndex(name);
1266 if (j>0) RemoveRefSignal(j,compress);
1268 ///////////////////////////////////////////////////////////////////////////
1269 Int_t AliAstrolab::GetSignalIndex(TString name)
1271 // Provide storage index of the signal with the specified name.
1272 // In case the name matches with the stored measurement,
1273 // the value 0 is returned.
1274 // In case no signal with the specified name was found, the value -1 is returned.
1280 if (name==fXsig->GetName()) return 0;
1283 if (!fRefs) return -1;
1285 for (Int_t i=0; i<fRefs->GetSize(); i++)
1287 AliSignal* sx=(AliSignal*)fRefs->At(i);
1290 if (name==sx->GetName())
1299 ///////////////////////////////////////////////////////////////////////////
1300 void AliAstrolab::PrintSignal(TString frame,TString mode,AliTimestamp* ts,Int_t ndig,Int_t jref)
1302 // Print data of a stored signal in user specified coordinates at the specific timestamp ts.
1303 // In case no stored signal was available or one of the input arguments was
1304 // invalid, no printout is produced.
1306 // The argument "ndig" specifies the number of digits for the fractional
1307 // part (e.g. ndig=6 for "dms" corresponds to micro-arcsecond precision).
1308 // No rounding will be performed, so an arcsecond count of 3.473 with ndig=1
1309 // will appear as 03.4 on the output.
1310 // Due to computer accuracy, precision on the pico-arcsecond level may get lost.
1312 // Note : The angle info is printed without additional spaces or "endline".
1313 // This allows the print to be included in various composite output formats.
1315 // The input parameter "frame" allows the user to specify the frame to which
1316 // the coordinates refer. Available options are :
1318 // frame = "equ" ==> Equatorial coordinates with right ascension (a) and declination (d).
1320 // "gal" ==> Galactic coordinates with longitude (l) and lattitude (b).
1322 // "ecl" ==> Ecliptic coordinates with longitude (l) and lattitude (b).
1324 // "hor" ==> Horizontal azimuth and altitude coordinates at the AliAstrolab location.
1326 // "icr" ==> ICRS coordinates with longitude (l) and lattitude (b).
1328 // "loc" ==> Local spherical angles theta and phi at the AliAstrolab location.
1330 // In case the coordinates are the equatorial right ascension and declination (a,d),
1331 // they can represent so-called "mean" and "true" values.
1332 // The distinction between these two representations is the following :
1334 // mean values : (a,d) are only corrected for precession and not for nutation
1335 // true values : (a,d) are corrected for both precession and nutation
1337 // The input parameter "mode" allows the user to specifiy either "mean" or "true"
1338 // values for the input in case of equatorial (a,d) coordinates.
1340 // mode = "M" --> Input coordinates are the mean values
1341 // "T" --> Input coordinates are the true values
1343 // The input parameter "mode" also determines which type of time and
1344 // local hour angle will appear in the printout.
1346 // mode = "M" --> Mean Sidereal Time (MST) and Local Mean Hour Angle (LMHA)
1347 // "T" --> Apparent Sidereal Time (AST) and Local Apparent Hour Angle (LAHA)
1349 // The input parameter "jref" allows printing of a so-called "reference" signal.
1350 // These reference signals may serve to check space-time event coincidences with the
1351 // stored measurement (e.g. coincidence of the measurement with transient phenomena).
1353 // jref = 0 --> Printing of the measurement
1354 // j --> Printing of the j-th reference signal
1356 // Default value is jref=0.
1358 // Note : In case ts=0 the current timestamp of the lab will be taken.
1361 AliSignal* sx=GetSignal(r,frame,mode,ts,jref);
1365 // Local Hour Angle of the signal
1366 Double_t lha=GetHourAngle("A",ts,jref);
1367 TString slha="LAHA";
1368 if (mode=="M" || mode=="m")
1370 lha=GetHourAngle("M",ts,jref);
1374 TString name=sx->GetName();
1375 if (name != "") cout << name.Data() << " ";
1380 d=90.-r.GetX(2,"sph","deg");
1381 a=r.GetX(3,"sph","rad");
1382 cout << "Equatorial (" << mode.Data() <<") a : "; PrintAngle(a,"rad","hms",ndig);
1383 cout << " d : "; PrintAngle(d,"deg","dms",ndig);
1384 cout << " " << slha.Data() << " : "; PrintAngle(lha,"deg","hms",ndig);
1391 b=90.-r.GetX(2,"sph","deg");
1392 l=r.GetX(3,"sph","deg");
1393 cout << "Galactic l : "; PrintAngle(l,"deg","deg",ndig);
1394 cout << " b : "; PrintAngle(b,"deg","deg",ndig);
1395 cout << " " << slha.Data() << " : "; PrintAngle(lha,"deg","hms",ndig);
1402 d=90.-r.GetX(2,"sph","deg");
1403 a=r.GetX(3,"sph","rad");
1404 cout << "ICRS l : "; PrintAngle(a,"rad","hms",ndig);
1405 cout << " b : "; PrintAngle(d,"deg","dms",ndig);
1406 cout << " " << slha.Data() << " : "; PrintAngle(lha,"deg","hms",ndig);
1413 d=90.-r.GetX(2,"sph","deg");
1414 a=r.GetX(3,"sph","deg");
1415 cout << "Ecliptic l : "; PrintAngle(a,"deg","deg",ndig);
1416 cout << " b : "; PrintAngle(d,"deg","deg",ndig);
1417 cout << " " << slha.Data() << " : "; PrintAngle(lha,"deg","hms",ndig);
1423 Double_t alt=90.-r.GetX(2,"sph","deg");
1424 Double_t azi=180.-r.GetX(3,"sph","deg");
1433 cout << "Horizontal azi : "; PrintAngle(azi,"deg","deg",ndig);
1434 cout << " alt : "; PrintAngle(alt,"deg","deg",ndig);
1435 cout << " " << slha.Data() << " : "; PrintAngle(lha,"deg","hms",ndig);
1441 Double_t theta=r.GetX(2,"sph","deg");
1442 Double_t phi=r.GetX(3,"sph","deg");
1443 cout << "Local-frame phi : "; PrintAngle(phi,"deg","deg",ndig);
1444 cout << " theta : "; PrintAngle(theta,"deg","deg",ndig);
1445 cout << " " << slha.Data() << " : "; PrintAngle(lha,"deg","hms",ndig);
1449 ///////////////////////////////////////////////////////////////////////////
1450 void AliAstrolab::PrintSignal(TString frame,TString mode,AliTimestamp* ts,Int_t ndig,TString name)
1452 // Print data of the stored signal with the specified name in user specified coordinates
1453 // at the specific timestamp ts.
1454 // In case such stored signal was available or one of the input arguments was
1455 // invalid, no printout is produced.
1457 // The argument "ndig" specifies the number of digits for the fractional
1458 // part (e.g. ndig=6 for "dms" corresponds to micro-arcsecond precision).
1459 // No rounding will be performed, so an arcsecond count of 3.473 with ndig=1
1460 // will appear as 03.4 on the output.
1461 // Due to computer accuracy, precision on the pico-arcsecond level may get lost.
1463 // Note : The angle info is printed without additional spaces or "endline".
1464 // This allows the print to be included in various composite output formats.
1466 // The input parameter "frame" allows the user to specify the frame to which
1467 // the coordinates refer. Available options are :
1469 // frame = "equ" ==> Equatorial coordinates with right ascension (a) and declination (d).
1471 // "gal" ==> Galactic coordinates with longitude (l) and lattitude (b).
1473 // "ecl" ==> Ecliptic coordinates with longitude (l) and lattitude (b).
1475 // "hor" ==> Horizontal azimuth and altitude coordinates at the AliAstrolab location.
1477 // "icr" ==> ICRS coordinates with longitude (l) and lattitude (b).
1479 // "loc" ==> Local spherical angles theta and phi at the AliAstrolab location.
1481 // In case the coordinates are the equatorial right ascension and declination (a,d),
1482 // they can represent so-called "mean" and "true" values.
1483 // The distinction between these two representations is the following :
1485 // mean values : (a,d) are only corrected for precession and not for nutation
1486 // true values : (a,d) are corrected for both precession and nutation
1488 // The input parameter "mode" allows the user to specifiy either "mean" or "true"
1489 // values for the input in case of equatorial (a,d) coordinates.
1491 // mode = "M" --> Input coordinates are the mean values
1492 // "T" --> Input coordinates are the true values
1494 // The input parameter "mode" also determines which type of time and
1495 // local hour angle will appear in the printout.
1497 // mode = "M" --> Mean Sidereal Time (MST) and Local Mean Hour Angle (LMHA)
1498 // "T" --> Apparent Sidereal Time (AST) and Local Apparent Hour Angle (LAHA)
1500 // Note : In case ts=0 the current timestamp of the lab will be taken.
1502 Int_t j=GetSignalIndex(name);
1503 if (j>=0) PrintSignal(frame,mode,ts,ndig,j);
1505 ///////////////////////////////////////////////////////////////////////////
1506 void AliAstrolab::ListSignals(TString frame,TString mode,Int_t ndig)
1508 // List all stored signals in user specified coordinates at the timestamp
1509 // of the actual recording of the stored measurement under investigation.
1510 // In case no (timestamp of the) actual measurement is available,
1511 // the current timestamp of the lab will be taken.
1512 // In case no stored signal is available or one of the input arguments is
1513 // invalid, no printout is produced.
1515 // The argument "ndig" specifies the number of digits for the fractional
1516 // part (e.g. ndig=6 for "dms" corresponds to micro-arcsecond precision).
1517 // No rounding will be performed, so an arcsecond count of 3.473 with ndig=1
1518 // will appear as 03.4 on the output.
1519 // Due to computer accuracy, precision on the pico-arcsecond level may get lost.
1521 // The default value is ndig=1.
1523 // Note : The angle info is printed without additional spaces or "endline".
1524 // This allows the print to be included in various composite output formats.
1526 // The input parameter "frame" allows the user to specify the frame to which
1527 // the coordinates refer. Available options are :
1529 // frame = "equ" ==> Equatorial coordinates with right ascension (a) and declination (d).
1531 // "gal" ==> Galactic coordinates with longitude (l) and lattitude (b).
1533 // "ecl" ==> Ecliptic coordinates with longitude (l) and lattitude (b).
1535 // "hor" ==> Horizontal azimuth and altitude coordinates at the AliAstrolab location.
1537 // "icr" ==> ICRS coordinates with longitude (l) and lattitude (b).
1539 // "loc" ==> Local spherical angles theta and phi at the AliAstrolab location.
1541 // In case the coordinates are the equatorial right ascension and declination (a,d),
1542 // they can represent so-called "mean" and "true" values.
1543 // The distinction between these two representations is the following :
1545 // mean values : (a,d) are only corrected for precession and not for nutation
1546 // true values : (a,d) are corrected for both precession and nutation
1548 // The input parameter "mode" allows the user to specifiy either "mean" or "true"
1549 // values for the input in case of equatorial (a,d) coordinates.
1551 // mode = "M" --> Input coordinates are the mean values
1552 // "T" --> Input coordinates are the true values
1554 // The input parameter "mode" also determines which type of time and
1555 // local hour angle will appear in the listing.
1557 // mode = "M" --> Mean Sidereal Time (MST) and Local Mean Hour Angle (LMHA)
1558 // "T" --> Apparent Sidereal Time (AST) and Local Apparent Hour Angle (LAHA)
1565 if (mode=="T" || mode=="t") dform=-1;
1569 tx=fXsig->GetTimestamp();
1570 if (!tx) tx=(AliTimestamp*)this;
1571 cout << " *AliAstrolab::ListSignals* List of all stored signals." << endl;
1572 cout << " === The measurement under investigation ===" << endl;
1573 cout << " Timestamp of the actual observation" << endl;
1574 tx->Date(dform,fToffset);
1575 cout << " Location of the actual observation" << endl;
1576 cout << " "; PrintSignal(frame,mode,tx,ndig); cout << endl;
1582 for (Int_t i=1; i<=fRefs->GetSize(); i++)
1584 AliSignal* sx=GetSignal(i);
1589 cout << " *AliAstrolab::ListRefSignals* List of all stored signals." << endl;
1590 tx=(AliTimestamp*)this;
1591 cout << " Current timestamp of the laboratory" << endl;
1592 tx->Date(dform,fToffset);
1597 cout << " === All stored reference signals according to the above timestamp ===" << endl;
1600 cout << " Index : " << i << " "; PrintSignal(frame,mode,tx,ndig,i); cout << endl;
1603 ///////////////////////////////////////////////////////////////////////////
1604 void AliAstrolab::Precess(Ali3Vector& r,AliTimestamp* ts1,AliTimestamp* ts2)
1606 // Correct mean right ascension and declination given for Julian date "jd"
1607 // for the earth's precession corresponding to the specified timestamp.
1608 // The results are the so-called "mean" (i.e. precession corrected) values,
1609 // corresponding to the specified timestamp.
1610 // The method used is the new IAU 2000 one as described in the
1611 // U.S. Naval Observatory (USNO) circular 179 (2005), which is available on
1612 // http://aa.usno,navy.mil/publications/docs/Circular_179.pdf.
1613 // Since the standard reference epoch is J2000, this implies that all
1614 // input (a,d) coordinates will be first internally converted to the
1615 // corresponding J2000 values before the precession correction w.r.t. the
1616 // specified lab timestamp will be applied.
1618 // r : Input vector containing the right ascension and declination information
1619 // in the form of standard Ali3Vector coordinates.
1620 // In spherical coordinates the phi corresponds to the right ascension,
1621 // whereas the declination corresponds to (pi/2)-theta.
1622 // jd : Julian date corresponding to the input coordinate values.
1623 // ts : Timestamp corresponding to the requested corrected coordinate values.
1625 // Note : In case ts=0 the current timestamp of the lab will be taken.
1627 // Convert back to J2000 values
1630 r0=r.GetUnprimed(&fP);
1632 // Precess to the specified timestamp
1633 if (!ts2) ts2=(AliTimestamp*)this;
1635 r=r0.GetPrimed(&fP);
1637 ///////////////////////////////////////////////////////////////////////////
1638 void AliAstrolab::Nutate(Ali3Vector& r,AliTimestamp* ts)
1640 // Correct mean right ascension and declination for the earth's nutation
1641 // corresponding to the specified timestamp.
1642 // The results are the so-called "true" (i.e. nutation corrected) values,
1643 // corresponding to the specified timestamp.
1644 // The method used is the new IAU 2000 one as described in the
1645 // U.S. Naval Observatory (USNO) circular 179 (2005), which is available on
1646 // http://aa.usno,navy.mil/publications/docs/Circular_179.pdf.
1648 // r : Input vector containing the right ascension and declination information
1649 // in the form of standard Ali3Vector coordinates.
1650 // In spherical coordinates the phi corresponds to the right ascension,
1651 // whereas the declination corresponds to (pi/2)-theta.
1652 // ts : Timestamp for which the corrected coordinate values are requested.
1654 // Note : In case ts=0 the current timestamp of the lab will be taken.
1656 // Nutation correction for the specified timestamp
1657 if (!ts) ts=(AliTimestamp*)this;
1661 ///////////////////////////////////////////////////////////////////////////
1662 void AliAstrolab::SetBmatrix()
1664 // Set the frame bias matrix elements.
1665 // The formulas and numerical constants used are the ones from the
1666 // U.S. Naval Observatory (USNO) circular 179 (2005), which is available on
1667 // http://aa.usno,navy.mil/publications/docs/Circular_179.pdf.
1669 Double_t pi=acos(-1.);
1671 // Parameters in mas
1673 Double_t x=-16.6170;
1676 // Convert to radians
1677 a*=pi/(180.*3600.*1000.);
1678 x*=pi/(180.*3600.*1000.);
1679 e*=pi/(180.*3600.*1000.);
1682 mat[0]=1.-0.5*(a*a+x*x);
1686 mat[4]=1.-0.5*(a*a+e*e);
1690 mat[8]=1.-0.5*(e*e+x*x);
1695 ///////////////////////////////////////////////////////////////////////////
1696 void AliAstrolab::SetPmatrix(AliTimestamp* ts)
1698 // Set precession matrix elements for Julian date jd w.r.t. J2000.
1699 // The formulas and numerical constants used are the ones from the
1700 // U.S. Naval Observatory (USNO) circular 179 (2005), which is available on
1701 // http://aa.usno,navy.mil/publications/docs/Circular_179.pdf.
1702 // All numerical constants refer to the standard reference epoch J2000.
1704 Double_t mat[9]={0,0,0,0,0,0,0,0,0};
1711 Double_t pi=acos(-1.);
1713 Double_t t=(ts->GetJD()-2451545.0)/36525.; // Julian centuries since J2000.0
1715 // Parameters for the precession matrix in arcseconds
1716 Double_t eps0=84381.406; // Mean ecliptic obliquity at J2000.0
1717 Double_t psi=5038.481507*t-1.0790069*pow(t,2)-0.00114045*pow(t,3)+0.000132851*pow(t,4)
1718 -0.0000000951*pow(t,4);
1719 Double_t om=eps0-0.025754*t+0.0512623*pow(t,2)-0.00772503*pow(t,3)-0.000000467*pow(t,4)
1720 +0.0000003337*pow(t,5);
1721 Double_t chi=10.556403*t-2.3814292*pow(t,2)-0.00121197*pow(t,3)+0.000170663*pow(t,4)
1722 -0.0000000560*pow(t,5);
1724 // Convert to radians
1725 eps0*=pi/(180.*3600.);
1726 psi*=pi/(180.*3600.);
1727 om*=pi/(180.*3600.);
1728 chi*=pi/(180.*3600.);
1730 Double_t s1=sin(eps0);
1731 Double_t s2=sin(-psi);
1732 Double_t s3=sin(-om);
1733 Double_t s4=sin(chi);
1734 Double_t c1=cos(eps0);
1735 Double_t c2=cos(-psi);
1736 Double_t c3=cos(-om);
1737 Double_t c4=cos(chi);
1739 mat[0]=c4*c2-s2*s4*c3;
1740 mat[1]=c4*s2*c1+s4*c3*c2*c1-s1*s4*s3;
1741 mat[2]=c4*s2*s1+s4*c3*c2*s1+c1*s4*s3;
1742 mat[3]=-s4*c2-s2*c4*c3;
1743 mat[4]=-s4*s2*c1+c4*c3*c2*c1-s1*c4*s3;
1744 mat[5]=-s4*s2*s1+c4*c3*c2*s1+c1*c4*s3;
1746 mat[7]=-s3*c2*c1-s1*c3;
1747 mat[8]=-s3*c2*s1+c3*c1;
1751 ///////////////////////////////////////////////////////////////////////////
1752 void AliAstrolab::SetNmatrix(AliTimestamp* ts)
1754 // Set nutation matrix elements for the specified Julian date jd.
1755 // The formulas and numerical constants used are the ones from the
1756 // U.S. Naval Observatory (USNO) circular 179 (2005), which is available on
1757 // http://aa.usno,navy.mil/publications/docs/Circular_179.pdf.
1759 Double_t mat[9]={0,0,0,0,0,0,0,0,0};
1766 Double_t pi=acos(-1.);
1768 Double_t dpsi,deps,eps;
1769 ts->Almanac(&dpsi,&deps,&eps);
1771 // Convert to radians
1772 dpsi*=pi/(180.*3600.);
1773 deps*=pi/(180.*3600.);
1774 eps*=pi/(180.*3600.);
1776 Double_t s1=sin(eps);
1777 Double_t s2=sin(-dpsi);
1778 Double_t s3=sin(-(eps+deps));
1779 Double_t c1=cos(eps);
1780 Double_t c2=cos(-dpsi);
1781 Double_t c3=cos(-(eps+deps));
1787 mat[4]=c3*c2*c1-s1*s3;
1788 mat[5]=c3*c2*s1+c1*s3;
1790 mat[7]=-s3*c2*c1-s1*c3;
1791 mat[8]=-s3*c2*s1+c3*c1;
1795 ///////////////////////////////////////////////////////////////////////////
1796 void AliAstrolab::SetGmatrix(TString mode)
1798 // Set the mean equatorial to galactic coordinate conversion matrix.
1799 // The B1950 parameters were taken from section 22.3 of the book
1800 // "An Introduction to Modern Astrophysics" by Carrol and Ostlie (1996).
1801 // The J2000 parameters are obtained by precession of the B1950 values.
1803 // Via the input argument "mode" the required epoch can be selected
1804 // mode = "B" ==> B1950
1807 Ali3Vector x; // The Galactic x-axis in the equatorial frame
1808 Ali3Vector y; // The Galactic y-axis in the equatorial frame
1809 Ali3Vector z; // The Galactic z-axis in the equatorial frame
1812 Double_t vec[3]={1,0,0};
1814 fGal=1; // Set flag to indicate B1950 matrix values
1816 // B1950 equatorial coordinates of the North Galactic Pole (NGP)
1819 a=ConvertAngle(a,"hms","deg");
1820 d=ConvertAngle(d,"dms","deg");
1823 z.SetVector(vec,"sph","deg");
1825 // B1950 equatorial coordinates of the Galactic l=b=0 point
1828 a=ConvertAngle(a,"hms","deg");
1829 d=ConvertAngle(d,"dms","deg");
1832 x.SetVector(vec,"sph","deg");
1834 // Precess to the corresponding J2000 values if requested
1837 fGal=2; // Set flag to indicate J2000 matrix values
1839 t1.SetEpoch(1950,"B");
1841 t2.SetEpoch(2000,"J");
1846 // The Galactic y-axis is determined for the right handed frame
1849 fG.SetAngles(x.GetX(2,"sph","deg"),x.GetX(3,"sph","deg"),
1850 y.GetX(2,"sph","deg"),y.GetX(3,"sph","deg"),
1851 z.GetX(2,"sph","deg"),z.GetX(3,"sph","deg"));
1853 ///////////////////////////////////////////////////////////////////////////
1854 void AliAstrolab::SetEmatrix(AliTimestamp* ts)
1856 // Set the mean equatorial to ecliptic coordinate conversion matrix
1857 // for the specified timestamp.
1858 // A nice sketch and explanation of the two frames can be found
1859 // in chapter 3 of the book "Astronomy Methods" by Hale Bradt (2004).
1861 Double_t dpsi,deps,eps;
1862 ts->Almanac(&dpsi,&deps,&eps);
1864 // Convert to degrees
1867 // Positions of the ecliptic axes w.r.t. the equatorial ones
1868 // at the moment of the specified timestamp
1869 Double_t theta1=90; // Ecliptic x-axis
1871 Double_t theta2=90.-eps; //Ecliptic y-axis
1873 Double_t theta3=eps; // Ecliptic z-axis
1876 fE.SetAngles(theta1,phi1,theta2,phi2,theta3,phi3);
1878 ///////////////////////////////////////////////////////////////////////////
1879 void AliAstrolab::SetHmatrix(AliTimestamp* ts)
1881 // Set the mean equatorial to horizontal coordinate conversion matrix
1882 // for the specified timestamp.
1883 // A nice sketch and explanation of the two frames can be found
1884 // in chapter 3 of the book "Astronomy Methods" by Hale Bradt (2004).
1886 // Note : In order to simplify the calculations, we use here a
1887 // right-handed horizontal frame.
1889 Ali3Vector x; // The (South pointing) horizontal x-axis in the equatorial frame
1890 Ali3Vector y; // The (East pointing) horizontal y-axis in the equatorial frame
1891 Ali3Vector z; // The (Zenith pointing) horizontal z-axis in the equatorial frame
1894 GetLabPosition(l,b,"deg");
1897 Double_t vec[3]={1,0,0};
1899 // Equatorial coordinates of the horizontal z-axis
1900 // at the moment of the specified timestamp
1901 a=ts->GetLAST(fToffset);
1902 a*=15.; // Convert fractional hours to degrees
1905 z.SetVector(vec,"sph","deg");
1907 // Equatorial coordinates of the horizontal x-axis
1908 // at the moment of the specified timestamp
1911 x.SetVector(vec,"sph","deg");
1913 // The horizontal y-axis is determined for the right handed frame
1916 fH.SetAngles(x.GetX(2,"sph","deg"),x.GetX(3,"sph","deg"),
1917 y.GetX(2,"sph","deg"),y.GetX(3,"sph","deg"),
1918 z.GetX(2,"sph","deg"),z.GetX(3,"sph","deg"));
1920 ///////////////////////////////////////////////////////////////////////////
1921 void AliAstrolab::SetLocalFrame(Double_t t1,Double_t p1,Double_t t2,Double_t p2,Double_t t3,Double_t p3)
1923 // Specification of the orientations of the local-frame axes.
1924 // The input arguments represent the angles (in degrees) of the local-frame axes
1925 // w.r.t. a so called Master Reference Frame (MRF), with the same convention
1926 // as the input arguments of TRrotMatix::SetAngles.
1928 // The right handed Master Reference Frame is defined as follows :
1929 // Z-axis : Points to the local Zenith
1930 // X-axis : Makes an angle of 90 degrees with the Z-axis and points South
1931 // Y-axis : Makes an angle of 90 degrees with the Z-axis and points East
1933 // Once the user has specified the local reference frame, any observed event
1934 // can be related to astronomical space-time locations via the SetSignal
1935 // and GetSignal memberfunctions.
1937 // Set the matrix for the conversion of our reference frame coordinates
1938 // into the local-frame ones.
1940 fL.SetAngles(t1,p1,t2,p2,t3,p3);
1942 ///////////////////////////////////////////////////////////////////////////
1943 Double_t AliAstrolab::ConvertAngle(Double_t a,TString in,TString out) const
1945 // Conversion of various angular formats.
1947 // The input argument "a" denotes the angle to be converted.
1948 // The string arguments "in" and "out" specify the angular I/O formats.
1950 // in = "rad" : input angle provided in radians
1951 // "deg" : input angle provided in degrees
1952 // "dms" : input angle provided in dddmmss.sss
1953 // "hms" : input angle provided in hhmmss.sss
1955 // out = "rad" : output angle provided in radians
1956 // "deg" : output angle provided in degrees
1957 // "dms" : output angle provided in dddmmss.sss
1958 // "hms" : output angle provided in hhmmss.sss
1960 if (in==out) return a;
1962 // Convert input to its absolute value in (fractional) degrees.
1963 Double_t pi=acos(-1.);
1964 Double_t epsilon=1.e-12; // Accuracy in (arc)seconds
1965 Int_t word=0,ddd=0,hh=0,mm=0,ss=0;
1970 if (in=="rad") b*=180./pi;
1979 s=b-Double_t(ddd*10000+mm*100+ss);
1980 b=Double_t(ddd)+Double_t(mm)/60.+(Double_t(ss)+s)/3600.;
1990 s=b-Double_t(hh*10000+mm*100+ss);
1991 b=15.*(Double_t(hh)+Double_t(mm)/60.+(Double_t(ss)+s)/3600.);
1999 if (out=="rad") b*=pi/180.;
2030 b=Double_t(10000*ddd+100*mm+ss)+s;
2063 b=Double_t(10000*hh+100*mm+ss)+s;
2070 ///////////////////////////////////////////////////////////////////////////
2071 Double_t AliAstrolab::GetHourAngle(TString mode,AliTimestamp* ts,Int_t jref)
2073 // Provide the Local Hour Angle (in fractional degrees) of a stored signal
2074 // object at the specified timestamp.
2076 // The input parameter "mode" allows the user to select either the
2077 // "mean" or "apparent" value for the returned Hour Angle.
2079 // mode = "M" --> Output is the Mean Hour Angle
2080 // "A" --> Output is the Apparent Hour Angle
2081 // ts : Timestamp at which the hour angle is requested.
2083 // The input parameter "jref" allows the user to specify so-called "reference" signals.
2084 // These reference signals may be used to check space-time event coincidences with the
2085 // stored measurement (e.g. coincidence of the measurement with transient phenomena).
2087 // jref = 0 --> Use the stored measurement
2088 // j --> Use the reference signal at the j-th position (j=1 is first)
2090 // Default value is jref=0.
2092 // Note : In case ts=0 the current timestamp of the lab will be taken.
2094 if (!ts) ts=(AliTimestamp*)this;
2096 // Get corrected right ascension and declination for the specified timestamp.
2098 if (mode=="M" || mode=="m") GetSignal(a,d,"M",ts,jref);
2099 if (mode=="A" || mode=="a") GetSignal(a,d,"T",ts,jref);
2101 // Convert coordinates to fractional degrees.
2102 a=ConvertAngle(a,"hms","deg");
2103 d=ConvertAngle(d,"dms","deg");
2105 a/=15.; // Convert a to fractional hours
2107 if (mode=="M" || mode=="m") ha=ts->GetLMST(fToffset)-a;
2108 if (mode=="A" || mode=="a") ha=ts->GetLAST(fToffset)-a;
2109 ha*=15.; // Convert to (fractional) degrees
2113 ///////////////////////////////////////////////////////////////////////////
2114 void AliAstrolab::SetLT(Int_t y,Int_t m,Int_t d,Int_t hh,Int_t mm,Int_t ss,Int_t ns,Int_t ps)
2116 // Set the AliTimestamp parameters corresponding to the LT date and time
2117 // in the Gregorian calendar as specified by the input arguments.
2119 // The input arguments represent the following :
2120 // y : year in LT (e.g. 1952, 2003 etc...)
2121 // m : month in LT (1=jan 2=feb etc...)
2122 // d : day in LT (1-31)
2123 // hh : elapsed hours in LT (0-23)
2124 // mm : elapsed minutes in LT (0-59)
2125 // ss : elapsed seconds in LT (0-59)
2126 // ns : remaining fractional elapsed second of LT in nanosecond
2127 // ps : remaining fractional elapsed nanosecond of LT in picosecond
2129 // Note : ns=0 and ps=0 are the default values.
2132 SetLT(fToffset,y,m,d,hh,mm,ss,ns,ps);
2134 ///////////////////////////////////////////////////////////////////////////
2135 void AliAstrolab::SetLT(Int_t y,Int_t d,Int_t s,Int_t ns,Int_t ps)
2137 // Set the AliTimestamp parameters corresponding to the specified elapsed
2138 // timespan since the beginning of the new LT year.
2140 // The LT year and elapsed time span is entered via the following input arguments :
2142 // y : year in LT (e.g. 1952, 2003 etc...)
2143 // d : elapsed number of days
2144 // s : (remaining) elapsed number of seconds
2145 // ns : (remaining) elapsed number of nanoseconds
2146 // ps : (remaining) elapsed number of picoseconds
2148 // The specified d, s, ns and ps values will be used in an additive
2149 // way to determine the elapsed timespan.
2150 // So, specification of d=1, s=100, ns=0, ps=0 will result in the
2151 // same elapsed time span as d=0, s=24*3600+100, ns=0, ps=0.
2152 // However, by making use of the latter the user should take care
2153 // of possible integer overflow problems in the input arguments,
2154 // which obviously will provide incorrect results.
2156 // Note : ns=0 and ps=0 are the default values.
2158 SetLT(fToffset,y,d,s,ns,ps);
2160 ///////////////////////////////////////////////////////////////////////////
2161 Double_t AliAstrolab::GetDifference(Int_t j,TString au,Double_t& dt,TString tu,Int_t mode,Int_t* ia,Int_t* it)
2163 // Provide space and time difference between the j-th reference signal
2164 // (j=1 indicates first) and the stored measurement.
2166 // The return value of this memberfunction provides the positional angular
2167 // difference, whereas the output argument "dt" provides the time difference.
2169 // The units of the angular difference can be specified via the the "au"
2170 // input argument, where
2172 // au = "rad" --> Angular difference in (fractional) radians
2173 // "deg" --> Angular difference in (fractional) degrees
2175 // The units of the time difference can be specified via the "tu" and "mode"
2176 // input arguments. For details please refer to AliTimestamp::GetDifference().
2177 // Also here mode=1 is the default value.
2179 // For the time difference the reference signal is used as the standard.
2180 // This means that in case of a positive time difference, the stored
2181 // measurement occurred later than the reference signal.
2183 // In case j=0, the stored measurement will be compared with each
2184 // reference signal and the returned angular and time differences are
2185 // the minimal differences which were encountered.
2186 // In this case the user may obtain the indices of the two stored reference signals
2187 // which had the minimal angular and minimal time difference via the output
2188 // arguments "ia" and "it" as follows :
2190 // ia = Index of the stored reference signal with minimial angular difference
2191 // it = Index of the stored reference signal with minimial time difference
2193 // In case these indices are the same, there obviously was 1 single reference signal
2194 // which showed both the minimal angular and time difference.
2196 // The default values are mode=1, ia=0 and it=0;
2203 if (!fRefs) return dang;
2205 Ali3Vector rx; // Position of the measurement
2206 Ali3Vector r0; // Position of the reference signal
2208 AliSignal* sx=GetSignal(rx,"icr","M",0);
2209 if (!sx) return dang;
2211 AliTimestamp* tx=sx->GetTimestamp();
2212 if (!tx) return dang;
2214 // Space and time difference w.r.t. a specific reference signal
2217 AliSignal* s0=GetSignal(r0,"icr","M",0,j);
2218 if (!s0) return dang;
2219 AliTimestamp* t0=s0->GetTimestamp();
2221 if (!t0) return dang;
2223 dang=r0.GetOpeningAngle(rx,au);
2224 dt=t0->GetDifference(tx,tu,mode);
2228 // Minimal space and time difference encountered over all reference signals
2229 Double_t dangmin=dang;
2231 for (Int_t i=1; i<=fRefs->GetSize(); i++)
2233 AliSignal* s0=GetSignal(r0,"icr","M",0,i);
2235 AliTimestamp* t0=s0->GetTimestamp();
2237 dang=r0.GetOpeningAngle(rx,au);
2238 dt=t0->GetDifference(tx,tu,mode);
2239 if (fabs(dang)<dangmin)
2254 ///////////////////////////////////////////////////////////////////////////
2255 Double_t AliAstrolab::GetDifference(TString name,TString au,Double_t& dt,TString tu,Int_t mode)
2257 // Provide space and time difference between the reference signal
2258 // with the specified name and the stored measurement.
2260 // The return value of this memberfunction provides the positional angular
2261 // difference, whereas the output argument "dt" provides the time difference.
2263 // The units of the angular difference can be specified via the the "au"
2264 // input argument, where
2266 // au = "rad" --> Angular difference in (fractional) radians
2267 // "deg" --> Angular difference in (fractional) degrees
2269 // The units of the time difference can be specified via the "tu" and "mode"
2270 // input arguments. For details please refer to AliTimestamp::GetDifference().
2271 // Also here mode=1 is the default value.
2273 // For the time difference the reference signal is used as the standard.
2274 // This means that in case of a positive time difference, the stored
2275 // measurement occurred later than the reference signal.
2280 Int_t j=GetSignalIndex(name);
2281 if (j>0) dang=GetDifference(j,au,dt,tu,mode);
2284 ///////////////////////////////////////////////////////////////////////////
2285 TArrayI* AliAstrolab::MatchRefSignal(Double_t da,TString au,Double_t dt,TString tu,Int_t mode)
2287 // Provide the storage indices of the reference signals which match in space
2288 // and time with the stored measurement.
2289 // The indices are returned via a pointer to a TArrayI object.
2290 // In case no matches were found, the null pointer is returned.
2291 // A reference signal is regarded as matching with the stored measurement
2292 // if the positional angular difference doesn't exceed "da" and the absolute
2293 // value of the time difference doesn't exceed "dt".
2295 // The units of the angular difference "da" can be specified via the the "au"
2296 // input argument, where
2298 // au = "rad" --> Angular difference in (fractional) radians
2299 // "deg" --> Angular difference in (fractional) degrees
2301 // The units of the time difference "dt" can be specified via the "tu" and "mode"
2302 // input arguments. For details please refer to AliTimestamp::GetDifference().
2303 // Also here mode=1 is the default value.
2305 if (!fXsig || !fRefs) return 0;
2307 Int_t nrefs=fRefs->GetEntries();
2309 if (fIndices) delete fIndices;
2310 fIndices=new TArrayI(nrefs);
2312 Double_t dang,dtime;
2314 for (Int_t i=1; i<=fRefs->GetSize(); i++)
2316 dang=GetDifference(i,au,dtime,tu,mode);
2317 if (fabs(dang)<=da && fabs(dtime)<=dt)
2319 fIndices->AddAt(i,jfill);
2324 fIndices->Set(jfill);
2327 ///////////////////////////////////////////////////////////////////////////
2328 TObject* AliAstrolab::Clone(const char* name) const
2330 // Make a deep copy of the current object and provide the pointer to the copy.
2331 // This memberfunction enables automatic creation of new objects of the
2332 // correct type depending on the object type, a feature which may be very useful
2333 // for containers when adding objects in case the container owns the objects.
2335 AliAstrolab* lab=new AliAstrolab(*this);
2338 if (strlen(name)) lab->SetName(name);
2342 ///////////////////////////////////////////////////////////////////////////