1 | /* ======================================================================== *\
|
---|
2 | !
|
---|
3 | ! *
|
---|
4 | ! * This file is part of MARS, the MAGIC Analysis and Reconstruction
|
---|
5 | ! * Software. It is distributed to you in the hope that it can be a useful
|
---|
6 | ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
|
---|
7 | ! * It is distributed WITHOUT ANY WARRANTY.
|
---|
8 | ! *
|
---|
9 | ! * Permission to use, copy, modify and distribute this software and its
|
---|
10 | ! * documentation for any purpose is hereby granted without fee,
|
---|
11 | ! * provided that the above copyright notice appear in all copies and
|
---|
12 | ! * that both that copyright notice and this permission notice appear
|
---|
13 | ! * in supporting documentation. It is provided "as is" without express
|
---|
14 | ! * or implied warranty.
|
---|
15 | ! *
|
---|
16 | !
|
---|
17 | !
|
---|
18 | ! Author(s): Wolfgang Wittek 03/2003 <mailto:wittek@mppmu.mpg.de>
|
---|
19 | !
|
---|
20 | ! Copyright: MAGIC Software Development, 2000-2003
|
---|
21 | !
|
---|
22 | !
|
---|
23 | \* ======================================================================== */
|
---|
24 |
|
---|
25 | /////////////////////////////////////////////////////////////////////////////
|
---|
26 | // //
|
---|
27 | // MCT1PointingCorrCalc //
|
---|
28 | // //
|
---|
29 | // This is a task to do the CT1 pointing correction //
|
---|
30 | // //
|
---|
31 | /////////////////////////////////////////////////////////////////////////////
|
---|
32 |
|
---|
33 | #include "MCT1PointingCorrCalc.h"
|
---|
34 |
|
---|
35 | #include "MParList.h"
|
---|
36 |
|
---|
37 | #include "MSrcPosCam.h"
|
---|
38 | #include "MGeomCam.h"
|
---|
39 | #include "MParameters.h"
|
---|
40 |
|
---|
41 | #include "MLog.h"
|
---|
42 | #include "MLogManip.h"
|
---|
43 |
|
---|
44 | ClassImp(MCT1PointingCorrCalc);
|
---|
45 |
|
---|
46 | // --------------------------------------------------------------------------
|
---|
47 | //
|
---|
48 | // Default constructor.
|
---|
49 | //
|
---|
50 | MCT1PointingCorrCalc::MCT1PointingCorrCalc(const char *srcname,
|
---|
51 | const char *name, const char *title)
|
---|
52 | : fSrcName(srcname)
|
---|
53 | {
|
---|
54 | fName = name ? name : "MCT1PointingCorrCalc";
|
---|
55 | fTitle = title ? title : "Task to do the CT1 pointing correction";
|
---|
56 | }
|
---|
57 |
|
---|
58 | // --------------------------------------------------------------------------
|
---|
59 | //
|
---|
60 | Bool_t MCT1PointingCorrCalc::PreProcess(MParList *pList)
|
---|
61 | {
|
---|
62 | MGeomCam *geom = (MGeomCam*)pList->FindObject("MGeomCam");
|
---|
63 | if (!geom)
|
---|
64 | *fLog << warn << GetDescriptor() << ": No Camera Geometry available. Using mm-scale for histograms." << endl;
|
---|
65 | else
|
---|
66 | {
|
---|
67 | fMm2Deg = geom->GetConvMm2Deg();
|
---|
68 | }
|
---|
69 |
|
---|
70 | fHourAngle = (MParameterD*)pList->FindObject("HourAngle", "MParameterD");
|
---|
71 | if (!fHourAngle)
|
---|
72 | {
|
---|
73 | *fLog << err << "HourAngle [MParameterD] not found... aborting." << endl;
|
---|
74 | return kFALSE;
|
---|
75 | }
|
---|
76 |
|
---|
77 |
|
---|
78 | fSrcPos = (MSrcPosCam*)pList->FindObject(fSrcName, "MSrcPosCam");
|
---|
79 | if (!fSrcPos)
|
---|
80 | {
|
---|
81 | *fLog << err << fSrcName << " [MSrcPosCam] not found... aborting." << endl;
|
---|
82 | return kFALSE;
|
---|
83 | }
|
---|
84 |
|
---|
85 |
|
---|
86 | return kTRUE;
|
---|
87 | }
|
---|
88 |
|
---|
89 | // --------------------------------------------------------------------------
|
---|
90 | //
|
---|
91 | // Do the pointing correction
|
---|
92 | //
|
---|
93 | // the parametrization is for Mkn421 2001 data (Daniel Kranich)
|
---|
94 | //
|
---|
95 | Bool_t MCT1PointingCorrCalc::Process()
|
---|
96 | {
|
---|
97 | // fhourangle is the hour angle [degrees]
|
---|
98 | // (cx, cy) is the source position in the camera [mm]
|
---|
99 | //
|
---|
100 | Float_t fhourangle = fHourAngle->GetVal();
|
---|
101 |
|
---|
102 | //*fLog << "MCT1PointingCorrCalc::Process; fhourangle = "
|
---|
103 | // << fhourangle << endl;
|
---|
104 |
|
---|
105 | Float_t cx = -0.05132 - 0.001064 * fhourangle
|
---|
106 | - 3.530e-6 * fhourangle * fhourangle;
|
---|
107 | cx /= fMm2Deg;
|
---|
108 |
|
---|
109 | Float_t cy = -0.04883 - 0.0003175* fhourangle
|
---|
110 | - 2.165e-5 * fhourangle * fhourangle;
|
---|
111 | cy /= fMm2Deg;
|
---|
112 |
|
---|
113 | fSrcPos->SetXY(cx, cy);
|
---|
114 |
|
---|
115 | //*fLog << "MCT1PointingCorrCal::Process; fhourangle, cx, cy, fMm2Deg = "
|
---|
116 | // << fhourangle << ", " << cx << ", " << cy << ", "
|
---|
117 | // << fMm2Deg << endl;
|
---|
118 |
|
---|
119 | fSrcPos->SetReadyToSave();
|
---|
120 |
|
---|
121 | return kTRUE;
|
---|
122 | }
|
---|
123 |
|
---|
124 |
|
---|
125 |
|
---|