1 | #ifndef MARS_MVector3
|
---|
2 | #define MARS_MVector3
|
---|
3 |
|
---|
4 | #ifndef ROOT_TVector3
|
---|
5 | #include <TVector3.h>
|
---|
6 | #endif
|
---|
7 |
|
---|
8 | class MVector3 : public TVector3
|
---|
9 | {
|
---|
10 | private:
|
---|
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); // SetMagThetaPhi(TMath::Power(10, -mag/2.5), theta, phi);
|
---|
25 |
|
---|
26 | public:
|
---|
27 | MVector3() { fType=kIsInvalid; }
|
---|
28 | MVector3(Double_t theta, Double_t phi, Double_t mag=0)
|
---|
29 | {
|
---|
30 | SetThetaPhiMag(theta, phi, mag);
|
---|
31 | fType=kIsArbitrary;
|
---|
32 | }
|
---|
33 | MVector3(const TVector3 &v3) : TVector3(v3) { fType=kIsArbitrary; }
|
---|
34 | Double_t Magnitude() const;// { return -2.5*TMath::Log10(Mag()); }
|
---|
35 |
|
---|
36 | Bool_t IsValid() const { return fType!=kIsInvalid; }
|
---|
37 |
|
---|
38 | void SetRaDec(Double_t ra, Double_t dec, Double_t mag=0); // SetThetaPhiMag(TMath::Pi()/2-dec, ra, mag);
|
---|
39 | void SetAltAz(Double_t alt, Double_t az, Double_t mag=0); // SetThetaPhiMag(TMath::Pi()/2-alt, az, mag);
|
---|
40 | void SetZdAz(Double_t zd, Double_t az, Double_t mag=0)
|
---|
41 | {
|
---|
42 | fType = kIsZdAz;
|
---|
43 | SetThetaPhiMag(zd, az, mag);
|
---|
44 | }
|
---|
45 |
|
---|
46 | void SetName(const TString &str) { fName = str.Strip(TString::kBoth); }
|
---|
47 | const char *GetName() const { return fName; }
|
---|
48 |
|
---|
49 | void WriteBinary(std::ostream &out) const;
|
---|
50 | void ReadBinary(std::istream &in);
|
---|
51 |
|
---|
52 | ClassDef(MVector3, 1) // A specialized TVector3 storing a star-name
|
---|
53 | };
|
---|
54 |
|
---|
55 | #endif
|
---|