source: trunk/MagicSoft/Mars/manalysis/MNewImagePar.cc@ 1884

Last change on this file since 1884 was 1880, checked in by tbretz, 22 years ago
*** empty log message ***
File size: 3.1 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 <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 //fHillas = (MHillas*)hillas;
75
76 const UInt_t npixevt = evt.GetNumPixels();
77
78 Double_t edgepix1 = 0.0;
79 Double_t edgepix2 = 0.0;
80
81 for (UInt_t i=0; i<npixevt; i++)
82 {
83 const MCerPhotPix &pix = evt[i];
84 if (!pix.IsPixelUsed())
85 continue;
86
87 const MGeomPix &gpix = geom[pix.GetPixId()];
88
89 Double_t nphot = pix.GetNumPhotons();
90
91 // count photons in outer rings of camera
92 if (gpix.IsInOutermostRing())
93 edgepix1 += nphot;
94 if (gpix.IsInOuterRing())
95 edgepix2 += nphot;
96 }
97
98 fLeakage1 = edgepix1 / hillas->GetSize();
99 fLeakage2 = edgepix2 / hillas->GetSize();
100
101 SetReadyToSave();
102
103 return kTRUE;
104}
105
106// --------------------------------------------------------------------------
107//
108void MNewImagePar::Print(Option_t *) const
109{
110 *fLog << all;
111 *fLog << "New Image Parameters (" << GetName() << ")" << endl;
112 *fLog << " - Leakage1 = " << fLeakage1 << endl;
113 *fLog << " - Leakage2 = " << fLeakage2 << endl;
114}
Note: See TracBrowser for help on using the repository browser.