1 | #ifndef MARS_MSrcPosCalc
|
---|
2 | #define MARS_MSrcPosCalc
|
---|
3 |
|
---|
4 | #ifndef MARS_MTask
|
---|
5 | #include "MTask.h"
|
---|
6 | #endif
|
---|
7 |
|
---|
8 | #ifndef ROOT_TVector2
|
---|
9 | #include <TVector2.h>
|
---|
10 | #endif
|
---|
11 |
|
---|
12 | class MObservatory;
|
---|
13 | class MPointingPos;
|
---|
14 | class MPointingDev;
|
---|
15 | class MSrcPosCam;
|
---|
16 | class MGeomCam;
|
---|
17 | class MTime;
|
---|
18 | class MVector3;
|
---|
19 | class MTaskList;
|
---|
20 |
|
---|
21 | class MSrcPosCalc : public MTask
|
---|
22 | {
|
---|
23 | public:
|
---|
24 | enum Mode_t {
|
---|
25 | kDefault = 0, // Set source position to on-position
|
---|
26 | kOffData = 1, // The source position is fixed to (0/0)
|
---|
27 | kWobble = 2 // The source position is set to the wobble aka. anti-source position depending on the cycle number
|
---|
28 | };
|
---|
29 | private:
|
---|
30 | enum {
|
---|
31 | kIsOwner = BIT(14)
|
---|
32 | };
|
---|
33 |
|
---|
34 | MObservatory *fObservatory; //! Observatory location
|
---|
35 | MPointingPos *fPointPos; //! Present pointing position of the telescope in Zd/Az
|
---|
36 | MPointingPos *fSourcePos; //! Source Postion in sky coordinates
|
---|
37 | MPointingDev *fDeviation; //! Deviation calculated from starguider data
|
---|
38 | MSrcPosCam *fSrcPosCam; //! Output: Source position in the camera
|
---|
39 | MSrcPosCam *fSrcPosAnti; //! Output: Anti Source position in the camera
|
---|
40 | MGeomCam *fGeom; //! Camera geomety
|
---|
41 | MTime *fTime; //! Time of the current event
|
---|
42 | MTaskList *fCallback; //! Callback function to get the number of the cycle
|
---|
43 |
|
---|
44 | UShort_t fRunType; //! Run Type to decide where to get pointing position from
|
---|
45 |
|
---|
46 | TVector2 fFixedPos; //! Fixed source position
|
---|
47 |
|
---|
48 | Int_t fMode; // Mode how the source position is calculated
|
---|
49 |
|
---|
50 | Int_t fNumRandomOffPositions; // Number of possible random off-sourcr position
|
---|
51 |
|
---|
52 | // MSrcPosCalc
|
---|
53 | void SetSrcPos(TVector2 v=TVector2()) const;
|
---|
54 | TVector2 Rotate(TVector2 v, Int_t pass, Int_t num) const;
|
---|
55 | TVector2 CalcXYinCamera(const MVector3 &pos0, const MVector3 &pos) const;
|
---|
56 | TString GetRaDec(const MPointingPos &pos) const;
|
---|
57 | Bool_t GetCoordinate(TString str, Double_t &ret) const;
|
---|
58 | void FreeSourcePos();
|
---|
59 |
|
---|
60 | // MParContainer
|
---|
61 | Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print);
|
---|
62 |
|
---|
63 | // MTask
|
---|
64 | Bool_t ReInit(MParList *pList);
|
---|
65 | Int_t PreProcess(MParList *pList);
|
---|
66 | Int_t Process();
|
---|
67 |
|
---|
68 | public:
|
---|
69 | MSrcPosCalc(const char *name=NULL, const char *title=NULL);
|
---|
70 | ~MSrcPosCalc() { FreeSourcePos(); }
|
---|
71 |
|
---|
72 | // MSrcPosCalc
|
---|
73 | void SetSourcePos(MPointingPos *pos) { FreeSourcePos(); fSourcePos = pos; }
|
---|
74 | void SetSourcePos(Double_t ra, Double_t dec);
|
---|
75 | void SetOwner(Bool_t b=kTRUE) { b ? SetBit(kIsOwner) : ResetBit(kIsOwner); } // Make MSrcPosCalc owner of fSourcePos
|
---|
76 | void SetMode(Mode_t m=kDefault) { fMode = m; }
|
---|
77 | void SetCallback(MTaskList *list) { fCallback=list; }
|
---|
78 | void SetNumRandomOffPositions(Int_t num=0) { fNumRandomOffPositions=num; }
|
---|
79 |
|
---|
80 | ClassDef(MSrcPosCalc, 0) // Calculates the source position in the camera
|
---|
81 | };
|
---|
82 |
|
---|
83 | #endif
|
---|