source: trunk/MagicSoft/Mars/mflux/MHadAlphaCut.cc@ 8104

Last change on this file since 8104 was 6605, checked in by marcos, 20 years ago
*** empty log message ***
File size: 3.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): Marcos Lopez 2/2005 <mailto:marcos@gae.ucm.es>
19!
20! Copyright: MAGIC Software Development, 2000-2003
21!
22!
23\* ======================================================================== */
24
25/////////////////////////////////////////////////////////////////////////////
26//
27// MHadAlphaCut
28//
29// Container for Hadronness and Alpha cut for each Estimated Energy and theta
30//
31/////////////////////////////////////////////////////////////////////////////
32#include "MHadAlphaCut.h"
33
34
35#include <TH2F.h>
36#include <TCanvas.h>
37
38#include "MBinning.h"
39
40#include "MLog.h"
41#include "MLogManip.h"
42
43ClassImp(MHadAlphaCut);
44
45using namespace std;
46
47
48// ------------------------------------------------------------------------
49//
50//
51MHadAlphaCut::MHadAlphaCut(const char* name, const char* title)
52{
53 fName = name ? name : "MHadAlphaCut";
54 fTitle = title ? title : "Container of Hadronness and Alpha cuts";
55
56
57 fHistHadCut = new TH2F;
58 fHistHadCut->UseCurrentStyle();
59 fHistHadCut->SetNameTitle("HadCut","HadCut");
60 fHistHadCut->SetXTitle("Energy");
61 fHistHadCut->SetYTitle("Theta");
62 fHistHadCut->SetZTitle("Hadronness Cut");
63
64 fHistAlphaCut = new TH2F;
65 fHistAlphaCut->UseCurrentStyle();
66 fHistAlphaCut->SetNameTitle("AlphaCut","AlphaCut");
67 fHistAlphaCut->SetXTitle("Energy");
68 fHistAlphaCut->SetYTitle("Theta");
69 fHistAlphaCut->SetZTitle("Alpha Cut");
70
71
72 MBinning binsx;
73 MBinning binsy;
74
75 binsx.SetEdgesLog(8, 50., 2000); // Est. Energy binning
76 binsy.SetEdges(2,14,31); // Theta binning
77
78 MH::SetBinning(fHistHadCut, &binsx, &binsy);
79 MH::SetBinning(fHistAlphaCut, &binsx, &binsy);
80
81
82 for(int ix=1; ix<=fHistHadCut->GetNbinsX(); ix++)
83 for(int iy=1; iy<=fHistHadCut->GetNbinsY(); iy++)
84 {
85 fHistAlphaCut->SetBinContent(ix,iy,10);
86 fHistHadCut->SetBinContent(ix,iy,0.3);
87 }
88}
89
90
91Float_t MHadAlphaCut::GetAlphaCut(Float_t energy, Float_t zd)
92{
93 Int_t bin = fHistAlphaCut->FindBin(energy,zd);
94 return fHistAlphaCut->GetBinContent(bin);
95}
96
97Float_t MHadAlphaCut::GetHadCut(Float_t energy, Float_t zd)
98{
99 Int_t bin = fHistHadCut->FindBin(energy,zd);
100 return fHistHadCut->GetBinContent(bin);
101}
102
103
104//------------------------------------------------------------------------
105//
106//
107void MHadAlphaCut::Print(Option_t *o) const
108{
109
110 // *fLog << " Size bin \t HadCut \t AlphaCut" << endl;
111 for(Int_t ix=1; ix<=fHistHadCut->GetNbinsX(); ix++)
112 {
113 for(Int_t iy=1; iy<=fHistHadCut->GetNbinsY(); iy++)
114 {
115 *fLog <<"(" <<ix << ", " << iy << ") = "
116 << fHistHadCut->GetBinContent(ix,iy) << " " <<
117 fHistAlphaCut->GetBinContent(ix,iy) << endl;
118 }
119 }
120}
121
122
123// -------------------------------------------------------------------------
124//
125//
126void MHadAlphaCut::Draw(Option_t *o)
127{
128 TCanvas *c1 = new TCanvas;
129 c1->SetLogx();
130 fHistAlphaCut->Draw("lego");
131
132 TCanvas *c2 = new TCanvas;
133 c2->SetLogx();
134 fHistHadCut->Draw("lego");
135}
136
137
138
139
Note: See TracBrowser for help on using the repository browser.