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

Last change on this file since 7207 was 7200, checked in by tbretz, 19 years ago
*** empty log message ***
File size: 5.3 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 if (fRunNumber<56161 && fRunNumber>53832)
103 {
104 *fLog << inf << "Run Number " << fRunNumber << " between 53832 and 56161." << endl;
105 *fLog << "A missfocussing correction (-0.048deg/0.034deg) will be applied." << endl;
106 }
107
108 return kTRUE;
109}
110
111// --------------------------------------------------------------------------
112//
113// Performs source position correction in the camera.
114// Due to missfocussing a shift of
115// dx=0.048deg and dy=0.034deg
116// or
117// dx=14.24mm and dy=9.495mm
118// is added between run 53832 (excl) and 56161 (excl)
119//
120// See also: Runbook
121//
122// 2005-05-23 03:33:51:
123// We start again to make tests on AMC with Roque lamp and PinDiode Tests.
124// At park position, we do a Laser initial isation and a Laser adjustment.
125// We discovered that the procedure we used yester day for Roque Lamp
126// light source was producing a very non-uniform light
127// We did some studies to produce an uniformly illuminated li ght from
128// the Roque Lamp Then we moved the telescope to the Roque Lamp position
129// and did a Laser adjust for the Roque position. We put the telescope to
130// the same shaftencoder values as were used in August to adjust the
131// mirrors
132// ( 29691 for SE-Az and SE-Zd1 1301 and SE-Zd2 9912 ( sometimes
133// oscillating to 9913 ) ) When we looked at the image of the spot on the
134// camer a, we saw a clear offset from the centre. Then we calculated this
135// offset and put the correct numbers in the AMC code. Then we redid the
136// laser adjustment and fou nd the spot to be nicely centred. Our
137// calculations showed that the offset was 0.048 deg in X direction and
138// 0.032 deg in Y direction.
139// Good night
140//
141Int_t MSrcPosCorrect::Process()
142{
143 if (fRunType==MRawRunHeader::kRTMonteCarlo)
144 return kTRUE;
145
146 // FIXME: Implement Culmination correction
147
148 if (fRunNumber<56161 && fRunNumber>53832)
149 {
150 // dx=-0.048deg, dy=0.034deg, d=0.059deg
151 static const TVector2 dxy(-14.24, -9.495);
152 fAxis->SetXY(dxy);
153 fSrcPosCam->Add(dxy);
154 if (fSrcPosAnti)
155 fSrcPosAnti->Add(dxy);
156 }
157
158 return kTRUE;
159}
Note: See TracBrowser for help on using the repository browser.