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 12/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
|
---|
19 | !
|
---|
20 | ! Copyright: MAGIC Software Development, 2000-2003
|
---|
21 | !
|
---|
22 | !
|
---|
23 | \* ======================================================================== */
|
---|
24 |
|
---|
25 | /////////////////////////////////////////////////////////////////////////////
|
---|
26 | //
|
---|
27 | // MHCerPhotEvt
|
---|
28 | //
|
---|
29 | /////////////////////////////////////////////////////////////////////////////
|
---|
30 | #include "MHCerPhotEvt.h"
|
---|
31 |
|
---|
32 | #include "MLog.h"
|
---|
33 | #include "MLogManip.h"
|
---|
34 |
|
---|
35 | #include "MParList.h"
|
---|
36 | #include "MCerPhotEvt.h"
|
---|
37 |
|
---|
38 | ClassImp(MHCerPhotEvt);
|
---|
39 |
|
---|
40 | // --------------------------------------------------------------------------
|
---|
41 | //
|
---|
42 | // Setup four histograms for Width, Length
|
---|
43 | //
|
---|
44 | MHCerPhotEvt::MHCerPhotEvt(const char *name, const char *title)
|
---|
45 | : fEvt(NULL)
|
---|
46 | {
|
---|
47 | //
|
---|
48 | // set the name and title of this object
|
---|
49 | //
|
---|
50 | fName = name ? name : "MHCerPhotEvt";
|
---|
51 | fTitle = title ? title : "Sum up camera events";
|
---|
52 |
|
---|
53 | fSum.InitSize(577);
|
---|
54 | for (int i=0; i<577; i++)
|
---|
55 | fSum.AddPixel(i, 0, 0);
|
---|
56 | }
|
---|
57 |
|
---|
58 | // --------------------------------------------------------------------------
|
---|
59 | //
|
---|
60 | // Setup the Binning for the histograms automatically if the correct
|
---|
61 | // instances of MBinning (with the names 'BinningWidth' and 'BinningLength')
|
---|
62 | // are found in the parameter list
|
---|
63 | // Use this function if you want to set the conversion factor which
|
---|
64 | // is used to convert the mm-scale in the camera plain into the deg-scale
|
---|
65 | // used for histogram presentations. The conversion factor is part of
|
---|
66 | // the camera geometry. Please create a corresponding MGeomCam container.
|
---|
67 | //
|
---|
68 | Bool_t MHCerPhotEvt::SetupFill(const MParList *plist)
|
---|
69 | {
|
---|
70 | fEvt = (MCerPhotEvt*)plist->FindObject("MCerPhotEvt");
|
---|
71 | if (!fEvt)
|
---|
72 | *fLog << warn << GetDescriptor() << ": No MCerPhotEvt available..." << endl;
|
---|
73 |
|
---|
74 | return kTRUE;
|
---|
75 | }
|
---|
76 |
|
---|
77 | // --------------------------------------------------------------------------
|
---|
78 | //
|
---|
79 | // Fill the histograms with data from a MHillas-Container.
|
---|
80 | // Be careful: Only call this with an object of type MHillas
|
---|
81 | //
|
---|
82 | Bool_t MHCerPhotEvt::Fill(const MParContainer *par)
|
---|
83 | {
|
---|
84 | const MCerPhotEvt *evt = par ? (MCerPhotEvt*)par : fEvt;
|
---|
85 | if (!evt)
|
---|
86 | {
|
---|
87 | *fLog << err << dbginf << "No MCerPhotEvt found..." << endl;
|
---|
88 | return kFALSE;
|
---|
89 | }
|
---|
90 |
|
---|
91 | const UInt_t n = evt->GetNumPixels();
|
---|
92 |
|
---|
93 | for (UInt_t i=0; i<n; i++)
|
---|
94 | {
|
---|
95 | const MCerPhotPix &pix = (*evt)[i];
|
---|
96 |
|
---|
97 | fSum[pix.GetPixId()].AddNumPhotons(pix.GetNumPhotons());
|
---|
98 | }
|
---|
99 | return kTRUE;
|
---|
100 | }
|
---|
101 |
|
---|