source: trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.cc@ 1054

Last change on this file since 1054 was 1051, checked in by tbretz, 24 years ago
*** empty log message ***
File size: 4.9 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): Harald Kornmayer 1/2001 (harald@mppmu.mpg.de)
19! Author(s): Thomas Bretz 12/2000 (tbretz@uni-sw.gwdg.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
36ClassImp(MCerPhotEvt);
37
38// --------------------------------------------------------------------------
39//
40// Creates a MCerPhotPix object for each pixel in the event
41//
42MCerPhotEvt::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//
54void 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//
72void MCerPhotEvt::Reset()
73{
74 fNumPixels = 0;
75 fPixels->Delete();
76}
77
78// --------------------------------------------------------------------------
79//
80// Dump the cerenkov photon event to *fLog
81//
82void MCerPhotEvt::Print(Option_t *) const
83{
84 const Int_t entries = fPixels->GetEntries();
85
86 *fLog << "MCerPhotEvt::Print()" << endl
87 << "Number of Pixels: " << fNumPixels
88 << "(" << entries << ")"
89 << 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//
99Bool_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//
116Bool_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//
135Bool_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.IsCorePixel())
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//
154Float_t MCerPhotEvt::GetNumPhotonsMin() const
155{
156 if (fNumPixels <= 0)
157 return -5.;
158
159 Float_t minval = (*this)[0].GetNumPhotons();
160
161 for (UInt_t i=1; i<fNumPixels; i++)
162 {
163 const Float_t testval = (*this)[i].GetNumPhotons();
164
165 if (testval < minval)
166 minval = testval;
167 }
168
169 return minval;
170}
171
172// --------------------------------------------------------------------------
173//
174// get the maximum number of photons of all valid pixels in the list
175//
176Float_t MCerPhotEvt::GetNumPhotonsMax() const
177{
178 if (fNumPixels <= 0)
179 return 50.;
180
181 Float_t maxval = (*this)[0].GetNumPhotons();
182
183 for (UInt_t i=1; i<fNumPixels; i++)
184 {
185 const Float_t testval = (*this)[i].GetNumPhotons();
186
187 if (testval > maxval)
188 maxval = testval;
189 }
190 return maxval;
191}
192
Note: See TracBrowser for help on using the repository browser.