OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
PeakFinder.h
Go to the documentation of this file.
1 #ifndef PEAKFINDER_H
2 #define PEAKFINDER_H
3 
17 #include "Utility/IpplInfo.h"
18 #include "Algorithms/Vektor.h"
19 
20 #include <fstream>
21 #include <string>
22 #include <vector>
23 #include <list>
24 
25 class PeakFinder {
26 
27 public:
28  using container_t = std::vector<double>;
29 
30 public:
31 
32  PeakFinder() = delete;
33 
34  PeakFinder(std::string elem, double min, double max, double binwidth, bool singlemode);
35 
40  void addParticle(const Vector_t& R);
41 
45  void evaluate(const int& turn);
46 
47  void save();
48 
49 private:
50 
51  // compute global histogram, involves some inter-node communication
52  void createHistogram_m();
53 
54  /***************
55  * Output file *
56  ***************/
58  void open_m();
60  void append_m();
62  void close_m();
64  void saveASCII_m();
65 
66  void computeCentroid_m();
67 
68 private:
72 
74  std::string fn_m;
75 
77  std::string hist_m;
78 
80  std::ofstream os_m;
81 
83  std::ofstream hos_m;
84 
86  std::string element_m;
87 
88  // Histogram details
90  unsigned int nBins_m;
92  double binWidth_m;
94  double min_m, max_m;
95 
96  int turn_m;
97  double peakRadius_m;
99  std::list<double> peaks_m;
101  bool first_m;
103 };
104 
105 #endif
std::list< double > peaks_m
Definition: PeakFinder.h:99
std::string hist_m
histogram filename with extension (.hist)
Definition: PeakFinder.h:77
void computeCentroid_m()
Definition: PeakFinder.cpp:104
PeakFinder()=delete
std::vector< double > container_t
Definition: PeakFinder.h:28
double peakRadius_m
Definition: PeakFinder.h:97
T::PETE_Expr_t::PETE_Return_t max(const PETE_Expr< T > &expr, NDIndex< D > &loc)
Definition: ReductionLoc.h:123
double min_m
histogram size
Definition: PeakFinder.h:94
int registered_m
Definition: PeakFinder.h:98
double max_m
Definition: PeakFinder.h:94
void addParticle(const Vector_t &R)
Definition: PeakFinder.cpp:31
bool finished_m
Definition: PeakFinder.h:102
void save()
Definition: PeakFinder.cpp:73
std::ofstream hos_m
used to write out the histrogram
Definition: PeakFinder.h:83
void evaluate(const int &turn)
Definition: PeakFinder.cpp:41
unsigned int nBins_m
Number of bins.
Definition: PeakFinder.h:90
void saveASCII_m()
Write to output file.
Definition: PeakFinder.cpp:170
void createHistogram_m()
Definition: PeakFinder.cpp:123
std::ofstream os_m
used to write out the data
Definition: PeakFinder.h:80
bool singlemode_m
Definition: PeakFinder.h:100
container_t globHist_m
global histogram values
Definition: PeakFinder.h:71
double binWidth_m
Bin width in mm.
Definition: PeakFinder.h:92
container_t radius_m
Definition: PeakFinder.h:69
void open_m()
Open output file.
Definition: PeakFinder.cpp:152
void close_m()
Close output file.
Definition: PeakFinder.cpp:164
std::string fn_m
filename with extension (.peaks)
Definition: PeakFinder.h:74
int turn_m
Definition: PeakFinder.h:96
bool first_m
Definition: PeakFinder.h:101
T::PETE_Expr_t::PETE_Return_t min(const PETE_Expr< T > &expr, NDIndex< D > &loc)
Definition: ReductionLoc.h:95
void append_m()
Open output file in append mode.
Definition: PeakFinder.cpp:158
std::string element_m
Element/probe name, for name output file.
Definition: PeakFinder.h:86