Changeset 8719 for trunk/MagicSoft/Mars/mpointing/MSrcPosCorrect.cc
- Timestamp:
- 08/28/07 13:03:04 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mpointing/MSrcPosCorrect.cc
r7388 r8719 18 18 ! Author(s): Thomas Bretz 6/2005 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! 20 ! Copyright: MAGIC Software Development, 2000-200 520 ! Copyright: MAGIC Software Development, 2000-2007 21 21 ! 22 22 ! … … 27 27 // MSrcPosCorrect 28 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 "MGeomCam.h" 42 #include "MSrcPosCam.h" 43 #include "MRawRunHeader.h" 44 #include "MReportStarguider.h" 45 46 ClassImp(MSrcPosCorrect); 47 48 using namespace std; 49 50 // -------------------------------------------------------------------------- 51 // 52 MSrcPosCorrect::MSrcPosCorrect(const char *name, const char *title) 53 : fSrcPosCam(NULL), fSrcPosAnti(NULL), fAxis(NULL), fGeom(NULL) 54 , fDx(-14.24) , fDy(-9.495) 55 56 { 57 fName = name ? name : "MSrcPosCorrect"; 58 fTitle = title ? title : "Calculates the source position in the camera"; 59 } 60 61 // -------------------------------------------------------------------------- 62 // 63 // Search and if necessary create MSrcPosCam in the parameter list. Search 64 // MSourcePos. If not found, do nothing else, and skip the task. If MSrcPosCam 65 // did not exist before and has been created here, it will contain as source 66 // position the camera center (0,0). 67 // In the case that MSourcePos is found, go ahead in searching the rest of 68 // necessary containers. The source position will be calculated for each 69 // event in Process. 70 // 71 Int_t MSrcPosCorrect::PreProcess(MParList *pList) 72 { 73 fSrcPosCam = (MSrcPosCam*)pList->FindObject("MSrcPosCam"); 74 if (!fSrcPosCam) 75 { 76 *fLog << err << "MSrcPosCam not found... aborting." << endl; 77 return kFALSE; 78 } 79 80 fSrcPosAnti = (MSrcPosCam*)pList->FindObject("MSrcPosAnti", "MSrcPosCam"); 81 82 fAxis = (MSrcPosCam*)pList->FindCreateObj("MSrcPosCam", "OpticalAxis"); 83 if (!fAxis) 84 return kFALSE; 85 86 return kTRUE; 87 } 88 89 // -------------------------------------------------------------------------- 90 // 91 // Checking for file type. If the file type is Monte Carlo the 92 // source position is arbitrarily determined from the MC headers. 93 // 94 Bool_t MSrcPosCorrect::ReInit(MParList *plist) 95 { 96 MRawRunHeader *run = (MRawRunHeader*)plist->FindObject("MRawRunHeader"); 97 if (!run) 98 { 99 *fLog << err << "MRawRunHeader not found... aborting." << endl; 100 return kFALSE; 101 } 102 103 fRunType = run->GetRunType(); 104 fRunNumber = run->GetRunNumber(); 105 106 if (fRunNumber<56161 && fRunNumber>53832) 107 { 108 *fLog << inf << "Run Number " << fRunNumber << " between 53832 and 56161." << endl; 109 *fLog << "A misfocussing correction (" << fDx << "mm/" << fDy << "mm) will be applied." << endl; 110 } 111 112 return kTRUE; 113 } 114 115 // -------------------------------------------------------------------------- 116 // 117 // Performs source position correction in the camera. 29 // Performs a misfocussing correction for source and anti-source position 30 // in the camera, i.e. it is assumed that the telscope is pointing well 31 // (all starguider and other corrections are already applied to the 32 // source positon) but the mirror is not focussing to the center of 33 // the camera. 34 // 118 35 // Due to missfocussing a shift of 119 36 // dx=0.048deg and dy=0.034deg … … 121 38 // dx=14.24mm and dy=9.495mm 122 39 // is added between run 53832 (excl) and 56161 (excl) 40 // 123 41 // 124 42 // See also: Runbook … … 153 71 // W-Comae 154 72 // 73 // 74 // For more details see Process() 75 // 76 // Input: 77 // MSrcPosCam 78 // MSrcPosAnti [MSrcPosCam] 79 // 80 // Output: 81 // OpticalAxis [MSrcPosCam] 82 // MSrcPosCam 83 // MSrcPosAnti [MSrcPosCam] 84 // 85 ////////////////////////////////////////////////////////////////////////////// 86 #include "MSrcPosCorrect.h" 87 88 #include <TVector2.h> 89 90 #include "MParList.h" 91 92 #include "MLog.h" 93 #include "MLogManip.h" 94 95 #include "MGeomCam.h" 96 #include "MSrcPosCam.h" 97 #include "MRawRunHeader.h" 98 #include "MReportStarguider.h" 99 100 ClassImp(MSrcPosCorrect); 101 102 using namespace std; 103 104 // -------------------------------------------------------------------------- 105 // 106 MSrcPosCorrect::MSrcPosCorrect(const char *name, const char *title) 107 : fSrcPosCam(NULL), fSrcPosAnti(NULL), fAxis(NULL), fGeom(NULL) 108 , fDx(-14.24) , fDy(-9.495) 109 110 { 111 fName = name ? name : "MSrcPosCorrect"; 112 fTitle = title ? title : "Calculates the source position in the camera"; 113 } 114 115 // -------------------------------------------------------------------------- 116 // 117 // Search and if necessary create MSrcPosCam in the parameter list. Search 118 // MSourcePos. If not found, do nothing else, and skip the task. If MSrcPosCam 119 // did not exist before and has been created here, it will contain as source 120 // position the camera center (0,0). 121 // In the case that MSourcePos is found, go ahead in searching the rest of 122 // necessary containers. The source position will be calculated for each 123 // event in Process. 124 // 125 Int_t MSrcPosCorrect::PreProcess(MParList *pList) 126 { 127 fSrcPosCam = (MSrcPosCam*)pList->FindObject("MSrcPosCam"); 128 if (!fSrcPosCam) 129 { 130 *fLog << err << "MSrcPosCam not found... aborting." << endl; 131 return kFALSE; 132 } 133 134 fSrcPosAnti = (MSrcPosCam*)pList->FindObject("MSrcPosAnti", "MSrcPosCam"); 135 136 fAxis = (MSrcPosCam*)pList->FindCreateObj("MSrcPosCam", "OpticalAxis"); 137 if (!fAxis) 138 return kFALSE; 139 140 return kTRUE; 141 } 142 143 // -------------------------------------------------------------------------- 144 // 145 // Checking for file type. If the file type is Monte Carlo the 146 // source position is arbitrarily determined from the MC headers. 147 // 148 Bool_t MSrcPosCorrect::ReInit(MParList *plist) 149 { 150 MRawRunHeader *run = (MRawRunHeader*)plist->FindObject("MRawRunHeader"); 151 if (!run) 152 { 153 *fLog << err << "MRawRunHeader not found... aborting." << endl; 154 return kFALSE; 155 } 156 157 fRunType = run->GetRunType(); 158 fRunNumber = run->GetRunNumber(); 159 160 if (fRunNumber<56161 && fRunNumber>53832) 161 { 162 *fLog << inf << "Run Number " << fRunNumber << " between 53832 and 56161." << endl; 163 *fLog << "A misfocussing correction (" << fDx << "mm/" << fDy << "mm) will be applied." << endl; 164 } 165 166 return kTRUE; 167 } 168 169 // -------------------------------------------------------------------------- 170 // 171 // The offset fDx/fDy is subtracted from the source position. The anti- 172 // source position is shifted away from the camera-center and rotated 173 // around the camera center according to this correction, because it 174 // should always be symmetric w.r.t. the camera-center, but it is not 175 // necessary on the other side of the camera (e.g. three off-regions). 176 // 155 177 Int_t MSrcPosCorrect::Process() 156 178 { … … 158 180 return kTRUE; 159 181 160 TVector2 d; 161 if (fRunNumber<56161 && fRunNumber>53832) 162 { 163 // dx=-0.048deg, dy=0.034deg, d=0.059deg 164 static const TVector2 dxy(fDx, fDy); 165 166 d -= dxy; 167 } 168 169 fAxis->SetXY(d); 170 fSrcPosCam->Add(d); 171 if (fSrcPosAnti) 172 { 173 d *= -1; // Anti-Source position should always be symetric 174 fSrcPosAnti->Add(d); 175 } 182 if (fRunNumber<=53832 || fRunNumber>=56161) 183 return kTRUE; 184 185 // dx=-0.048deg, dy=0.034deg, d=0.059deg 186 const TVector2 dxy(-fDx, -fDy); 187 188 const TVector2 s1(fSrcPosCam->GetXY()); 189 const TVector2 a1(fSrcPosAnti->GetXY()); 190 const TVector2 s2 = s1 + dxy; 191 192 193 // Anti-Source position should always be symetric w.r.t. camera center 194 TVector2 a2; 195 a2.SetMagPhi(a1.Mod()+s2.Mod()-s1.Mod(), a1.Phi()+s2.DeltaPhi(s1)); 196 197 fAxis->SetXY(dxy); 198 fSrcPosCam->SetXY(s2); 199 fSrcPosAnti->SetXY(s2); 176 200 177 201 return kTRUE; 178 202 } 179 203 204 // -------------------------------------------------------------------------- 205 // 206 // MSrcPosCorrect.Dx: -14.24 207 // MSrcPosCorrect.Dy: -9.495 208 // 209 // For a detailed description see the class reference. 210 // 180 211 Int_t MSrcPosCorrect::ReadEnv(const TEnv &env, TString prefix, Bool_t print) 181 212 {
Note:
See TracChangeset
for help on using the changeset viewer.