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

Last change on this file since 2043 was 2043, 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
48
49// --------------------------------------------------------------------------
50//
51// Default Constructor. It sets name and title of the histogram.
52//
53MHThetabarTime::MHThetabarTime(const char *name, const char *title)
54 : fHist()
55{
56 //
57 // set the name and title of this object
58 //
59 fName = name ? name : "MHThetabarTime";
60 fTitle = title ? title : "1-D profile histogram Thetabar vs. time";
61
62 fHist.SetDirectory(NULL);
63
64 fHist.SetXTitle("time [s]");
65 fHist.SetYTitle("\\bar{\\Theta} [ \\circ]");
66}
67
68// --------------------------------------------------------------------------
69//
70// Set the binnings and prepare the filling of the histogram
71//
72Bool_t MHThetabarTime::SetupFill(const MParList *plist)
73{
74 fTime = (MTime*)plist->FindObject("MTime");
75 if (!fTime)
76 {
77 *fLog << err << dbginf << "MTime not found... aborting." << endl;
78 return kFALSE;
79 }
80
81 fMcEvt = (MMcEvt*)plist->FindObject("MMcEvt");
82 if (!fMcEvt)
83 {
84 *fLog << err << dbginf << "MMcEvt not found... aborting." << endl;
85 return kFALSE;
86 }
87
88 const MBinning* binstime = (MBinning*)plist->FindObject("BinningTime");
89 if (!binstime )
90 {
91 *fLog << err << dbginf << "At least one MBinning not found... aborting." << endl;
92 return kFALSE;
93 }
94
95 SetBinning(&fHist, binstime);
96
97 return kTRUE;
98}
99
100// --------------------------------------------------------------------------
101//
102// Draw the histogram
103//
104void MHThetabarTime::Draw(Option_t *opt)
105{
106 TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this);
107 pad->SetBorderMode(0);
108
109 AppendPad("");
110
111 fHist.Draw(opt);
112
113 pad->Modified();
114 pad->Update();
115}
116
117// --------------------------------------------------------------------------
118//
119// Fill the histogram
120//
121Bool_t MHThetabarTime::Fill(const MParContainer *par, const Stat_t w)
122{
123 const Int_t time = fTime->GetTimeLo();
124
125 fHist.Fill(0.0001*time, fMcEvt->GetTheta()*kRad2Deg, w);
126
127 return kTRUE;
128}
Note: See TracBrowser for help on using the repository browser.