26#include "Utility/IpplInfo.h"
53 double radius = std::hypot(R(0), R(1));
70 bool globFinished =
false;
73 ippl::Comm->allreduce(
finished_m, globFinished, 1, std::logical_and<bool>());
120 double globPeakRadius = 0.0;
121 int globRegister = 0;
124 ippl::Comm->reduce(
peakRadius_m, globPeakRadius, 1, std::plus<double>());
125 ippl::Comm->reduce(
registered_m, globRegister, 1, std::plus<int>());
131 if (ippl::Comm->rank() == 0) {
132 if (globRegister > 0)
133 peaks_m.push_back(globPeakRadius /
double(globRegister));
146 for (container_t::iterator it =
radius_m.begin(); it !=
radius_m.end(); ++it) {
147 int bin =
static_cast<int>(std::abs(*it -
min_m) * invBinWidth);
148 if (bin < 0 || (
unsigned int)bin >=
nBins_m)
157 reduce(locHist.data(),
globHist_m.data(), locHist.size(), std::plus<double>());
179 os_m <<
"# Peak Radii (mm)" << std::endl;
181 os_m << radius << std::endl;
183 hos_m <<
"# Histogram bin counts (min, max, nbins, binsize) " <<
min_m <<
" mm " <<
max_m
186 hos_m << binCount << std::endl;
ippl::Vector< T, Dim > Vector_t
void checkAndAddOutputFileName(const std::string &outfn)
checks the output file names of all items to avoid duplicates
static OpalData * getInstance()
void addParticle(const Vector_t< double, 3 > &R)
std::vector< double > container_t
void open_m()
Open output file.
std::list< double > peaks_m
std::ofstream hos_m
used to write out the histrogram
std::ofstream os_m
used to write out the data
double binWidth_m
Bin width in mm.
container_t globHist_m
global histogram values
double min_m
histogram size
unsigned int nBins_m
Number of bins.
std::string outputName_m
Element/probe name, for name output file.
void append_m()
Open output file in append mode.
std::string hist_m
histogram filename with extension (.hist)
std::string fileName_m
filename with extension (.peaks)
void evaluate(const int &turn)
void saveASCII_m()
Write to output file.
void close_m()
Close output file.