source: trunk/MagicSoft/Mars/mhist/MHThetabarTime.cc@ 2811

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