| 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): Keiichi Mase 10/2004 <mailto:mase@mppmu.mpg.de>
|
|---|
| 19 | ! Markus Meyer 10/2004 <mailto:meyer@astro.uni-wuerzburg.de>
|
|---|
| 20 | !
|
|---|
| 21 | ! Copyright: MAGIC Software Development, 2000-2004
|
|---|
| 22 | !
|
|---|
| 23 | !
|
|---|
| 24 | \* ======================================================================== */
|
|---|
| 25 |
|
|---|
| 26 | //////////////////////////////////////////////////////////////////////////////
|
|---|
| 27 | //
|
|---|
| 28 | // MMuonCalibParCalc
|
|---|
| 29 | //
|
|---|
| 30 | // Task to calculate the muon parameters
|
|---|
| 31 | //
|
|---|
| 32 | // This class allows you to get more muon information especially usefule for
|
|---|
| 33 | // the calibration of our telescope. This class store the information into the
|
|---|
| 34 | // container of MMuonCalibPar. The actual calculation is done in the class of
|
|---|
| 35 | // MMuonCalibPar. Please see the manual.
|
|---|
| 36 | //
|
|---|
| 37 | // In order to make this class work, we need the information of the arc
|
|---|
| 38 | // center and the radius. Therefore, we need to use the task of
|
|---|
| 39 | // MMuonSearchParCalc.
|
|---|
| 40 | //
|
|---|
| 41 | // You can use this class such as the followings;
|
|---|
| 42 | //
|
|---|
| 43 | // MTaskList tlist;
|
|---|
| 44 | // MMuonSearchParCalc musearchcalc;
|
|---|
| 45 | // MMuonCalibParCalc mucalibcalc;
|
|---|
| 46 | // tlist.AddToList(&musearchcalc);
|
|---|
| 47 | // tlist.AddToList(&mucalibcalc);.
|
|---|
| 48 | //
|
|---|
| 49 | // You may change the allowed region to estimate muon parameters such as
|
|---|
| 50 | // Muon SIZE and ARC LENGTH. The default value is 60 mm (0.2 deg.). If the
|
|---|
| 51 | // estimated radius of the arc is 1.0 degree, we take the photons in the
|
|---|
| 52 | // radius range from 0.8 to 1.2 degrees. You can change this value such as
|
|---|
| 53 | // the followings;
|
|---|
| 54 | //
|
|---|
| 55 | // MParList plist;
|
|---|
| 56 | // MMuonCalibPar muparcalib;
|
|---|
| 57 | // plist.AddToList(&muparcalib);.
|
|---|
| 58 | // muparcalib.SetMargin(60.);
|
|---|
| 59 | //
|
|---|
| 60 | // You can retrieve the histogram (TH1F) using the function of GetHistPhi()
|
|---|
| 61 | // (also GetHistWid()). Therefore, you can draw the histogram such as
|
|---|
| 62 | //
|
|---|
| 63 | // muparcalib.GetHistPhi().Draw();.
|
|---|
| 64 | //
|
|---|
| 65 | // In order to use another information of muons such as the center position
|
|---|
| 66 | // of the estimated circle, the radius of the circle. Use the infomation
|
|---|
| 67 | // stored in MMuonSearchPar.
|
|---|
| 68 | //
|
|---|
| 69 | //
|
|---|
| 70 | // For the faster computation, by default, the calculation of impact
|
|---|
| 71 | // parameter is suppressed. If you want to calculate the impact parameter
|
|---|
| 72 | // from the muon image, you can use the function of EnableImpactCalc(),
|
|---|
| 73 | // namely;
|
|---|
| 74 | //
|
|---|
| 75 | // muparcalib.EnableImpactCalc();.
|
|---|
| 76 | //
|
|---|
| 77 | // In addition, for the faster comutation, pre cuts to select the candidates
|
|---|
| 78 | // of muons for the calibration is done. You can set the values using the
|
|---|
| 79 | // function of SetPreCuts. This function takes 5 variables. They correspond
|
|---|
| 80 | // to the cur for the Arc Radius (low and high), the deviation of the fit
|
|---|
| 81 | // (high), the Muon Size (low) and Arc Phi (low). You can set them such as
|
|---|
| 82 | //
|
|---|
| 83 | // mucalibcalc.SetPreCuts(180., 400., 50., 2000., 180.);
|
|---|
| 84 | //
|
|---|
| 85 | // If you want to disable the pre cuts, you can disable it by using the
|
|---|
| 86 | // function of DisablePreCuts(), namely;
|
|---|
| 87 | //
|
|---|
| 88 | // muparcalib.DisablePreCuts();.
|
|---|
| 89 | //
|
|---|
| 90 | //
|
|---|
| 91 | // ### TODO ###
|
|---|
| 92 | // Up to now, in the histogram the error of the signal is estimated from
|
|---|
| 93 | // the signal using a rough conversion factor and a F-factor and this values
|
|---|
| 94 | // are global for all pixels. This is not the case for the real data. This
|
|---|
| 95 | // value should be taken from some containers. In addition, the error of
|
|---|
| 96 | // the pedestal is not taken into accout. The error treatment should be
|
|---|
| 97 | // done correctly.
|
|---|
| 98 | //
|
|---|
| 99 | // Because of this rough treatment of the error, it may be better to use
|
|---|
| 100 | // the image after the cleaning for the evaluation of the Arc Width. There
|
|---|
| 101 | // is a possibility to use the image after the cleaning for the Arc Width.
|
|---|
| 102 | // You can use the function of UseCleanForWid(). However, this treatment
|
|---|
| 103 | // should be temporal and if the problem of the error is fixed, this function
|
|---|
| 104 | // will be removed.
|
|---|
| 105 | //
|
|---|
| 106 | //
|
|---|
| 107 | // Input Containers:
|
|---|
| 108 | // [MGeomCam]
|
|---|
| 109 | // [MCerPhotEvt]
|
|---|
| 110 | // [MMuonSearchPar]
|
|---|
| 111 | //
|
|---|
| 112 | // Output Containers:
|
|---|
| 113 | // [MMuonCalibPar]
|
|---|
| 114 | //
|
|---|
| 115 | //////////////////////////////////////////////////////////////////////////////
|
|---|
| 116 |
|
|---|
| 117 | #include "MMuonCalibParCalc.h"
|
|---|
| 118 |
|
|---|
| 119 | #include <fstream>
|
|---|
| 120 |
|
|---|
| 121 | #include "MParList.h"
|
|---|
| 122 |
|
|---|
| 123 | #include "MGeomCam.h"
|
|---|
| 124 | #include "MSrcPosCam.h"
|
|---|
| 125 | #include "MCerPhotEvt.h"
|
|---|
| 126 | #include "MMuonSearchPar.h"
|
|---|
| 127 | #include "MMuonCalibPar.h"
|
|---|
| 128 | #include "MLog.h"
|
|---|
| 129 | #include "MLogManip.h"
|
|---|
| 130 |
|
|---|
| 131 | using namespace std;
|
|---|
| 132 |
|
|---|
| 133 | ClassImp(MMuonCalibParCalc);
|
|---|
| 134 |
|
|---|
| 135 | static const TString gsDefName = "MMuonCalibParCalc";
|
|---|
| 136 | static const TString gsDefTitle = "Calculate new image parameters";
|
|---|
| 137 |
|
|---|
| 138 | // -------------------------------------------------------------------------
|
|---|
| 139 | //
|
|---|
| 140 | // Default constructor.
|
|---|
| 141 | //
|
|---|
| 142 | MMuonCalibParCalc::MMuonCalibParCalc(const char *name, const char *title)
|
|---|
| 143 | : fCerPhotName("MCerPhotEvt")
|
|---|
| 144 | {
|
|---|
| 145 | fName = name ? name : gsDefName.Data();
|
|---|
| 146 | fTitle = title ? title : gsDefTitle.Data();
|
|---|
| 147 |
|
|---|
| 148 | fPreCuts[0] = 180.;
|
|---|
| 149 | fPreCuts[1] = 400.;
|
|---|
| 150 | fPreCuts[2] = 50.;
|
|---|
| 151 | fPreCuts[3] = 2000.;
|
|---|
| 152 | fPreCuts[4] = 150.;
|
|---|
| 153 | }
|
|---|
| 154 |
|
|---|
| 155 | // -------------------------------------------------------------------------
|
|---|
| 156 | //
|
|---|
| 157 | Int_t MMuonCalibParCalc::PreProcess(MParList *pList)
|
|---|
| 158 | {
|
|---|
| 159 | fCerPhotEvt = (MCerPhotEvt*)pList->FindObject(AddSerialNumber(fCerPhotName), "MCerPhotEvt");
|
|---|
| 160 | if (!fCerPhotEvt)
|
|---|
| 161 | {
|
|---|
| 162 | *fLog << dbginf << "MCerPhotEvt not found... aborting." << endl;
|
|---|
| 163 | return kFALSE;
|
|---|
| 164 | }
|
|---|
| 165 |
|
|---|
| 166 | fGeomCam = (MGeomCam*)pList->FindObject("MGeomCam");
|
|---|
| 167 | if (!fGeomCam)
|
|---|
| 168 | {
|
|---|
| 169 | *fLog << dbginf << "MGeomCam (Camera Geometry) missing in Parameter List... aborting." << endl;
|
|---|
| 170 | return kFALSE;
|
|---|
| 171 | }
|
|---|
| 172 |
|
|---|
| 173 | fMuonCalibPar = (MMuonCalibPar*)pList->FindCreateObj("MMuonCalibPar", "MMuonCalibPar");
|
|---|
| 174 | if (!fMuonCalibPar)
|
|---|
| 175 | {
|
|---|
| 176 | *fLog << dbginf << "MMuonCalibPar missing in Parameter List... aborting." << endl;
|
|---|
| 177 | return kFALSE;
|
|---|
| 178 | }
|
|---|
| 179 |
|
|---|
| 180 | fMuonSearchPar = (MMuonSearchPar*)pList->FindCreateObj("MMuonSearchPar", "MMuonSearchPar");
|
|---|
| 181 | if (!fMuonSearchPar)
|
|---|
| 182 | {
|
|---|
| 183 | *fLog << dbginf << "MMuonSearchPar missing in Parameter List... aborting." << endl;
|
|---|
| 184 | return kFALSE;
|
|---|
| 185 | }
|
|---|
| 186 |
|
|---|
| 187 | return kTRUE;
|
|---|
| 188 | }
|
|---|
| 189 |
|
|---|
| 190 | // -------------------------------------------------------------------------
|
|---|
| 191 | //
|
|---|
| 192 | Int_t MMuonCalibParCalc::Process()
|
|---|
| 193 | {
|
|---|
| 194 |
|
|---|
| 195 | if(!fMuonCalibPar->Calc(*fGeomCam, *fCerPhotEvt, *fMuonSearchPar, fPreCuts))
|
|---|
| 196 | return kCONTINUE;
|
|---|
| 197 |
|
|---|
| 198 | return kTRUE;
|
|---|
| 199 | }
|
|---|
| 200 |
|
|---|
| 201 | void MMuonCalibParCalc::SetMargin(Float_t margin)
|
|---|
| 202 | {
|
|---|
| 203 | fMuonCalibPar->SetMargin(margin);
|
|---|
| 204 | }
|
|---|
| 205 |
|
|---|
| 206 | void MMuonCalibParCalc::EnableImpactCalc()
|
|---|
| 207 | {
|
|---|
| 208 | fMuonCalibPar->EnableImpactCalc();
|
|---|
| 209 | }
|
|---|
| 210 |
|
|---|
| 211 | void MMuonCalibParCalc::DisablePreCuts()
|
|---|
| 212 | {
|
|---|
| 213 | fMuonCalibPar->DisablePreCuts();
|
|---|
| 214 | }
|
|---|
| 215 |
|
|---|
| 216 | void MMuonCalibParCalc::SetPreCuts
|
|---|
| 217 | (Float_t radcutlow, Float_t radcuthigh, Float_t devcuthigh,
|
|---|
| 218 | Float_t musizecutlow, Float_t arcphicutlow)
|
|---|
| 219 | {
|
|---|
| 220 | fPreCuts[0] = radcutlow;
|
|---|
| 221 | fPreCuts[1] = radcuthigh;
|
|---|
| 222 | fPreCuts[2] = devcuthigh;
|
|---|
| 223 | fPreCuts[3] = musizecutlow;
|
|---|
| 224 | fPreCuts[4] = arcphicutlow;
|
|---|
| 225 | }
|
|---|
| 226 |
|
|---|