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): Abelardo Moralejo, 11/2003 <mailto:moralejo@pd.infn.it>
|
---|
19 | !
|
---|
20 | ! Copyright: MAGIC Software Development, 2000-2003
|
---|
21 | !
|
---|
22 | !
|
---|
23 | \* ======================================================================== */
|
---|
24 |
|
---|
25 | /////////////////////////////////////////////////////////////////////////////
|
---|
26 | //
|
---|
27 | // MStereoCalc
|
---|
28 | //
|
---|
29 | // This is a task to calculate some shower parameters from the images of
|
---|
30 | // two telescopes in stereo mode.
|
---|
31 | //
|
---|
32 | // Input Containers:
|
---|
33 | // MGeomCam
|
---|
34 | // MHillas
|
---|
35 | // MMcEvt
|
---|
36 | //
|
---|
37 | // Output Containers:
|
---|
38 | // MStereoPar
|
---|
39 | //
|
---|
40 | /////////////////////////////////////////////////////////////////////////////
|
---|
41 | #include "MStereoCalc.h"
|
---|
42 |
|
---|
43 | #include "MParList.h"
|
---|
44 |
|
---|
45 | #include "MHillas.h"
|
---|
46 | #include "MMcEvt.hxx"
|
---|
47 | #include "MStereoPar.h"
|
---|
48 |
|
---|
49 | #include "MLog.h"
|
---|
50 | #include "MLogManip.h"
|
---|
51 |
|
---|
52 | ClassImp(MStereoCalc);
|
---|
53 |
|
---|
54 | using namespace std;
|
---|
55 |
|
---|
56 | // --------------------------------------------------------------------------
|
---|
57 | //
|
---|
58 | // Default constructor.
|
---|
59 | //
|
---|
60 | MStereoCalc::MStereoCalc(const char *name, const char *title)
|
---|
61 | : fStereoParName("MStereoPar")
|
---|
62 | {
|
---|
63 | fName = name ? name : "MStereoCalc";
|
---|
64 | fTitle = title ? title : "Calculate shower parameters in stereo mode";
|
---|
65 |
|
---|
66 | }
|
---|
67 |
|
---|
68 | // --------------------------------------------------------------------------
|
---|
69 | //
|
---|
70 | // Check for MMcEvt and MHillas containers.
|
---|
71 | // Try to find the Geometry conatiner.
|
---|
72 | // Try to find (and maybe create) the container MStereoPar.
|
---|
73 | //
|
---|
74 | Int_t MStereoCalc::PreProcess(MParList *pList)
|
---|
75 | {
|
---|
76 | // necessary
|
---|
77 | TString mcname = "MMcEvt;";
|
---|
78 | mcname += fCT1_id;
|
---|
79 |
|
---|
80 | fmcevt1 = (MMcEvt*)pList->FindObject(mcname);
|
---|
81 | if (!fmcevt1)
|
---|
82 | {
|
---|
83 | *fLog << err << mcname << " not found... aborting." << endl;
|
---|
84 | return kFALSE;
|
---|
85 | }
|
---|
86 |
|
---|
87 | // necessary
|
---|
88 | mcname = "MMcEvt;";
|
---|
89 | mcname += fCT2_id;
|
---|
90 |
|
---|
91 | fmcevt2 = (MMcEvt*)pList->FindObject(mcname);
|
---|
92 | if (!fmcevt2)
|
---|
93 | {
|
---|
94 | *fLog << err << mcname << " not found... aborting." << endl;
|
---|
95 | return kFALSE;
|
---|
96 | }
|
---|
97 |
|
---|
98 | // necessary
|
---|
99 | TString geomname = "MGeomCam;";
|
---|
100 | geomname += fCT1_id;
|
---|
101 | fGeomCam1 = (MGeomCam*)pList->FindObject(geomname);
|
---|
102 | if (!fGeomCam1)
|
---|
103 | {
|
---|
104 | *fLog << err << geomname << " (Camera Geometry) missing in Parameter List... aborting." << endl;
|
---|
105 | return kFALSE;
|
---|
106 | }
|
---|
107 |
|
---|
108 | // necessary
|
---|
109 | geomname = "MGeomCam;";
|
---|
110 | geomname += fCT2_id;
|
---|
111 | fGeomCam2 = (MGeomCam*)pList->FindObject(geomname);
|
---|
112 | if (!fGeomCam2)
|
---|
113 | {
|
---|
114 | *fLog << err << geomname << " (Camera Geometry) missing in Parameter List... aborting." << endl;
|
---|
115 | return kFALSE;
|
---|
116 | }
|
---|
117 |
|
---|
118 | // necessary
|
---|
119 | TString hillasname = "MHillas;";
|
---|
120 | hillasname += fCT1_id;
|
---|
121 | fHillas1 = (MHillas*)pList->FindObject(hillasname);
|
---|
122 | if (!fHillas1)
|
---|
123 | {
|
---|
124 | *fLog << err << hillasname << " missing in Parameter List... aborting." << endl;
|
---|
125 | return kFALSE;
|
---|
126 | }
|
---|
127 |
|
---|
128 | // necessary
|
---|
129 | hillasname = "MHillas;";
|
---|
130 | hillasname += fCT2_id;
|
---|
131 | fHillas2 = (MHillas*)pList->FindObject(hillasname);
|
---|
132 | if (!fHillas2)
|
---|
133 | {
|
---|
134 | *fLog << err << hillasname << " missing in Parameter List... aborting." << endl;
|
---|
135 | return kFALSE;
|
---|
136 | }
|
---|
137 |
|
---|
138 | fStereoPar = (MStereoPar*)pList->FindCreateObj("MStereoPar");
|
---|
139 | if (!fStereoPar)
|
---|
140 | {
|
---|
141 | *fLog << err << "Could not create MStereoPar... aborting" << endl;
|
---|
142 | return kFALSE;
|
---|
143 | }
|
---|
144 |
|
---|
145 | return kTRUE;
|
---|
146 | }
|
---|
147 |
|
---|
148 | // --------------------------------------------------------------------------
|
---|
149 | //
|
---|
150 | // Call the Calc procedure of the MStereoPar object, where the
|
---|
151 | // calculations combining the data from the two telescopes are performed.
|
---|
152 | //
|
---|
153 | Int_t MStereoCalc::Process()
|
---|
154 | {
|
---|
155 | fStereoPar->Calc(*fHillas1, *fmcevt1, *fGeomCam1, fCT1_x, fCT1_y, *fHillas2, *fmcevt2, *fGeomCam2, fCT2_x, fCT2_y);
|
---|
156 |
|
---|
157 | return kTRUE;
|
---|
158 | }
|
---|
159 |
|
---|
160 | // --------------------------------------------------------------------------
|
---|
161 | //
|
---|
162 | // Does nothing at the moment.
|
---|
163 | //
|
---|
164 | Int_t MStereoCalc::PostProcess()
|
---|
165 | {
|
---|
166 | return kTRUE;
|
---|
167 | }
|
---|