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