source: branches/MarsGapdTimeJitter/mmuon/MMuonCalibParCalc.cc@ 18306

Last change on this file since 18306 was 9365, checked in by tbretz, 16 years ago
*** empty log message ***
File size: 5.9 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// In the second step two histograms has to be filled for every muon.
40// This is made by MHSingleMuon (look there for more information).
41//
42// The calculation of Muon parameters works as the followings;
43//
44// MTaskList tlist;
45// MMuonSearchParCalc musearchcalc;
46// MFillH fillmuon("MHSingleMuon", "", "FillMuon");
47// MMuonCalibParCalc mucalibcalc;
48// tlist.AddToList(&musearchcalc);
49// tlist.AddToList(&fillmuon);
50// tlist.AddToList(&mucalibcalc);.
51//
52//
53// For a faster coputation, pre cuts to select the candidates
54// of muons for the calibration should be done. It is already implemented
55// in star. You can set the values in star.rc.
56//
57// ### TODO ###
58// Up to now, in the histogram the error of the signal is estimated from
59// the signal using a rough conversion factor and a F-factor and this values
60// are global for all pixels. This is not the case for the real data. This
61// value should be taken from some containers. In addition, the error of
62// the pedestal is not taken into accout. The error treatment should be
63// done correctly.
64//
65//
66// Input Containers:
67// MGeomCam
68// MSignalCam
69// MMuonSearchPar
70//
71// Output Containers:
72// MMuonCalibPar
73//
74//////////////////////////////////////////////////////////////////////////////
75
76#include "MMuonCalibParCalc.h"
77
78#include <TH1.h>
79#include <TF1.h>
80#include <TMinuit.h>
81
82#include "MLog.h"
83#include "MLogManip.h"
84
85#include "MParList.h"
86
87#include "MGeomCam.h"
88#include "MGeomPix.h"
89
90#include "MSignalCam.h"
91
92#include "MMuonCalibPar.h"
93#include "MMuonSetup.h"
94#include "MMuonSearchPar.h"
95#include "MHSingleMuon.h"
96
97using namespace std;
98
99ClassImp(MMuonCalibParCalc);
100
101static const TString gsDefName = "MMuonCalibParCalc";
102static const TString gsDefTitle = "Calculate new image parameters";
103
104// -------------------------------------------------------------------------
105//
106// Default constructor.
107//
108MMuonCalibParCalc::MMuonCalibParCalc(const char *name, const char *title)
109// : fEnableImpactCalc(kFALSE)
110{
111 fName = name ? name : gsDefName.Data();
112 fTitle = title ? title : gsDefTitle.Data();
113}
114
115// -------------------------------------------------------------------------
116//
117Int_t MMuonCalibParCalc::PreProcess(MParList *pList)
118{
119 fGeomCam = (MGeomCam*)pList->FindObject("MGeomCam");
120 if (!fGeomCam)
121 {
122 *fLog << err << "MGeomCam not found... abort." << endl;
123 return kFALSE;
124 }
125
126 fHist = (MHSingleMuon*)pList->FindObject("MHSingleMuon");
127 if (!fHist)
128 {
129 *fLog << err << "MHSingleMuon not found... abort." << endl;
130 return kFALSE;
131 }
132
133 fMuonSetup = (MMuonSetup*)pList->FindObject("MMuonSetup");
134 if (!fMuonSetup)
135 {
136 *fLog << err << "MMuonSetup not found... abort." << endl;
137 return kFALSE;
138 }
139
140 fMuonCalibPar = (MMuonCalibPar*)pList->FindCreateObj("MMuonCalibPar");
141 if (!fMuonCalibPar)
142 return kFALSE;
143
144 fMuonSearchPar = (MMuonSearchPar*)pList->FindCreateObj("MMuonSearchPar");
145 if (!fMuonSearchPar)
146 return kFALSE;
147
148 return kTRUE;
149}
150
151// -------------------------------------------------------------------------
152//
153Int_t MMuonCalibParCalc::Process()
154{
155 // Calculation of ArcPhi, ArcWidth and MuonSize.
156 const Float_t thresphi = fMuonSetup->GetThresholdArcPhi();
157 const Float_t threswidth = fMuonSetup->GetThresholdArcWidth();
158
159 Double_t peakphi, arcphi;
160 Double_t width, chi;
161
162 if (!fHist->CalcPhi(thresphi, peakphi, arcphi))
163 return kTRUE;
164
165 if (!fHist->CalcWidth(threswidth, width, chi))
166 return kTRUE;
167
168 // Get Muon Size
169 //fMuonCalibPar->SetMuonSize(fHist->GetHistPhi().Integral());
170
171 fMuonCalibPar->SetMuonSize(fHist->CalcSize());
172
173 // Calculate ArcPhi
174 fMuonCalibPar->SetPeakPhi(peakphi);
175 fMuonCalibPar->SetArcPhi(arcphi);
176
177 fMuonCalibPar->SetTime(fHist->GetRelTimeMean(), fHist->GetRelTimeSigma());
178
179// const Float_t conv = TMath::RadToDeg()*fGeomCam->GetConvMm2Deg();
180// fMuonCalibPar->SetArcLength(fMuonCalibPar->GetArcPhi()
181// *fMuonSearchPar->GetRadius()*conv);
182
183 // Calculation of ArcWidth etc...
184 fMuonCalibPar->SetChiArcWidth(chi);
185 fMuonCalibPar->SetArcWidth(width);
186
187 const Double_t rad = fMuonSearchPar->GetRadius()*fGeomCam->GetConvMm2Deg();
188 const Double_t dev = fMuonSearchPar->GetDeviation()*fGeomCam->GetConvMm2Deg();
189
190 // Check if this is a 'Write-Out' candidate
191 if (arcphi>160 && rad>0.573 && rad<1.35 && dev<0.169)
192 fMuonCalibPar->SetReadyToSave();
193
194 return kTRUE;
195}
Note: See TracBrowser for help on using the repository browser.