source: trunk/MagicSoft/Mars/manalysis/MCameraData.cc@ 2908

Last change on this file since 2908 was 2781, checked in by tbretz, 21 years ago
*** empty log message ***
File size: 4.8 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): Thomas Bretz, 10/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
19!
20! Copyright: MAGIC Software Development, 2000-2003
21!
22!
23\* ======================================================================== */
24
25/////////////////////////////////////////////////////////////////////////////
26//
27// MCameraData
28//
29/////////////////////////////////////////////////////////////////////////////
30#include "MCameraData.h"
31
32#include "MCerPhotEvt.h"
33#include "MCerPhotPix.h"
34
35#include "MGeomCam.h"
36
37#include "MLog.h"
38#include "MLogManip.h"
39
40#include "MPedPhotCam.h"
41#include "MPedPhotPix.h"
42
43#include "MSigmabar.h"
44
45ClassImp(MCameraData);
46
47using namespace std;
48
49// --------------------------------------------------------------------------
50//
51// Creates a MCerPhotPix object for each pixel in the event
52//
53MCameraData::MCameraData(const char *name, const char *title)
54{
55 fName = name ? name : "MCameraData";
56 fTitle = title ? title : "Photons/PedRMS Information";
57}
58
59// --------------------------------------------------------------------------
60//
61// This is not yet implemented like it should.
62//
63/*
64void MCameraData::Draw(Option_t* option)
65{
66 //
67 // FIXME!!! Here the Draw function of the CamDisplay
68 // should be called to add the CamDisplay to the Pad.
69 // The drawing should be done in MCamDisplay::Paint
70 //
71
72 // MGeomCam *geom = fType ? new MGeomCamMagic : new MGeomCamCT1;
73 // MCamDisplay *disp = new MCamDisplay(geom);
74 // delete geom;
75 // disp->DrawPhotNum(this);
76}
77*/
78
79void MCameraData::CalcCleaningLevel(const MCerPhotEvt &evt, const MPedPhotCam &cam,
80 const MGeomCam &geom)
81{
82 const Int_t n = geom.GetNumPixels();
83
84 fData.Set(n);
85 fData.Reset();
86
87 fValidity.Set(n);
88 fValidity.Reset();
89
90 const Int_t entries = evt.GetNumPixels();
91
92 //
93 // check the number of all pixels against the noise level and
94 // set them to 'unused' state if necessary
95 //
96 for (Int_t i=0; i<entries; i++)
97 {
98 const MCerPhotPix &pix = evt[i];
99
100 const Int_t idx = pix.GetPixId();
101 const Float_t noise = cam[idx].GetRms();
102
103 if (noise<=0) // fData[idx]=0, fValidity[idx]=0
104 continue;
105
106 //
107 // We calculate a correction factor which accounts for the
108 // fact that pixels have different size (see TDAS 02-14).
109 //
110 fData[idx] = pix.GetNumPhotons() * geom.GetPixRatioSqrt(idx) / noise;
111 fValidity[idx] = 1;
112 }
113}
114
115void MCameraData::CalcCleaningLevel(const MCerPhotEvt &evt, const MSigmabar &sgb,
116 const MGeomCam &geom)
117{
118 CalcCleaningLevel(evt, sgb.GetSigmabarInner(), geom);
119}
120
121void MCameraData::CalcCleaningLevel(const MCerPhotEvt &evt, Double_t noise,
122 const MGeomCam &geom)
123{
124 const Int_t n = geom.GetNumPixels();
125
126 fData.Set(n);
127 fData.Reset();
128
129 fValidity.Set(n);
130 fValidity.Reset();
131
132 if (noise<=0)
133 return;
134
135 const Int_t entries = evt.GetNumPixels();
136
137 //
138 // check the number of all pixels against the noise level and
139 // set them to 'unused' state if necessary
140 //
141 for (Int_t i=0; i<entries; i++)
142 {
143 const MCerPhotPix &pix = evt[i];
144
145 const Int_t idx = pix.GetPixId();
146
147 //
148 // We calculate a correction factor which accounts for the
149 // fact that pixels have different size (see TDAS 02-14).
150 //
151 fData[idx] = pix.GetNumPhotons() * geom.GetPixRatio(idx) / noise;
152 fValidity[idx] = 1;
153 }
154}
155
156// --------------------------------------------------------------------------
157//
158// Returns, depending on the type flag:
159//
160// 0: Number of Photons*PixRatio
161// 1: Error*sqrt(PixRatio)
162// 2: Cleaning level = Num Photons*sqrt(PixRatio)/Error
163// 3: Number of Photons
164// 4: Error
165//
166Bool_t MCameraData::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const
167{
168 if (idx<0 || idx>=fData.GetSize())
169 return kFALSE;
170
171 val = fData[idx];
172 return fValidity[idx];
173}
174
175void MCameraData::DrawPixelContent(Int_t num) const
176{
177 *fLog << warn << "MCameraData::DrawPixelContent - not available." << endl;
178}
Note: See TracBrowser for help on using the repository browser.