Public Member Functions | Private Attributes | List of all members
WireCell::SigProc::PMTNoiseROI Class Reference

#include <PMTNoiseROI.h>

Public Member Functions

 PMTNoiseROI (int start_bin, int end_bin, int peak, int channel, float peak_height)
 
 ~PMTNoiseROI ()
 
int get_start_bin ()
 
int get_end_bin ()
 
void insert_peak (int peak)
 
void insert_uwires (int wire_no, float peak_height)
 
void insert_vwires (int wire_no, float peak_height)
 
std::vector< int > & get_peaks ()
 
std::vector< int > & get_uwires ()
 
std::vector< int > & get_vwires ()
 
std::vector< int > & get_wwires ()
 
std::map< int, float > & get_uwires_peak_heights ()
 
std::map< int, float > & get_vwires_peak_heights ()
 
std::map< int, float > & get_wwires_peak_heights ()
 
float get_average_uwires_peak_height (int group)
 
float get_average_vwires_peak_height (int group)
 
float get_max_uwires_peak_height (int group)
 
float get_max_vwires_peak_height (int group)
 
float get_average_wwires_peak_height ()
 
float get_max_wwires_peak_height ()
 
std::vector< std::vector< int > > & get_sorted_uwires ()
 
std::vector< std::vector< int > > & get_sorted_vwires ()
 
std::vector< int > & get_sorted_wwires ()
 
void sort_wires (int nwire=1)
 
bool merge_ROI (PMTNoiseROI &ROI)
 

Private Attributes

std::vector< int > peaks
 
int start_bin
 
int end_bin
 
std::map< int, float > uwires_peak_heights
 
std::map< int, float > vwires_peak_heights
 
std::map< int, float > wwires_peak_heights
 
std::vector< int > induction_uwires
 
std::vector< int > induction_vwires
 
std::vector< int > collection_wwires
 
std::vector< std::vector< int > > sorted_ind_uwires
 
std::vector< std::vector< int > > sorted_ind_vwires
 
std::vector< int > sorted_col_wwires
 

Detailed Description

Definition at line 9 of file PMTNoiseROI.h.

Constructor & Destructor Documentation

PMTNoiseROI::PMTNoiseROI ( int  start_bin,
int  end_bin,
int  peak,
int  channel,
float  peak_height 
)

Definition at line 10 of file PMTNoiseROI.cxx.

12  , end_bin(end_bin)
13 {
14  peaks.push_back(peak);
15  collection_wwires.push_back(channel);
16  wwires_peak_heights[channel] = fabs(peak_height);
17 }
std::map< int, float > wwires_peak_heights
Definition: PMTNoiseROI.h:58
std::vector< int > peaks
Definition: PMTNoiseROI.h:52
std::vector< int > collection_wwires
Definition: PMTNoiseROI.h:63
PMTNoiseROI::~PMTNoiseROI ( )

Definition at line 20 of file PMTNoiseROI.cxx.

20  {
21 
22 }

Member Function Documentation

float PMTNoiseROI::get_average_uwires_peak_height ( int  group)

Definition at line 90 of file PMTNoiseROI.cxx.

90  {
91  float ave = 0 ;
92  float ave1 = 0 ;
93  if (group < int(sorted_ind_uwires.size())){
94  for (int i=0;i!=int(sorted_ind_uwires.at(group).size());i++){
95  ave += uwires_peak_heights[sorted_ind_uwires.at(group).at(i)];
96  ave1 ++;
97  }
98  }
99 
100  if (ave1 >0){
101  return ave/ave1;
102  }else{
103  return 0;
104  }
105 }
std::map< int, float > uwires_peak_heights
Definition: PMTNoiseROI.h:56
std::vector< std::vector< int > > sorted_ind_uwires
Definition: PMTNoiseROI.h:65
float PMTNoiseROI::get_average_vwires_peak_height ( int  group)

Definition at line 107 of file PMTNoiseROI.cxx.

