Particle Identification and Tracking
filter.h
Go to the documentation of this file.
1 //Copyright 2009-2011 Thomas A Caswell
2 //tcaswell@uchicago.edu
3 //http://jfi.uchicago.edu/~tcaswell
4 //
5 //This program is free software; you can redistribute it and/or modify
6 //it under the terms of the GNU General Public License as published by
7 //the Free Software Foundation; either version 3 of the License, or (at
8 //your option) any later version.
9 //
10 //This program is distributed in the hope that it will be useful, but
11 //WITHOUT ANY WARRANTY; without even the implied warranty of
12 //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 //General Public License for more details.
14 //
15 //You should have received a copy of the GNU General Public License
16 //along with this program; if not, see <http://www.gnu.org/licenses>.
17 //
18 //Additional permission under GNU GPL version 3 section 7
19 //
20 //If you modify this Program, or any covered work, by linking or
21 //combining it with MATLAB (or a modified version of that library),
22 //containing parts covered by the terms of MATLAB User License, the
23 //licensors of this Program grant you additional permission to convey
24 //the resulting work.
25 
26 #ifndef FILTER
27 #define FILTER
28 #include <string>
29 #include <vector>
30 
31 namespace utilities
32 {
33 class Wrapper_in;
34 class Md_store;
35 
40 typedef enum FILT_TYPE{
41  FILT_TRIV = 0, // trivial, always returns true
42  FILT_ERS, // e_cut(top),rg_cut(top),shift_cut(top)
43  FILT_ERSImin, // e_cut(top),rg_cut(top),shift_cut(top), I_cut(bottom)
44 } FILT_TYPE;
45 
46 
57 class Filter
58 {
59 public:
64  virtual bool operator() (int index,int frame)const = 0;
68  virtual void set_wrapper(const Wrapper_in * )=0;
69 
73  virtual FILT_TYPE get_type()const = 0;
74 
78  virtual ~Filter(){};
82  Filter(){};
83 };
84 
85 
89 class Filter_trivial:public Filter
90 {
91 public:
92  bool operator()(int,int)const
93  {
94  return true;
95  }
96  void set_wrapper(const Wrapper_in * ){};
97  FILT_TYPE get_type()const{return FILT_TRIV;};
100 };
101 
102 
103 
107 class Filter_ers:public Filter
108 {
109 public:
110  bool operator()(int ind,int frame) const;
114  Filter_ers();
118  void init(const Md_store & md_store);
119  void set_wrapper(const Wrapper_in * w_i )
120  {
121  wrap_ = w_i;
122  }
123  FILT_TYPE get_type()const{return FILT_ERS;};
127  Md_store get_parameters()const;
128 
133  {
134  }
135 private:
139  float e_cut_;
143  float rg_cut_;
147  float shift_cut_;
152 
156  const Wrapper_in * wrap_;
157 };
158 
159 
160 
165 class Filter_ersI:public Filter
166 {
167 public:
168  bool operator()(int ind,int frame) const;
172  Filter_ersI();
176  void init(const Md_store & md_store);
177  void set_wrapper(const Wrapper_in * w_i )
178  {
179  wrap_ = w_i;
180  }
181  FILT_TYPE get_type()const{return FILT_ERSImin;};
185  Md_store get_parameters()const;
186 
191  {
192  }
193 private:
197  float e_cut_;
201  float rg_cut_;
205  float shift_cut_;
209  float I_min_cut_;
210 
214  const Wrapper_in * wrap_;
215 };
216 
217 
218 
219 
220 
227 Filter * filter_factory(const Md_store & filter_prams);
228 
234 Md_store extract_prams(const std::string & fname,int comp_num, const std::vector<std::string> & pram_list);
235 
236 
237 }
238 #endif