source: tags/Mars-V0.9.2/mhflux/MHThetaSq.cc

Last change on this file was 7064, checked in by tbretz, 20 years ago
*** empty log message ***
File size: 4.6 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): Thomas Bretz, 5/2005 <mailto:tbretz@astro.uni-wuerzburg.de>
19!
20! Copyright: MAGIC Software Development, 2000-2005
21!
22!
23\* ======================================================================== */
24
25//////////////////////////////////////////////////////////////////////////////
26//
27// MHThetaSq
28//
29// This is a MHAlpha using "ThetaSquared [MParameterD]" as 'alpha'
30//
31// The default binning is determined from the integration range set in
32// MAlphaFitter.
33//
34// For more detailes see MHAlpha.
35//
36//////////////////////////////////////////////////////////////////////////////
37#include "MHThetaSq.h"
38
39#include "MParameters.h"
40#include "MHMatrix.h"
41
42#include "MBinning.h"
43#include "MParList.h"
44#include "MTaskList.h"
45#include "MParameters.h"
46
47#include "MLog.h"
48#include "MLogManip.h"
49
50ClassImp(MHThetaSq);
51
52using namespace std;
53
54// --------------------------------------------------------------------------
55//
56// Default Constructor
57//
58MHThetaSq::MHThetaSq(const char *name, const char *title)
59 : MHAlpha(name, title), fThetaSq(0)
60{
61 //
62 // set the name and title of this object
63 //
64 fName = name ? name : "MHThetaSq";
65 fTitle = title ? title : "Theta Squared plot";
66
67 fNameParameter = "ThetaSquared";
68
69 fHist.SetName("Theta");
70 fHist.SetTitle("Theta");
71 fHist.SetZTitle("\\theta^{2} [deg^{2}]");
72 fHist.SetDirectory(NULL);
73
74 // Main histogram
75 fHistTime.SetName("Theta");
76 fHistTime.SetXTitle("\\theta^{2} [deg^{2}]");
77 fHistTime.SetDirectory(NULL);
78
79 //fHistTime.SetYTitle("\\theta^{2] [deg^{2}]");
80 /*
81 TArrayD arr(50);
82 for (int i=1; i<50; i++)
83 arr[i] = sqrt((arr[i-1]+1)*(arr[i-1]+1) + 1.1)-1;
84 */
85 MBinning binsa, binse, binst;
86 binsa.SetEdges(75, 0, 1.5);
87 //binsa.SetEdges(arr);
88 binse.SetEdgesLog(15, 10, 100000);
89 binst.SetEdgesCos(50, 0, 60);
90 binsa.Apply(fHistTime);
91
92 MH::SetBinning(&fHist, &binst, &binse, &binsa);
93}
94
95// --------------------------------------------------------------------------
96//
97// Overwrites the binning in Alpha (ThetaSq) with a binning for which
98// the upper edge of the 5th bin (bin=5) fit the signal integration window.
99// In total 75 bins are setup.
100//
101// In case of fOffData!=NULL the binnings are taken later from fOffData anyhow.
102//
103Bool_t MHThetaSq::SetupFill(const MParList *pl)
104{
105 // Default is from default fitter
106 // if a user defined fitter is in the parlist: use this range
107 MAlphaFitter *fit = (MAlphaFitter*)pl->FindObject("MAlphaFitter");
108 if (!fit)
109 fit = &fFit;
110
111 MParameterD *cut = (MParameterD*)pl->FindObject("ThetaSquaredCut", "MParameterD");
112 if (cut)
113 fit->SetSignalIntegralMax(cut->GetVal());
114
115 // Get Histogram binnings
116 MBinning binst, binse;
117 binst.SetEdges(fHist, 'x');
118 binse.SetEdges(fHist, 'y');
119
120 // Calculate bining which fits alpha-cut
121 const Double_t intmax = fit->GetSignalIntegralMax();
122 const UInt_t nbins = 75;
123 const UInt_t nsig = 5;
124
125 MBinning binsa(nbins, 0, nbins*intmax/nsig);
126
127 // Apply binning
128 binsa.Apply(fHistTime);
129 MH::SetBinning(&fHist, &binst, &binse, &binsa);
130
131 // Remark: Binnings might be overwritten in MHAlpha::SetupFill
132 return MHAlpha::SetupFill(pl);
133}
134
135// --------------------------------------------------------------------------
136//
137// Store the pointer to the parameter container storing the plotted value
138// (here ThetaSq) in fParameter.
139//
140// return whether it was found or not.
141//
142Bool_t MHThetaSq::GetParameter(const MParList &pl)
143{
144 fParameter = (MParContainer*)pl.FindObject(fNameParameter, "MParameterD");
145 if (fParameter)
146 return kTRUE;
147
148 *fLog << err << fNameParameter << " [MParameterD] not found... abort." << endl;
149 return kFALSE;
150}
151
152// --------------------------------------------------------------------------
153//
154// Return the value from fParemeter which should be filled into the plots
155//
156Double_t MHThetaSq::GetVal() const
157{
158 return static_cast<const MParameterD*>(fParameter)->GetVal();
159}
Note: See TracBrowser for help on using the repository browser.