107  {
108  float ave = 0 ;
109  float ave1 = 0 ;
110  if (group < int(sorted_ind_vwires.size())){
111  for (int i=0;i!=int(sorted_ind_vwires.at(group).size());i++){
112  ave += vwires_peak_heights[sorted_ind_vwires.at(group).at(i)];
113  ave1 ++;
114  }
115  }
116  if (ave1 >0){
117  return ave/ave1;
118  }else{
119  return 0;
120  }
121 }
std::vector< std::vector< int > > sorted_ind_vwires
Definition: PMTNoiseROI.h:66
std::map< int, float > vwires_peak_heights
Definition: PMTNoiseROI.h:57
float PMTNoiseROI::get_average_wwires_peak_height ( )

Definition at line 53 of file PMTNoiseROI.cxx.

53  {
54  float ave = 0 ;
55  float ave1 = 0 ;
56  for (int i=0;i!=int(sorted_col_wwires.size());i++){
58  ave1 ++;
59  }
60  if (ave1 >0){
61  return ave/ave1;
62  }else{
63  return 0;
64  }
65 }
std::map< int, float > wwires_peak_heights
Definition: PMTNoiseROI.h:58
std::vector< int > sorted_col_wwires
Definition: PMTNoiseROI.h:67
int WireCell::SigProc::PMTNoiseROI::get_end_bin ( )
inline

Definition at line 15 of file PMTNoiseROI.h.

float PMTNoiseROI::get_max_uwires_peak_height ( int  group)

Definition at line 68 of file PMTNoiseROI.cxx.

68  {
69  float max = 0;
70  if (group < int(sorted_ind_uwires.size())){
71  for (int i=0;i!=int(sorted_ind_uwires.at(group).size());i++){
72  if (uwires_peak_heights[sorted_ind_uwires.at(group).at(i)] > max)
73  max= uwires_peak_heights[sorted_ind_uwires.at(group).at(i)];
74  }
75  }
76  return max;
77 }
std::map< int, float > uwires_peak_heights
Definition: PMTNoiseROI.h:56
std::vector< std::vector< int > > sorted_ind_uwires
Definition: PMTNoiseROI.h:65
static int max(int a, int b)
float PMTNoiseROI::get_max_vwires_peak_height ( int  group)

Definition at line 79 of file PMTNoiseROI.cxx.

79  {
80  float max = 0;
81  if (group < int(sorted_ind_vwires.size())){
82  for (int i=0;i!=int(sorted_ind_vwires.at(group).size());i++){
83  if (vwires_peak_heights[sorted_ind_vwires.at(group).at(i)] > max)
84  max= vwires_peak_heights[sorted_ind_vwires.at(group).at(i)];
85  }
86  }
87  return max;
88 }
std::vector< std::vector< int > > sorted_ind_vwires
Definition: PMTNoiseROI.h:66
static int max(int a, int b)
std::map< int, float > vwires_peak_heights
Definition: PMTNoiseROI.h:57
float PMTNoiseROI::get_max_wwires_peak_height ( )

Definition at line 44 of file PMTNoiseROI.cxx.

44  {
45  float max = 0;
46  for (int i=0;i!=int(sorted_col_wwires.size());i++){
49  }
50  return max;
51 }
std::map< int, float > wwires_peak_heights
Definition: PMTNoiseROI.h:58
std::vector< int > sorted_col_wwires
Definition: PMTNoiseROI.h:67
static int max(int a, int b)
std::vector<int>& WireCell::SigProc::PMTNoiseROI::get_peaks ( )
inline

Definition at line 23 of file PMTNoiseROI.h.

23 {return peaks;}
std::vector< int > peaks
Definition: PMTNoiseROI.h:52
std::vector<std::vector<int> >& WireCell::SigProc::PMTNoiseROI::get_sorted_uwires ( )
inline

Definition at line 44 of file PMTNoiseROI.h.

44 {return sorted_ind_uwires;}
std::vector< std::vector< int > > sorted_ind_uwires
Definition: PMTNoiseROI.h:65
std::vector<std::vector<int> >& WireCell::SigProc::PMTNoiseROI::get_sorted_vwires ( )
inline

Definition at line 45 of file PMTNoiseROI.h.

