source: tags/Mars-V0.10.3/mastro/MVector3.h

Last change on this file was 4977, checked in by tbretz, 20 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 void SetRaDec(Double_t ra, Double_t dec, Double_t mag=0)
40 {
41 fType = kIsRaDec;
42 SetThetaPhiMag(TMath::Pi()/2-dec, ra, mag);
43 }
44 void SetName(const TString &str) { fName = str.Strip(TString::kBoth); }
45 void SetZdAz(Double_t zd, Double_t az, Double_t mag=0)
46 {
47 fType = kIsZdAz;
48 SetThetaPhiMag(zd, az, mag);
49 }
50 void SetAltAz(Double_t alt, Double_t az, Double_t mag=0)
51 {
52 fType = kIsAltAz;
53 SetThetaPhiMag(TMath::Pi()/2-alt, az, mag);
54 }
55
56 const char *GetName() const { return fName; }
57
58 void WriteBinary(ostream &out) const;
59 void ReadBinary(istream &in);
60
61 ClassDef(MVector3, 1) // A specialized TVector3 storing a star-name
62};
63
64#endif
Note: See TracBrowser for help on using the repository browser.