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 |
|
---|
42 | ClassImp(MHFadcPix);
|
---|
43 |
|
---|
44 | // --------------------------------------------------------------------------
|
---|
45 | //
|
---|
46 | // Creates the histograms for lo and hi gain of one pixel
|
---|
47 | //
|
---|
48 | MHFadcPix::MHFadcPix(UInt_t pixid) : fPixId(pixid)
|
---|
49 | {
|
---|
50 | fHistHi = new TH1F(pixid ? Form("HiGain%03d", pixid) : "HiGain",
|
---|
51 | pixid ? Form("Hi Gain Pixel #%d", pixid) : "Hi Gain Samples",
|
---|
52 | 256, -.5, 255.5);
|
---|
53 |
|
---|
54 | fHistHi->SetDirectory(NULL);
|
---|
55 | fHistHi->SetXTitle("Signal/FADC Units");
|
---|
56 | fHistHi->SetYTitle("Count");
|
---|
57 |
|
---|
58 | fHistLo = new TH1F(pixid ? Form("LoGain%03d", pixid) : "LoGain",
|
---|
59 | pixid ? Form("Lo Gain Pixel #%d", pixid) : "Lo Gain Samples",
|
---|
60 | 256, -.5, 255.5);
|
---|
61 |
|
---|
62 | fHistLo->SetDirectory(NULL);
|
---|
63 | fHistLo->SetXTitle("Signal/FADC Units");
|
---|
64 | fHistLo->SetYTitle("Count");
|
---|
65 | }
|
---|
66 |
|
---|
67 | // --------------------------------------------------------------------------
|
---|
68 | MHFadcPix::~MHFadcPix()
|
---|
69 | {
|
---|
70 | delete fHistHi;
|
---|
71 | delete fHistLo;
|
---|
72 | }
|
---|
73 |
|
---|
74 | // --------------------------------------------------------------------------
|
---|
75 | void MHFadcPix::FillHi(Byte_t i)
|
---|
76 | {
|
---|
77 | fHistHi->Fill(i);
|
---|
78 | }
|
---|
79 |
|
---|
80 | // --------------------------------------------------------------------------
|
---|
81 | void MHFadcPix::FillLo(Byte_t i)
|
---|
82 | {
|
---|
83 | fHistLo->Fill(i);
|
---|
84 | }
|
---|
85 |
|
---|
86 | // --------------------------------------------------------------------------
|
---|
87 | void MHFadcPix::DrawHi()
|
---|
88 | {
|
---|
89 | fHistHi->Draw();
|
---|
90 | }
|
---|
91 |
|
---|
92 | // --------------------------------------------------------------------------
|
---|
93 | void MHFadcPix::DrawLo()
|
---|
94 | {
|
---|
95 | fHistLo->Draw();
|
---|
96 | }
|
---|
97 |
|
---|
98 | // --------------------------------------------------------------------------
|
---|
99 | //
|
---|
100 | // We need our own clone function to get rid of the histogram in any
|
---|
101 | // directory
|
---|
102 | //
|
---|
103 | TObject *MHFadcPix::Clone(const char *) const
|
---|
104 | {
|
---|
105 | MHFadcPix &pix = *(MHFadcPix*)TObject::Clone();
|
---|
106 |
|
---|
107 | pix.fHistHi->SetDirectory(NULL);
|
---|
108 | pix.fHistLo->SetDirectory(NULL);
|
---|
109 |
|
---|
110 | return &pix;
|
---|
111 | }
|
---|
112 |
|
---|
113 | // --------------------------------------------------------------------------
|
---|
114 | void MHFadcPix::Draw(Option_t *)
|
---|
115 | {
|
---|
116 | if (!gPad)
|
---|
117 | {
|
---|
118 | const char *name = StrDup(fPixId ? Form("Pixel #%d", fPixId) : "Pixel");
|
---|
119 | MH::MakeDefCanvas(name, fPixId ? Form("%s FADC Samples", name) : "FADC Samples");
|
---|
120 | delete [] name;
|
---|
121 | }
|
---|
122 |
|
---|
123 | gPad->Divide(1, 2);
|
---|
124 |
|
---|
125 | gPad->cd(1);
|
---|
126 | fHistHi->Draw();
|
---|
127 |
|
---|
128 | gPad->cd(2);
|
---|
129 | fHistLo->Draw();
|
---|
130 | }
|
---|