source: trunk/MagicSoft/Mars/mmuon/MMuonCalibParCalc.cc@ 7005

Last change on this file since 7005 was 7005, checked in by tbretz, 19 years ago
*** empty log message ***
File size: 6.7 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): 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 useful for
33// the calibration of our telescope. This class store the information into the
34// container of MMuonCalibPar.
35//
36// In order to make this class work, we need the information of the arc
37// center and the radius. Therefore, we need to use the task of
38// MMuonSearchParCalc.
39//
40// You can use this class such as the followings;
41//
42// MTaskList tlist;
43// MMuonSearchParCalc musearchcalc;
44// MMuonCalibParCalc mucalibcalc;
45// tlist.AddToList(&musearchcalc);
46// tlist.AddToList(&mucalibcalc);.
47//
48// You may change the allowed region to estimate muon parameters such as
49// Muon SIZE and ARC LENGTH. The default value is 60 mm (0.2 deg.). If the
50// estimated radius of the arc is 1.0 degree, we take the photons in the
51// radius range from 0.8 to 1.2 degrees. You can change this value such as
52// the followings;
53//
54// mucalibcalc.SetMargin(60.);
55//
56// You can retrieve the histogram (TH1F) using the function of GetHistPhi()
57// (also GetHistWid()). Therefore, you can draw the histogram such as
58//
59// MParList plist;
60// MMuonCalibPar muparcalib;
61// plist.AddToList(&muparcalib);.
62// muparcalib.GetHistPhi().Draw();.
63//
64// In order to use another information of muons such as the center position
65// of the estimated circle, the radius of the circle. Use the infomation
66// stored in MMuonSearchPar.
67//
68//
69// // For the faster computation, by default, the calculation of impact
70// // parameter is suppressed. If you want to calculate the impact parameter
71// // from the muon image, you can use the function of EnableImpactCalc(),
72// // namely;
73// //
74// // mucalibcalc.EnableImpactCalc();.
75//
76// In addition, for the faster comutation, pre cuts to select the candidates
77// of muons for the calibration is done. You can set the values using the
78// function of SetPreCuts. This function takes 5 variables. They correspond
79// to the cur for the Arc Radius (low and high), the deviation of the fit
80// (high), the Muon Size (low) and Arc Phi (low). You can set them such as
81//
82// mucalibcalc.SetPreCuts(180., 400., 50., 2000., 180.);
83//
84// If you want to disable the pre cuts, you can disable it by using the
85// function of DisablePreCuts(), namely;
86//
87// mucalibcalc.DisablePreCuts();.
88//
89//
90// ### TODO ###
91// Up to now, in the histogram the error of the signal is estimated from
92// the signal using a rough conversion factor and a F-factor and this values
93// are global for all pixels. This is not the case for the real data. This
94// value should be taken from some containers. In addition, the error of
95// the pedestal is not taken into accout. The error treatment should be
96// done correctly.
97//
98//
99// Input Containers:
100// MGeomCam
101// MSignalCam
102// MMuonSearchPar
103//
104// Output Containers:
105// MMuonCalibPar
106//
107//////////////////////////////////////////////////////////////////////////////
108
109#include "MMuonCalibParCalc.h"
110
111#include <TH1.h>
112#include <TF1.h>
113#include <TMinuit.h>
114
115#include "MLog.h"
116#include "MLogManip.h"
117
118#include "MParList.h"
119
120#include "MGeomCam.h"
121#include "MGeomPix.h"
122
123#include "MSignalCam.h"
124
125#include "MMuonCalibPar.h"
126#include "MMuonSetup.h"
127#include "MMuonSearchPar.h"
128#include "MHSingleMuon.h"
129
130using namespace std;
131
132ClassImp(MMuonCalibParCalc);
133
134static const TString gsDefName = "MMuonCalibParCalc";
135static const TString gsDefTitle = "Calculate new image parameters";
136
137// -------------------------------------------------------------------------
138//
139// Default constructor.
140//
141MMuonCalibParCalc::MMuonCalibParCalc(const char *name, const char *title)
142// : fEnableImpactCalc(kFALSE)
143{
144 fName = name ? name : gsDefName.Data();
145 fTitle = title ? title : gsDefTitle.Data();
146}
147
148// -------------------------------------------------------------------------
149//
150Int_t MMuonCalibParCalc::PreProcess(MParList *pList)
151{
152 fGeomCam = (MGeomCam*)pList->FindObject("MGeomCam");
153 if (!fGeomCam)
154 {
155 *fLog << err << "MGeomCam not found... abort." << endl;
156 return kFALSE;
157 }
158
159 fHist = (MHSingleMuon*)pList->FindObject("MHSingleMuon");
160 if (!fHist)
161 {
162 *fLog << err << "MHSingleMuon not found... abort." << endl;
163 return kFALSE;
164 }
165
166 fMuonSetup = (MMuonSetup*)pList->FindObject("MMuonSetup");
167 if (!fMuonSetup)
168 {
169 *fLog << err << "MMuonSetup not found... abort." << endl;
170 return kFALSE;
171 }
172
173 fMuonCalibPar = (MMuonCalibPar*)pList->FindCreateObj("MMuonCalibPar");
174 if (!fMuonCalibPar)
175 return kFALSE;
176
177 fMuonSearchPar = (MMuonSearchPar*)pList->FindCreateObj("MMuonSearchPar");
178 if (!fMuonSearchPar)
179 return kFALSE;
180
181 return kTRUE;
182}
183
184// -------------------------------------------------------------------------
185//
186Int_t MMuonCalibParCalc::Process()
187{
188 // Calculation of Arc Phi etc...
189 const Float_t thresphi = fMuonSetup->GetThresholdArcPhi();
190 const Float_t threswidth = fMuonSetup->GetThresholdArcWidth();
191
192 Double_t peakphi, arcphi;
193 Double_t width, chi;
194
195 if (!fHist->CalcPhi(thresphi, peakphi, arcphi))
196 return kTRUE;
197
198 if (!fHist->CalcWidth(threswidth, width, chi))
199 return kTRUE;
200
201 // Get Muon Size
202 fMuonCalibPar->SetMuonSize(fHist->GetHistPhi().Integral());
203
204 // Calculate Arc Length
205 fMuonCalibPar->SetPeakPhi(peakphi);
206 fMuonCalibPar->SetArcPhi(arcphi);
207
208 const Float_t conv = TMath::RadToDeg()*fGeomCam->GetConvMm2Deg();
209 fMuonCalibPar->SetArcLength(fMuonCalibPar->GetArcPhi()*fMuonSearchPar->GetRadius()*conv);
210
211 // Calculation of Arc Width etc...
212 fMuonCalibPar->SetChiArcWidth(chi);
213 fMuonCalibPar->SetArcWidth(width);
214
215 return kTRUE;
216}
Note: See TracBrowser for help on using the repository browser.