source: trunk/MagicSoft/Mars/mfilter/MFDataMember.cc@ 1333

Last change on this file since 1333 was 1333, checked in by tbretz, 23 years ago
*** empty log message ***
File size: 3.1 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): 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// MFDataMember
28//
29// With this filter you can filter in all variables from Mars parameter
30// containers.
31//
32// In the constructor you can give the filter variable, like
33// "MHillas.fLength"
34// Where MHillas is the name of the parameter container in the parameter
35// list and fLength is the name of the data member which should be used
36// for the filter rule. If the name of the container is use specified
37// (MyHillas) the name to give would be:
38// "MyHillas.fLength"
39//
40// For example:
41// MFDataMember filter("MHillas.fLength", '<', 150);
42//
43/////////////////////////////////////////////////////////////////////////////
44
45#include "MFDataMember.h"
46
47#include <TMethodCall.h>
48
49#include "MParList.h"
50
51#include "MLog.h"
52#include "MLogManip.h"
53
54ClassImp(MFDataMember);
55
56// --------------------------------------------------------------------------
57//
58MFDataMember::MFDataMember(const char *member, const char type, const Double_t val,
59 const char *name, const char *title)
60 : fData(member), fValue(val)
61{
62 fName = name ? name : "MFDataMember";
63 fTitle = title ? title : "Filter using any data member of a class";
64
65 AddToBranchList(member);
66
67 fFilterType = (type=='<' ? kELowerThan : kEGreaterThan);
68
69 if (type!='<' && type!='>')
70 *fLog << warn << dbginf << "Warning: Neither '<' nor '>' specified... using '>'." << endl;
71}
72
73// --------------------------------------------------------------------------
74//
75Bool_t MFDataMember::PreProcess(MParList *plist)
76{
77 return fData.PreProcess(plist);
78}
79
80// --------------------------------------------------------------------------
81//
82Bool_t MFDataMember::Process()
83{
84 switch (fFilterType)
85 {
86 case kELowerThan:
87 fResult = (fData.GetValue() < fValue);
88 return kTRUE;
89 case kEGreaterThan:
90 fResult = (fData.GetValue() > fValue);
91 return kTRUE;
92 }
93
94 return kFALSE;
95}
96
97void MFDataMember::Print(Option_t *) const
98{
99 fData.Print();
100 *fLog << (fFilterType==kELowerThan?"<":">") << fValue << flush;
101}
Note: See TracBrowser for help on using the repository browser.