source: trunk/MagicSoft/Mars/mhist/MHFadcPix.cc@ 1167

Last change on this file since 1167 was 1082, checked in by tbretz, 23 years ago
*** empty log message ***
File size: 3.4 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): Thomas Bretz 12/2000 <mailto:tbretz@uni-sw.gwdg.de>
19! Author(s): Harald Kornmayer 1/2001
20!
21! Copyright: MAGIC Software Development, 2000-2001
22!
23!
24\* ======================================================================== */
25
26///////////////////////////////////////////////////////////////////////
27//
28// MHFadcPix
29//
30// This container stores a hostogram to display an Fadc Spekrtum.
31// The spektrum of all the values measured by the Fadcs.
32//
33///////////////////////////////////////////////////////////////////////
34
35#include "MHFadcPix.h"
36
37#include <TH1.h>
38#include <TPad.h>
39
40#include "MH.h"
41
42ClassImp(MHFadcPix);
43
44// --------------------------------------------------------------------------
45//
46// Creates the histograms for lo and hi gain of one pixel
47//
48MHFadcPix::MHFadcPix(UInt_t pixid) : fPixId(pixid)
49{
50 Char_t *name = StrDup(pixid ? Form("HiGain%03d", pixid) : "HiGain");
51 Char_t *title = StrDup(pixid ? Form("Hi Gain Pixel #%d", pixid) : "Hi Gain Samples");
52
53 fHistHi = new TH1F(name, title, 256, 0, 255);
54
55 fHistHi->SetDirectory(NULL);
56 fHistHi->SetXTitle("Signal/FADC Units");
57 fHistHi->SetYTitle("Count");
58
59 delete [] name;
60 delete [] title;
61
62 name = StrDup(pixid ? Form("LoGain%03d", pixid) : "LoGain");
63 title = StrDup(pixid ? Form("Lo Gain Pixel #%d", pixid) : "Lo Gain Samples");
64
65 fHistLo = new TH1F(name, title, 256, 0, 255);
66
67 fHistLo->SetDirectory(NULL);
68 fHistLo->SetXTitle("Signal/FADC Units");
69 fHistLo->SetYTitle("Count");
70
71 delete [] name;
72 delete [] title;
73}
74
75// --------------------------------------------------------------------------
76MHFadcPix::~MHFadcPix()
77{
78 delete fHistHi;
79 delete fHistLo;
80}
81
82// --------------------------------------------------------------------------
83void MHFadcPix::FillHi(Byte_t i)
84{
85 fHistHi->Fill(i);
86}
87
88// --------------------------------------------------------------------------
89void MHFadcPix::FillLo(Byte_t i)
90{
91 fHistLo->Fill(i);
92}
93
94// --------------------------------------------------------------------------
95void MHFadcPix::DrawHi()
96{
97 fHistHi->Draw();
98}
99
100// --------------------------------------------------------------------------
101void MHFadcPix::DrawLo()
102{
103 fHistLo->Draw();
104}
105
106// --------------------------------------------------------------------------
107void MHFadcPix::Draw(Option_t *)
108{
109 if (!gPad)
110 {
111 const char *name = StrDup(fPixId ? Form("Pixel #%d", fPixId) : "Pixel");
112 const char *title = StrDup(fPixId ? Form("%s FADC Samples", name) : "FADC Samples");
113 MH::MakeDefCanvas(name, title);
114 delete [] name;
115 delete [] title;
116 }
117
118 gPad->Divide(1, 2);
119
120 gPad->cd(1);
121 fHistHi->Draw();
122
123 gPad->cd(2);
124 fHistLo->Draw();
125}
Note: See TracBrowser for help on using the repository browser.