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