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 11/2003 <mailto:wittek@mppmu.mpg.de>
|
---|
19 | !
|
---|
20 | ! Copyright: MAGIC Software Development, 2000-2003
|
---|
21 | !
|
---|
22 | !
|
---|
23 | \* ======================================================================== */
|
---|
24 |
|
---|
25 | /////////////////////////////////////////////////////////////////////////////
|
---|
26 | // //
|
---|
27 | // MFAntiFilter //
|
---|
28 | // //
|
---|
29 | // it checks the result of the filter 'fFilter' and returns the opposite //
|
---|
30 | // of the result //
|
---|
31 | // //
|
---|
32 | // Note : when this class is used both the original filter and its //
|
---|
33 | // opposite are available; this is not the case when //
|
---|
34 | // SetInverted() is used; //
|
---|
35 | // //
|
---|
36 | // //
|
---|
37 | /////////////////////////////////////////////////////////////////////////////
|
---|
38 | #include "MFAntiFilter.h"
|
---|
39 |
|
---|
40 | #include <math.h>
|
---|
41 | #include <fstream>
|
---|
42 |
|
---|
43 | #include "MLog.h"
|
---|
44 | #include "MLogManip.h"
|
---|
45 |
|
---|
46 | #include "MParList.h"
|
---|
47 |
|
---|
48 | #include "MFilter.h"
|
---|
49 |
|
---|
50 | ClassImp(MFAntiFilter);
|
---|
51 |
|
---|
52 | using namespace std;
|
---|
53 |
|
---|
54 | // --------------------------------------------------------------------------
|
---|
55 | //
|
---|
56 | MFAntiFilter::MFAntiFilter(MFilter &filter,
|
---|
57 | const char *name, const char *title)
|
---|
58 | {
|
---|
59 | fName = name ? name : "MFAntiFilter";
|
---|
60 | fTitle = title ? title : "Filter returning the opposite of a given filter";
|
---|
61 |
|
---|
62 | fFilter = &filter;
|
---|
63 | }
|
---|
64 |
|
---|
65 |
|
---|
66 | // --------------------------------------------------------------------------
|
---|
67 | //
|
---|
68 | Int_t MFAntiFilter::PreProcess(MParList *pList)
|
---|
69 | {
|
---|
70 | fNumSelectedEvts = 0;
|
---|
71 |
|
---|
72 | return kTRUE;
|
---|
73 | }
|
---|
74 |
|
---|
75 | // --------------------------------------------------------------------------
|
---|
76 | //
|
---|
77 | Int_t MFAntiFilter::Process()
|
---|
78 | {
|
---|
79 | fResult = !fFilter->IsConditionTrue();
|
---|
80 |
|
---|
81 | if (!fResult)
|
---|
82 | return kTRUE;
|
---|
83 |
|
---|
84 | fNumSelectedEvts++;
|
---|
85 |
|
---|
86 | return kTRUE;
|
---|
87 | }
|
---|
88 |
|
---|
89 | // --------------------------------------------------------------------------
|
---|
90 | //
|
---|
91 | Int_t MFAntiFilter::PostProcess()
|
---|
92 | {
|
---|
93 | *fLog << "MFAntiFilter::PostProcess; " << fNumSelectedEvts
|
---|
94 | << " events were selected out of " << GetNumExecutions() << endl;
|
---|
95 |
|
---|
96 | return kTRUE;
|
---|
97 | }
|
---|
98 |
|
---|
99 | //=========================================================================
|
---|
100 |
|
---|
101 |
|
---|
102 |
|
---|
103 |
|
---|
104 |
|
---|
105 |
|
---|
106 |
|
---|