| 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 |
|
|---|
| 19 | ClassImp(MHHillas);
|
|---|
| 20 |
|
|---|
| 21 | MHHillas::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 | fAlpha->GetXaxis()->SetTitle("Alpha [deg]");
|
|---|
| 49 | fLength->GetXaxis()->SetTitle("Length [mm]");
|
|---|
| 50 | fDist->GetXaxis()->SetTitle("Dist [mm]");
|
|---|
| 51 | fWidth->GetXaxis()->SetTitle("Width [mm]");
|
|---|
| 52 |
|
|---|
| 53 | fAlpha->GetYaxis()->SetTitle("Counts");
|
|---|
| 54 | fLength->GetYaxis()->SetTitle("Counts");
|
|---|
| 55 | fDist->GetYaxis()->SetTitle("Counts");
|
|---|
| 56 | fWidth->GetYaxis()->SetTitle("Counts");
|
|---|
| 57 | }
|
|---|
| 58 |
|
|---|
| 59 | MHHillas::~MHHillas()
|
|---|
| 60 | {
|
|---|
| 61 | delete fAlpha;
|
|---|
| 62 | delete fWidth;
|
|---|
| 63 | delete fLength;
|
|---|
| 64 | delete fDist;
|
|---|
| 65 | }
|
|---|
| 66 |
|
|---|
| 67 | void MHHillas::Fill(const MParContainer *par)
|
|---|
| 68 | {
|
|---|
| 69 | MHillas &h = *(MHillas*)par;
|
|---|
| 70 |
|
|---|
| 71 | fAlpha ->Fill(fabs(h.GetAlpha()));
|
|---|
| 72 | fWidth ->Fill(h.GetWidth());
|
|---|
| 73 | fLength->Fill(h.GetLength());
|
|---|
| 74 | fDist ->Fill(h.GetDist());
|
|---|
| 75 | }
|
|---|
| 76 |
|
|---|
| 77 | void MHHillas::Draw(Option_t *)
|
|---|
| 78 | {
|
|---|
| 79 |
|
|---|
| 80 | //
|
|---|
| 81 | // Fixme! Check for an existing canvas.
|
|---|
| 82 | // And create one if no canvas exists only!
|
|---|
| 83 | //
|
|---|
| 84 | TCanvas *c = new TCanvas("Hillas", "Histograms of Hillas Parameters");
|
|---|
| 85 | c->Divide(2,2);
|
|---|
| 86 |
|
|---|
| 87 | c->cd(1);
|
|---|
| 88 | fAlpha->SetBit(kCanDelete);
|
|---|
| 89 | fAlpha->Draw();
|
|---|
| 90 | c->cd(2);
|
|---|
| 91 | fLength->SetBit(kCanDelete);
|
|---|
| 92 | fLength->Draw();
|
|---|
| 93 | c->cd(3);
|
|---|
| 94 | fDist->SetBit(kCanDelete);
|
|---|
| 95 | fDist->Draw();
|
|---|
| 96 | c->cd(4);
|
|---|
| 97 | fWidth->SetBit(kCanDelete);
|
|---|
| 98 | fWidth->Draw();
|
|---|
| 99 |
|
|---|
| 100 | c->Modified();
|
|---|
| 101 | c->Update();
|
|---|
| 102 | }
|
|---|