Particle Identification and Tracking
hash_box.h
Go to the documentation of this file.
1 //Copyright 2008,2009 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 
27 
28 #ifndef HASH_BOX
29 #define HASH_BOX
30 #include <vector>
31 #include <list>
32 
33 #include "part_def.h"
34 #include "enum_utils.h"
35 #include "part_def.h"
36 
37 namespace utilities
38 {
39 class Wrapper_out;
40 
41 
42 }
43 
44 
45 namespace tracking{
46 
47 class Corr;
48 class Accumulator;
49 class Hash_shelf;
50 
63 class hash_box{
64 protected:
66  std::vector<particle*> contents_;
67 
71  const Hash_shelf * shelf_;
72 
77 
82 
83 public:
84 
87 
88 
90  hash_box(const Hash_shelf* in,int hash_indx,bool own_part):
91  contents_(),shelf_(in),hash_indx_(hash_indx),owns_particles_(own_part){
92 
93  }
98  {}
99 
101  ~hash_box();
102 
104  void clear(){contents_.clear();}
105 
106 
107 
108 
109 
111  void push(particle* next){
112  contents_.push_back(next);
113  };
114 
115 
117  void append(hash_box* next);
118 
119 
121  void print();
122 
124 
127 
129  int get_size(){return contents_.size(); }
130 
134  void get_val_vec(std::vector<float> & vec, utilities::D_TYPE type);
135 
142  std::vector<particle*>::iterator begin(){
143  return contents_.begin();
144  }
150  std::vector<particle*>::const_iterator begin()const{
151  return contents_.begin();
152  }
159  std::vector<particle*>::iterator end(){
160  return contents_.end();
161  }
162 
163  /*
164  Returns a pointer to a new list of the pa rticle_track* pointers
165  for dealing with tracking. This always returns a valid pointer
166  to a list. If the box is empty then a pointer to an empty list
167  is returned. This function allocates heap that needs to be cleaned
168  up!
169  */
170  // std::list<par ticle_track*>* box_to_list() const;
171 
172  /*
173  A safer version of converting a hash_box to a list
174  */
175  //void box_to_list(std::list<part icle_track*>& p_list) const;
179  void box_to_list(std::list<particle*>& p_list) const;
180 
181  //lots more of these along different components, likely reason to extend
182  //these critters, however I haven't decided the most effective method of
183  //returning this data, and it may very well depend on exactly what I am going
184  //to do with it because I haven't addressed how to handle the IPP
185  //junk
186 
188 
189 
190 
195  void pass_fun_to_part(void(particle::*fun)());
201  void pass_fun_to_part(void(particle::*fun)()const)const;
202 
206  void output_to_wrapper(utilities::Wrapper_out & wrapper) const;
207 
208 
212  void compute_corr(tracking::Corr &) const ;
213 
217  void compute_accum(Accumulator & in)const;
218 
219 };
220 }
221 #endif
222 
223  //random ideas
224  /*
225  Implement a g(r) struct that will hold the the count and r for
226  each bin
227  */