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

Last change on this file since 1891 was 1412, checked in by wittek, 22 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): 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("Theta-bar [ \\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 a copy of the histogram
103//
104TObject *MHThetabarTime::DrawClone(Option_t *opt) const
105{
106 TCanvas &c = *MakeDefCanvas("ThetabarTime", "Thetabar vs. time");
107
108 gROOT->SetSelectedPad(NULL);
109
110 ((TProfile*)&fHist)->DrawCopy(opt);
111
112 c.Modified();
113 c.Update();
114
115 return &c;
116}
117
118// --------------------------------------------------------------------------
119//
120// Draw the histogram
121//
122void MHThetabarTime::Draw(Option_t *opt)
123{
124 if (!gPad)
125 MakeDefCanvas("ThetabarTime", "Thetabar vs. time");
126
127 fHist.DrawCopy(opt);
128
129 gPad->Modified();
130 gPad->Update();
131}
132
133// --------------------------------------------------------------------------
134//
135// Fill the histogram
136//
137Bool_t MHThetabarTime::Fill(const MParContainer *par)
138{
139 const Int_t time = fTime->GetTimeLo();
140
141 fHist.Fill(0.0001*time, fMcEvt->GetTheta()*kRad2Deg);
142
143 return kTRUE;
144}
Note: See TracBrowser for help on using the repository browser.