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): Harald Kornmayer 1/2001 (harald@mppmu.mpg.de)
|
---|
19 | ! Author(s): Thomas Bretz 12/2000 (tbretz@uni-sw.gwdg.de)
|
---|
20 | !
|
---|
21 | ! Copyright: MAGIC Software Development, 2000-2001
|
---|
22 | !
|
---|
23 | !
|
---|
24 | \* ======================================================================== */
|
---|
25 |
|
---|
26 | /////////////////////////////////////////////////////////////////////////////
|
---|
27 | // //
|
---|
28 | // MHillasCalc //
|
---|
29 | // //
|
---|
30 | // This is a task to calculate the Hillas parameters from each event //
|
---|
31 | // //
|
---|
32 | // Input Containers: //
|
---|
33 | // MCerPhotEvt, MGeomCam //
|
---|
34 | // //
|
---|
35 | // Output Containers: //
|
---|
36 | // MHillas //
|
---|
37 | // //
|
---|
38 | /////////////////////////////////////////////////////////////////////////////
|
---|
39 |
|
---|
40 | #include "MHillasCalc.h"
|
---|
41 |
|
---|
42 | #include "MParList.h"
|
---|
43 |
|
---|
44 | #include "MHillas.h"
|
---|
45 | #include "MCerPhotEvt.h"
|
---|
46 |
|
---|
47 | #include "MLog.h"
|
---|
48 | #include "MLogManip.h"
|
---|
49 |
|
---|
50 | ClassImp(MHillasCalc);
|
---|
51 |
|
---|
52 | // --------------------------------------------------------------------------
|
---|
53 | //
|
---|
54 | // Default constructor.
|
---|
55 | //
|
---|
56 | MHillasCalc::MHillasCalc(const char *name, const char *title)
|
---|
57 | {
|
---|
58 | *fName = name ? name : "MHillasCalc";
|
---|
59 | *fTitle = title ? title : "Task to calculate Hillas parameters";
|
---|
60 | }
|
---|
61 |
|
---|
62 | // --------------------------------------------------------------------------
|
---|
63 | //
|
---|
64 | // Check for a MCerPhotEvt object from which the Hillas are calculated.
|
---|
65 | // Try to find the Geometry conatiner. And try to find the output
|
---|
66 | // (Hillas) container or create one.
|
---|
67 | //
|
---|
68 | Bool_t MHillasCalc::PreProcess(MParList *pList)
|
---|
69 | {
|
---|
70 | fCerPhotEvt = (MCerPhotEvt*)pList->FindObject("MCerPhotEvt");
|
---|
71 | if (!fCerPhotEvt)
|
---|
72 | {
|
---|
73 | *fLog << dbginf << "MCerPhotEvt not found... aborting." << endl;
|
---|
74 | return kFALSE;
|
---|
75 | }
|
---|
76 |
|
---|
77 | fGeomCam = (MGeomCam*)pList->FindObject("MGeomCam");
|
---|
78 | if (!fGeomCam)
|
---|
79 | {
|
---|
80 | *fLog << dbginf << "MGeomCam (Camera Geometry) missing in Parameter List... aborting." << endl;
|
---|
81 | return kFALSE;
|
---|
82 | }
|
---|
83 |
|
---|
84 | fHillas = (MHillas*)pList->FindCreateObj("MHillas");
|
---|
85 | if (!fHillas)
|
---|
86 | return kFALSE;
|
---|
87 |
|
---|
88 | return kTRUE;
|
---|
89 | }
|
---|
90 |
|
---|
91 | // --------------------------------------------------------------------------
|
---|
92 | //
|
---|
93 | // If you want do complex descisions inside the calculations
|
---|
94 | // we must move the calculation code inside this function
|
---|
95 | //
|
---|
96 | // If the calculation wasn't sucessfull skip this event
|
---|
97 | //
|
---|
98 | Bool_t MHillasCalc::Process()
|
---|
99 | {
|
---|
100 | return fHillas->Calc(*fGeomCam, *fCerPhotEvt) ? kTRUE : kCONTINUE;
|
---|
101 | }
|
---|
102 |
|
---|