source: trunk/MagicSoft/Mars/mastro/MVector3.h@ 8785

Last change on this file since 8785 was 8725, checked in by tbretz, 17 years ago
*** empty log message ***
File size: 1.5 KB
Line 
1#ifndef MARS_MVector3
2#define MARS_MVector3
3
4#ifndef ROOT_TVector3
5#include <TVector3.h>
6#endif
7
8class MVector3 : public TVector3
9{
10private:
11 enum VectorType_t
12 {
13 kIsInvalid,
14 kIsRaDec,
15 kIsZdAz,
16 kIsAltAz,
17 kIsArbitrary
18 };
19
20 VectorType_t fType;
21
22 TString fName;
23
24 void SetThetaPhiMag(Double_t theta, Double_t phi, Double_t mag)
25 {
26 SetMagThetaPhi(TMath::Power(10, -mag/2.5), theta, phi);
27 }
28
29public:
30 MVector3() { fType=kIsInvalid; }
31 MVector3(Double_t theta, Double_t phi, Double_t mag=0)
32 {
33 SetThetaPhiMag(theta, phi, mag);
34 fType=kIsArbitrary;
35 }
36 MVector3(const TVector3 &v3) : TVector3(v3) { fType=kIsArbitrary; }
37 Double_t Magnitude() const { return -2.5*TMath::Log10(Mag()); }
38
39 Bool_t IsValid() const { return fType!=kIsInvalid; }
40
41 void SetRaDec(Double_t ra, Double_t dec, Double_t mag=0)
42 {
43 fType = kIsRaDec;
44 SetThetaPhiMag(TMath::Pi()/2-dec, ra, mag);
45 }
46 void SetName(const TString &str) { fName = str.Strip(TString::kBoth); }
47 void SetZdAz(Double_t zd, Double_t az, Double_t mag=0)
48 {
49 fType = kIsZdAz;
50 SetThetaPhiMag(zd, az, mag);
51 }
52 void SetAltAz(Double_t alt, Double_t az, Double_t mag=0)
53 {
54 fType = kIsAltAz;
55 SetThetaPhiMag(TMath::Pi()/2-alt, az, mag);
56 }
57
58 const char *GetName() const { return fName; }
59
60 void WriteBinary(ostream &out) const;
61 void ReadBinary(istream &in);
62
63 ClassDef(MVector3, 1) // A specialized TVector3 storing a star-name
64};
65
66#endif
Note: See TracBrowser for help on using the repository browser.