source: trunk/MagicSoft/Mars/mtemp/meth/MDCACalc.cc@ 6724

Last change on this file since 6724 was 4096, checked in by commichau, 21 years ago
*** empty log message ***
File size: 2.9 KB
Line 
1
2
3/* ======================================================================== *\
4!
5! *
6! * This file is part of MARS, the MAGIC Analysis and Reconstruction
7! * Software. It is distributed to you in the hope that it can be a useful
8! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
9! * It is distributed WITHOUT ANY WARRANTY.
10! *
11! * Permission to use, copy, modify and distribute this software and its
12! * documentation for any purpose is hereby granted without fee,
13! * provided that the above copyright notice appear in all copies and
14! * that both that copyright notice and this permission notice appear
15! * in supporting documentation. It is provided "as is" without express
16! * or implied warranty.
17! *
18!
19!
20! Author(s): Sebastian Commichau 05/2004 <mailto:commichau@particle.phys.ethz.ch>
21! Author(s): Sabrina Stark 05/2004 <mailto:lstark@particle.phys.ethz.ch>
22!
23! Copyright: MAGIC Software Development, 2000-2004
24!
25!
26\* ======================================================================== */
27
28
29//Task to calculate the DCA parameter
30
31
32#include "MDCACalc.h"
33
34ClassImp(MDCACalc);
35
36using namespace std;
37
38MDCACalc::MDCACalc(const char *name, const char *title)
39 : fDCAName("MDCA"), fFlags(0xff)
40{
41 fName = name ? name : "MDCACalc";
42 fTitle = title ? title : "Calculate Hillas, DCA and other image parameters";
43
44}
45
46Int_t MDCACalc::PreProcess(MParList *pList)
47{
48 fErrors = 0;
49
50 fCerPhotEvt = (MCerPhotEvt*)pList->FindObject(AddSerialNumber("MCerPhotEvt"));
51 if (!fCerPhotEvt)
52 {
53 *fLog << err << "MCerPhotEvt not found... aborting." << endl;
54 return kFALSE;
55 }
56
57 fGeomCam = (MGeomCam*)pList->FindObject(AddSerialNumber("MGeomCam"));
58 if (!fGeomCam)
59 {
60 *fLog << err << "MGeomCam (Camera Geometry) missing in Parameter List... aborting." << endl;
61 return kFALSE;
62 }
63
64 fHillas = (MHillas*)pList->FindObject(AddSerialNumber("MHillas"));
65 if (!fHillas)
66 {
67 *fLog << err << "MHillas missing in Parameter List... aborting." << endl;
68 return kFALSE;
69 }
70
71 if (TestFlag(kCalcDCA))
72 fMDCA = (MDCA*)pList->FindCreateObj("MDCA", AddSerialNumber(fDCAName));
73 else
74 {
75 fMDCA = (MDCA*)pList->FindObject(AddSerialNumber(fDCAName), "MDCA");
76 *fLog << err << fDCAName << " [MDCA] not found... aborting." << endl;
77 }
78 if (!fMDCA)
79 return kFALSE;
80
81 return kTRUE;
82}
83
84// If the calculation wasn't sucessfull skip this event
85
86Int_t MDCACalc::Process()
87{
88
89 if (TestFlag(kCalcDCA))
90 {
91 Int_t rc = fMDCA->Calc(*fGeomCam, *fCerPhotEvt, *fHillas);
92
93
94 if (rc == -1)
95 {
96 fErrors++;
97 *fLog << err << dbginf << "MDCA::Calc returned ... error!" << endl;
98 return kFALSE;
99 }
100 }
101
102 return kTRUE;
103}
104
105Int_t MDCACalc::PostProcess()
106{
107
108 *fLog << fErrors << " errors occured..." << endl;
109 *fLog << endl;
110
111 return kTRUE;
112}
113
114
115
116
117
118
Note: See TracBrowser for help on using the repository browser.