| 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 |
|
|---|
| 78 | fmcevt1 = (MMcEvt*)pList->FindObject(AddSerialNumber("MMcEvt",fCT1id));
|
|---|
| 79 | if (!fmcevt1)
|
|---|
| 80 | {
|
|---|
| 81 | *fLog << err << AddSerialNumber("MMcEvt",fCT1id) << " not found... aborting." << endl;
|
|---|
| 82 | return kFALSE;
|
|---|
| 83 | }
|
|---|
| 84 |
|
|---|
| 85 | // necessary
|
|---|
| 86 | fmcevt2 = (MMcEvt*)pList->FindObject(AddSerialNumber("MMcEvt",fCT2id));
|
|---|
| 87 | if (!fmcevt2)
|
|---|
| 88 | {
|
|---|
| 89 | *fLog << err << AddSerialNumber("MMcEvt",fCT2id) << " not found... aborting." << endl;
|
|---|
| 90 | return kFALSE;
|
|---|
| 91 | }
|
|---|
| 92 |
|
|---|
| 93 | // necessary
|
|---|
| 94 | TString geomname = "MGeomCam;";
|
|---|
| 95 | geomname += fCT1id;
|
|---|
| 96 | fGeomCam1 = (MGeomCam*)pList->FindObject(geomname);
|
|---|
| 97 | if (!fGeomCam1)
|
|---|
| 98 | {
|
|---|
| 99 | *fLog << err << geomname << " (Camera Geometry) missing in Parameter List... aborting." << endl;
|
|---|
| 100 | return kFALSE;
|
|---|
| 101 | }
|
|---|
| 102 |
|
|---|
| 103 | // necessary
|
|---|
| 104 | geomname = "MGeomCam;";
|
|---|
| 105 | geomname += fCT2id;
|
|---|
| 106 | fGeomCam2 = (MGeomCam*)pList->FindObject(geomname);
|
|---|
| 107 | if (!fGeomCam2)
|
|---|
| 108 | {
|
|---|
| 109 | *fLog << err << geomname << " (Camera Geometry) missing in Parameter List... aborting." << endl;
|
|---|
| 110 | return kFALSE;
|
|---|
| 111 | }
|
|---|
| 112 |
|
|---|
| 113 | // necessary
|
|---|
| 114 | TString hillasname = "MHillas;";
|
|---|
| 115 | hillasname += fCT1id;
|
|---|
| 116 | fHillas1 = (MHillas*)pList->FindObject(hillasname);
|
|---|
| 117 | if (!fHillas1)
|
|---|
| 118 | {
|
|---|
| 119 | *fLog << err << hillasname << " missing in Parameter List... aborting." << endl;
|
|---|
| 120 | return kFALSE;
|
|---|
| 121 | }
|
|---|
| 122 |
|
|---|
| 123 | // necessary
|
|---|
| 124 | hillasname = "MHillas;";
|
|---|
| 125 | hillasname += fCT2id;
|
|---|
| 126 | fHillas2 = (MHillas*)pList->FindObject(hillasname);
|
|---|
| 127 | if (!fHillas2)
|
|---|
| 128 | {
|
|---|
| 129 | *fLog << err << hillasname << " missing in Parameter List... aborting." << endl;
|
|---|
| 130 | return kFALSE;
|
|---|
| 131 | }
|
|---|
| 132 |
|
|---|
| 133 | fStereoPar = (MStereoPar*)pList->FindCreateObj("MStereoPar");
|
|---|
| 134 | if (!fStereoPar)
|
|---|
| 135 | {
|
|---|
| 136 | *fLog << err << "Could not create MStereoPar... aborting" << endl;
|
|---|
| 137 | return kFALSE;
|
|---|
| 138 | }
|
|---|
| 139 |
|
|---|
| 140 | return kTRUE;
|
|---|
| 141 | }
|
|---|
| 142 |
|
|---|
| 143 | // --------------------------------------------------------------------------
|
|---|
| 144 | //
|
|---|
| 145 | // Call the Calc procedure of the MStereoPar object, where the
|
|---|
| 146 | // calculations combining the data from the two telescopes are performed.
|
|---|
| 147 | //
|
|---|
| 148 | Int_t MStereoCalc::Process()
|
|---|
| 149 | {
|
|---|
| 150 | fStereoPar->Calc(*fHillas1, *fmcevt1, *fGeomCam1, fCT1x, fCT1y, *fHillas2, *fmcevt2, *fGeomCam2, fCT2x, fCT2y);
|
|---|
| 151 |
|
|---|
| 152 | return kTRUE;
|
|---|
| 153 | }
|
|---|
| 154 |
|
|---|
| 155 | // --------------------------------------------------------------------------
|
|---|
| 156 | //
|
|---|
| 157 | // Does nothing at the moment.
|
|---|
| 158 | //
|
|---|
| 159 | Int_t MStereoCalc::PostProcess()
|
|---|
| 160 | {
|
|---|
| 161 | return kTRUE;
|
|---|
| 162 | }
|
|---|