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): Robert Wagner 10/2002 <mailto:magicsoft@rwagner.de>
|
---|
19 | ! Copyright: MAGIC Software Development, 2000-2002
|
---|
20 | !
|
---|
21 | !
|
---|
22 | \* ======================================================================== */
|
---|
23 |
|
---|
24 | //////////////////////////////////////////////////////////////////////////////
|
---|
25 | // //
|
---|
26 | // MHSigmabarTheta //
|
---|
27 | // //
|
---|
28 | // 2D-Histogram in Sigmabar and Theta //
|
---|
29 | // //
|
---|
30 | //////////////////////////////////////////////////////////////////////////////
|
---|
31 |
|
---|
32 | #include "MHSigmabarTheta.h"
|
---|
33 |
|
---|
34 | #include <TCanvas.h>
|
---|
35 |
|
---|
36 | #include <math.h>
|
---|
37 |
|
---|
38 | #include "MMcEvt.hxx"
|
---|
39 | #include "MSigmabar.h"
|
---|
40 |
|
---|
41 | #include "MBinning.h"
|
---|
42 | #include "MParList.h"
|
---|
43 |
|
---|
44 | #include "MLog.h"
|
---|
45 | #include "MLogManip.h"
|
---|
46 |
|
---|
47 | ClassImp(MHSigmabarTheta);
|
---|
48 |
|
---|
49 | // --------------------------------------------------------------------------
|
---|
50 | //
|
---|
51 | // Default Constructor. It sets name and title of the histogram.
|
---|
52 | //
|
---|
53 | MHSigmabarTheta::MHSigmabarTheta(const char *name, const char *title)
|
---|
54 | {
|
---|
55 | //
|
---|
56 | // set the name and title of this object
|
---|
57 | //
|
---|
58 | fName = name ? name : "MHSigmabarTheta";
|
---|
59 | fTitle = title ? title : "3-D histogram in sigmabar and theta";
|
---|
60 |
|
---|
61 | fHist.SetDirectory(NULL);
|
---|
62 |
|
---|
63 | fHist.SetTitle("3D-plot of sigmabar and theta");
|
---|
64 | fHist.SetXTitle("\\theta [\\circ]");
|
---|
65 | fHist.SetYTitle("\\overline{\\sigma}");
|
---|
66 | fHist.SetZTitle("N");
|
---|
67 | }
|
---|
68 |
|
---|
69 | // --------------------------------------------------------------------------
|
---|
70 | //
|
---|
71 | // Set binnings and prepare filling of the histogram
|
---|
72 | //
|
---|
73 | Bool_t MHSigmabarTheta::SetupFill(const MParList *plist)
|
---|
74 | {
|
---|
75 | fMcEvt = (MMcEvt*)plist->FindObject("MMcEvt");
|
---|
76 | if (!fMcEvt)
|
---|
77 | {
|
---|
78 | *fLog << err << dbginf << "MHSigmabarTheta : MMcEvt not found... aborting." << endl;
|
---|
79 | return kFALSE;
|
---|
80 | }
|
---|
81 |
|
---|
82 | fSigmabar = (MSigmabar*)plist->FindObject("MSigmabar");
|
---|
83 | if (!fSigmabar)
|
---|
84 | {
|
---|
85 | *fLog << err << dbginf << "MHSigmabarTheta : MSigmabar not found... aborting." << endl;
|
---|
86 | return kFALSE;
|
---|
87 | }
|
---|
88 |
|
---|
89 | MBinning* binssigmabar = (MBinning*)plist->FindObject("BinningSigmabar");
|
---|
90 | MBinning* binstheta = (MBinning*)plist->FindObject("BinningTheta");
|
---|
91 | if (!binssigmabar || !binstheta)
|
---|
92 | {
|
---|
93 | *fLog << err << dbginf << "MHSigmabarTheta : At least one MBinning not found... aborting." << endl;
|
---|
94 | return kFALSE;
|
---|
95 | }
|
---|
96 |
|
---|
97 | SetBinning(&fHist, binstheta, binssigmabar);
|
---|
98 |
|
---|
99 | fHist.Sumw2();
|
---|
100 |
|
---|
101 | return kTRUE;
|
---|
102 | }
|
---|
103 |
|
---|
104 | // --------------------------------------------------------------------------
|
---|
105 | //
|
---|
106 | // Fill the histogram
|
---|
107 | //
|
---|
108 | Bool_t MHSigmabarTheta::Fill(const MParContainer *par)
|
---|
109 | {
|
---|
110 | fHist.Fill(fMcEvt->GetTheta()*kRad2Deg, fSigmabar->GetSigmabar());
|
---|
111 | return kTRUE;
|
---|
112 | }
|
---|
113 |
|
---|
114 | // --------------------------------------------------------------------------
|
---|
115 | //
|
---|
116 | // Draw the histogram
|
---|
117 | //
|
---|
118 | void MHSigmabarTheta::Draw(Option_t *opt)
|
---|
119 | {
|
---|
120 | if (!gPad)
|
---|
121 | MakeDefCanvas("SigmabarTheta", fTitle);
|
---|
122 |
|
---|
123 | fHist.Draw(opt);
|
---|
124 |
|
---|
125 | gPad->Modified();
|
---|
126 | gPad->Update();
|
---|
127 | }
|
---|
128 |
|
---|
129 | // --------------------------------------------------------------------------
|
---|
130 | //
|
---|
131 | // Draw copies of the histogram
|
---|
132 | //
|
---|
133 | TObject *MHSigmabarTheta::DrawClone(Option_t *opt) const
|
---|
134 | {
|
---|
135 | TCanvas &c = *MakeDefCanvas("SigmabarTheta", fTitle);
|
---|
136 |
|
---|
137 | ((TH2&)fHist).DrawCopy(opt);
|
---|
138 |
|
---|
139 | c.Modified();
|
---|
140 | c.Update();
|
---|
141 |
|
---|
142 | return &c;
|
---|
143 | }
|
---|
144 |
|
---|