source: trunk/MagicSoft/Mars/mflux/MFHadAlpha.cc@ 7348

Last change on this file since 7348 was 6605, checked in by marcos, 20 years ago
*** empty log message ***
File size: 4.2 KB
Line 
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): Marcos Lopez 2/2005 <mailto:tbretz@uni-sw.gwdg.de>
19!
20! Copyright: MAGIC Software Development, 2000-2002
21!
22!
23\* ======================================================================== */
24
25/////////////////////////////////////////////////////////////////////////////
26// //
27// MFHadAlpha //
28// //
29/////////////////////////////////////////////////////////////////////////////
30#include "MFHadAlpha.h"
31
32
33#include <fstream>
34#include <TFile.h>
35#include "MLog.h"
36#include "MLogManip.h"
37
38#include "MParList.h"
39
40#include "MHillas.h"
41#include "MHillasSrc.h"
42#include "MHadAlphaCut.h"
43#include "MEnergyEst.h"
44#include "MHadronness.h"
45#include "MPointingPos.h"
46
47ClassImp(MFHadAlpha);
48
49using namespace std;
50
51
52// --------------------------------------------------------------------------
53//
54MFHadAlpha::MFHadAlpha(const char *name, const char *title)
55 : fFilterType(kHadAlphaCut), fFileName("")
56{
57 fName = name ? name : "MFHadAlpha";
58 fTitle = title ? title : "Filter to apply hadroness and alpha cuts for each size and theta bin";
59}
60
61
62// --------------------------------------------------------------------------
63//
64Int_t MFHadAlpha::PreProcess(MParList *pList)
65{
66
67 fHillas = (MHillas*)pList->FindObject("MHillas");
68 if (!fHillas)
69 {
70 *fLog << dbginf << "MHillas not found... aborting." << endl;
71 return kFALSE;
72 }
73
74 fPointingPos = (MPointingPos*)pList->FindObject("MPointingPos");
75 if (!fPointingPos)
76 {
77 *fLog << dbginf << "MPointingPos not found... aborting." << endl;
78 return kFALSE;
79 }
80
81 fHadronness = (MHadronness*)pList->FindObject("MHadronness");
82 if (!fHadronness)
83 {
84 *fLog << dbginf << "MHadronness not found... aborting." << endl;
85 return kFALSE;
86 }
87
88 fHillasSrc = (MHillasSrc*)pList->FindObject("MHillasSrc");
89 if (!fHillasSrc)
90 {
91 *fLog << dbginf << "MHillasSrc not found... aborting." << endl;
92 return kFALSE;
93 }
94
95 fEnergyEst = (MEnergyEst*)pList->FindObject("MEnergyEst");
96 if (!fEnergyEst)
97 {
98 *fLog << dbginf << "MEnergyEst not found... aborting." << endl;
99 return kFALSE;
100 }
101
102
103 fHadAlphaCut = (MHadAlphaCut*)pList->FindCreateObj("MHadAlphaCut");
104 if (!fHadAlphaCut)
105 {
106 *fLog << dbginf << "MHadAlphaCut not found... aborting." << endl;
107 return kFALSE;
108 }
109
110 if(fFileName!="")
111 {
112 TFile f(fFileName);
113 fHadAlphaCut->Read("MHadAlphaCut");
114 }
115
116 return kTRUE;
117}
118
119// --------------------------------------------------------------------------
120//
121Int_t MFHadAlpha::Process()
122{
123 //const Float_t size = fHillas->GetSize();
124 const Float_t energy = fEnergyEst->GetEnergy();
125 const Float_t zd = fPointingPos->GetZd();
126 const Float_t alpha = TMath::Abs(fHillasSrc->GetAlpha());
127 const Float_t had = fHadronness->GetHadronness();
128
129 const Float_t alphacut = fHadAlphaCut->GetAlphaCut(energy,zd);
130 const Float_t hadcut = fHadAlphaCut->GetHadCut(energy,zd);
131
132 switch(fFilterType)
133 {
134 case MFHadAlpha::kAlphaCut:
135 fResult = ( alpha <= alphacut );
136 break;
137 case MFHadAlpha::kHadCut:
138 fResult = ( had <= hadcut );
139 break;
140 case MFHadAlpha::kHadAlphaCut:
141 fResult = ( (alpha <= alphacut) && (had <= hadcut) );
142 break;
143 default:
144 fResult = kTRUE;
145 }
146
147
148 return kTRUE;
149}
Note: See TracBrowser for help on using the repository browser.