| 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): Wolfgang Wittek 03/2003 <mailto:wittek@mppmu.mpg.de>
|
|---|
| 19 | !
|
|---|
| 20 | ! Copyright: MAGIC Software Development, 2000-2003
|
|---|
| 21 | !
|
|---|
| 22 | !
|
|---|
| 23 | \* ======================================================================== */
|
|---|
| 24 |
|
|---|
| 25 | //////////////////////////////////////////////////////////////////////////////
|
|---|
| 26 | //
|
|---|
| 27 | // MNewImageParCalc
|
|---|
| 28 | //
|
|---|
| 29 | // Task to calculate the source dependant part of the hillas parameters
|
|---|
| 30 | //
|
|---|
| 31 | //////////////////////////////////////////////////////////////////////////////
|
|---|
| 32 | #include "MNewImageParCalc.h"
|
|---|
| 33 |
|
|---|
| 34 | #include <fstream.h>
|
|---|
| 35 |
|
|---|
| 36 | #include "MParList.h"
|
|---|
| 37 |
|
|---|
| 38 | #include "MGeomCam.h"
|
|---|
| 39 | #include "MSrcPosCam.h"
|
|---|
| 40 | #include "MCerPhotEvt.h"
|
|---|
| 41 | #include "MNewImagePar.h"
|
|---|
| 42 | #include "MNewImagePar.h"
|
|---|
| 43 | #include "MLog.h"
|
|---|
| 44 | #include "MLogManip.h"
|
|---|
| 45 |
|
|---|
| 46 | ClassImp(MNewImageParCalc);
|
|---|
| 47 |
|
|---|
| 48 | static const TString gsDefName = "MNewImageParCalc";
|
|---|
| 49 | static const TString gsDefTitle = "Calculate new image parameters";
|
|---|
| 50 |
|
|---|
| 51 | // -------------------------------------------------------------------------
|
|---|
| 52 | //
|
|---|
| 53 | // Default constructor. The first argument is the name of a container
|
|---|
| 54 | // containing the source position in the camera plain (MScrPosCam).
|
|---|
| 55 | // The default is "MSrcPosCam". newpar is the name of a container
|
|---|
| 56 | // of type MNewImagePar, in which the parameters are stored.
|
|---|
| 57 | // The default is "MNewImagePar"
|
|---|
| 58 | //
|
|---|
| 59 | //
|
|---|
| 60 | MNewImageParCalc::MNewImageParCalc(const char *src, const char *newpar,
|
|---|
| 61 | const char *name, const char *title)
|
|---|
| 62 | : fHillas(NULL), fSrcPos(NULL), fNewImagePar(NULL)
|
|---|
| 63 | {
|
|---|
| 64 | fName = name ? name : gsDefName.Data();
|
|---|
| 65 | fTitle = title ? title : gsDefTitle.Data();
|
|---|
| 66 |
|
|---|
| 67 | fSrcName = src;
|
|---|
| 68 | fNewParName = newpar;
|
|---|
| 69 | fHillasInput = "MHillas";
|
|---|
| 70 | }
|
|---|
| 71 |
|
|---|
| 72 | // -------------------------------------------------------------------------
|
|---|
| 73 | //
|
|---|
| 74 | Int_t MNewImageParCalc::PreProcess(MParList *pList)
|
|---|
| 75 | {
|
|---|
| 76 | fHillas = (MHillas*)pList->FindObject(fHillasInput, "MHillas");
|
|---|
| 77 | if (!fHillas)
|
|---|
| 78 | {
|
|---|
| 79 | *fLog << err << dbginf << "MHillas not found... aborting." << endl;
|
|---|
| 80 | return kFALSE;
|
|---|
| 81 | }
|
|---|
| 82 |
|
|---|
| 83 | fSrcPos = (MSrcPosCam*)pList->FindObject(fSrcName, "MSrcPosCam");
|
|---|
| 84 | if (!fSrcPos)
|
|---|
| 85 | {
|
|---|
| 86 | *fLog << err << dbginf << fSrcName << " [MSrcPosCam] not found... aborting." << endl;
|
|---|
| 87 | return kFALSE;
|
|---|
| 88 | }
|
|---|
| 89 |
|
|---|
| 90 | fCerPhotEvt = (MCerPhotEvt*)pList->FindObject("MCerPhotEvt");
|
|---|
| 91 | if (!fCerPhotEvt)
|
|---|
| 92 | {
|
|---|
| 93 | *fLog << dbginf << "MCerPhotEvt not found... aborting." << endl;
|
|---|
| 94 | return kFALSE;
|
|---|
| 95 | }
|
|---|
| 96 |
|
|---|
| 97 | fGeomCam = (MGeomCam*)pList->FindObject("MGeomCam");
|
|---|
| 98 | if (!fGeomCam)
|
|---|
| 99 | {
|
|---|
| 100 | *fLog << dbginf << "MGeomCam (Camera Geometry) missing in Parameter List... aborting." << endl;
|
|---|
| 101 | return kFALSE;
|
|---|
| 102 | }
|
|---|
| 103 |
|
|---|
| 104 | fNewImagePar = (MNewImagePar*)pList->FindCreateObj("MNewImagePar", fNewParName);
|
|---|
| 105 | if (!fNewImagePar)
|
|---|
| 106 | return kFALSE;
|
|---|
| 107 |
|
|---|
| 108 | //fErrors = 0;
|
|---|
| 109 |
|
|---|
| 110 | return kTRUE;
|
|---|
| 111 | }
|
|---|
| 112 |
|
|---|
| 113 | // -------------------------------------------------------------------------
|
|---|
| 114 | //
|
|---|
| 115 | Int_t MNewImageParCalc::Process()
|
|---|
| 116 | {
|
|---|
| 117 |
|
|---|
| 118 | /*if (!*/fNewImagePar->Calc(*fGeomCam, *fCerPhotEvt, *fHillas);/*)
|
|---|
| 119 | {
|
|---|
| 120 | fErrors++;
|
|---|
| 121 | return kCONTINUE;
|
|---|
| 122 |
|
|---|
| 123 | }*/
|
|---|
| 124 | return kTRUE;
|
|---|
| 125 | }
|
|---|
| 126 |
|
|---|
| 127 | // --------------------------------------------------------------------------
|
|---|
| 128 | //
|
|---|
| 129 | // Prints some statistics about the hillas calculation. The percentage
|
|---|
| 130 | // is calculated with respect to the number of executions of this task.
|
|---|
| 131 | //
|
|---|
| 132 | /*
|
|---|
| 133 | Bool_t MNewImageParCalc::PostProcess()
|
|---|
| 134 | {
|
|---|
| 135 | if (GetNumExecutions()==0)
|
|---|
| 136 | return kTRUE;
|
|---|
| 137 |
|
|---|
| 138 | *fLog << inf << endl;
|
|---|
| 139 | *fLog << GetDescriptor() << " execution statistics:" << endl;
|
|---|
| 140 | *fLog << dec << setfill(' ');
|
|---|
| 141 | *fLog << " " << fErrors << " (" << (int)(fErrors*100/GetNumExecutions()) << "%) Evts skipped due to: calculation failed" << endl;
|
|---|
| 142 | *fLog << endl;
|
|---|
| 143 |
|
|---|
| 144 | return kTRUE;
|
|---|
| 145 | }
|
|---|
| 146 | */
|
|---|