source: trunk/MagicSoft/Mars/manalysis/MPointingCorr.cc@ 6121

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