| 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 | TString  GetRaDec(const MPointingPos &pos) const; | 
|---|
| 56 | Bool_t   GetCoordinate(TString str, Double_t &ret) const; | 
|---|
| 57 | void     FreeSourcePos(); | 
|---|
| 58 |  | 
|---|
| 59 | // MParContainer | 
|---|
| 60 | Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print); | 
|---|
| 61 |  | 
|---|
| 62 | // MTask | 
|---|
| 63 | Bool_t ReInit(MParList *pList); | 
|---|
| 64 | Int_t  PreProcess(MParList *pList); | 
|---|
| 65 | Int_t  Process(); | 
|---|
| 66 |  | 
|---|
| 67 | public: | 
|---|
| 68 | MSrcPosCalc(const char *name=NULL, const char *title=NULL); | 
|---|
| 69 | ~MSrcPosCalc() { FreeSourcePos(); } | 
|---|
| 70 |  | 
|---|
| 71 | // MSrcPosCalc | 
|---|
| 72 | void SetSourcePos(MPointingPos *pos) { FreeSourcePos(); fSourcePos = pos; } | 
|---|
| 73 | void SetSourcePos(Double_t ra, Double_t dec); | 
|---|
| 74 | void SetOwner(Bool_t b=kTRUE) { b ? SetBit(kIsOwner) : ResetBit(kIsOwner); } // Make MSrcPosCalc owner of fSourcePos | 
|---|
| 75 | void SetMode(Mode_t m=kDefault) { fMode = m; } | 
|---|
| 76 | void SetCallback(MTaskList *list) { fCallback=list; } | 
|---|
| 77 | void SetNumRandomOffPositions(Int_t num=0) { fNumRandomOffPositions=num; } | 
|---|
| 78 |  | 
|---|
| 79 | ClassDef(MSrcPosCalc, 0) // Calculates the source position in the camera | 
|---|
| 80 | }; | 
|---|
| 81 |  | 
|---|
| 82 | #endif | 
|---|