source: trunk/MagicSoft/Mars/mhist/MHSigmabarTheta.cc@ 6447

Last change on this file since 6447 was 2173, checked in by tbretz, 21 years ago
*** empty log message ***
File size: 3.9 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): 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
47ClassImp(MHSigmabarTheta);
48
49using namespace std;
50
51// --------------------------------------------------------------------------
52//
53// Default Constructor. It sets name and title of the histogram.
54//
55MHSigmabarTheta::MHSigmabarTheta(const char *name, const char *title)
56{
57 //
58 // set the name and title of this object
59 //
60 fName = name ? name : "MHSigmabarTheta";
61 fTitle = title ? title : "3-D histogram in sigmabar and theta";
62
63 fHist.SetDirectory(NULL);
64
65 fHist.SetTitle("3D-plot of sigmabar and theta");
66 fHist.SetXTitle("\\theta [\\circ]");
67 fHist.SetYTitle("\\bar{\\sigma}");
68 fHist.SetZTitle("N");
69}
70
71// --------------------------------------------------------------------------
72//
73// Set binnings and prepare filling of the histogram
74//
75Bool_t MHSigmabarTheta::SetupFill(const MParList *plist)
76{
77 fMcEvt = (MMcEvt*)plist->FindObject("MMcEvt");
78 if (!fMcEvt)
79 {
80 *fLog << err << "MMcEvt not found... aborting." << endl;
81 return kFALSE;
82 }
83
84 fSigmabar = (MSigmabar*)plist->FindObject("MSigmabar");
85 if (!fSigmabar)
86 {
87 *fLog << err << "MSigmabar not found... aborting." << endl;
88 return kFALSE;
89 }
90
91 MBinning* binstheta = (MBinning*)plist->FindObject("BinningTheta");
92 if (!binstheta)
93 {
94 *fLog << err << "BinningTheta [MBinning] not found... aborting." << endl;
95 return kFALSE;
96 }
97 MBinning* binssigmabar = (MBinning*)plist->FindObject("BinningSigmabar");
98 if (!binssigmabar)
99 {
100 *fLog << err << "BinningSigmabar [MBinning] not found... aborting." << endl;
101 return kFALSE;
102 }
103
104 SetBinning(&fHist, binstheta, binssigmabar);
105
106 fHist.Sumw2();
107
108 return kTRUE;
109}
110
111// --------------------------------------------------------------------------
112//
113// Fill the histogram
114//
115Bool_t MHSigmabarTheta::Fill(const MParContainer *par, const Stat_t w)
116{
117 fHist.Fill(fMcEvt->GetTheta()*kRad2Deg, fSigmabar->GetSigmabar(), w);
118 return kTRUE;
119}
120
121// --------------------------------------------------------------------------
122//
123// Draw the histogram
124//
125void MHSigmabarTheta::Draw(Option_t *opt)
126{
127 TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this);
128 pad->SetBorderMode(0);
129
130 AppendPad("");
131
132 fHist.Draw(opt);
133
134 pad->Modified();
135 pad->Update();
136}
137
Note: See TracBrowser for help on using the repository browser.