| 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): Thomas Bretz 01/2002 <mailto:tbretz@uni-sw.gwdg.de>
|
|---|
| 19 | !
|
|---|
| 20 | ! Copyright: MAGIC Software Development, 2000-2002
|
|---|
| 21 | !
|
|---|
| 22 | !
|
|---|
| 23 | \* ======================================================================== */
|
|---|
| 24 |
|
|---|
| 25 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 26 | // //
|
|---|
| 27 | // MFAlpha //
|
|---|
| 28 | // //
|
|---|
| 29 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 30 |
|
|---|
| 31 | #include "MFAlpha.h"
|
|---|
| 32 |
|
|---|
| 33 | #include <math.h>
|
|---|
| 34 |
|
|---|
| 35 | #include "MParList.h"
|
|---|
| 36 | #include "MLog.h"
|
|---|
| 37 | #include "MLogManip.h"
|
|---|
| 38 |
|
|---|
| 39 | #include "MHillasSrc.h"
|
|---|
| 40 |
|
|---|
| 41 | ClassImp(MFAlpha);
|
|---|
| 42 |
|
|---|
| 43 |
|
|---|
| 44 | // --------------------------------------------------------------------------
|
|---|
| 45 | //
|
|---|
| 46 | MFAlpha::MFAlpha(const char *cname, const char type, const Float_t val,
|
|---|
| 47 | const char *name, const char *title) : fHillas(NULL)
|
|---|
| 48 | {
|
|---|
| 49 | fContName = cname;
|
|---|
| 50 | Init(type, val, name, title);
|
|---|
| 51 | }
|
|---|
| 52 |
|
|---|
| 53 | // --------------------------------------------------------------------------
|
|---|
| 54 | //
|
|---|
| 55 | MFAlpha::MFAlpha(const MHillasSrc *hillas, const char type, const Float_t val,
|
|---|
| 56 | const char *name, const char *title) : fHillas(hillas)
|
|---|
| 57 | {
|
|---|
| 58 | Init(type, val, name, title);
|
|---|
| 59 | }
|
|---|
| 60 |
|
|---|
| 61 | // --------------------------------------------------------------------------
|
|---|
| 62 | //
|
|---|
| 63 | void MFAlpha::Init(const char type, const Int_t val,
|
|---|
| 64 | const char *name, const char *title)
|
|---|
| 65 | {
|
|---|
| 66 | fName = name ? name : "MFAlpha";
|
|---|
| 67 | fTitle = title ? title : "Filter using the alpha angle";
|
|---|
| 68 |
|
|---|
| 69 | fFilterType = (type=='<' ? kELowerThan : kEGreaterThan);
|
|---|
| 70 |
|
|---|
| 71 | if (type!='<' && type!='>')
|
|---|
| 72 | *fLog << warn << dbginf << "Warning: Neither '<' nor '>' specified... using '>'." << endl;
|
|---|
| 73 |
|
|---|
| 74 | fValue = val;
|
|---|
| 75 |
|
|---|
| 76 | AddToBranchList(Form("%s.fAlpha", (const char*)fContName));
|
|---|
| 77 | }
|
|---|
| 78 |
|
|---|
| 79 | // --------------------------------------------------------------------------
|
|---|
| 80 | //
|
|---|
| 81 | Bool_t MFAlpha::PreProcess(MParList *pList)
|
|---|
| 82 | {
|
|---|
| 83 | if (fHillas)
|
|---|
| 84 | return kTRUE;
|
|---|
| 85 |
|
|---|
| 86 | fHillas = (MHillasSrc*)pList->FindObject(fContName);
|
|---|
| 87 | if (fHillas)
|
|---|
| 88 | return kTRUE;
|
|---|
| 89 |
|
|---|
| 90 | *fLog << err << dbginf << fContName << " [MHillas] not found... aborting." << endl;
|
|---|
| 91 | return kFALSE;
|
|---|
| 92 | }
|
|---|
| 93 |
|
|---|
| 94 | // --------------------------------------------------------------------------
|
|---|
| 95 | //
|
|---|
| 96 | Bool_t MFAlpha::Process()
|
|---|
| 97 | {
|
|---|
| 98 | const Float_t alpha = fabs(fHillas->GetAlpha());
|
|---|
| 99 |
|
|---|
| 100 | switch (fFilterType)
|
|---|
| 101 | {
|
|---|
| 102 | case kELowerThan:
|
|---|
| 103 | fResult = (alpha < fValue);
|
|---|
| 104 | break;
|
|---|
| 105 | case kEGreaterThan:
|
|---|
| 106 | fResult = (alpha > fValue);
|
|---|
| 107 | break;
|
|---|
| 108 | }
|
|---|
| 109 |
|
|---|
| 110 | return kTRUE;
|
|---|
| 111 | }
|
|---|
| 112 |
|
|---|