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 (harald@mppmu.mpg.de)
|
---|
20 | !
|
---|
21 | ! Copyright: MAGIC Software Development, 2000-2001
|
---|
22 | !
|
---|
23 | !
|
---|
24 | \* ======================================================================== */
|
---|
25 |
|
---|
26 | #include "MCerPhotEvt.h"
|
---|
27 |
|
---|
28 | #include <math.h>
|
---|
29 | #include <fstream.h>
|
---|
30 |
|
---|
31 | #include <TCanvas.h>
|
---|
32 |
|
---|
33 | #include "MLog.h"
|
---|
34 | #include "MHexagon.h"
|
---|
35 |
|
---|
36 | ClassImp(MCerPhotEvt);
|
---|
37 |
|
---|
38 | // --------------------------------------------------------------------------
|
---|
39 | //
|
---|
40 | // Creates a MCerPhotPix object for each pixel in the event
|
---|
41 | //
|
---|
42 | MCerPhotEvt::MCerPhotEvt(const char *name, const char *title) : fNumPixels(0)
|
---|
43 | {
|
---|
44 | fName = name ? name : "MCerPhotEvt";
|
---|
45 | fTitle = title ? title : "(Number of Photon)-Event Information";
|
---|
46 |
|
---|
47 | fPixels = new TClonesArray("MCerPhotPix", 0);
|
---|
48 | }
|
---|
49 |
|
---|
50 | // --------------------------------------------------------------------------
|
---|
51 | //
|
---|
52 | // This is not yet implemented like it should.
|
---|
53 | //
|
---|
54 | void MCerPhotEvt::Draw(Option_t* option)
|
---|
55 | {
|
---|
56 | //
|
---|
57 | // FIXME!!! Here the Draw function of the CamDisplay
|
---|
58 | // should be called to add the CamDisplay to the Pad.
|
---|
59 | // The drawing should be done in MCamDisplay::Paint
|
---|
60 | //
|
---|
61 |
|
---|
62 | // MGeomCam *geom = fType ? new MGeomCamMagic : new MGeomCamCT1;
|
---|
63 | // MCamDisplay *disp = new MCamDisplay(geom);
|
---|
64 | // delete geom;
|
---|
65 | // disp->DrawPhotNum(this);
|
---|
66 | }
|
---|
67 |
|
---|
68 | // --------------------------------------------------------------------------
|
---|
69 | //
|
---|
70 | // reset counter and delete netries in list.
|
---|
71 | //
|
---|
72 | void MCerPhotEvt::Reset()
|
---|
73 | {
|
---|
74 | fNumPixels = 0;
|
---|
75 | fPixels->Delete();
|
---|
76 | }
|
---|
77 |
|
---|
78 | // --------------------------------------------------------------------------
|
---|
79 | //
|
---|
80 | // Dump the cerenkov photon event to *fLog
|
---|
81 | //
|
---|
82 | void MCerPhotEvt::Print(Option_t *) const
|
---|
83 | {
|
---|
84 | const Int_t entries = fPixels->GetEntries();
|
---|
85 |
|
---|
86 | *fLog << GetDescriptor() << dec << endl;
|
---|
87 | *fLog << " Number of Pixels: " << fNumPixels << "(" << entries << ")" << endl;
|
---|
88 |
|
---|
89 | for (Int_t i=0; i<entries; i++ )
|
---|
90 | (*this)[i].Print();
|
---|
91 | }
|
---|
92 |
|
---|
93 | // --------------------------------------------------------------------------
|
---|
94 | //
|
---|
95 | // Checks if in the pixel list is an entry with pixel id
|
---|
96 | //
|
---|
97 | Bool_t MCerPhotEvt::IsPixelExisting(Int_t id) const
|
---|
98 | {
|
---|
99 | const Int_t entries = fPixels->GetEntries();
|
---|
100 |
|
---|
101 | for (Int_t i=0; i<entries; i++)
|
---|
102 | {
|
---|
103 | if (id == (*this)[i].GetPixId())
|
---|
104 | return kTRUE;
|
---|
105 | }
|
---|
106 |
|
---|
107 | return kFALSE;
|
---|
108 | }
|
---|
109 |
|
---|
110 | // --------------------------------------------------------------------------
|
---|
111 | //
|
---|
112 | // Checks if in the pixel list is an entry with pixel id
|
---|
113 | //
|
---|
114 | Bool_t MCerPhotEvt::IsPixelUsed(Int_t id) const
|
---|
115 | {
|
---|
116 | const Int_t entries = fPixels->GetEntries();
|
---|
117 |
|
---|
118 | for (Int_t i=0; i<entries; i++)
|
---|
119 | {
|
---|
120 | const MCerPhotPix &pix = (*this)[i];
|
---|
121 |
|
---|
122 | if (id == pix.GetPixId() && pix.IsPixelUsed())
|
---|
123 | return kTRUE;
|
---|
124 | }
|
---|
125 |
|
---|
126 | return kFALSE;
|
---|
127 | }
|
---|
128 |
|
---|
129 | // --------------------------------------------------------------------------
|
---|
130 | //
|
---|
131 | // Checks if in the pixel list is an entry with pixel id
|
---|
132 | //
|
---|
133 | Bool_t MCerPhotEvt::IsPixelCore(Int_t id) const
|
---|
134 | {
|
---|
135 | const Int_t entries = fPixels->GetEntries();
|
---|
136 |
|
---|
137 | for (Int_t i=0; i<entries; i++)
|
---|
138 | {
|
---|
139 | const MCerPhotPix &pix = (*this)[i];
|
---|
140 |
|
---|
141 | if (id == pix.GetPixId() && pix.IsCorePixel())
|
---|
142 | return kTRUE;
|
---|
143 | }
|
---|
144 |
|
---|
145 | return kFALSE;
|
---|
146 | }
|
---|
147 |
|
---|
148 | // --------------------------------------------------------------------------
|
---|
149 | //
|
---|
150 | // get the minimum number of photons of all valid pixels in the list
|
---|
151 | //
|
---|
152 | Float_t MCerPhotEvt::GetNumPhotonsMin() const
|
---|
153 | {
|
---|
154 | if (fNumPixels <= 0)
|
---|
155 | return -5.;
|
---|
156 |
|
---|
157 | Float_t minval = (*this)[0].GetNumPhotons();
|
---|
158 |
|
---|
159 | for (UInt_t i=1; i<fNumPixels; i++)
|
---|
160 | {
|
---|
161 | const Float_t testval = (*this)[i].GetNumPhotons();
|
---|
162 |
|
---|
163 | if (testval < minval)
|
---|
164 | minval = testval;
|
---|
165 | }
|
---|
166 |
|
---|
167 | return minval;
|
---|
168 | }
|
---|
169 |
|
---|
170 | // --------------------------------------------------------------------------
|
---|
171 | //
|
---|
172 | // get the maximum number of photons of all valid pixels in the list
|
---|
173 | //
|
---|
174 | Float_t MCerPhotEvt::GetNumPhotonsMax() const
|
---|
175 | {
|
---|
176 | if (fNumPixels <= 0)
|
---|
177 | return 50.;
|
---|
178 |
|
---|
179 | Float_t maxval = (*this)[0].GetNumPhotons();
|
---|
180 |
|
---|
181 | for (UInt_t i=1; i<fNumPixels; i++)
|
---|
182 | {
|
---|
183 | const Float_t testval = (*this)[i].GetNumPhotons();
|
---|
184 |
|
---|
185 | if (testval > maxval)
|
---|
186 | maxval = testval;
|
---|
187 | }
|
---|
188 | return maxval;
|
---|
189 | }
|
---|
190 |
|
---|