source: trunk/MagicSoft/Mars/manalysis/MCT1PointingCorrCalc.cc@ 2057

Last change on this file since 2057 was 1952, checked in by tbretz, 21 years ago
*** empty log message ***
File size: 4.0 KB
Line 
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 "MMcEvt.hxx"
38#include "MSrcPosCam.h"
39#include "MGeomCam.h"
40#include "MParameters.h"
41
42#include "MLog.h"
43#include "MLogManip.h"
44
45ClassImp(MCT1PointingCorrCalc);
46
47// --------------------------------------------------------------------------
48//
49// Default constructor.
50//
51MCT1PointingCorrCalc::MCT1PointingCorrCalc(const char *srcname,
52 const char *name, const char *title)
53 : fSrcName(srcname)
54{
55 fName = name ? name : "MCT1PointingCorrCalc";
56 fTitle = title ? title : "Task to do the CT1 pointing correction";
57}
58
59// --------------------------------------------------------------------------
60//
61Bool_t MCT1PointingCorrCalc::PreProcess(MParList *pList)
62{
63 MGeomCam *geom = (MGeomCam*)pList->FindObject("MGeomCam");
64 if (!geom)
65 *fLog << warn << GetDescriptor() << ": No Camera Geometry available. Using mm-scale for histograms." << endl;
66 else
67 {
68 fMm2Deg = geom->GetConvMm2Deg();
69 }
70
71
72 fMcEvt = (MMcEvt*)pList->FindObject("MMcEvt");
73 if (!fMcEvt)
74 {
75 *fLog << err << "MMcEvt not found... aborting." << endl;
76 return kFALSE;
77 }
78
79 fHourAngle = (MParameterD*)pList->FindObject("HourAngle", "MParameterD");
80 if (!fHourAngle)
81 {
82 *fLog << err << "HourAngle [MParameterD] not found... aborting." << endl;
83 return kFALSE;
84 }
85
86
87 fSrcPos = (MSrcPosCam*)pList->FindObject(fSrcName, "MSrcPosCam");
88 if (!fSrcPos)
89 {
90 *fLog << err << fSrcName << " [MSrcPosCam] not found... aborting." << endl;
91 return kFALSE;
92 }
93
94
95 return kTRUE;
96}
97
98// --------------------------------------------------------------------------
99//
100// Do the pointing correction
101//
102// the parametrization is for Mkn421 2001 data (Daniel Kranich)
103//
104Bool_t MCT1PointingCorrCalc::Process()
105{
106 // fhourangle is the hour angle [degrees]
107 // (cx, cy) is the source position in the camera [mm]
108 //
109 Float_t fhourangle = fHourAngle->GetVal();
110
111 //*fLog << "MCT1PointingCorrCalc::Process; fhourangle = "
112 // << fhourangle << endl;
113
114 Float_t cx = -0.05132 - 0.001064 * fhourangle
115 - 3.530e-6 * fhourangle * fhourangle;
116 cx /= fMm2Deg;
117
118 Float_t cy = -0.04883 - 0.0003175* fhourangle
119 - 2.165e-5 * fhourangle * fhourangle;
120 cy /= fMm2Deg;
121
122 fSrcPos->SetXY(cx, cy);
123
124 //*fLog << "MCT1PointingCorrCal::Process; fhourangle, cx, cy, fMm2Deg = "
125 // << fhourangle << ", " << cx << ", " << cy << ", "
126 // << fMm2Deg << endl;
127
128 fSrcPos->SetReadyToSave();
129
130 return kTRUE;
131}
132
Note: See TracBrowser for help on using the repository browser.