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 | // --------------------------------------------------------------------------
|
---|
48 | //
|
---|
49 | // Default Constructor. It sets name and title of the histogram.
|
---|
50 | //
|
---|
51 | MHThetabarTheta::MHThetabarTheta(const char *name, const char *title)
|
---|
52 | : fHist()
|
---|
53 | {
|
---|
54 | //
|
---|
55 | // set the name and title of this object
|
---|
56 | //
|
---|
57 | fName = name ? name : "MHThetabarTheta";
|
---|
58 | fTitle = title ? title : "1-D profile histogram Thetabar vs. Theta";
|
---|
59 |
|
---|
60 | fHist.SetDirectory(NULL);
|
---|
61 |
|
---|
62 | fHist.SetXTitle("\\Theta [s]");
|
---|
63 | fHist.SetYTitle("\\overline{\\Theta} [\\circ]");
|
---|
64 | }
|
---|
65 |
|
---|
66 | // --------------------------------------------------------------------------
|
---|
67 | //
|
---|
68 | // Set the binnings and prepare the filling of the histogram
|
---|
69 | //
|
---|
70 | Bool_t MHThetabarTheta::SetupFill(const MParList *plist)
|
---|
71 | {
|
---|
72 | fMcEvt = (MMcEvt*)plist->FindObject("MMcEvt");
|
---|
73 | if (!fMcEvt)
|
---|
74 | {
|
---|
75 | *fLog << err << dbginf << "MMcEvt not found... aborting." << endl;
|
---|
76 | return kFALSE;
|
---|
77 | }
|
---|
78 |
|
---|
79 | const MBinning* binstheta = (MBinning*)plist->FindObject("BinningTheta");
|
---|
80 | if (!binstheta )
|
---|
81 | {
|
---|
82 | *fLog << err << dbginf << "At least one MBinning not found... aborting." << endl;
|
---|
83 | return kFALSE;
|
---|
84 | }
|
---|
85 |
|
---|
86 | SetBinning(&fHist, binstheta);
|
---|
87 |
|
---|
88 | return kTRUE;
|
---|
89 | }
|
---|
90 |
|
---|
91 | // --------------------------------------------------------------------------
|
---|
92 | //
|
---|
93 | // Draw a copy of the histogram
|
---|
94 | //
|
---|
95 | TObject *MHThetabarTheta::DrawClone(Option_t *opt) const
|
---|
96 | {
|
---|
97 | TCanvas &c = *MakeDefCanvas("ThetabarTheta", "Thetabar vs. Theta");
|
---|
98 |
|
---|
99 | gROOT->SetSelectedPad(NULL);
|
---|
100 |
|
---|
101 | ((TProfile*)&fHist)->DrawCopy(opt);
|
---|
102 |
|
---|
103 | c.Modified();
|
---|
104 | c.Update();
|
---|
105 |
|
---|
106 | return &c;
|
---|
107 | }
|
---|
108 |
|
---|
109 | // --------------------------------------------------------------------------
|
---|
110 | //
|
---|
111 | // Draw the histogram
|
---|
112 | //
|
---|
113 | void MHThetabarTheta::Draw(Option_t *opt)
|
---|
114 | {
|
---|
115 | if (!gPad)
|
---|
116 | MakeDefCanvas("ThetabarTheta", "Thetabar vs. Theta");
|
---|
117 |
|
---|
118 | fHist.DrawCopy(opt);
|
---|
119 |
|
---|
120 | gPad->Modified();
|
---|
121 | gPad->Update();
|
---|
122 | }
|
---|
123 |
|
---|
124 | // --------------------------------------------------------------------------
|
---|
125 | //
|
---|
126 | // Fill the histogram
|
---|
127 | //
|
---|
128 | Bool_t MHThetabarTheta::Fill(const MParContainer *par)
|
---|
129 | {
|
---|
130 | fHist.Fill(fMcEvt->GetTheta()*kRad2Deg, fMcEvt->GetTheta()*kRad2Deg);
|
---|
131 |
|
---|
132 | return kTRUE;
|
---|
133 | }
|
---|
134 |
|
---|