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): Wolfgang Wittek 1/2002 <mailto:wittek@mppmu.mpg.de>
|
---|
19 | !
|
---|
20 | ! Copyright: MAGIC Software Development, 2000-2002
|
---|
21 | !
|
---|
22 | !
|
---|
23 | \* ======================================================================== */
|
---|
24 |
|
---|
25 | //////////////////////////////////////////////////////////////////////////////
|
---|
26 | // //
|
---|
27 | // MHThetabarTheta //
|
---|
28 | // //
|
---|
29 | // calculates the average Theta for different bins in Theta //
|
---|
30 | // //
|
---|
31 | //////////////////////////////////////////////////////////////////////////////
|
---|
32 |
|
---|
33 | #include "MHThetabarTheta.h"
|
---|
34 |
|
---|
35 | #include <TCanvas.h>
|
---|
36 |
|
---|
37 | #include "MMcEvt.hxx"
|
---|
38 |
|
---|
39 | #include "MBinning.h"
|
---|
40 | #include "MParList.h"
|
---|
41 |
|
---|
42 | #include "MLog.h"
|
---|
43 | #include "MLogManip.h"
|
---|
44 |
|
---|
45 | ClassImp(MHThetabarTheta);
|
---|
46 |
|
---|
47 | using namespace std;
|
---|
48 |
|
---|
49 | // --------------------------------------------------------------------------
|
---|
50 | //
|
---|
51 | // Default Constructor. It sets name and title of the histogram.
|
---|
52 | //
|
---|
53 | MHThetabarTheta::MHThetabarTheta(const char *name, const char *title)
|
---|
54 | : fHist()
|
---|
55 | {
|
---|
56 | //
|
---|
57 | // set the name and title of this object
|
---|
58 | //
|
---|
59 | fName = name ? name : "MHThetabarTheta";
|
---|
60 | fTitle = title ? title : "1-D profile histogram Thetabar vs. Theta";
|
---|
61 |
|
---|
62 | fHist.SetDirectory(NULL);
|
---|
63 |
|
---|
64 | fHist.SetXTitle("\\Theta [\\circ]");
|
---|
65 | fHist.SetYTitle("\\bar{\\Theta} [ \\circ]");
|
---|
66 | }
|
---|
67 |
|
---|
68 | // --------------------------------------------------------------------------
|
---|
69 | //
|
---|
70 | // Set the binnings and prepare the filling of the histogram
|
---|
71 | //
|
---|
72 | Bool_t MHThetabarTheta::SetupFill(const MParList *plist)
|
---|
73 | {
|
---|
74 | fMcEvt = (MMcEvt*)plist->FindObject("MMcEvt");
|
---|
75 | if (!fMcEvt)
|
---|
76 | {
|
---|
77 | *fLog << err << dbginf << "MMcEvt not found... aborting." << endl;
|
---|
78 | return kFALSE;
|
---|
79 | }
|
---|
80 |
|
---|
81 | const MBinning* binstheta = (MBinning*)plist->FindObject("BinningTheta");
|
---|
82 | if (!binstheta )
|
---|
83 | {
|
---|
84 | *fLog << err << dbginf << "At least one MBinning not found... aborting." << endl;
|
---|
85 | return kFALSE;
|
---|
86 | }
|
---|
87 |
|
---|
88 | SetBinning(&fHist, binstheta);
|
---|
89 |
|
---|
90 | return kTRUE;
|
---|
91 | }
|
---|
92 |
|
---|
93 | // --------------------------------------------------------------------------
|
---|
94 | //
|
---|
95 | // Draw the histogram
|
---|
96 | //
|
---|
97 | void MHThetabarTheta::Draw(Option_t *opt)
|
---|
98 | {
|
---|
99 | TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this);
|
---|
100 | pad->SetBorderMode(0);
|
---|
101 |
|
---|
102 | AppendPad("");
|
---|
103 |
|
---|
104 | fHist.Draw(opt);
|
---|
105 |
|
---|
106 | pad->Modified();
|
---|
107 | pad->Update();
|
---|
108 | }
|
---|
109 |
|
---|
110 | // --------------------------------------------------------------------------
|
---|
111 | //
|
---|
112 | // Fill the histogram
|
---|
113 | //
|
---|
114 | Bool_t MHThetabarTheta::Fill(const MParContainer *par, const Stat_t w)
|
---|
115 | {
|
---|
116 | const Double_t theta = fMcEvt->GetTelescopeTheta()*kRad2Deg;
|
---|
117 |
|
---|
118 | fHist.Fill(theta, theta, w);
|
---|
119 |
|
---|
120 | return kTRUE;
|
---|
121 | }
|
---|