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-2008
|
---|
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 | // MPointingPos
|
---|
36 | //
|
---|
37 | // Output Containers:
|
---|
38 | // MStereoPar
|
---|
39 | //
|
---|
40 | /////////////////////////////////////////////////////////////////////////////
|
---|
41 | #include "MStereoCalc.h"
|
---|
42 |
|
---|
43 | #include "MParList.h"
|
---|
44 |
|
---|
45 | #include "MHillas.h"
|
---|
46 | #include "MStereoPar.h"
|
---|
47 | #include "MPointingPos.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 | // Check for MMcEvt and MHillas containers.
|
---|
70 | // Try to find the Geometry conatiner.
|
---|
71 | // Try to find (and maybe create) the container MStereoPar.
|
---|
72 | //
|
---|
73 | Int_t MStereoCalc::PreProcess(MParList *pList)
|
---|
74 | {
|
---|
75 | fPointingPos1 = (MPointingPos*)pList->FindObject(AddSerialNumber("MPointingPos",fCT1id));
|
---|
76 | if (!fPointingPos1)
|
---|
77 | {
|
---|
78 | *fLog << err << AddSerialNumber("MPointingPos",fCT1id) << " not found... aborting." << endl;
|
---|
79 | return kFALSE;
|
---|
80 | }
|
---|
81 |
|
---|
82 | fPointingPos2 = (MPointingPos*)pList->FindObject(AddSerialNumber("MPointingPos",fCT2id));
|
---|
83 | if (!fPointingPos2)
|
---|
84 | {
|
---|
85 | *fLog << err << AddSerialNumber("MPointingPos",fCT2id) << " not found... aborting." << endl;
|
---|
86 | return kFALSE;
|
---|
87 | }
|
---|
88 |
|
---|
89 | fGeomCam1 = (MGeomCam*)pList->FindObject(AddSerialNumber("MGeomCam", fCT1id));
|
---|
90 | if (!fGeomCam1)
|
---|
91 | {
|
---|
92 | *fLog << err << AddSerialNumber("MGeomCam", fCT1id) << " not found... aborting." << endl;
|
---|
93 | return kFALSE;
|
---|
94 | }
|
---|
95 |
|
---|
96 | fGeomCam2 = (MGeomCam*)pList->FindObject(AddSerialNumber("MGeomCam", fCT2id));
|
---|
97 | if (!fGeomCam2)
|
---|
98 | {
|
---|
99 | *fLog << err << AddSerialNumber("MGeomCam", fCT2id) << " not found... aborting." << endl;
|
---|
100 | return kFALSE;
|
---|
101 | }
|
---|
102 |
|
---|
103 | fHillas1 = (MHillas*)pList->FindObject(AddSerialNumber("MHillas", fCT1id));
|
---|
104 | if (!fHillas1)
|
---|
105 | {
|
---|
106 | *fLog << err << AddSerialNumber("MHillas", fCT1id) << " not found... aborting." << endl;
|
---|
107 | return kFALSE;
|
---|
108 | }
|
---|
109 |
|
---|
110 | fHillas2 = (MHillas*)pList->FindObject(AddSerialNumber("MHillas", fCT2id));
|
---|
111 | if (!fHillas2)
|
---|
112 | {
|
---|
113 | *fLog << err << AddSerialNumber("MHillas", fCT2id) << " not found... aborting." << endl;
|
---|
114 | return kFALSE;
|
---|
115 | }
|
---|
116 |
|
---|
117 | fStereoPar = (MStereoPar*)pList->FindCreateObj("MStereoPar", fStereoParName);
|
---|
118 | if (!fStereoPar)
|
---|
119 | return kFALSE;
|
---|
120 |
|
---|
121 | return kTRUE;
|
---|
122 | }
|
---|
123 |
|
---|
124 | // --------------------------------------------------------------------------
|
---|
125 | //
|
---|
126 | // Call the Calc procedure of the MStereoPar object, where the
|
---|
127 | // calculations combining the data from the two telescopes are performed.
|
---|
128 | //
|
---|
129 | Int_t MStereoCalc::Process()
|
---|
130 | {
|
---|
131 | fStereoPar->Calc(*fHillas1, *fPointingPos1, *fGeomCam1, fCT1x, fCT1y,
|
---|
132 | *fHillas2, *fPointingPos2, *fGeomCam2, fCT2x, fCT2y);
|
---|
133 |
|
---|
134 | return kTRUE;
|
---|
135 | }
|
---|