45 {return sorted_ind_vwires;}
std::vector< std::vector< int > > sorted_ind_vwires
Definition: PMTNoiseROI.h:66
std::vector<int>& WireCell::SigProc::PMTNoiseROI::get_sorted_wwires ( )
inline

Definition at line 46 of file PMTNoiseROI.h.

46 {return sorted_col_wwires;}
std::vector< int > sorted_col_wwires
Definition: PMTNoiseROI.h:67
int WireCell::SigProc::PMTNoiseROI::get_start_bin ( )
inline

Definition at line 14 of file PMTNoiseROI.h.

std::vector<int>& WireCell::SigProc::PMTNoiseROI::get_uwires ( )
inline

Definition at line 25 of file PMTNoiseROI.h.

25 {return induction_uwires;}
std::vector< int > induction_uwires
Definition: PMTNoiseROI.h:61
std::map<int,float>& WireCell::SigProc::PMTNoiseROI::get_uwires_peak_heights ( )
inline

Definition at line 29 of file PMTNoiseROI.h.

29 {return uwires_peak_heights;}
std::map< int, float > uwires_peak_heights
Definition: PMTNoiseROI.h:56
std::vector<int>& WireCell::SigProc::PMTNoiseROI::get_vwires ( )
inline

Definition at line 26 of file PMTNoiseROI.h.

26 {return induction_vwires;}
std::vector< int > induction_vwires
Definition: PMTNoiseROI.h:62
std::map<int,float>& WireCell::SigProc::PMTNoiseROI::get_vwires_peak_heights ( )
inline

Definition at line 30 of file PMTNoiseROI.h.

30 {return vwires_peak_heights;}
std::map< int, float > vwires_peak_heights
Definition: PMTNoiseROI.h:57
std::vector<int>& WireCell::SigProc::PMTNoiseROI::get_wwires ( )
inline

Definition at line 27 of file PMTNoiseROI.h.

27 {return collection_wwires;}
std::vector< int > collection_wwires
Definition: PMTNoiseROI.h:63
std::map<int,float>& WireCell::SigProc::PMTNoiseROI::get_wwires_peak_heights ( )
inline

Definition at line 31 of file PMTNoiseROI.h.

31 {return wwires_peak_heights;}
std::map< int, float > wwires_peak_heights
Definition: PMTNoiseROI.h:58
void PMTNoiseROI::insert_peak ( int  peak)

Definition at line 24 of file PMTNoiseROI.cxx.

24  {
25  if (find(peaks.begin(),peaks.end(),peak)==peaks.end())
26  peaks.push_back(peak);
27 }
Configuration find(Configuration &lst, const std::string &dotpath, const T &val)
Return dictionary in given list if it value at dotpath matches.
std::vector< int > peaks
Definition: PMTNoiseROI.h:52
void PMTNoiseROI::insert_uwires ( int  wire_no,
float  peak_height 
)

Definition at line 30 of file PMTNoiseROI.cxx.

30  {
31  if (find(induction_uwires.begin(),induction_uwires.end(),wire_no)==induction_uwires.end()){
32  induction_uwires.push_back(wire_no);
33  uwires_peak_heights[wire_no] = peak_height;
34  }
35 }
std::map< int, float > uwires_peak_heights
Definition: PMTNoiseROI.h:56
Configuration find(Configuration &lst, const std::string &dotpath, const T &val)
Return dictionary in given list if it value at dotpath matches.
std::vector< int > induction_uwires
Definition: PMTNoiseROI.h:61
void PMTNoiseROI::insert_vwires ( int  wire_no,
float  peak_height 
)

Definition at line 37 of file PMTNoiseROI.cxx.

37  {
38  if (find(induction_vwires.begin(),induction_vwires.end(),wire_no)==induction_vwires.end()){
39  induction_vwires.push_back(wire_no);
40  vwires_peak_heights[wire_no] = peak_height;
41  }
42 }
std::vector< int > induction_vwires
Definition: PMTNoiseROI.h:62
Configuration find(Configuration &lst, const std::string &dotpath, const T &val)
Return dictionary in given list if it value at dotpath matches.
std::map< int, float > vwires_peak_heights
Definition: PMTNoiseROI.h:57
bool PMTNoiseROI::merge_ROI ( PMTNoiseROI ROI)

