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): Josep Flix 09/2004 <mailto:jflix@ifae.es>
|
---|
19 | !
|
---|
20 | ! Copyright: MAGIC Software Development, 2004
|
---|
21 | !
|
---|
22 | !
|
---|
23 | \* ======================================================================== */
|
---|
24 |
|
---|
25 | /////////////////////////////////////////////////////////////////////////////
|
---|
26 | //
|
---|
27 | // MTopologyCalc
|
---|
28 | //
|
---|
29 | // Taks that evaluates the Topological Parameters of images after image cleaning
|
---|
30 | //
|
---|
31 | // fDistance = SUM_(i,j) D_ij , where i,j<UsedPixels and d_ij are distances
|
---|
32 | // between pixels. This characterizes topology.
|
---|
33 | //
|
---|
34 | // fUsed = Used Pixels after image cleaning.
|
---|
35 | //
|
---|
36 | /////////////////////////////////////////////////////////////////////////////
|
---|
37 |
|
---|
38 | #include "MTopologyCalc.h"
|
---|
39 |
|
---|
40 | #include "MParList.h"
|
---|
41 |
|
---|
42 | #include "MTopology.h"
|
---|
43 |
|
---|
44 | #include "MCerPhotEvt.h"
|
---|
45 |
|
---|
46 | #include "MLog.h"
|
---|
47 | #include "MLogManip.h"
|
---|
48 |
|
---|
49 | ClassImp(MTopologyCalc);
|
---|
50 |
|
---|
51 | using namespace std;
|
---|
52 |
|
---|
53 | static const TString gsDefName = "MTopologyCalc";
|
---|
54 | static const TString gsDefTitle = "Calculate Topology related parameters";
|
---|
55 |
|
---|
56 | // -------------------------------------------------------------------------
|
---|
57 | //
|
---|
58 | // Default constructor.
|
---|
59 | //
|
---|
60 | MTopologyCalc::MTopologyCalc(const char *name, const char *title)
|
---|
61 | : fTopology(NULL)
|
---|
62 | {
|
---|
63 | fName = name ? name : gsDefName.Data();
|
---|
64 | fTitle = title ? title : gsDefTitle.Data();
|
---|
65 |
|
---|
66 | }
|
---|
67 |
|
---|
68 | // -------------------------------------------------------------------------
|
---|
69 | //
|
---|
70 | Int_t MTopologyCalc::PreProcess(MParList *pList)
|
---|
71 | {
|
---|
72 |
|
---|
73 | fCerPhotEvt = (MCerPhotEvt*)pList->FindObject("MCerPhotEvt");
|
---|
74 | if (!fCerPhotEvt)
|
---|
75 | {
|
---|
76 | *fLog << err << dbginf << "MCerPhotEvt not found... aborting." << endl;
|
---|
77 | return kFALSE;
|
---|
78 | }
|
---|
79 |
|
---|
80 | fGeomCam = (MGeomCam*)pList->FindObject("MGeomCam");
|
---|
81 | if (!fGeomCam)
|
---|
82 | {
|
---|
83 | *fLog << err << dbginf << "MGeomCam not found... aborting." << endl;
|
---|
84 | return kFALSE;
|
---|
85 | }
|
---|
86 |
|
---|
87 | fTopology = (MTopology*)pList->FindCreateObj("MTopology");
|
---|
88 | if (!fTopology)
|
---|
89 | return kFALSE;
|
---|
90 |
|
---|
91 | return kTRUE;
|
---|
92 |
|
---|
93 | }
|
---|
94 |
|
---|
95 | // -------------------------------------------------------------------------
|
---|
96 | //
|
---|
97 | Int_t MTopologyCalc::Process()
|
---|
98 | {
|
---|
99 |
|
---|
100 | Int_t rc = fTopology->Calc(*fGeomCam, *fCerPhotEvt);
|
---|
101 |
|
---|
102 | if (rc == 1)
|
---|
103 | fErrors++;
|
---|
104 |
|
---|
105 | return kTRUE;
|
---|
106 | }
|
---|
107 |
|
---|
108 | // --------------------------------------------------------------------------
|
---|
109 | //
|
---|
110 | // Prints some statistics about the Topology calculation. The percentage
|
---|
111 | // is calculated with respect to the number of executions of this task.
|
---|
112 | //
|
---|
113 | Int_t MTopologyCalc::PostProcess()
|
---|
114 | {
|
---|
115 | if (GetNumExecutions()==0)
|
---|
116 | return kTRUE;
|
---|
117 |
|
---|
118 | *fLog << inf << endl;
|
---|
119 | *fLog << GetDescriptor() << " execution statistics:" << endl;
|
---|
120 | *fLog << dec << setfill(' ');
|
---|
121 | *fLog << " " << fErrors << " (" << (int)(fErrors*100/GetNumExecutions())
|
---|
122 | << "%) Evts skipped due to UsedPixels == -1" << endl;
|
---|
123 | *fLog << endl;
|
---|
124 |
|
---|
125 | /*
|
---|
126 | delete fHillas;
|
---|
127 | delete fHillasSrc;
|
---|
128 | delete fSrcPos;
|
---|
129 | delete fTopology;
|
---|
130 | */
|
---|
131 |
|
---|
132 | return kTRUE;
|
---|
133 | }
|
---|