source: trunk/MagicSoft/Mars/mimage/MHNewImagePar.cc@ 1968

Last change on this file since 1968 was 1966, checked in by tbretz, 22 years ago
*** empty log message ***
File size: 3.3 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 03/2003 <mailto:wittek@mppmu.mpg.de>
19!
20! Copyright: MAGIC Software Development, 2000-2003
21!
22!
23\* ======================================================================== */
24
25///////////////////////////////////////////////////////////////////////
26//
27// MHNewImagePar
28//
29// This class contains histograms for every Hillas parameter
30//
31///////////////////////////////////////////////////////////////////////
32#include "MHNewImagePar.h"
33
34#include <math.h>
35
36#include <TH1.h>
37#include <TPad.h>
38#include <TCanvas.h>
39
40#include "MLog.h"
41#include "MLogManip.h"
42
43#include "MGeomCam.h"
44
45#include "MParList.h"
46
47#include "MHillas.h"
48#include "MNewImagePar.h"
49
50ClassImp(MHNewImagePar);
51
52// --------------------------------------------------------------------------
53//
54// Setup histograms
55//
56MHNewImagePar::MHNewImagePar(const char *name, const char *title)
57{
58 fName = name ? name : "MHNewImagePar";
59 fTitle = title ? title : "Histograms of new image parameters";
60
61 fLeakage1 = new TH1F("Leakage1", "Leakage_{1}", 100, 0.0, 1.0);
62 fLeakage1->SetDirectory(NULL);
63 fLeakage1->SetXTitle("Leakage");
64 fLeakage1->SetYTitle("Counts");
65
66 fLeakage2 = new TH1F("Leakage2", "Leakage_{2}", 100, 0.0, 1.0);
67 fLeakage2->SetDirectory(NULL);
68 fLeakage2->SetXTitle("Leakage");
69 fLeakage2->SetYTitle("Counts");
70 fLeakage2->SetLineColor(kBlue);
71}
72
73// --------------------------------------------------------------------------
74//
75// Delete the four histograms
76//
77MHNewImagePar::~MHNewImagePar()
78{
79 delete fLeakage1;
80 delete fLeakage2;
81}
82
83// --------------------------------------------------------------------------
84//
85// Fill the histograms with data from a MNewImagePar container.
86//
87Bool_t MHNewImagePar::Fill(const MParContainer *par)
88{
89 const MNewImagePar &h = *(MNewImagePar*)par;
90
91 fLeakage1->Fill(h.GetLeakage1());
92 fLeakage2->Fill(h.GetLeakage2());
93
94 return kTRUE;
95}
96
97// --------------------------------------------------------------------------
98//
99// Creates a new canvas and draws the two histograms into it.
100// Be careful: The histograms belongs to this object and won't get deleted
101// together with the canvas.
102//
103void MHNewImagePar::Draw(Option_t *)
104{
105 TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this);
106 pad->SetBorderMode(0);
107
108 AppendPad("");
109
110 MH::Draw(*fLeakage1, *fLeakage2, "Leakage1 and Leakage2");
111
112 pad->Modified();
113 pad->Update();
114}
115
116TH1 *MHNewImagePar::GetHistByName(const TString name)
117{
118 if (name.Contains("Leakage1", TString::kIgnoreCase))
119 return fLeakage1;
120
121 if (name.Contains("Leakage2", TString::kIgnoreCase))
122 return fLeakage2;
123
124 return NULL;
125}
Note: See TracBrowser for help on using the repository browser.