source: trunk/MagicSoft/Mars/mhist/MHHillas.cc@ 891

Last change on this file since 891 was 887, checked in by tbretz, 23 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 2.1 KB
Line 
1///////////////////////////////////////////////////////////////////////
2//
3// MHHillas
4//
5// This class contains histograms for every Hillas parameter
6//
7///////////////////////////////////////////////////////////////////////
8
9#include "MHHillas.h"
10
11#include <math.h>
12
13#include <TH1.h>
14#include <TPad.h>
15#include <TCanvas.h>
16
17#include "MHillas.h"
18
19ClassImp(MHHillas);
20
21MHHillas::MHHillas (const char *name, const char *title)
22{
23 //
24 // default constructor
25 // creates an a list of histograms for all pixels and both gain channels
26 //
27
28 //
29 // set the name and title of this object
30 //
31
32 *fName = name ? name : "MHHillas" ;
33 *fTitle = title ? title : "Container for Hillas histograms" ;
34
35 //
36 // loop over all Pixels and create two histograms
37 // one for the Low and one for the High gain
38 // connect all the histogram with the container fHist
39 //
40 // FIXME! Make the histograms looking that they can be used for
41 // presentations (axis title, ...)
42 //
43 fAlpha = new TH1F("Alpha [deg]", "Alpha of Hillas", 90, 0, 90);
44 fWidth = new TH1F("Width [mm]", "Width of Hillas", 100, 0, 300);
45 fLength = new TH1F("Length [mm]", "Length of Hillas", 100, 0, 300);
46 fDist = new TH1F("Dist [mm]", "Dist of Hillas", 100, 0, 300);
47}
48
49MHHillas::~MHHillas()
50{
51 delete fAlpha;
52 delete fWidth;
53 delete fLength;
54 delete fDist;
55}
56
57void MHHillas::Fill(const MParContainer *par)
58{
59 MHillas &h = *(MHillas*)par;
60
61 fAlpha ->Fill(fabs(h.GetAlpha()));
62 fWidth ->Fill(h.GetWidth());
63 fLength->Fill(h.GetLength());
64 fDist ->Fill(h.GetDist());
65}
66
67void MHHillas::Draw(Option_t *)
68{
69
70 //
71 // Fixme! Check for an existing canvas.
72 // And create one if no canvas exists only!
73 //
74 TCanvas *c = new TCanvas("Hillas", "Histograms of Hillas Parameters");
75 c->Divide(2,2);
76
77 c->cd(1);
78 fAlpha->SetBit(kCanDelete);
79 fAlpha->Draw();
80 c->cd(2);
81 fLength->SetBit(kCanDelete);
82 fLength->Draw();
83 c->cd(3);
84 fDist->SetBit(kCanDelete);
85 fDist->Draw();
86 c->cd(4);
87 fWidth->SetBit(kCanDelete);
88 fWidth->Draw();
89
90 c->Modified();
91 c->Update();
92}
Note: See TracBrowser for help on using the repository browser.