source: trunk/MagicSoft/Mars/mhist/MHThetabarTheta.cc@ 2029

Last change on this file since 2029 was 1992, checked in by tbretz, 22 years ago
*** empty log message ***
File size: 3.4 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): 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
45ClassImp(MHThetabarTheta);
46
47// --------------------------------------------------------------------------
48//
49// Default Constructor. It sets name and title of the histogram.
50//
51MHThetabarTheta::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 [\\circ]");
63 fHist.SetYTitle("\\bar{\\Theta} [ \\circ]");
64}
65
66// --------------------------------------------------------------------------
67//
68// Set the binnings and prepare the filling of the histogram
69//
70Bool_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 the histogram
94//
95void MHThetabarTheta::Draw(Option_t *opt)
96{
97 TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this);
98 pad->SetBorderMode(0);
99
100 AppendPad("");
101
102 fHist.Draw(opt);
103
104 pad->Modified();
105 pad->Update();
106}
107
108// --------------------------------------------------------------------------
109//
110// Fill the histogram
111//
112Bool_t MHThetabarTheta::Fill(const MParContainer *par, Double_t w)
113{
114 const Double_t theta = fMcEvt->GetTelescopeTheta()*kRad2Deg;
115
116 fHist.Fill(theta, theta);
117
118 return kTRUE;
119}
Note: See TracBrowser for help on using the repository browser.