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