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 |
|
---|
46 | ClassImp(MNewImagePar);
|
---|
47 |
|
---|
48 | // --------------------------------------------------------------------------
|
---|
49 | //
|
---|
50 | // Default constructor.
|
---|
51 | //
|
---|
52 | MNewImagePar::MNewImagePar(const char *name, const char *title)
|
---|
53 | {
|
---|
54 | fName = name ? name : "MNewImagePar";
|
---|
55 | fTitle = title ? title : "New image parameters";
|
---|
56 | }
|
---|
57 |
|
---|
58 | // --------------------------------------------------------------------------
|
---|
59 | //
|
---|
60 | void MNewImagePar::Reset()
|
---|
61 | {
|
---|
62 | fLeakage1 = 0;
|
---|
63 | fLeakage2 = 0;
|
---|
64 | }
|
---|
65 |
|
---|
66 | // --------------------------------------------------------------------------
|
---|
67 | //
|
---|
68 | // Calculation of new image parameters
|
---|
69 | //
|
---|
70 | //
|
---|
71 | Bool_t MNewImagePar::Calc(const MGeomCam &geom, const MCerPhotEvt &evt,
|
---|
72 | const MHillas *hillas)
|
---|
73 | {
|
---|
74 | fHillas = 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 |
|
---|
99 | fLeakage1 = edgepix1 / fHillas->GetSize();
|
---|
100 | fLeakage2 = edgepix2 / fHillas->GetSize();
|
---|
101 |
|
---|
102 | SetReadyToSave();
|
---|
103 |
|
---|
104 | return kTRUE;
|
---|
105 | }
|
---|
106 |
|
---|
107 | // --------------------------------------------------------------------------
|
---|
108 | //
|
---|
109 | void MNewImagePar::Print(Option_t *) const
|
---|
110 | {
|
---|
111 | *fLog << all;
|
---|
112 | *fLog << "New Image Parameters (" << GetName() << ")" << endl;
|
---|
113 | *fLog << " - Leakage1 = " << fLeakage1 << endl;
|
---|
114 | *fLog << " - Leakage2 = " << fLeakage2 << endl;
|
---|
115 | }
|
---|