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 | /////////////////////////////////////////////////////////////////////////////
|
---|
33 |
|
---|
34 | #include "MHillasCalc.h"
|
---|
35 |
|
---|
36 | #include "MParList.h"
|
---|
37 |
|
---|
38 | #include "MHillas.h"
|
---|
39 | #include "MCerPhotEvt.h"
|
---|
40 |
|
---|
41 | #include "MLog.h"
|
---|
42 | #include "MLogManip.h"
|
---|
43 |
|
---|
44 | ClassImp(MHillasCalc)
|
---|
45 |
|
---|
46 | // --------------------------------------------------------------------------
|
---|
47 | //
|
---|
48 | // Default constructor.
|
---|
49 | //
|
---|
50 | MHillasCalc::MHillasCalc(const char *name, const char *title)
|
---|
51 | {
|
---|
52 | *fName = name ? name : "MHillasCalc";
|
---|
53 | *fTitle = title ? title : "Task to calculate Hillas parameters";
|
---|
54 | }
|
---|
55 |
|
---|
56 | // --------------------------------------------------------------------------
|
---|
57 | //
|
---|
58 | // Check for a MCerPhotEvt object from which the Hillas are calculated.
|
---|
59 | // Try to find the Geometry conatiner. And try to find the output
|
---|
60 | // (Hillas) container or create one.
|
---|
61 | //
|
---|
62 | Bool_t MHillasCalc::PreProcess(MParList *pList)
|
---|
63 | {
|
---|
64 | fCerPhotEvt = (MCerPhotEvt*)pList->FindObject("MCerPhotEvt");
|
---|
65 | if (!fCerPhotEvt)
|
---|
66 | {
|
---|
67 | *fLog << dbginf << "MCerPhotEvt not found... aborting." << endl;
|
---|
68 | return kFALSE;
|
---|
69 | }
|
---|
70 |
|
---|
71 | fGeomCam = (MGeomCam*)pList->FindObject("MGeomCam");
|
---|
72 | if (!fGeomCam)
|
---|
73 | {
|
---|
74 | *fLog << dbginf << "MGeomCam (Camera Geometry) missing in Parameter List... aborting." << endl;
|
---|
75 | return kFALSE;
|
---|
76 | }
|
---|
77 |
|
---|
78 | fHillas = (MHillas*)pList->FindCreateObj("MHillas");
|
---|
79 | if (!fHillas)
|
---|
80 | return kFALSE;
|
---|
81 |
|
---|
82 | return kTRUE;
|
---|
83 | }
|
---|
84 |
|
---|
85 | // --------------------------------------------------------------------------
|
---|
86 | //
|
---|
87 | // If you want do complex descisions inside the calculations
|
---|
88 | // we must move the calculation code inside this function
|
---|
89 | //
|
---|
90 | // If the calculation wasn't sucessfull skip this event
|
---|
91 | //
|
---|
92 | Bool_t MHillasCalc::Process()
|
---|
93 | {
|
---|
94 | return fHillas->Calc(*fGeomCam, *fCerPhotEvt) ? kTRUE : kCONTINUE;
|
---|
95 | }
|
---|
96 |
|
---|