Definition at line 124 of file PMTNoiseROI.cxx.

124  {
125  // decide how to merge two ROIs? ...
126 
127  // one peak is contained in the other's range then merge
128  if ( (peaks.at(0)>=ROI.get_start_bin() && peaks.at(0)<=ROI.get_end_bin())
129  || (start_bin <= ROI.get_peaks().at(0) && end_bin >= ROI.get_peaks().at(0))){
130  if (ROI.get_start_bin() < start_bin)
131  start_bin = ROI.get_start_bin();
132  if (ROI.get_end_bin() > end_bin)
133  end_bin = ROI.get_end_bin();
134 
135  for (int i=0;i!=int(ROI.get_peaks().size());i++){
136  if (find(peaks.begin(),peaks.end(),ROI.get_peaks().at(i)) == peaks.end())
137  peaks.push_back(ROI.get_peaks().at(i));
138  }
139 
140  for (int i=0;i!=int(ROI.get_wwires().size());i++){
141  if (find(collection_wwires.begin(),collection_wwires.end(),ROI.get_wwires().at(i)) == collection_wwires.end()){
142  collection_wwires.push_back(ROI.get_wwires().at(i));
143  }
144 
145  // calculate wire height
146  if (wwires_peak_heights.find(ROI.get_wwires().at(i))==wwires_peak_heights.end()){
147  wwires_peak_heights[ROI.get_wwires().at(i)] = ROI.get_wwires_peak_heights()[ROI.get_wwires().at(i)];
148  }else{
149  if (ROI.get_wwires_peak_heights()[ROI.get_wwires().at(i)] > wwires_peak_heights[ROI.get_wwires().at(i)])
150  wwires_peak_heights[ROI.get_wwires().at(i)] = ROI.get_wwires_peak_heights()[ROI.get_wwires().at(i)];
151  }
152 
153  }
154 
155  // for (int i=0;i!=ROI.get_wwires_peak_heights().size();i++){
156  // wwires_peak_heights.push_back(ROI.get_wwires_peak_heights().at(i));
157  //}
158 
159 
160 
161  return true;
162  }
163 
164  return false;
165 }
std::map< int, float > wwires_peak_heights
Definition: PMTNoiseROI.h:58
std::map< int, float > & get_wwires_peak_heights()
Definition: PMTNoiseROI.h:31
Configuration find(Configuration &lst, const std::string &dotpath, const T &val)
Return dictionary in given list if it value at dotpath matches.
std::vector< int > peaks
Definition: PMTNoiseROI.h:52
std::vector< int > collection_wwires
Definition: PMTNoiseROI.h:63
std::vector< int > & get_peaks()
Definition: PMTNoiseROI.h:23
std::vector< int > & get_wwires()
Definition: PMTNoiseROI.h:27
void PMTNoiseROI::sort_wires ( int  nwire = 1)

Definition at line 168 of file PMTNoiseROI.cxx.

