source: trunk/MagicSoft/Mars/mimage/MNewImagePar.cc@ 1978

Last change on this file since 1978 was 1966, checked in by tbretz, 22 years ago
*** empty log message ***
File size: 3.0 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): Wolfgang Wittek 03/2003 <mailto:wittek@mppmu.mpg.de>
19!
20! Copyright: MAGIC Software Development, 2000-2003
21!
22!
23\* ======================================================================== */
24
25/////////////////////////////////////////////////////////////////////////////
26//
27// MNewImagePar
28//
29// Storage Container for new image parameters
30//
31/////////////////////////////////////////////////////////////////////////////
32#include "MNewImagePar.h"
33
34#include <fstream.h>
35#include <TArrayF.h>
36
37#include "MLog.h"
38#include "MLogManip.h"
39
40#include "MGeomCam.h"
41#include "MGeomPix.h"
42#include "MCerPhotEvt.h"
43#include "MCerPhotPix.h"
44#include "MSrcPosCam.h"
45
46ClassImp(MNewImagePar);
47
48// --------------------------------------------------------------------------
49//
50// Default constructor.
51//
52MNewImagePar::MNewImagePar(const char *name, const char *title)
53{
54 fName = name ? name : "MNewImagePar";
55 fTitle = title ? title : "New image parameters";
56}
57
58// --------------------------------------------------------------------------
59//
60void MNewImagePar::Reset()
61{
62 fLeakage1 = 0;
63 fLeakage2 = 0;
64}
65
66// --------------------------------------------------------------------------
67//
68// Calculation of new image parameters
69//
70//
71Bool_t MNewImagePar::Calc(const MGeomCam &geom, const MCerPhotEvt &evt,
72 const MHillas *hillas)
73{
74 const UInt_t npixevt = evt.GetNumPixels();
75
76 Double_t edgepix1 = 0;
77 Double_t edgepix2 = 0;
78
79 for (UInt_t i=0; i<npixevt; i++)
80 {
81 const MCerPhotPix &pix = evt[i];
82 if (!pix.IsPixelUsed())
83 continue;
84
85 const MGeomPix &gpix = geom[pix.GetPixId()];
86
87 const Double_t nphot = pix.GetNumPhotons();
88
89 // count photons in outer rings of camera
90 if (gpix.IsInOutermostRing())
91 edgepix1 += nphot;
92 if (gpix.IsInOuterRing())
93 edgepix2 += nphot;
94 }
95
96 fLeakage1 = edgepix1 / hillas->GetSize();
97 fLeakage2 = edgepix2 / hillas->GetSize();
98
99 SetReadyToSave();
100
101 return kTRUE;
102}
103
104// --------------------------------------------------------------------------
105//
106void MNewImagePar::Print(Option_t *) const
107{
108 *fLog << all;
109 *fLog << "New Image Parameters (" << GetName() << ")" << endl;
110 *fLog << " - Leakage1 = " << fLeakage1 << endl;
111 *fLog << " - Leakage2 = " << fLeakage2 << endl;
112}
Note: See TracBrowser for help on using the repository browser.