| 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 | ! Nadia Tonello 05/2003 <mailto:tonello@mppmu.mpg.de>
|
|---|
| 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 | // NT: You can correct the Mkn421 data (default setting), or the 1ES1959 //
|
|---|
| 32 | // data. //
|
|---|
| 33 | // To change to the correction needed for 1ES1959, you have to call //
|
|---|
| 34 | // the member funcion: SetPointedSource //
|
|---|
| 35 | // //
|
|---|
| 36 | // Example: //
|
|---|
| 37 | // MCT1PointingCorrCalc correct; //
|
|---|
| 38 | // correct.SetPointedSource(MCT1PointingCorrectionCalc::K1959) //
|
|---|
| 39 | // //
|
|---|
| 40 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 41 |
|
|---|
| 42 | #include "MCT1PointingCorrCalc.h"
|
|---|
| 43 |
|
|---|
| 44 | #include "MParList.h"
|
|---|
| 45 |
|
|---|
| 46 | #include "MSrcPosCam.h"
|
|---|
| 47 | #include "MGeomCam.h"
|
|---|
| 48 | #include "MParameters.h"
|
|---|
| 49 |
|
|---|
| 50 | #include "MLog.h"
|
|---|
| 51 | #include "MLogManip.h"
|
|---|
| 52 |
|
|---|
| 53 | ClassImp(MCT1PointingCorrCalc);
|
|---|
| 54 |
|
|---|
| 55 | using namespace std;
|
|---|
| 56 | // --------------------------------------------------------------------------
|
|---|
| 57 | //
|
|---|
| 58 | // Default constructor.
|
|---|
| 59 | //
|
|---|
| 60 | MCT1PointingCorrCalc::MCT1PointingCorrCalc(const char *srcname,
|
|---|
| 61 | const char *name, const char *title)
|
|---|
| 62 | : fSrcName(srcname), fPoiSource(k421)
|
|---|
| 63 | {
|
|---|
| 64 | fName = name ? name : "MCT1PointingCorrCalc";
|
|---|
| 65 | fTitle = title ? title : "Task to do the CT1 pointing correction";
|
|---|
| 66 | }
|
|---|
| 67 |
|
|---|
| 68 | // --------------------------------------------------------------------------
|
|---|
| 69 | //
|
|---|
| 70 | Int_t MCT1PointingCorrCalc::PreProcess(MParList *pList)
|
|---|
| 71 | {
|
|---|
| 72 | MGeomCam *geom = (MGeomCam*)pList->FindObject("MGeomCam");
|
|---|
| 73 | if (!geom)
|
|---|
| 74 | *fLog << warn << GetDescriptor() << ": No Camera Geometry available. Using mm-scale for histograms." << endl;
|
|---|
| 75 | else
|
|---|
| 76 | {
|
|---|
| 77 | fMm2Deg = geom->GetConvMm2Deg();
|
|---|
| 78 | }
|
|---|
| 79 |
|
|---|
| 80 | fHourAngle = (MParameterD*)pList->FindObject("HourAngle", "MParameterD");
|
|---|
| 81 | if (!fHourAngle)
|
|---|
| 82 | {
|
|---|
| 83 | *fLog << err << "HourAngle [MParameterD] not found... aborting." << endl;
|
|---|
| 84 | return kFALSE;
|
|---|
| 85 | }
|
|---|
| 86 |
|
|---|
| 87 |
|
|---|
| 88 | fSrcPos = (MSrcPosCam*)pList->FindObject(fSrcName, "MSrcPosCam");
|
|---|
| 89 | if (!fSrcPos)
|
|---|
| 90 | {
|
|---|
| 91 | *fLog << err << fSrcName << " [MSrcPosCam] not found... aborting." << endl;
|
|---|
| 92 | return kFALSE;
|
|---|
| 93 | }
|
|---|
| 94 |
|
|---|
| 95 |
|
|---|
| 96 | return kTRUE;
|
|---|
| 97 | }
|
|---|
| 98 |
|
|---|
| 99 |
|
|---|
| 100 | // --------------------------------------------------------------------------
|
|---|
| 101 | //
|
|---|
| 102 | //Implemented Daniel Kranich's pointing correction for Mkn421 (2001 data)
|
|---|
| 103 | //
|
|---|
| 104 |
|
|---|
| 105 | void MCT1PointingCorrCalc::PointCorr421()
|
|---|
| 106 | {
|
|---|
| 107 | //*fLog << "MCT1PointingCorrCalc::Process; fhourangle = "
|
|---|
| 108 | // << fhourangle << endl;
|
|---|
| 109 |
|
|---|
| 110 | Float_t fhourangle = fHourAngle->GetVal();
|
|---|
| 111 |
|
|---|
| 112 | Float_t cx = -0.05132 - 0.001064 * fhourangle
|
|---|
| 113 | - 3.530e-6 * fhourangle * fhourangle;
|
|---|
| 114 | cx /= fMm2Deg;
|
|---|
| 115 |
|
|---|
| 116 | Float_t cy = -0.04883 - 0.0003175* fhourangle
|
|---|
| 117 | - 2.165e-5 * fhourangle * fhourangle;
|
|---|
| 118 | cy /= fMm2Deg;
|
|---|
| 119 |
|
|---|
| 120 | fSrcPos->SetXY(cx, cy);
|
|---|
| 121 |
|
|---|
| 122 | //*fLog << "MCT1PointingCorrCal::Process; fhourangle, cx, cy, fMm2Deg = "
|
|---|
| 123 | // << fhourangle << ", " << cx << ", " << cy << ", "
|
|---|
| 124 | // << fMm2Deg << endl;
|
|---|
| 125 |
|
|---|
| 126 | fSrcPos->SetReadyToSave();
|
|---|
| 127 | return;
|
|---|
| 128 | }
|
|---|
| 129 |
|
|---|
| 130 |
|
|---|
| 131 | // --------------------------------------------------------------------------
|
|---|
| 132 | //
|
|---|
| 133 | // NT :Implemente Daniel Kranich's pointing correction for 1ES1959 (2002 data)
|
|---|
| 134 |
|
|---|
| 135 | void MCT1PointingCorrCalc::PointCorr1959()
|
|---|
| 136 | {
|
|---|
| 137 | //*fLog << "MCT1PointingCorrCalc::Process; fhourangle = "
|
|---|
| 138 | // << fhourangle << endl;
|
|---|
| 139 |
|
|---|
| 140 | Float_t fhourangle = fHourAngle->GetVal();
|
|---|
| 141 |
|
|---|
| 142 | Float_t cx = -0.086 - 0.00091 * fhourangle ;
|
|---|
| 143 | cx /= fMm2Deg;
|
|---|
| 144 |
|
|---|
| 145 | Float_t cy = -0.083 - 0.001 * fhourangle ;
|
|---|
| 146 | cy /= fMm2Deg;
|
|---|
| 147 |
|
|---|
| 148 | fSrcPos->SetXY(cx, cy);
|
|---|
| 149 |
|
|---|
| 150 | //*fLog << "MCT1PointingCorrCal::Process; fhourangle, cx, cy, fMm2Deg = "
|
|---|
| 151 | // << fhourangle << ", " << cx << ", " << cy << ", "
|
|---|
| 152 | // << fMm2Deg << endl;
|
|---|
| 153 |
|
|---|
| 154 | fSrcPos->SetReadyToSave();
|
|---|
| 155 | return;
|
|---|
| 156 |
|
|---|
| 157 | }
|
|---|
| 158 | // --------------------------------------------------------------------------
|
|---|
| 159 | //
|
|---|
| 160 | // Do the pointing correction
|
|---|
| 161 | //
|
|---|
| 162 | Int_t MCT1PointingCorrCalc::Process()
|
|---|
| 163 | {
|
|---|
| 164 | // fhourangle is the hour angle [degrees]
|
|---|
| 165 | // (cx, cy) is the source position in the camera [mm]
|
|---|
| 166 | //
|
|---|
| 167 | switch (fPoiSource)
|
|---|
| 168 | {
|
|---|
| 169 | case k421:
|
|---|
| 170 | PointCorr421();
|
|---|
| 171 | case k1959:
|
|---|
| 172 | PointCorr1959();
|
|---|
| 173 | }
|
|---|
| 174 | return kTRUE;
|
|---|
| 175 | }
|
|---|
| 176 |
|
|---|
| 177 |
|
|---|
| 178 |
|
|---|
| 179 |
|
|---|
| 180 |
|
|---|
| 181 |
|
|---|
| 182 |
|
|---|
| 183 |
|
|---|
| 184 |
|
|---|
| 185 |
|
|---|
| 186 |
|
|---|
| 187 |
|
|---|
| 188 |
|
|---|
| 189 |
|
|---|
| 190 |
|
|---|
| 191 |
|
|---|
| 192 |
|
|---|
| 193 |
|
|---|
| 194 |
|
|---|
| 195 |
|
|---|
| 196 |
|
|---|
| 197 |
|
|---|
| 198 |
|
|---|
| 199 |
|
|---|
| 200 |
|
|---|
| 201 |
|
|---|
| 202 |
|
|---|
| 203 |
|
|---|
| 204 |
|
|---|
| 205 |
|
|---|
| 206 |
|
|---|
| 207 |
|
|---|
| 208 |
|
|---|
| 209 |
|
|---|
| 210 |
|
|---|
| 211 |
|
|---|
| 212 |
|
|---|
| 213 |
|
|---|
| 214 |
|
|---|
| 215 |
|
|---|
| 216 |
|
|---|
| 217 |
|
|---|
| 218 |
|
|---|