source: trunk/MagicSoft/Mars/mpointing/MSrcPosCorrect.cc@ 7199

Last change on this file since 7199 was 7196, checked in by tbretz, 19 years ago
*** empty log message ***
File size: 5.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): Thomas Bretz 6/2005 <mailto:tbretz@astro.uni-wuerzburg.de>
19!
20! Copyright: MAGIC Software Development, 2000-2005
21!
22!
23\* ======================================================================== */
24
25//////////////////////////////////////////////////////////////////////////////
26//
27// MSrcPosCorrect
28//
29// For more details see Process()
30//
31//////////////////////////////////////////////////////////////////////////////
32#include "MSrcPosCorrect.h"
33
34#include <TVector2.h>
35
36#include "MParList.h"
37
38#include "MLog.h"
39#include "MLogManip.h"
40
41#include "MSrcPosCam.h"
42#include "MRawRunHeader.h"
43
44ClassImp(MSrcPosCorrect);
45
46using namespace std;
47
48// --------------------------------------------------------------------------
49//
50MSrcPosCorrect::MSrcPosCorrect(const char *name, const char *title)
51 : fSrcPosCam(NULL), fSrcPosAnti(NULL), fAxis(NULL)
52{
53 fName = name ? name : "MSrcPosCorrect";
54 fTitle = title ? title : "Calculates the source position in the camera";
55}
56
57// --------------------------------------------------------------------------
58//
59// Search and if necessary create MSrcPosCam in the parameter list. Search
60// MSourcePos. If not found, do nothing else, and skip the task. If MSrcPosCam
61// did not exist before and has been created here, it will contain as source
62// position the camera center (0,0).
63// In the case that MSourcePos is found, go ahead in searching the rest of
64// necessary containers. The source position will be calculated for each
65// event in Process.
66//
67Int_t MSrcPosCorrect::PreProcess(MParList *pList)
68{
69 fSrcPosCam = (MSrcPosCam*)pList->FindObject("MSrcPosCam");
70 if (!fSrcPosCam)
71 {
72 *fLog << err << "MSrcPosCam not found... aborting." << endl;
73 return kFALSE;
74 }
75
76 fSrcPosAnti = (MSrcPosCam*)pList->FindObject("MSrcPosAnti", "MSrcPosCam");
77
78 fAxis = (MSrcPosCam*)pList->FindCreateObj("MSrcPosCam", "OpticalAxis");
79 if (!fAxis)
80 return kFALSE;
81
82 return kTRUE;
83}
84
85// --------------------------------------------------------------------------
86//
87// Checking for file type. If the file type is Monte Carlo the
88// source position is arbitrarily determined from the MC headers.
89//
90Bool_t MSrcPosCorrect::ReInit(MParList *plist)
91{
92 MRawRunHeader *run = (MRawRunHeader*)plist->FindObject("MRawRunHeader");
93 if (!run)
94 {
95 *fLog << err << "MRawRunHeader not found... aborting." << endl;
96 return kFALSE;
97 }
98
99 fRunType = run->GetRunType();
100 fRunNumber = run->GetRunNumber();
101
102 return kTRUE;
103}
104
105// --------------------------------------------------------------------------
106//
107// Performs source position correction in the camera.
108// Due to missfocussing a shift of
109// dx=0.048deg and dy=0.034deg
110// or
111// dx=14.24mm and dy=9.495mm
112// is added between run 53832 (excl) and 56161 (excl)
113//
114// See also: Runbook
115//
116// 2005-05-23 03:33:51:
117// We start again to make tests on AMC with Roque lamp and PinDiode Tests.
118// At park position, we do a Laser initial isation and a Laser adjustment.
119// We discovered that the procedure we used yester day for Roque Lamp
120// light source was producing a very non-uniform light
121// We did some studies to produce an uniformly illuminated li ght from
122// the Roque Lamp Then we moved the telescope to the Roque Lamp position
123// and did a Laser adjust for the Roque position. We put the telescope to
124// the same shaftencoder values as were used in August to adjust the
125// mirrors
126// ( 29691 for SE-Az and SE-Zd1 1301 and SE-Zd2 9912 ( sometimes
127// oscillating to 9913 ) ) When we looked at the image of the spot on the
128// camer a, we saw a clear offset from the centre. Then we calculated this
129// offset and put the correct numbers in the AMC code. Then we redid the
130// laser adjustment and fou nd the spot to be nicely centred. Our
131// calculations showed that the offset was 0.048 deg in X direction and
132// 0.032 deg in Y direction.
133// Good night
134//
135Int_t MSrcPosCorrect::Process()
136{
137 if (fRunType==MRawRunHeader::kRTMonteCarlo)
138 return kTRUE;
139
140 // FIXME: Implement Culmination correction
141
142 if (fRunNumber<56161 && fRunNumber>53832)
143 {
144 // dx=-0.048deg, dy=0.034deg, d=0.059deg
145 static const TVector2 dxy(-14.24, -9.495);
146 fAxis->SetXY(dxy);
147 fSrcPosCam->Add(dxy);
148 if (fSrcPosAnti)
149 fSrcPosAnti->Add(dxy);
150 }
151
152 return kTRUE;
153}
Note: See TracBrowser for help on using the repository browser.