168  {
169 
170  std::vector<int> temp_wires;
171  if (int(induction_uwires.size()) >=nwire){
172  std::sort(induction_uwires.begin(),induction_uwires.end());
173  temp_wires.push_back(induction_uwires.at(0));
174  // do u wires;
175  for (int i=1;i<int(induction_uwires.size());i++){
176  if (induction_uwires.at(i) - temp_wires.back() == 1){
177  temp_wires.push_back(induction_uwires.at(i));
178  }else{
179  if (int(temp_wires.size()) >= nwire){
180  sorted_ind_uwires.push_back(temp_wires);
181  }
182  temp_wires.clear();
183  temp_wires.push_back(induction_uwires.at(i));
184  }
185  }
186  if (int(temp_wires.size()) >= nwire){
187  sorted_ind_uwires.push_back(temp_wires);
188  }
189  temp_wires.clear();
190  }
191 
192  if (int(induction_vwires.size()) >=nwire){
193  std::sort(induction_vwires.begin(),induction_vwires.end());
194  temp_wires.push_back(induction_vwires.at(0));
195  // do u wires;
196  for (int i=1;i<int(induction_vwires.size());i++){
197  if (induction_vwires.at(i) - temp_wires.back() == 1){
198  temp_wires.push_back(induction_vwires.at(i));
199  }else{
200  if (int(temp_wires.size()) >= nwire){
201  sorted_ind_vwires.push_back(temp_wires);
202  }
203  temp_wires.clear();
204  temp_wires.push_back(induction_vwires.at(i));
205  }
206  }
207  if (int(temp_wires.size()) >= nwire){
208  sorted_ind_vwires.push_back(temp_wires);
209  }
210  temp_wires.clear();
211  }
212 
213 
214  if (int(collection_wwires.size()) >=nwire){
215  std::sort(collection_wwires.begin(),collection_wwires.end());
216  temp_wires.push_back(collection_wwires.at(0));
217  // do u wires;
218  for (int i=1;i<int(collection_wwires.size());i++){
219  if (collection_wwires.at(i) - temp_wires.back() == 1){
220  temp_wires.push_back(collection_wwires.at(i));
221  }else{
222  if (int(temp_wires.size()) >= nwire){
223  for (int j=0;j!=int(temp_wires.size());j++){
224  sorted_col_wwires.push_back(temp_wires.at(j));
225  }
226  }
227  temp_wires.clear();
228  temp_wires.push_back(collection_wwires.at(i));
229  }
230  }
231  if (int(temp_wires.size()) >= nwire){
232  for (int j=0;j!=int(temp_wires.size());j++){
233  sorted_col_wwires.push_back(temp_wires.at(j));
234  }
235  }
236  temp_wires.clear();
237  }
238 
239 
240 }
std::vector< int > induction_vwires
Definition: PMTNoiseROI.h:62
std::vector< std::vector< int > > sorted_ind_vwires
Definition: PMTNoiseROI.h:66
std::vector< std::vector< int > > sorted_ind_uwires
Definition: PMTNoiseROI.h:65
std::vector< int > sorted_col_wwires
Definition: PMTNoiseROI.h:67
std::vector< int > induction_uwires
Definition: PMTNoiseROI.h:61
std::vector< int > collection_wwires
Definition: PMTNoiseROI.h:63

Member Data Documentation

std::vector<int> WireCell::SigProc::PMTNoiseROI::collection_wwires
private

Definition at line 63 of file PMTNoiseROI.h.

int WireCell::SigProc::PMTNoiseROI::end_bin
private

Definition at line 54 of file PMTNoiseROI.h.

std::vector<int> WireCell::SigProc::PMTNoiseROI::induction_uwires
private

Definition at line 61 of file PMTNoiseROI.h.

std::vector<int> WireCell::SigProc::PMTNoiseROI::induction_vwires
private

Definition at line 62 of file PMTNoiseROI.h.

std::vector<int> WireCell::SigProc::PMTNoiseROI::peaks
private

Definition at line 52 of file PMTNoiseROI.h.

std::vector<int> WireCell::SigProc::PMTNoiseROI::sorted_col_wwires
private

Definition at line 67 of file PMTNoiseROI.h.

std::vector<std::vector<int> > WireCell::SigProc::PMTNoiseROI::sorted_ind_uwires
private

Definition at line 65 of file PMTNoiseROI.h.

std::vector<std::vector<int> > WireCell::SigProc::PMTNoiseROI::sorted_ind_vwires
private

Definition at line 66 of file PMTNoiseROI.h.

int WireCell::SigProc::PMTNoiseROI::start_bin
private

Definition at line 53 of file PMTNoiseROI.h.

std::map<int,float> WireCell::SigProc::PMTNoiseROI::uwires_peak_heights
private

Definition at line 56 of file PMTNoiseROI.h.

std::map<int,float> WireCell::SigProc::PMTNoiseROI::vwires_peak_heights
private

Definition at line 57 of file PMTNoiseROI.h.

std::map<int,float> WireCell::SigProc::PMTNoiseROI::wwires_peak_heights
private

Definition at line 58 of file PMTNoiseROI.h.


The documentation for this class was generated from the following files: